8 "github.com/go-playground/locales"
9 "github.com/go-playground/locales/currency"
14 pluralsCardinal []locales.PluralRule
15 pluralsOrdinal []locales.PluralRule
16 pluralsRange []locales.PluralRule
24 currencies []string // idx = enum of currency code
25 currencyPositivePrefix string
26 currencyNegativePrefix string
27 monthsAbbreviated []string
30 daysAbbreviated []string
34 periodsAbbreviated []string
35 periodsNarrow []string
38 erasAbbreviated []string
41 timezones map[string]string
44 // New returns a new instance of translator for the 'os_GE' locale
45 func New() locales.Translator {
48 pluralsCardinal: []locales.PluralRule{2, 6},
58 currencies: []string{"ADP", "AED", "AFA", "AFN", "ALK", "ALL", "AMD", "ANG", "AOA", "AOK", "AON", "AOR", "ARA", "ARL", "ARM", "ARP", "ARS", "ATS", "AUD", "AWG", "AZM", "AZN", "BAD", "BAM", "BAN", "BBD", "BDT", "BEC", "BEF", "BEL", "BGL", "BGM", "BGN", "BGO", "BHD", "BIF", "BMD", "BND", "BOB", "BOL", "BOP", "BOV", "BRB", "BRC", "BRE", "BRL", "BRN", "BRR", "BRZ", "BSD", "BTN", "BUK", "BWP", "BYB", "BYN", "BYR", "BZD", "CAD", "CDF", "CHE", "CHF", "CHW", "CLE", "CLF", "CLP", "CNX", "CNY", "COP", "COU", "CRC", "CSD", "CSK", "CUC", "CUP", "CVE", "CYP", "CZK", "DDM", "DEM", "DJF", "DKK", "DOP", "DZD", "ECS", "ECV", "EEK", "EGP", "ERN", "ESA", "ESB", "ESP", "ETB", "EUR", "FIM", "FJD", "FKP", "FRF", "GBP", "GEK", "GEL", "GHC", "GHS", "GIP", "GMD", "GNF", "GNS", "GQE", "GRD", "GTQ", "GWE", "GWP", "GYD", "HKD", "HNL", "HRD", "HRK", "HTG", "HUF", "IDR", "IEP", "ILP", "ILR", "ILS", "INR", "IQD", "IRR", "ISJ", "ISK", "ITL", "JMD", "JOD", "JPY", "KES", "KGS", "KHR", "KMF", "KPW", "KRH", "KRO", "KRW", "KWD", "KYD", "KZT", "LAK", "LBP", "LKR", "LRD", "LSL", "LTL", "LTT", "LUC", "LUF", "LUL", "LVL", "LVR", "LYD", "MAD", "MAF", "MCF", "MDC", "MDL", "MGA", "MGF", "MKD", "MKN", "MLF", "MMK", "MNT", "MOP", "MRO", "MTL", "MTP", "MUR", "MVP", "MVR", "MWK", "MXN", "MXP", "MXV", "MYR", "MZE", "MZM", "MZN", "NAD", "NGN", "NIC", "NIO", "NLG", "NOK", "NPR", "NZD", "OMR", "PAB", "PEI", "PEN", "PES", "PGK", "PHP", "PKR", "PLN", "PLZ", "PTE", "PYG", "QAR", "RHD", "ROL", "RON", "RSD", "RUB", "RUR", "RWF", "SAR", "SBD", "SCR", "SDD", "SDG", "SDP", "SEK", "SGD", "SHP", "SIT", "SKK", "SLL", "SOS", "SRD", "SRG", "SSP", "STD", "SUR", "SVC", "SYP", "SZL", "THB", "TJR", "TJS", "TMM", "TMT", "TND", "TOP", "TPE", "TRL", "TRY", "TTD", "TWD", "TZS", "UAH", "UAK", "UGS", "UGX", "USD", "USN", "USS", "UYI", "UYP", "UYU", "UZS", "VEB", "VEF", "VND", "VNN", "VUV", "WST", "XAF", "XAG", "XAU", "XBA", "XBB", "XBC", "XBD", "XCD", "XDR", "XEU", "XFO", "XFU", "XOF", "XPD", "XPF", "XPT", "XRE", "XSU", "XTS", "XUA", "XXX", "YDD", "YER", "YUD", "YUM", "YUN", "YUR", "ZAL", "ZAR", "ZMK", "ZMW", "ZRN", "ZRZ", "ZWD", "ZWL", "ZWR"},
59 currencyPositivePrefix: " ",
60 currencyNegativePrefix: " ",
61 monthsAbbreviated: []string{"", "янв.", "фев.", "мар.", "апр.", "майы", "июны", "июлы", "авг.", "сен.", "окт.", "ноя.", "дек."},
62 monthsNarrow: []string{"", "Я", "Ф", "М", "А", "М", "И", "И", "А", "С", "О", "Н", "Д"},
63 monthsWide: []string{"", "январы", "февралы", "мартъийы", "апрелы", "майы", "июны", "июлы", "августы", "сентябры", "октябры", "ноябры", "декабры"},
64 daysAbbreviated: []string{"хцб", "крс", "дцг", "ӕрт", "цпр", "мрб", "сбт"},
65 daysNarrow: []string{"Х", "К", "Д", "Ӕ", "Ц", "М", "С"},
66 daysWide: []string{"хуыцаубон", "къуырисӕр", "дыццӕг", "ӕртыццӕг", "цыппӕрӕм", "майрӕмбон", "сабат"},
67 periodsAbbreviated: []string{"AM", "PM"},
68 periodsWide: []string{"ӕмбисбоны размӕ", "ӕмбисбоны фӕстӕ"},
69 erasAbbreviated: []string{"н.д.а.", "н.д."},
70 erasNarrow: []string{"", ""},
71 erasWide: []string{"", ""},
72 timezones: map[string]string{"HNCU": "HNCU", "HEPM": "HEPM", "BOT": "BOT", "CDT": "CDT", "LHST": "LHST", "UYST": "UYST", "LHDT": "LHDT", "EAT": "EAT", "HKT": "HKT", "CAT": "CAT", "SRT": "SRT", "WART": "WART", "HENOMX": "HENOMX", "JST": "JST", "ART": "ART", "HAT": "HAT", "COST": "COST", "HNPM": "HNPM", "MESZ": "Астӕуккаг Европӕйаг сӕрдыгон рӕстӕг", "JDT": "JDT", "AEDT": "AEDT", "WEZ": "Ныгъуылӕн Европӕйаг стандартон рӕстӕг", "CST": "CST", "UYT": "UYT", "TMT": "TMT", "TMST": "TMST", "OESZ": "Скӕсӕн Европӕйаг сӕрдыгон рӕстӕг", "AST": "AST", "SAST": "SAST", "ACST": "ACST", "ECT": "ECT", "SGT": "SGT", "HECU": "HECU", "ACWDT": "ACWDT", "MEZ": "Астӕуккаг Европӕйаг стандартон рӕстӕг", "HEOG": "HEOG", "AKST": "AKST", "HNEG": "HNEG", "GFT": "GFT", "GMT": "Гринвичы рӕстӕмбис рӕстӕг", "HNPMX": "HNPMX", "HEPMX": "HEPMX", "MDT": "MDT", "ARST": "ARST", "HNT": "HNT", "CLST": "CLST", "MST": "MST", "AEST": "AEST", "AWST": "AWST", "HNNOMX": "HNNOMX", "COT": "COT", "WIB": "WIB", "PST": "PST", "CHADT": "CHADT", "OEZ": "Скӕсӕн Европӕйаг стандартон рӕстӕг", "VET": "VET", "HKST": "HKST", "EDT": "EDT", "GYT": "GYT", "∅∅∅": "∅∅∅", "AWDT": "AWDT", "ACWST": "ACWST", "WIT": "WIT", "NZST": "NZST", "IST": "IST", "ChST": "ChST", "PDT": "PDT", "HADT": "HADT", "NZDT": "NZDT", "ADT": "ADT", "WAST": "WAST", "AKDT": "AKDT", "MYT": "MYT", "HNOG": "HNOG", "WAT": "WAT", "HEEG": "HEEG", "WESZ": "Ныгъуылӕн Европӕйаг сӕрдыгон рӕстӕг", "CHAST": "CHAST", "BT": "BT", "HAST": "HAST", "WARST": "WARST", "WITA": "WITA", "CLT": "CLT", "EST": "EST", "ACDT": "ACDT"},
76 // Locale returns the current translators string locale
77 func (os *os_GE) Locale() string {
81 // PluralsCardinal returns the list of cardinal plural rules associated with 'os_GE'
82 func (os *os_GE) PluralsCardinal() []locales.PluralRule {
83 return os.pluralsCardinal
86 // PluralsOrdinal returns the list of ordinal plural rules associated with 'os_GE'
87 func (os *os_GE) PluralsOrdinal() []locales.PluralRule {
88 return os.pluralsOrdinal
91 // PluralsRange returns the list of range plural rules associated with 'os_GE'
92 func (os *os_GE) PluralsRange() []locales.PluralRule {
93 return os.pluralsRange
96 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'os_GE'
97 func (os *os_GE) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
102 return locales.PluralRuleOne
105 return locales.PluralRuleOther
108 // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'os_GE'
109 func (os *os_GE) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
110 return locales.PluralRuleUnknown
113 // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'os_GE'
114 func (os *os_GE) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
115 return locales.PluralRuleUnknown
118 // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
119 func (os *os_GE) MonthAbbreviated(month time.Month) string {
120 return os.monthsAbbreviated[month]
123 // MonthsAbbreviated returns the locales abbreviated months
124 func (os *os_GE) MonthsAbbreviated() []string {
125 return os.monthsAbbreviated[1:]
128 // MonthNarrow returns the locales narrow month given the 'month' provided
129 func (os *os_GE) MonthNarrow(month time.Month) string {
130 return os.monthsNarrow[month]
133 // MonthsNarrow returns the locales narrow months
134 func (os *os_GE) MonthsNarrow() []string {
135 return os.monthsNarrow[1:]
138 // MonthWide returns the locales wide month given the 'month' provided
139 func (os *os_GE) MonthWide(month time.Month) string {
140 return os.monthsWide[month]
143 // MonthsWide returns the locales wide months
144 func (os *os_GE) MonthsWide() []string {
145 return os.monthsWide[1:]
148 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
149 func (os *os_GE) WeekdayAbbreviated(weekday time.Weekday) string {
150 return os.daysAbbreviated[weekday]
153 // WeekdaysAbbreviated returns the locales abbreviated weekdays
154 func (os *os_GE) WeekdaysAbbreviated() []string {
155 return os.daysAbbreviated
158 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
159 func (os *os_GE) WeekdayNarrow(weekday time.Weekday) string {
160 return os.daysNarrow[weekday]
163 // WeekdaysNarrow returns the locales narrow weekdays
164 func (os *os_GE) WeekdaysNarrow() []string {
168 // WeekdayShort returns the locales short weekday given the 'weekday' provided
169 func (os *os_GE) WeekdayShort(weekday time.Weekday) string {
170 return os.daysShort[weekday]
173 // WeekdaysShort returns the locales short weekdays
174 func (os *os_GE) WeekdaysShort() []string {
178 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
179 func (os *os_GE) WeekdayWide(weekday time.Weekday) string {
180 return os.daysWide[weekday]
183 // WeekdaysWide returns the locales wide weekdays
184 func (os *os_GE) WeekdaysWide() []string {
188 // Decimal returns the decimal point of number
189 func (os *os_GE) Decimal() string {
193 // Group returns the group of number
194 func (os *os_GE) Group() string {
198 // Group returns the minus sign of number
199 func (os *os_GE) Minus() string {
203 // FmtNumber returns 'num' with digits/precision of 'v' for 'os_GE' and handles both Whole and Real numbers based on 'v'
204 func (os *os_GE) FmtNumber(num float64, v uint64) string {
206 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
207 l := len(s) + 2 + 2*len(s[:len(s)-int(v)-1])/3
210 b := make([]byte, 0, l)
212 for i := len(s) - 1; i >= 0; i-- {
215 b = append(b, os.decimal[0])
222 for j := len(os.group) - 1; j >= 0; j-- {
223 b = append(b, os.group[j])
235 b = append(b, os.minus[0])
239 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
240 b[i], b[j] = b[j], b[i]
246 // FmtPercent returns 'num' with digits/precision of 'v' for 'os_GE' and handles both Whole and Real numbers based on 'v'
247 // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
248 func (os *os_GE) FmtPercent(num float64, v uint64) string {
249 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
251 b := make([]byte, 0, l)
253 for i := len(s) - 1; i >= 0; i-- {
256 b = append(b, os.decimal[0])
264 b = append(b, os.minus[0])
268 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
269 b[i], b[j] = b[j], b[i]
272 b = append(b, os.percent...)
277 // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'os_GE'
278 func (os *os_GE) FmtCurrency(num float64, v uint64, currency currency.Type) string {
280 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
281 symbol := os.currencies[currency]
282 l := len(s) + len(symbol) + 4 + 2*len(s[:len(s)-int(v)-1])/3
285 b := make([]byte, 0, l)
287 for i := len(s) - 1; i >= 0; i-- {
290 b = append(b, os.decimal[0])
297 for j := len(os.group) - 1; j >= 0; j-- {
298 b = append(b, os.group[j])
309 for j := len(symbol) - 1; j >= 0; j-- {
310 b = append(b, symbol[j])
313 for j := len(os.currencyPositivePrefix) - 1; j >= 0; j-- {
314 b = append(b, os.currencyPositivePrefix[j])
318 b = append(b, os.minus[0])
322 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
323 b[i], b[j] = b[j], b[i]
329 b = append(b, os.decimal...)
332 for i := 0; i < 2-int(v); i++ {
340 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'os_GE'
341 // in accounting notation.
342 func (os *os_GE) FmtAccounting(num float64, v uint64, currency currency.Type) string {
344 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
345 symbol := os.currencies[currency]
346 l := len(s) + len(symbol) + 4 + 2*len(s[:len(s)-int(v)-1])/3
349 b := make([]byte, 0, l)
351 for i := len(s) - 1; i >= 0; i-- {
354 b = append(b, os.decimal[0])
361 for j := len(os.group) - 1; j >= 0; j-- {
362 b = append(b, os.group[j])
375 for j := len(symbol) - 1; j >= 0; j-- {
376 b = append(b, symbol[j])
379 for j := len(os.currencyNegativePrefix) - 1; j >= 0; j-- {
380 b = append(b, os.currencyNegativePrefix[j])
383 b = append(b, os.minus[0])
387 for j := len(symbol) - 1; j >= 0; j-- {
388 b = append(b, symbol[j])
391 for j := len(os.currencyPositivePrefix) - 1; j >= 0; j-- {
392 b = append(b, os.currencyPositivePrefix[j])
398 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
399 b[i], b[j] = b[j], b[i]
405 b = append(b, os.decimal...)
408 for i := 0; i < 2-int(v); i++ {
416 // FmtDateShort returns the short date representation of 't' for 'os_GE'
417 func (os *os_GE) FmtDateShort(t time.Time) string {
419 b := make([]byte, 0, 32)
425 b = strconv.AppendInt(b, int64(t.Day()), 10)
426 b = append(b, []byte{0x2e}...)
432 b = strconv.AppendInt(b, int64(t.Month()), 10)
434 b = append(b, []byte{0x2e}...)
437 b = append(b, strconv.Itoa(t.Year())[2:]...)
439 b = append(b, strconv.Itoa(t.Year())[1:]...)
445 // FmtDateMedium returns the medium date representation of 't' for 'os_GE'
446 func (os *os_GE) FmtDateMedium(t time.Time) string {
448 b := make([]byte, 0, 32)
454 b = strconv.AppendInt(b, int64(t.Day()), 10)
455 b = append(b, []byte{0x20}...)
456 b = append(b, os.monthsAbbreviated[t.Month()]...)
457 b = append(b, []byte{0x20}...)
460 b = strconv.AppendInt(b, int64(t.Year()), 10)
462 b = strconv.AppendInt(b, int64(-t.Year()), 10)
465 b = append(b, []byte{0x20, 0xd0, 0xb0, 0xd0, 0xb7}...)
470 // FmtDateLong returns the long date representation of 't' for 'os_GE'
471 func (os *os_GE) FmtDateLong(t time.Time) string {
473 b := make([]byte, 0, 32)
475 b = strconv.AppendInt(b, int64(t.Day()), 10)
476 b = append(b, []byte{0x20}...)
477 b = append(b, os.monthsWide[t.Month()]...)
478 b = append(b, []byte{0x2c, 0x20}...)
481 b = strconv.AppendInt(b, int64(t.Year()), 10)
483 b = strconv.AppendInt(b, int64(-t.Year()), 10)
486 b = append(b, []byte{0x20, 0xd0, 0xb0, 0xd0, 0xb7}...)
491 // FmtDateFull returns the full date representation of 't' for 'os_GE'
492 func (os *os_GE) FmtDateFull(t time.Time) string {
494 b := make([]byte, 0, 32)
496 b = append(b, os.daysWide[t.Weekday()]...)
497 b = append(b, []byte{0x2c, 0x20}...)
498 b = strconv.AppendInt(b, int64(t.Day()), 10)
499 b = append(b, []byte{0x20}...)
500 b = append(b, os.monthsWide[t.Month()]...)
501 b = append(b, []byte{0x2c, 0x20}...)
504 b = strconv.AppendInt(b, int64(t.Year()), 10)
506 b = strconv.AppendInt(b, int64(-t.Year()), 10)
509 b = append(b, []byte{0x20, 0xd0, 0xb0, 0xd0, 0xb7}...)
514 // FmtTimeShort returns the short time representation of 't' for 'os_GE'
515 func (os *os_GE) FmtTimeShort(t time.Time) string {
517 b := make([]byte, 0, 32)
523 b = strconv.AppendInt(b, int64(t.Hour()), 10)
524 b = append(b, os.timeSeparator...)
530 b = strconv.AppendInt(b, int64(t.Minute()), 10)
535 // FmtTimeMedium returns the medium time representation of 't' for 'os_GE'
536 func (os *os_GE) FmtTimeMedium(t time.Time) string {
538 b := make([]byte, 0, 32)
544 b = strconv.AppendInt(b, int64(t.Hour()), 10)
545 b = append(b, os.timeSeparator...)
551 b = strconv.AppendInt(b, int64(t.Minute()), 10)
552 b = append(b, os.timeSeparator...)
558 b = strconv.AppendInt(b, int64(t.Second()), 10)
563 // FmtTimeLong returns the long time representation of 't' for 'os_GE'
564 func (os *os_GE) FmtTimeLong(t time.Time) string {
566 b := make([]byte, 0, 32)
572 b = strconv.AppendInt(b, int64(t.Hour()), 10)
573 b = append(b, os.timeSeparator...)
579 b = strconv.AppendInt(b, int64(t.Minute()), 10)
580 b = append(b, os.timeSeparator...)
586 b = strconv.AppendInt(b, int64(t.Second()), 10)
587 b = append(b, []byte{0x20}...)
595 // FmtTimeFull returns the full time representation of 't' for 'os_GE'
596 func (os *os_GE) FmtTimeFull(t time.Time) string {
598 b := make([]byte, 0, 32)
604 b = strconv.AppendInt(b, int64(t.Hour()), 10)
605 b = append(b, os.timeSeparator...)
611 b = strconv.AppendInt(b, int64(t.Minute()), 10)
612 b = append(b, os.timeSeparator...)
618 b = strconv.AppendInt(b, int64(t.Second()), 10)
619 b = append(b, []byte{0x20}...)
623 if btz, ok := os.timezones[tz]; ok {
624 b = append(b, btz...)