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 currencyPositiveSuffix string
26 currencyNegativeSuffix 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 'ksf_CM' locale
45 func New() locales.Translator {
54 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"},
55 currencyPositiveSuffix: " ",
56 currencyNegativeSuffix: " ",
57 monthsAbbreviated: []string{"", "ŋ1", "ŋ2", "ŋ3", "ŋ4", "ŋ5", "ŋ6", "ŋ7", "ŋ8", "ŋ9", "ŋ10", "ŋ11", "ŋ12"},
58 monthsWide: []string{"", "ŋwíí a ntɔ́ntɔ", "ŋwíí akǝ bɛ́ɛ", "ŋwíí akǝ ráá", "ŋwíí akǝ nin", "ŋwíí akǝ táan", "ŋwíí akǝ táafɔk", "ŋwíí akǝ táabɛɛ", "ŋwíí akǝ táaraa", "ŋwíí akǝ táanin", "ŋwíí akǝ ntɛk", "ŋwíí akǝ ntɛk di bɔ́k", "ŋwíí akǝ ntɛk di bɛ́ɛ"},
59 daysAbbreviated: []string{"sɔ́n", "lǝn", "maa", "mɛk", "jǝǝ", "júm", "sam"},
60 daysNarrow: []string{"s", "l", "m", "m", "j", "j", "s"},
61 daysWide: []string{"sɔ́ndǝ", "lǝndí", "maadí", "mɛkrɛdí", "jǝǝdí", "júmbá", "samdí"},
62 periodsAbbreviated: []string{"sárúwá", "cɛɛ́nko"},
63 periodsWide: []string{"sárúwá", "cɛɛ́nko"},
64 erasAbbreviated: []string{"d.Y.", "k.Y."},
65 erasNarrow: []string{"", ""},
66 erasWide: []string{"di Yɛ́sus aká yálɛ", "cámɛɛn kǝ kǝbɔpka Y"},
67 timezones: map[string]string{"WAST": "WAST", "HKST": "HKST", "HECU": "HECU", "ART": "ART", "WIB": "WIB", "HNPM": "HNPM", "PDT": "PDT", "ACWDT": "ACWDT", "TMST": "TMST", "AEST": "AEST", "HNEG": "HNEG", "PST": "PST", "MYT": "MYT", "VET": "VET", "COST": "COST", "GMT": "GMT", "MEZ": "MEZ", "LHDT": "LHDT", "ARST": "ARST", "EST": "EST", "ACDT": "ACDT", "CAT": "CAT", "CST": "CST", "MST": "MST", "LHST": "LHST", "AKDT": "AKDT", "ACST": "ACST", "SGT": "SGT", "AWST": "AWST", "NZST": "NZST", "JST": "JST", "HNNOMX": "HNNOMX", "HADT": "HADT", "WARST": "WARST", "∅∅∅": "∅∅∅", "COT": "COT", "CLT": "CLT", "WEZ": "WEZ", "CHAST": "CHAST", "BT": "BT", "AWDT": "AWDT", "JDT": "JDT", "OESZ": "OESZ", "IST": "IST", "HNOG": "HNOG", "HNPMX": "HNPMX", "SRT": "SRT", "HENOMX": "HENOMX", "CLST": "CLST", "EDT": "EDT", "WIT": "WIT", "HEOG": "HEOG", "AEDT": "AEDT", "EAT": "EAT", "GFT": "GFT", "ACWST": "ACWST", "UYT": "UYT", "ADT": "ADT", "SAST": "SAST", "HKT": "HKT", "AKST": "AKST", "ECT": "ECT", "ChST": "ChST", "HEPMX": "HEPMX", "CHADT": "CHADT", "WART": "WART", "UYST": "UYST", "CDT": "CDT", "HNT": "HNT", "HAT": "HAT", "HEPM": "HEPM", "BOT": "BOT", "MDT": "MDT", "MESZ": "MESZ", "NZDT": "NZDT", "WITA": "WITA", "WAT": "WAT", "HNCU": "HNCU", "TMT": "TMT", "HAST": "HAST", "HEEG": "HEEG", "AST": "AST", "GYT": "GYT", "WESZ": "WESZ", "OEZ": "OEZ"},
71 // Locale returns the current translators string locale
72 func (ksf *ksf_CM) Locale() string {
76 // PluralsCardinal returns the list of cardinal plural rules associated with 'ksf_CM'
77 func (ksf *ksf_CM) PluralsCardinal() []locales.PluralRule {
78 return ksf.pluralsCardinal
81 // PluralsOrdinal returns the list of ordinal plural rules associated with 'ksf_CM'
82 func (ksf *ksf_CM) PluralsOrdinal() []locales.PluralRule {
83 return ksf.pluralsOrdinal
86 // PluralsRange returns the list of range plural rules associated with 'ksf_CM'
87 func (ksf *ksf_CM) PluralsRange() []locales.PluralRule {
88 return ksf.pluralsRange
91 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'ksf_CM'
92 func (ksf *ksf_CM) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
93 return locales.PluralRuleUnknown
96 // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'ksf_CM'
97 func (ksf *ksf_CM) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
98 return locales.PluralRuleUnknown
101 // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'ksf_CM'
102 func (ksf *ksf_CM) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
103 return locales.PluralRuleUnknown
106 // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
107 func (ksf *ksf_CM) MonthAbbreviated(month time.Month) string {
108 return ksf.monthsAbbreviated[month]
111 // MonthsAbbreviated returns the locales abbreviated months
112 func (ksf *ksf_CM) MonthsAbbreviated() []string {
113 return ksf.monthsAbbreviated[1:]
116 // MonthNarrow returns the locales narrow month given the 'month' provided
117 func (ksf *ksf_CM) MonthNarrow(month time.Month) string {
118 return ksf.monthsNarrow[month]
121 // MonthsNarrow returns the locales narrow months
122 func (ksf *ksf_CM) MonthsNarrow() []string {
126 // MonthWide returns the locales wide month given the 'month' provided
127 func (ksf *ksf_CM) MonthWide(month time.Month) string {
128 return ksf.monthsWide[month]
131 // MonthsWide returns the locales wide months
132 func (ksf *ksf_CM) MonthsWide() []string {
133 return ksf.monthsWide[1:]
136 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
137 func (ksf *ksf_CM) WeekdayAbbreviated(weekday time.Weekday) string {
138 return ksf.daysAbbreviated[weekday]
141 // WeekdaysAbbreviated returns the locales abbreviated weekdays
142 func (ksf *ksf_CM) WeekdaysAbbreviated() []string {
143 return ksf.daysAbbreviated
146 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
147 func (ksf *ksf_CM) WeekdayNarrow(weekday time.Weekday) string {
148 return ksf.daysNarrow[weekday]
151 // WeekdaysNarrow returns the locales narrow weekdays
152 func (ksf *ksf_CM) WeekdaysNarrow() []string {
153 return ksf.daysNarrow
156 // WeekdayShort returns the locales short weekday given the 'weekday' provided
157 func (ksf *ksf_CM) WeekdayShort(weekday time.Weekday) string {
158 return ksf.daysShort[weekday]
161 // WeekdaysShort returns the locales short weekdays
162 func (ksf *ksf_CM) WeekdaysShort() []string {
166 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
167 func (ksf *ksf_CM) WeekdayWide(weekday time.Weekday) string {
168 return ksf.daysWide[weekday]
171 // WeekdaysWide returns the locales wide weekdays
172 func (ksf *ksf_CM) WeekdaysWide() []string {
176 // Decimal returns the decimal point of number
177 func (ksf *ksf_CM) Decimal() string {
181 // Group returns the group of number
182 func (ksf *ksf_CM) Group() string {
186 // Group returns the minus sign of number
187 func (ksf *ksf_CM) Minus() string {
191 // FmtNumber returns 'num' with digits/precision of 'v' for 'ksf_CM' and handles both Whole and Real numbers based on 'v'
192 func (ksf *ksf_CM) FmtNumber(num float64, v uint64) string {
194 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
195 l := len(s) + 1 + 2*len(s[:len(s)-int(v)-1])/3
198 b := make([]byte, 0, l)
200 for i := len(s) - 1; i >= 0; i-- {
203 b = append(b, ksf.decimal[0])
210 for j := len(ksf.group) - 1; j >= 0; j-- {
211 b = append(b, ksf.group[j])
223 b = append(b, ksf.minus[0])
227 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
228 b[i], b[j] = b[j], b[i]
234 // FmtPercent returns 'num' with digits/precision of 'v' for 'ksf_CM' and handles both Whole and Real numbers based on 'v'
235 // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
236 func (ksf *ksf_CM) FmtPercent(num float64, v uint64) string {
237 return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
240 // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'ksf_CM'
241 func (ksf *ksf_CM) FmtCurrency(num float64, v uint64, currency currency.Type) string {
243 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
244 symbol := ksf.currencies[currency]
245 l := len(s) + len(symbol) + 3 + 2*len(s[:len(s)-int(v)-1])/3
248 b := make([]byte, 0, l)
250 for i := len(s) - 1; i >= 0; i-- {
253 b = append(b, ksf.decimal[0])
260 for j := len(ksf.group) - 1; j >= 0; j-- {
261 b = append(b, ksf.group[j])
273 b = append(b, ksf.minus[0])
277 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
278 b[i], b[j] = b[j], b[i]
284 b = append(b, ksf.decimal...)
287 for i := 0; i < 2-int(v); i++ {
292 b = append(b, ksf.currencyPositiveSuffix...)
294 b = append(b, symbol...)
299 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ksf_CM'
300 // in accounting notation.
301 func (ksf *ksf_CM) FmtAccounting(num float64, v uint64, currency currency.Type) string {
303 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
304 symbol := ksf.currencies[currency]
305 l := len(s) + len(symbol) + 3 + 2*len(s[:len(s)-int(v)-1])/3
308 b := make([]byte, 0, l)
310 for i := len(s) - 1; i >= 0; i-- {
313 b = append(b, ksf.decimal[0])
320 for j := len(ksf.group) - 1; j >= 0; j-- {
321 b = append(b, ksf.group[j])
334 b = append(b, ksf.minus[0])
339 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
340 b[i], b[j] = b[j], b[i]
346 b = append(b, ksf.decimal...)
349 for i := 0; i < 2-int(v); i++ {
355 b = append(b, ksf.currencyNegativeSuffix...)
356 b = append(b, symbol...)
359 b = append(b, ksf.currencyPositiveSuffix...)
360 b = append(b, symbol...)
366 // FmtDateShort returns the short date representation of 't' for 'ksf_CM'
367 func (ksf *ksf_CM) FmtDateShort(t time.Time) string {
369 b := make([]byte, 0, 32)
371 b = strconv.AppendInt(b, int64(t.Day()), 10)
372 b = append(b, []byte{0x2f}...)
373 b = strconv.AppendInt(b, int64(t.Month()), 10)
374 b = append(b, []byte{0x2f}...)
377 b = strconv.AppendInt(b, int64(t.Year()), 10)
379 b = strconv.AppendInt(b, int64(-t.Year()), 10)
385 // FmtDateMedium returns the medium date representation of 't' for 'ksf_CM'
386 func (ksf *ksf_CM) FmtDateMedium(t time.Time) string {
388 b := make([]byte, 0, 32)
390 b = strconv.AppendInt(b, int64(t.Day()), 10)
391 b = append(b, []byte{0x20}...)
392 b = append(b, ksf.monthsAbbreviated[t.Month()]...)
393 b = append(b, []byte{0x20}...)
396 b = strconv.AppendInt(b, int64(t.Year()), 10)
398 b = strconv.AppendInt(b, int64(-t.Year()), 10)
404 // FmtDateLong returns the long date representation of 't' for 'ksf_CM'
405 func (ksf *ksf_CM) FmtDateLong(t time.Time) string {
407 b := make([]byte, 0, 32)
409 b = strconv.AppendInt(b, int64(t.Day()), 10)
410 b = append(b, []byte{0x20}...)
411 b = append(b, ksf.monthsWide[t.Month()]...)
412 b = append(b, []byte{0x20}...)
415 b = strconv.AppendInt(b, int64(t.Year()), 10)
417 b = strconv.AppendInt(b, int64(-t.Year()), 10)
423 // FmtDateFull returns the full date representation of 't' for 'ksf_CM'
424 func (ksf *ksf_CM) FmtDateFull(t time.Time) string {
426 b := make([]byte, 0, 32)
428 b = append(b, ksf.daysWide[t.Weekday()]...)
429 b = append(b, []byte{0x20}...)
430 b = strconv.AppendInt(b, int64(t.Day()), 10)
431 b = append(b, []byte{0x20}...)
432 b = append(b, ksf.monthsWide[t.Month()]...)
433 b = append(b, []byte{0x20}...)
436 b = strconv.AppendInt(b, int64(t.Year()), 10)
438 b = strconv.AppendInt(b, int64(-t.Year()), 10)
444 // FmtTimeShort returns the short time representation of 't' for 'ksf_CM'
445 func (ksf *ksf_CM) FmtTimeShort(t time.Time) string {
447 b := make([]byte, 0, 32)
453 b = strconv.AppendInt(b, int64(t.Hour()), 10)
454 b = append(b, ksf.timeSeparator...)
460 b = strconv.AppendInt(b, int64(t.Minute()), 10)
465 // FmtTimeMedium returns the medium time representation of 't' for 'ksf_CM'
466 func (ksf *ksf_CM) FmtTimeMedium(t time.Time) string {
468 b := make([]byte, 0, 32)
474 b = strconv.AppendInt(b, int64(t.Hour()), 10)
475 b = append(b, ksf.timeSeparator...)
481 b = strconv.AppendInt(b, int64(t.Minute()), 10)
482 b = append(b, ksf.timeSeparator...)
488 b = strconv.AppendInt(b, int64(t.Second()), 10)
493 // FmtTimeLong returns the long time representation of 't' for 'ksf_CM'
494 func (ksf *ksf_CM) FmtTimeLong(t time.Time) string {
496 b := make([]byte, 0, 32)
502 b = strconv.AppendInt(b, int64(t.Hour()), 10)
503 b = append(b, ksf.timeSeparator...)
509 b = strconv.AppendInt(b, int64(t.Minute()), 10)
510 b = append(b, ksf.timeSeparator...)
516 b = strconv.AppendInt(b, int64(t.Second()), 10)
517 b = append(b, []byte{0x20}...)
525 // FmtTimeFull returns the full time representation of 't' for 'ksf_CM'
526 func (ksf *ksf_CM) FmtTimeFull(t time.Time) string {
528 b := make([]byte, 0, 32)
534 b = strconv.AppendInt(b, int64(t.Hour()), 10)
535 b = append(b, ksf.timeSeparator...)
541 b = strconv.AppendInt(b, int64(t.Minute()), 10)
542 b = append(b, ksf.timeSeparator...)
548 b = strconv.AppendInt(b, int64(t.Second()), 10)
549 b = append(b, []byte{0x20}...)
553 if btz, ok := ksf.timezones[tz]; ok {
554 b = append(b, btz...)