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 'nnh_CM' locale
45 func New() locales.Translator {
48 pluralsCardinal: []locales.PluralRule{2, 6},
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"},
56 currencyPositivePrefix: " ",
57 currencyNegativePrefix: " ",
58 monthsAbbreviated: []string{"", "saŋ tsetsɛ̀ɛ lùm", "saŋ kàg ngwóŋ", "saŋ lepyè shúm", "saŋ cÿó", "saŋ tsɛ̀ɛ cÿó", "saŋ njÿoláʼ", "saŋ tyɛ̀b tyɛ̀b mbʉ̀ŋ", "saŋ mbʉ̀ŋ", "saŋ ngwɔ̀ʼ mbÿɛ", "saŋ tàŋa tsetsáʼ", "saŋ mejwoŋó", "saŋ lùm"},
59 monthsWide: []string{"", "saŋ tsetsɛ̀ɛ lùm", "saŋ kàg ngwóŋ", "saŋ lepyè shúm", "saŋ cÿó", "saŋ tsɛ̀ɛ cÿó", "saŋ njÿoláʼ", "saŋ tyɛ̀b tyɛ̀b mbʉ̀ŋ", "saŋ mbʉ̀ŋ", "saŋ ngwɔ̀ʼ mbÿɛ", "saŋ tàŋa tsetsáʼ", "saŋ mejwoŋó", "saŋ lùm"},
60 daysAbbreviated: []string{"lyɛʼɛ́ sẅíŋtè", "mvfò lyɛ̌ʼ", "mbɔ́ɔntè mvfò lyɛ̌ʼ", "tsètsɛ̀ɛ lyɛ̌ʼ", "mbɔ́ɔntè tsetsɛ̀ɛ lyɛ̌ʼ", "mvfò màga lyɛ̌ʼ", "màga lyɛ̌ʼ"},
61 daysShort: []string{"lyɛʼɛ́ sẅíŋtè", "mvfò lyɛ̌ʼ", "mbɔ́ɔntè mvfò lyɛ̌ʼ", "tsètsɛ̀ɛ lyɛ̌ʼ", "mbɔ́ɔntè tsetsɛ̀ɛ lyɛ̌ʼ", "mvfò màga lyɛ̌ʼ", "màga lyɛ̌ʼ"},
62 daysWide: []string{"lyɛʼɛ́ sẅíŋtè", "mvfò lyɛ̌ʼ", "mbɔ́ɔntè mvfò lyɛ̌ʼ", "tsètsɛ̀ɛ lyɛ̌ʼ", "mbɔ́ɔntè tsetsɛ̀ɛ lyɛ̌ʼ", "mvfò màga lyɛ̌ʼ", "màga lyɛ̌ʼ"},
63 periodsAbbreviated: []string{"mbaʼámbaʼ", "ncwònzém"},
64 periodsWide: []string{"mbaʼámbaʼ", "ncwònzém"},
65 erasAbbreviated: []string{"m.z.Y.", "m.g.n.Y."},
66 erasNarrow: []string{"", ""},
67 erasWide: []string{"mé zyé Yěsô", "mé gÿo ńzyé Yěsô"},
68 timezones: map[string]string{"HADT": "HADT", "WART": "WART", "IST": "IST", "ARST": "ARST", "HKT": "HKT", "MEZ": "MEZ", "∅∅∅": "∅∅∅", "WAT": "WAT", "ACWST": "ACWST", "MYT": "MYT", "WEZ": "WEZ", "WESZ": "WESZ", "GMT": "GMT", "NZDT": "NZDT", "AEDT": "AEDT", "GFT": "GFT", "AKST": "AKST", "AKDT": "AKDT", "CHAST": "CHAST", "CDT": "CDT", "TMST": "TMST", "ACWDT": "ACWDT", "CLST": "CLST", "COST": "COST", "HAT": "HAT", "ACDT": "ACDT", "OEZ": "OEZ", "ACST": "ACST", "SGT": "SGT", "WIB": "WIB", "HNCU": "HNCU", "JDT": "JDT", "EAT": "EAT", "HEPMX": "HEPMX", "PDT": "PDT", "SRT": "SRT", "SAST": "SAST", "ChST": "ChST", "CST": "CST", "TMT": "TMT", "MESZ": "MESZ", "MST": "MST", "OESZ": "OESZ", "WAST": "WAST", "HAST": "HAST", "VET": "VET", "LHDT": "LHDT", "HNPMX": "HNPMX", "HECU": "HECU", "ADT": "ADT", "PST": "PST", "ECT": "ECT", "CHADT": "CHADT", "HENOMX": "HENOMX", "LHST": "LHST", "AEST": "AEST", "HEEG": "HEEG", "CLT": "CLT", "AWDT": "AWDT", "UYST": "UYST", "WIT": "WIT", "MDT": "MDT", "WITA": "WITA", "ART": "ART", "HNOG": "HNOG", "CAT": "CAT", "HEPM": "HEPM", "BT": "BT", "AWST": "AWST", "NZST": "NZST", "HNNOMX": "HNNOMX", "JST": "JST", "HEOG": "HEOG", "HNPM": "HNPM", "UYT": "UYT", "BOT": "BOT", "WARST": "WARST", "HNEG": "HNEG", "COT": "COT", "HNT": "HNT", "HKST": "HKST", "AST": "AST", "EST": "EST", "EDT": "EDT", "GYT": "GYT"},
72 // Locale returns the current translators string locale
73 func (nnh *nnh_CM) Locale() string {
77 // PluralsCardinal returns the list of cardinal plural rules associated with 'nnh_CM'
78 func (nnh *nnh_CM) PluralsCardinal() []locales.PluralRule {
79 return nnh.pluralsCardinal
82 // PluralsOrdinal returns the list of ordinal plural rules associated with 'nnh_CM'
83 func (nnh *nnh_CM) PluralsOrdinal() []locales.PluralRule {
84 return nnh.pluralsOrdinal
87 // PluralsRange returns the list of range plural rules associated with 'nnh_CM'
88 func (nnh *nnh_CM) PluralsRange() []locales.PluralRule {
89 return nnh.pluralsRange
92 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'nnh_CM'
93 func (nnh *nnh_CM) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
98 return locales.PluralRuleOne
101 return locales.PluralRuleOther
104 // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'nnh_CM'
105 func (nnh *nnh_CM) 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 'nnh_CM'
110 func (nnh *nnh_CM) 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 (nnh *nnh_CM) MonthAbbreviated(month time.Month) string {
116 return nnh.monthsAbbreviated[month]
119 // MonthsAbbreviated returns the locales abbreviated months
120 func (nnh *nnh_CM) MonthsAbbreviated() []string {
121 return nnh.monthsAbbreviated[1:]
124 // MonthNarrow returns the locales narrow month given the 'month' provided
125 func (nnh *nnh_CM) MonthNarrow(month time.Month) string {
126 return nnh.monthsNarrow[month]
129 // MonthsNarrow returns the locales narrow months
130 func (nnh *nnh_CM) MonthsNarrow() []string {
134 // MonthWide returns the locales wide month given the 'month' provided
135 func (nnh *nnh_CM) MonthWide(month time.Month) string {
136 return nnh.monthsWide[month]
139 // MonthsWide returns the locales wide months
140 func (nnh *nnh_CM) MonthsWide() []string {
141 return nnh.monthsWide[1:]
144 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
145 func (nnh *nnh_CM) WeekdayAbbreviated(weekday time.Weekday) string {
146 return nnh.daysAbbreviated[weekday]
149 // WeekdaysAbbreviated returns the locales abbreviated weekdays
150 func (nnh *nnh_CM) WeekdaysAbbreviated() []string {
151 return nnh.daysAbbreviated
154 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
155 func (nnh *nnh_CM) WeekdayNarrow(weekday time.Weekday) string {
156 return nnh.daysNarrow[weekday]
159 // WeekdaysNarrow returns the locales narrow weekdays
160 func (nnh *nnh_CM) WeekdaysNarrow() []string {
161 return nnh.daysNarrow
164 // WeekdayShort returns the locales short weekday given the 'weekday' provided
165 func (nnh *nnh_CM) WeekdayShort(weekday time.Weekday) string {
166 return nnh.daysShort[weekday]
169 // WeekdaysShort returns the locales short weekdays
170 func (nnh *nnh_CM) WeekdaysShort() []string {
174 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
175 func (nnh *nnh_CM) WeekdayWide(weekday time.Weekday) string {
176 return nnh.daysWide[weekday]
179 // WeekdaysWide returns the locales wide weekdays
180 func (nnh *nnh_CM) WeekdaysWide() []string {
184 // Decimal returns the decimal point of number
185 func (nnh *nnh_CM) Decimal() string {
189 // Group returns the group of number
190 func (nnh *nnh_CM) Group() string {
194 // Group returns the minus sign of number
195 func (nnh *nnh_CM) Minus() string {
199 // FmtNumber returns 'num' with digits/precision of 'v' for 'nnh_CM' and handles both Whole and Real numbers based on 'v'
200 func (nnh *nnh_CM) FmtNumber(num float64, v uint64) string {
202 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
203 l := len(s) + 1 + 1*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, nnh.decimal[0])
218 b = append(b, nnh.group[0])
229 b = append(b, nnh.minus[0])
233 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
234 b[i], b[j] = b[j], b[i]
240 // FmtPercent returns 'num' with digits/precision of 'v' for 'nnh_CM' and handles both Whole and Real numbers based on 'v'
241 // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
242 func (nnh *nnh_CM) FmtPercent(num float64, v uint64) string {
243 return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
246 // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'nnh_CM'
247 func (nnh *nnh_CM) FmtCurrency(num float64, v uint64, currency currency.Type) string {
249 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
250 symbol := nnh.currencies[currency]
251 l := len(s) + len(symbol) + 3 + 1*len(s[:len(s)-int(v)-1])/3
254 b := make([]byte, 0, l)
256 for i := len(s) - 1; i >= 0; i-- {
259 b = append(b, nnh.decimal[0])
266 b = append(b, nnh.group[0])
276 for j := len(symbol) - 1; j >= 0; j-- {
277 b = append(b, symbol[j])
280 for j := len(nnh.currencyPositivePrefix) - 1; j >= 0; j-- {
281 b = append(b, nnh.currencyPositivePrefix[j])
285 b = append(b, nnh.minus[0])
289 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
290 b[i], b[j] = b[j], b[i]
296 b = append(b, nnh.decimal...)
299 for i := 0; i < 2-int(v); i++ {
307 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'nnh_CM'
308 // in accounting notation.
309 func (nnh *nnh_CM) FmtAccounting(num float64, v uint64, currency currency.Type) string {
311 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
312 symbol := nnh.currencies[currency]
313 l := len(s) + len(symbol) + 3 + 1*len(s[:len(s)-int(v)-1])/3
316 b := make([]byte, 0, l)
318 for i := len(s) - 1; i >= 0; i-- {
321 b = append(b, nnh.decimal[0])
328 b = append(b, nnh.group[0])
340 for j := len(symbol) - 1; j >= 0; j-- {
341 b = append(b, symbol[j])
344 for j := len(nnh.currencyNegativePrefix) - 1; j >= 0; j-- {
345 b = append(b, nnh.currencyNegativePrefix[j])
348 b = append(b, nnh.minus[0])
352 for j := len(symbol) - 1; j >= 0; j-- {
353 b = append(b, symbol[j])
356 for j := len(nnh.currencyPositivePrefix) - 1; j >= 0; j-- {
357 b = append(b, nnh.currencyPositivePrefix[j])
363 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
364 b[i], b[j] = b[j], b[i]
370 b = append(b, nnh.decimal...)
373 for i := 0; i < 2-int(v); i++ {
381 // FmtDateShort returns the short date representation of 't' for 'nnh_CM'
382 func (nnh *nnh_CM) FmtDateShort(t time.Time) string {
384 b := make([]byte, 0, 32)
390 b = strconv.AppendInt(b, int64(t.Day()), 10)
391 b = append(b, []byte{0x2f}...)
397 b = strconv.AppendInt(b, int64(t.Month()), 10)
399 b = append(b, []byte{0x2f}...)
402 b = append(b, strconv.Itoa(t.Year())[2:]...)
404 b = append(b, strconv.Itoa(t.Year())[1:]...)
410 // FmtDateMedium returns the medium date representation of 't' for 'nnh_CM'
411 func (nnh *nnh_CM) FmtDateMedium(t time.Time) string {
413 b := make([]byte, 0, 32)
415 b = strconv.AppendInt(b, int64(t.Day()), 10)
416 b = append(b, []byte{0x20}...)
417 b = append(b, nnh.monthsAbbreviated[t.Month()]...)
418 b = append(b, []byte{0x2c, 0x20}...)
421 b = strconv.AppendInt(b, int64(t.Year()), 10)
423 b = strconv.AppendInt(b, int64(-t.Year()), 10)
429 // FmtDateLong returns the long date representation of 't' for 'nnh_CM'
430 func (nnh *nnh_CM) FmtDateLong(t time.Time) string {
432 b := make([]byte, 0, 32)
434 b = append(b, []byte{0x6c, 0x79, 0xc9, 0x9b}...)
435 b = append(b, []byte{0xcc, 0x8c, 0xca, 0xbc, 0x20}...)
436 b = strconv.AppendInt(b, int64(t.Day()), 10)
437 b = append(b, []byte{0x20, 0x6e, 0x61}...)
438 b = append(b, []byte{0x20}...)
439 b = append(b, nnh.monthsWide[t.Month()]...)
440 b = append(b, []byte{0x2c, 0x20}...)
443 b = strconv.AppendInt(b, int64(t.Year()), 10)
445 b = strconv.AppendInt(b, int64(-t.Year()), 10)
451 // FmtDateFull returns the full date representation of 't' for 'nnh_CM'
452 func (nnh *nnh_CM) FmtDateFull(t time.Time) string {
454 b := make([]byte, 0, 32)
456 b = append(b, nnh.daysWide[t.Weekday()]...)
457 b = append(b, []byte{0x20, 0x2c, 0x20, 0x6c, 0x79, 0xc9, 0x9b}...)
458 b = append(b, []byte{0xcc, 0x8c, 0xca, 0xbc, 0x20}...)
459 b = strconv.AppendInt(b, int64(t.Day()), 10)
460 b = append(b, []byte{0x20, 0x6e, 0x61}...)
461 b = append(b, []byte{0x20}...)
462 b = append(b, nnh.monthsWide[t.Month()]...)
463 b = append(b, []byte{0x2c, 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 'nnh_CM'
475 func (nnh *nnh_CM) FmtTimeShort(t time.Time) string {
477 b := make([]byte, 0, 32)
482 // FmtTimeMedium returns the medium time representation of 't' for 'nnh_CM'
483 func (nnh *nnh_CM) FmtTimeMedium(t time.Time) string {
485 b := make([]byte, 0, 32)
490 // FmtTimeLong returns the long time representation of 't' for 'nnh_CM'
491 func (nnh *nnh_CM) FmtTimeLong(t time.Time) string {
493 b := make([]byte, 0, 32)
498 // FmtTimeFull returns the full time representation of 't' for 'nnh_CM'
499 func (nnh *nnh_CM) FmtTimeFull(t time.Time) string {
501 b := make([]byte, 0, 32)