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 'bas_CM' locale
46 func New() locales.Translator {
55 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"},
57 currencyPositiveSuffix: " ",
58 currencyNegativeSuffix: " ",
59 monthsAbbreviated: []string{"", "kɔn", "mac", "mat", "mto", "mpu", "hil", "nje", "hik", "dip", "bio", "may", "liɓ"},
60 monthsNarrow: []string{"", "k", "m", "m", "m", "m", "h", "n", "h", "d", "b", "m", "l"},
61 monthsWide: []string{"", "Kɔndɔŋ", "Màcɛ̂l", "Màtùmb", "Màtop", "M̀puyɛ", "Hìlòndɛ̀", "Njèbà", "Hìkaŋ", "Dìpɔ̀s", "Bìòôm", "Màyɛsèp", "Lìbuy li ńyèe"},
62 daysAbbreviated: []string{"nɔy", "nja", "uum", "ŋge", "mbɔ", "kɔɔ", "jon"},
63 daysNarrow: []string{"n", "n", "u", "ŋ", "m", "k", "j"},
64 daysWide: []string{"ŋgwà nɔ̂y", "ŋgwà njaŋgumba", "ŋgwà ûm", "ŋgwà ŋgê", "ŋgwà mbɔk", "ŋgwà kɔɔ", "ŋgwà jôn"},
65 periodsAbbreviated: []string{"I bikɛ̂glà", "I ɓugajɔp"},
66 periodsWide: []string{"I bikɛ̂glà", "I ɓugajɔp"},
67 erasAbbreviated: []string{"b.Y.K", "m.Y.K"},
68 erasNarrow: []string{"", ""},
69 erasWide: []string{"bisū bi Yesù Krǐstò", "i mbūs Yesù Krǐstò"},
70 timezones: map[string]string{"UYST": "UYST", "HAST": "HAST", "TMST": "TMST", "HENOMX": "HENOMX", "SGT": "SGT", "HEPMX": "HEPMX", "CHAST": "CHAST", "PDT": "PDT", "HEEG": "HEEG", "HKT": "HKT", "HKST": "HKST", "WESZ": "WESZ", "HNPM": "HNPM", "HNNOMX": "HNNOMX", "GYT": "GYT", "OEZ": "OEZ", "CLT": "CLT", "HAT": "HAT", "GMT": "GMT", "AWDT": "AWDT", "ACWST": "ACWST", "WITA": "WITA", "WEZ": "WEZ", "HEPM": "HEPM", "EAT": "EAT", "JST": "JST", "EST": "EST", "EDT": "EDT", "AKST": "AKST", "HNPMX": "HNPMX", "HNCU": "HNCU", "MESZ": "MESZ", "LHST": "LHST", "WARST": "WARST", "ACDT": "ACDT", "HECU": "HECU", "ACWDT": "ACWDT", "NZST": "NZST", "TMT": "TMT", "ECT": "ECT", "ChST": "ChST", "AWST": "AWST", "MYT": "MYT", "HNOG": "HNOG", "ACST": "ACST", "OESZ": "OESZ", "AEST": "AEST", "ART": "ART", "ADT": "ADT", "SAST": "SAST", "WAT": "WAT", "BOT": "BOT", "MST": "MST", "SRT": "SRT", "MEZ": "MEZ", "WART": "WART", "COST": "COST", "AST": "AST", "HNEG": "HNEG", "HNT": "HNT", "∅∅∅": "∅∅∅", "WIB": "WIB", "CDT": "CDT", "IST": "IST", "MDT": "MDT", "GFT": "GFT", "BT": "BT", "NZDT": "NZDT", "JDT": "JDT", "WAST": "WAST", "CHADT": "CHADT", "UYT": "UYT", "ARST": "ARST", "HEOG": "HEOG", "VET": "VET", "AEDT": "AEDT", "CLST": "CLST", "COT": "COT", "CAT": "CAT", "PST": "PST", "WIT": "WIT", "LHDT": "LHDT", "AKDT": "AKDT", "CST": "CST", "HADT": "HADT"},
74 // Locale returns the current translators string locale
75 func (bas *bas_CM) Locale() string {
79 // PluralsCardinal returns the list of cardinal plural rules associated with 'bas_CM'
80 func (bas *bas_CM) PluralsCardinal() []locales.PluralRule {
81 return bas.pluralsCardinal
84 // PluralsOrdinal returns the list of ordinal plural rules associated with 'bas_CM'
85 func (bas *bas_CM) PluralsOrdinal() []locales.PluralRule {
86 return bas.pluralsOrdinal
89 // PluralsRange returns the list of range plural rules associated with 'bas_CM'
90 func (bas *bas_CM) PluralsRange() []locales.PluralRule {
91 return bas.pluralsRange
94 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'bas_CM'
95 func (bas *bas_CM) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
96 return locales.PluralRuleUnknown
99 // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'bas_CM'
100 func (bas *bas_CM) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
101 return locales.PluralRuleUnknown
104 // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'bas_CM'
105 func (bas *bas_CM) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
106 return locales.PluralRuleUnknown
109 // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
110 func (bas *bas_CM) MonthAbbreviated(month time.Month) string {
111 return bas.monthsAbbreviated[month]
114 // MonthsAbbreviated returns the locales abbreviated months
115 func (bas *bas_CM) MonthsAbbreviated() []string {
116 return bas.monthsAbbreviated[1:]
119 // MonthNarrow returns the locales narrow month given the 'month' provided
120 func (bas *bas_CM) MonthNarrow(month time.Month) string {
121 return bas.monthsNarrow[month]
124 // MonthsNarrow returns the locales narrow months
125 func (bas *bas_CM) MonthsNarrow() []string {
126 return bas.monthsNarrow[1:]
129 // MonthWide returns the locales wide month given the 'month' provided
130 func (bas *bas_CM) MonthWide(month time.Month) string {
131 return bas.monthsWide[month]
134 // MonthsWide returns the locales wide months
135 func (bas *bas_CM) MonthsWide() []string {
136 return bas.monthsWide[1:]
139 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
140 func (bas *bas_CM) WeekdayAbbreviated(weekday time.Weekday) string {
141 return bas.daysAbbreviated[weekday]
144 // WeekdaysAbbreviated returns the locales abbreviated weekdays
145 func (bas *bas_CM) WeekdaysAbbreviated() []string {
146 return bas.daysAbbreviated
149 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
150 func (bas *bas_CM) WeekdayNarrow(weekday time.Weekday) string {
151 return bas.daysNarrow[weekday]
154 // WeekdaysNarrow returns the locales narrow weekdays
155 func (bas *bas_CM) WeekdaysNarrow() []string {
156 return bas.daysNarrow
159 // WeekdayShort returns the locales short weekday given the 'weekday' provided
160 func (bas *bas_CM) WeekdayShort(weekday time.Weekday) string {
161 return bas.daysShort[weekday]
164 // WeekdaysShort returns the locales short weekdays
165 func (bas *bas_CM) WeekdaysShort() []string {
169 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
170 func (bas *bas_CM) WeekdayWide(weekday time.Weekday) string {
171 return bas.daysWide[weekday]
174 // WeekdaysWide returns the locales wide weekdays
175 func (bas *bas_CM) WeekdaysWide() []string {
179 // Decimal returns the decimal point of number
180 func (bas *bas_CM) Decimal() string {
184 // Group returns the group of number
185 func (bas *bas_CM) Group() string {
189 // Group returns the minus sign of number
190 func (bas *bas_CM) Minus() string {
194 // FmtNumber returns 'num' with digits/precision of 'v' for 'bas_CM' and handles both Whole and Real numbers based on 'v'
195 func (bas *bas_CM) FmtNumber(num float64, v uint64) string {
197 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
198 l := len(s) + 1 + 2*len(s[:len(s)-int(v)-1])/3
201 b := make([]byte, 0, l)
203 for i := len(s) - 1; i >= 0; i-- {
206 b = append(b, bas.decimal[0])
213 for j := len(bas.group) - 1; j >= 0; j-- {
214 b = append(b, bas.group[j])
226 b = append(b, bas.minus[0])
230 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
231 b[i], b[j] = b[j], b[i]
237 // FmtPercent returns 'num' with digits/precision of 'v' for 'bas_CM' and handles both Whole and Real numbers based on 'v'
238 // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
239 func (bas *bas_CM) FmtPercent(num float64, v uint64) string {
240 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
242 b := make([]byte, 0, l)
244 for i := len(s) - 1; i >= 0; i-- {
247 b = append(b, bas.decimal[0])
255 b = append(b, bas.minus[0])
259 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
260 b[i], b[j] = b[j], b[i]
263 b = append(b, bas.percentSuffix...)
265 b = append(b, bas.percent...)
270 // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'bas_CM'
271 func (bas *bas_CM) FmtCurrency(num float64, v uint64, currency currency.Type) string {
273 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
274 symbol := bas.currencies[currency]
275 l := len(s) + len(symbol) + 3 + 2*len(s[:len(s)-int(v)-1])/3
278 b := make([]byte, 0, l)
280 for i := len(s) - 1; i >= 0; i-- {
283 b = append(b, bas.decimal[0])
290 for j := len(bas.group) - 1; j >= 0; j-- {
291 b = append(b, bas.group[j])
303 b = append(b, bas.minus[0])
307 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
308 b[i], b[j] = b[j], b[i]
314 b = append(b, bas.decimal...)
317 for i := 0; i < 2-int(v); i++ {
322 b = append(b, bas.currencyPositiveSuffix...)
324 b = append(b, symbol...)
329 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'bas_CM'
330 // in accounting notation.
331 func (bas *bas_CM) FmtAccounting(num float64, v uint64, currency currency.Type) string {
333 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
334 symbol := bas.currencies[currency]
335 l := len(s) + len(symbol) + 3 + 2*len(s[:len(s)-int(v)-1])/3
338 b := make([]byte, 0, l)
340 for i := len(s) - 1; i >= 0; i-- {
343 b = append(b, bas.decimal[0])
350 for j := len(bas.group) - 1; j >= 0; j-- {
351 b = append(b, bas.group[j])
364 b = append(b, bas.minus[0])
369 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
370 b[i], b[j] = b[j], b[i]
376 b = append(b, bas.decimal...)
379 for i := 0; i < 2-int(v); i++ {
385 b = append(b, bas.currencyNegativeSuffix...)
386 b = append(b, symbol...)
389 b = append(b, bas.currencyPositiveSuffix...)
390 b = append(b, symbol...)
396 // FmtDateShort returns the short date representation of 't' for 'bas_CM'
397 func (bas *bas_CM) FmtDateShort(t time.Time) string {
399 b := make([]byte, 0, 32)
401 b = strconv.AppendInt(b, int64(t.Day()), 10)
402 b = append(b, []byte{0x2f}...)
403 b = strconv.AppendInt(b, int64(t.Month()), 10)
404 b = append(b, []byte{0x2f}...)
407 b = strconv.AppendInt(b, int64(t.Year()), 10)
409 b = strconv.AppendInt(b, int64(-t.Year()), 10)
415 // FmtDateMedium returns the medium date representation of 't' for 'bas_CM'
416 func (bas *bas_CM) FmtDateMedium(t time.Time) string {
418 b := make([]byte, 0, 32)
420 b = strconv.AppendInt(b, int64(t.Day()), 10)
421 b = append(b, []byte{0x20}...)
422 b = append(b, bas.monthsAbbreviated[t.Month()]...)
423 b = append(b, []byte{0x2c, 0x20}...)
426 b = strconv.AppendInt(b, int64(t.Year()), 10)
428 b = strconv.AppendInt(b, int64(-t.Year()), 10)
434 // FmtDateLong returns the long date representation of 't' for 'bas_CM'
435 func (bas *bas_CM) FmtDateLong(t time.Time) string {
437 b := make([]byte, 0, 32)
439 b = strconv.AppendInt(b, int64(t.Day()), 10)
440 b = append(b, []byte{0x20}...)
441 b = append(b, bas.monthsWide[t.Month()]...)
442 b = append(b, []byte{0x20}...)
445 b = strconv.AppendInt(b, int64(t.Year()), 10)
447 b = strconv.AppendInt(b, int64(-t.Year()), 10)
453 // FmtDateFull returns the full date representation of 't' for 'bas_CM'
454 func (bas *bas_CM) FmtDateFull(t time.Time) string {
456 b := make([]byte, 0, 32)
458 b = append(b, bas.daysWide[t.Weekday()]...)
459 b = append(b, []byte{0x20}...)
460 b = strconv.AppendInt(b, int64(t.Day()), 10)
461 b = append(b, []byte{0x20}...)
462 b = append(b, bas.monthsWide[t.Month()]...)
463 b = append(b, []byte{0x20}...)
466 b = strconv.AppendInt(b, int64(t.Year()), 10)
468 b = strconv.AppendInt(b, int64(-t.Year()), 10)
474 // FmtTimeShort returns the short time representation of 't' for 'bas_CM'
475 func (bas *bas_CM) FmtTimeShort(t time.Time) string {
477 b := make([]byte, 0, 32)
483 b = strconv.AppendInt(b, int64(t.Hour()), 10)
484 b = append(b, bas.timeSeparator...)
490 b = strconv.AppendInt(b, int64(t.Minute()), 10)
495 // FmtTimeMedium returns the medium time representation of 't' for 'bas_CM'
496 func (bas *bas_CM) FmtTimeMedium(t time.Time) string {
498 b := make([]byte, 0, 32)
504 b = strconv.AppendInt(b, int64(t.Hour()), 10)
505 b = append(b, bas.timeSeparator...)
511 b = strconv.AppendInt(b, int64(t.Minute()), 10)
512 b = append(b, bas.timeSeparator...)
518 b = strconv.AppendInt(b, int64(t.Second()), 10)
523 // FmtTimeLong returns the long time representation of 't' for 'bas_CM'
524 func (bas *bas_CM) FmtTimeLong(t time.Time) string {
526 b := make([]byte, 0, 32)
532 b = strconv.AppendInt(b, int64(t.Hour()), 10)
533 b = append(b, bas.timeSeparator...)
539 b = strconv.AppendInt(b, int64(t.Minute()), 10)
540 b = append(b, bas.timeSeparator...)
546 b = strconv.AppendInt(b, int64(t.Second()), 10)
547 b = append(b, []byte{0x20}...)
555 // FmtTimeFull returns the full time representation of 't' for 'bas_CM'
556 func (bas *bas_CM) FmtTimeFull(t time.Time) string {
558 b := make([]byte, 0, 32)
564 b = strconv.AppendInt(b, int64(t.Hour()), 10)
565 b = append(b, bas.timeSeparator...)
571 b = strconv.AppendInt(b, int64(t.Minute()), 10)
572 b = append(b, bas.timeSeparator...)
578 b = strconv.AppendInt(b, int64(t.Second()), 10)
579 b = append(b, []byte{0x20}...)
583 if btz, ok := bas.timezones[tz]; ok {
584 b = append(b, btz...)