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
25 currencies []string // idx = enum of currency code
26 currencyPositiveSuffix string
27 currencyNegativeSuffix string
28 monthsAbbreviated []string
31 daysAbbreviated []string
35 periodsAbbreviated []string
36 periodsNarrow []string
39 erasAbbreviated []string
42 timezones map[string]string
45 // New returns a new instance of translator for the 'cu_RU' locale
46 func New() locales.Translator {
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"},
60 currencyPositiveSuffix: " ",
61 currencyNegativeSuffix: " ",
62 monthsAbbreviated: []string{"", "і҆аⷩ҇", "феⷡ҇", "маⷬ҇", "а҆пⷬ҇", "маꙵ", "і҆ꙋⷩ҇", "і҆ꙋⷧ҇", "а҆́ѵⷢ҇", "сеⷫ҇", "ѻ҆кⷮ", "ноеⷨ", "деⷦ҇"},
63 monthsNarrow: []string{"", "І҆", "Ф", "М", "А҆", "М", "І҆", "І҆", "А҆", "С", "Ѻ҆", "Н", "Д"},
64 monthsWide: []string{"", "і҆аннꙋа́рїа", "феврꙋа́рїа", "ма́рта", "а҆прі́ллїа", "ма́їа", "і҆ꙋ́нїа", "і҆ꙋ́лїа", "а҆́ѵгꙋста", "септе́мврїа", "ѻ҆ктѡ́врїа", "ное́мврїа", "деке́мврїа"},
65 daysAbbreviated: []string{"ндⷧ҇ѧ", "пнⷣе", "втоⷬ҇", "срⷣе", "чеⷦ҇", "пѧⷦ҇", "сꙋⷠ҇"},
66 daysNarrow: []string{"Н", "П", "В", "С", "Ч", "П", "С"},
67 daysShort: []string{"ндⷧ҇ѧ", "пнⷣе", "втоⷬ҇", "срⷣе", "чеⷦ҇", "пѧⷦ҇", "сꙋⷠ҇"},
68 daysWide: []string{"недѣ́лѧ", "понедѣ́льникъ", "вто́рникъ", "среда̀", "четверто́къ", "пѧто́къ", "сꙋббѡ́та"},
69 periodsAbbreviated: []string{"ДП", "ПП"},
70 periodsNarrow: []string{"ДП", "ПП"},
71 periodsWide: []string{"ДП", "ПП"},
72 erasAbbreviated: []string{"", ""},
73 erasNarrow: []string{"", ""},
74 erasWide: []string{"пре́дъ р.\u00a0х.", "по р.\u00a0х."},
75 timezones: map[string]string{"JST": "JST", "HNOG": "HNOG", "GYT": "GYT", "ACDT": "ACDT", "AKST": "AKST", "HENOMX": "HENOMX", "HKST": "HKST", "AWDT": "AWDT", "SRT": "SRT", "UYT": "UYT", "ACWST": "ACWST", "ACWDT": "ACWDT", "PST": "тихоѻкеа́нское зи́мнее вре́мѧ", "BOT": "BOT", "NZDT": "NZDT", "WARST": "WARST", "HKT": "HKT", "AKDT": "AKDT", "WIT": "WIT", "TMST": "TMST", "EDT": "восточноамерїка́нское лѣ́тнее вре́мѧ", "HNPMX": "HNPMX", "HNCU": "HNCU", "WESZ": "западноєѵрѡпе́йское лѣ́тнее вре́мѧ", "MEZ": "среднеєѵрѡпе́йское зи́мнее вре́мѧ", "OEZ": "восточноєѵрѡпе́йское зи́мнее вре́мѧ", "AEST": "AEST", "HEOG": "HEOG", "AST": "а҆тланті́ческое зи́мнее вре́мѧ", "WITA": "WITA", "WAST": "WAST", "GFT": "GFT", "SGT": "SGT", "CST": "среднеамерїка́нское зи́мнее вре́мѧ", "HADT": "HADT", "OESZ": "восточноєѵрѡпе́йское лѣ́тнее вре́мѧ", "SAST": "SAST", "HEPM": "HEPM", "GMT": "сре́днее вре́мѧ по грі́нꙋичꙋ", "CHADT": "CHADT", "CDT": "среднеамерїка́нское лѣ́тнее вре́мѧ", "ADT": "а҆тланті́ческое лѣ́тнее вре́мѧ", "HNEG": "HNEG", "COT": "COT", "EST": "восточноамерїка́нское зи́мнее вре́мѧ", "HNPM": "HNPM", "ACST": "ACST", "ECT": "ECT", "WIB": "WIB", "AWST": "AWST", "UYST": "UYST", "MESZ": "среднеєѵрѡпе́йское лѣ́тнее вре́мѧ", "LHST": "LHST", "IST": "IST", "CLT": "CLT", "CLST": "CLST", "ChST": "ChST", "∅∅∅": "∅∅∅", "HAST": "HAST", "HNNOMX": "HNNOMX", "JDT": "JDT", "AEDT": "AEDT", "HECU": "HECU", "MST": "MST", "MDT": "MDT", "HEEG": "HEEG", "CAT": "CAT", "HEPMX": "HEPMX", "PDT": "тихоѻкеа́нское лѣ́тнее вре́мѧ", "BT": "BT", "ARST": "ARST", "COST": "COST", "HNT": "HNT", "CHAST": "CHAST", "WEZ": "западноєѵрѡпе́йское зи́мнее вре́мѧ", "NZST": "NZST", "LHDT": "LHDT", "VET": "VET", "ART": "ART", "WAT": "WAT", "TMT": "TMT", "WART": "WART", "MYT": "MYT", "EAT": "EAT", "HAT": "HAT"},
79 // Locale returns the current translators string locale
80 func (cu *cu_RU) Locale() string {
84 // PluralsCardinal returns the list of cardinal plural rules associated with 'cu_RU'
85 func (cu *cu_RU) PluralsCardinal() []locales.PluralRule {
86 return cu.pluralsCardinal
89 // PluralsOrdinal returns the list of ordinal plural rules associated with 'cu_RU'
90 func (cu *cu_RU) PluralsOrdinal() []locales.PluralRule {
91 return cu.pluralsOrdinal
94 // PluralsRange returns the list of range plural rules associated with 'cu_RU'
95 func (cu *cu_RU) PluralsRange() []locales.PluralRule {
96 return cu.pluralsRange
99 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'cu_RU'
100 func (cu *cu_RU) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
101 return locales.PluralRuleUnknown
104 // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'cu_RU'
105 func (cu *cu_RU) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
106 return locales.PluralRuleUnknown
109 // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'cu_RU'
110 func (cu *cu_RU) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
111 return locales.PluralRuleUnknown
114 // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
115 func (cu *cu_RU) MonthAbbreviated(month time.Month) string {
116 return cu.monthsAbbreviated[month]
119 // MonthsAbbreviated returns the locales abbreviated months
120 func (cu *cu_RU) MonthsAbbreviated() []string {
121 return cu.monthsAbbreviated[1:]
124 // MonthNarrow returns the locales narrow month given the 'month' provided
125 func (cu *cu_RU) MonthNarrow(month time.Month) string {
126 return cu.monthsNarrow[month]
129 // MonthsNarrow returns the locales narrow months
130 func (cu *cu_RU) MonthsNarrow() []string {
131 return cu.monthsNarrow[1:]
134 // MonthWide returns the locales wide month given the 'month' provided
135 func (cu *cu_RU) MonthWide(month time.Month) string {
136 return cu.monthsWide[month]
139 // MonthsWide returns the locales wide months
140 func (cu *cu_RU) MonthsWide() []string {
141 return cu.monthsWide[1:]
144 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
145 func (cu *cu_RU) WeekdayAbbreviated(weekday time.Weekday) string {
146 return cu.daysAbbreviated[weekday]
149 // WeekdaysAbbreviated returns the locales abbreviated weekdays
150 func (cu *cu_RU) WeekdaysAbbreviated() []string {
151 return cu.daysAbbreviated
154 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
155 func (cu *cu_RU) WeekdayNarrow(weekday time.Weekday) string {
156 return cu.daysNarrow[weekday]
159 // WeekdaysNarrow returns the locales narrow weekdays
160 func (cu *cu_RU) WeekdaysNarrow() []string {
164 // WeekdayShort returns the locales short weekday given the 'weekday' provided
165 func (cu *cu_RU) WeekdayShort(weekday time.Weekday) string {
166 return cu.daysShort[weekday]
169 // WeekdaysShort returns the locales short weekdays
170 func (cu *cu_RU) WeekdaysShort() []string {
174 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
175 func (cu *cu_RU) WeekdayWide(weekday time.Weekday) string {
176 return cu.daysWide[weekday]
179 // WeekdaysWide returns the locales wide weekdays
180 func (cu *cu_RU) WeekdaysWide() []string {
184 // Decimal returns the decimal point of number
185 func (cu *cu_RU) Decimal() string {
189 // Group returns the group of number
190 func (cu *cu_RU) Group() string {
194 // Group returns the minus sign of number
195 func (cu *cu_RU) Minus() string {
199 // FmtNumber returns 'num' with digits/precision of 'v' for 'cu_RU' and handles both Whole and Real numbers based on 'v'
200 func (cu *cu_RU) FmtNumber(num float64, v uint64) string {
202 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
203 l := len(s) + 2 + 2*len(s[:len(s)-int(v)-1])/3
206 b := make([]byte, 0, l)
208 for i := len(s) - 1; i >= 0; i-- {
211 b = append(b, cu.decimal[0])
218 for j := len(cu.group) - 1; j >= 0; j-- {
219 b = append(b, cu.group[j])
231 b = append(b, cu.minus[0])
235 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
236 b[i], b[j] = b[j], b[i]
242 // FmtPercent returns 'num' with digits/precision of 'v' for 'cu_RU' and handles both Whole and Real numbers based on 'v'
243 // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
244 func (cu *cu_RU) FmtPercent(num float64, v uint64) string {
245 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
247 b := make([]byte, 0, l)
249 for i := len(s) - 1; i >= 0; i-- {
252 b = append(b, cu.decimal[0])
260 b = append(b, cu.minus[0])
264 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
265 b[i], b[j] = b[j], b[i]
268 b = append(b, cu.percentSuffix...)
270 b = append(b, cu.percent...)
275 // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'cu_RU'
276 func (cu *cu_RU) FmtCurrency(num float64, v uint64, currency currency.Type) string {
278 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
279 symbol := cu.currencies[currency]
280 l := len(s) + len(symbol) + 4 + 2*len(s[:len(s)-int(v)-1])/3
283 b := make([]byte, 0, l)
285 for i := len(s) - 1; i >= 0; i-- {
288 b = append(b, cu.decimal[0])
295 for j := len(cu.group) - 1; j >= 0; j-- {
296 b = append(b, cu.group[j])
308 b = append(b, cu.minus[0])
312 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
313 b[i], b[j] = b[j], b[i]
319 b = append(b, cu.decimal...)
322 for i := 0; i < 2-int(v); i++ {
327 b = append(b, cu.currencyPositiveSuffix...)
329 b = append(b, symbol...)
334 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'cu_RU'
335 // in accounting notation.
336 func (cu *cu_RU) FmtAccounting(num float64, v uint64, currency currency.Type) string {
338 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
339 symbol := cu.currencies[currency]
340 l := len(s) + len(symbol) + 4 + 2*len(s[:len(s)-int(v)-1])/3
343 b := make([]byte, 0, l)
345 for i := len(s) - 1; i >= 0; i-- {
348 b = append(b, cu.decimal[0])
355 for j := len(cu.group) - 1; j >= 0; j-- {
356 b = append(b, cu.group[j])
369 b = append(b, cu.minus[0])
374 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
375 b[i], b[j] = b[j], b[i]
381 b = append(b, cu.decimal...)
384 for i := 0; i < 2-int(v); i++ {
390 b = append(b, cu.currencyNegativeSuffix...)
391 b = append(b, symbol...)
394 b = append(b, cu.currencyPositiveSuffix...)
395 b = append(b, symbol...)
401 // FmtDateShort returns the short date representation of 't' for 'cu_RU'
402 func (cu *cu_RU) FmtDateShort(t time.Time) string {
404 b := make([]byte, 0, 32)
407 b = strconv.AppendInt(b, int64(t.Year()), 10)
409 b = strconv.AppendInt(b, int64(-t.Year()), 10)
412 b = append(b, []byte{0x2e}...)
418 b = strconv.AppendInt(b, int64(t.Month()), 10)
420 b = append(b, []byte{0x2e}...)
426 b = strconv.AppendInt(b, int64(t.Day()), 10)
431 // FmtDateMedium returns the medium date representation of 't' for 'cu_RU'
432 func (cu *cu_RU) FmtDateMedium(t time.Time) string {
434 b := make([]byte, 0, 32)
437 b = strconv.AppendInt(b, int64(t.Year()), 10)
439 b = strconv.AppendInt(b, int64(-t.Year()), 10)
442 b = append(b, []byte{0x20}...)
443 b = append(b, cu.monthsAbbreviated[t.Month()]...)
444 b = append(b, []byte{0x20}...)
445 b = strconv.AppendInt(b, int64(t.Day()), 10)
450 // FmtDateLong returns the long date representation of 't' for 'cu_RU'
451 func (cu *cu_RU) FmtDateLong(t time.Time) string {
453 b := make([]byte, 0, 32)
456 b = strconv.AppendInt(b, int64(t.Year()), 10)
458 b = strconv.AppendInt(b, int64(-t.Year()), 10)
461 b = append(b, []byte{0x20}...)
462 b = append(b, cu.monthsWide[t.Month()]...)
463 b = append(b, []byte{0x20}...)
464 b = strconv.AppendInt(b, int64(t.Day()), 10)
469 // FmtDateFull returns the full date representation of 't' for 'cu_RU'
470 func (cu *cu_RU) FmtDateFull(t time.Time) string {
472 b := make([]byte, 0, 32)
474 b = append(b, cu.daysWide[t.Weekday()]...)
475 b = append(b, []byte{0x2c, 0x20}...)
476 b = strconv.AppendInt(b, int64(t.Day()), 10)
477 b = append(b, []byte{0x20}...)
478 b = append(b, cu.monthsWide[t.Month()]...)
479 b = append(b, []byte{0x20, 0xd0, 0xbb}...)
480 b = append(b, []byte{0x2e, 0x20}...)
483 b = strconv.AppendInt(b, int64(t.Year()), 10)
485 b = strconv.AppendInt(b, int64(-t.Year()), 10)
488 b = append(b, []byte{0x2e}...)
493 // FmtTimeShort returns the short time representation of 't' for 'cu_RU'
494 func (cu *cu_RU) FmtTimeShort(t time.Time) string {
496 b := make([]byte, 0, 32)
502 b = strconv.AppendInt(b, int64(t.Hour()), 10)
503 b = append(b, cu.timeSeparator...)
509 b = strconv.AppendInt(b, int64(t.Minute()), 10)
514 // FmtTimeMedium returns the medium time representation of 't' for 'cu_RU'
515 func (cu *cu_RU) FmtTimeMedium(t time.Time) string {
517 b := make([]byte, 0, 32)
523 b = strconv.AppendInt(b, int64(t.Hour()), 10)
524 b = append(b, cu.timeSeparator...)
530 b = strconv.AppendInt(b, int64(t.Minute()), 10)
531 b = append(b, cu.timeSeparator...)
537 b = strconv.AppendInt(b, int64(t.Second()), 10)
542 // FmtTimeLong returns the long time representation of 't' for 'cu_RU'
543 func (cu *cu_RU) FmtTimeLong(t time.Time) string {
545 b := make([]byte, 0, 32)
551 b = strconv.AppendInt(b, int64(t.Hour()), 10)
552 b = append(b, cu.timeSeparator...)
558 b = strconv.AppendInt(b, int64(t.Minute()), 10)
559 b = append(b, cu.timeSeparator...)
565 b = strconv.AppendInt(b, int64(t.Second()), 10)
566 b = append(b, []byte{0x20}...)
574 // FmtTimeFull returns the full time representation of 't' for 'cu_RU'
575 func (cu *cu_RU) FmtTimeFull(t time.Time) string {
577 b := make([]byte, 0, 32)
583 b = strconv.AppendInt(b, int64(t.Hour()), 10)
584 b = append(b, cu.timeSeparator...)
590 b = strconv.AppendInt(b, int64(t.Minute()), 10)
591 b = append(b, cu.timeSeparator...)
597 b = strconv.AppendInt(b, int64(t.Second()), 10)
598 b = append(b, []byte{0x20}...)
602 if btz, ok := cu.timezones[tz]; ok {
603 b = append(b, btz...)