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 'ewo_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{"", "ngo", "ngb", "ngl", "ngn", "ngt", "ngs", "ngz", "ngm", "nge", "nga", "ngad", "ngab"},
58 monthsNarrow: []string{"", "o", "b", "l", "n", "t", "s", "z", "m", "e", "a", "d", "b"},
59 monthsWide: []string{"", "ngɔn osú", "ngɔn bɛ̌", "ngɔn lála", "ngɔn nyina", "ngɔn tána", "ngɔn saməna", "ngɔn zamgbála", "ngɔn mwom", "ngɔn ebulú", "ngɔn awóm", "ngɔn awóm ai dziá", "ngɔn awóm ai bɛ̌"},
60 daysAbbreviated: []string{"sɔ́n", "mɔ́n", "smb", "sml", "smn", "fúl", "sér"},
61 daysNarrow: []string{"s", "m", "s", "s", "s", "f", "s"},
62 daysWide: []string{"sɔ́ndɔ", "mɔ́ndi", "sɔ́ndɔ məlú mə́bɛ̌", "sɔ́ndɔ məlú mə́lɛ́", "sɔ́ndɔ məlú mə́nyi", "fúladé", "séradé"},
63 periodsAbbreviated: []string{"kíkíríg", "ngəgógəle"},
64 periodsWide: []string{"kíkíríg", "ngəgógəle"},
65 erasAbbreviated: []string{"oyk", "ayk"},
66 erasNarrow: []string{"", ""},
67 erasWide: []string{"osúsúa Yésus kiri", "ámvus Yésus Kirís"},
68 timezones: map[string]string{"HENOMX": "HENOMX", "WITA": "WITA", "OEZ": "OEZ", "MDT": "MDT", "HEOG": "HEOG", "COST": "COST", "CLT": "CLT", "TMST": "TMST", "LHDT": "LHDT", "AST": "AST", "AEST": "AEST", "ART": "ART", "PST": "PST", "PDT": "PDT", "MYT": "MYT", "VET": "VET", "EAT": "EAT", "WAT": "WAT", "ACST": "ACST", "HNPMX": "HNPMX", "BOT": "BOT", "WART": "WART", "CHADT": "CHADT", "AWDT": "AWDT", "HNOG": "HNOG", "BT": "BT", "SRT": "SRT", "HNNOMX": "HNNOMX", "LHST": "LHST", "AEDT": "AEDT", "HNCU": "HNCU", "UYST": "UYST", "SAST": "SAST", "WAST": "WAST", "COT": "COT", "EST": "EST", "ECT": "ECT", "CDT": "CDT", "HAST": "HAST", "AKST": "AKST", "ACDT": "ACDT", "CAT": "CAT", "CHAST": "CHAST", "NZST": "NZST", "EDT": "EDT", "AKDT": "AKDT", "GMT": "GMT", "HECU": "HECU", "JDT": "JDT", "HNEG": "HNEG", "HAT": "HAT", "HKT": "HKT", "CLST": "CLST", "HADT": "HADT", "HEEG": "HEEG", "WEZ": "WEZ", "HNPM": "HNPM", "AWST": "AWST", "IST": "IST", "OESZ": "OESZ", "MST": "MST", "GYT": "GYT", "CST": "CST", "WARST": "WARST", "ARST": "ARST", "HKST": "HKST", "NZDT": "NZDT", "MEZ": "MEZ", "GFT": "GFT", "ChST": "ChST", "HEPMX": "HEPMX", "HEPM": "HEPM", "ACWST": "ACWST", "WIB": "WIB", "WIT": "WIT", "UYT": "UYT", "TMT": "TMT", "MESZ": "MESZ", "JST": "JST", "∅∅∅": "∅∅∅", "ADT": "ADT", "HNT": "HNT", "ACWDT": "ACWDT", "SGT": "SGT", "WESZ": "WESZ"},
72 // Locale returns the current translators string locale
73 func (ewo *ewo_CM) Locale() string {
77 // PluralsCardinal returns the list of cardinal plural rules associated with 'ewo_CM'
78 func (ewo *ewo_CM) PluralsCardinal() []locales.PluralRule {
79 return ewo.pluralsCardinal
82 // PluralsOrdinal returns the list of ordinal plural rules associated with 'ewo_CM'
83 func (ewo *ewo_CM) PluralsOrdinal() []locales.PluralRule {
84 return ewo.pluralsOrdinal
87 // PluralsRange returns the list of range plural rules associated with 'ewo_CM'
88 func (ewo *ewo_CM) PluralsRange() []locales.PluralRule {
89 return ewo.pluralsRange
92 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'ewo_CM'
93 func (ewo *ewo_CM) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
94 return locales.PluralRuleUnknown
97 // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'ewo_CM'
98 func (ewo *ewo_CM) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
99 return locales.PluralRuleUnknown
102 // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'ewo_CM'
103 func (ewo *ewo_CM) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
104 return locales.PluralRuleUnknown
107 // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
108 func (ewo *ewo_CM) MonthAbbreviated(month time.Month) string {
109 return ewo.monthsAbbreviated[month]
112 // MonthsAbbreviated returns the locales abbreviated months
113 func (ewo *ewo_CM) MonthsAbbreviated() []string {
114 return ewo.monthsAbbreviated[1:]
117 // MonthNarrow returns the locales narrow month given the 'month' provided
118 func (ewo *ewo_CM) MonthNarrow(month time.Month) string {
119 return ewo.monthsNarrow[month]
122 // MonthsNarrow returns the locales narrow months
123 func (ewo *ewo_CM) MonthsNarrow() []string {
124 return ewo.monthsNarrow[1:]
127 // MonthWide returns the locales wide month given the 'month' provided
128 func (ewo *ewo_CM) MonthWide(month time.Month) string {
129 return ewo.monthsWide[month]
132 // MonthsWide returns the locales wide months
133 func (ewo *ewo_CM) MonthsWide() []string {
134 return ewo.monthsWide[1:]
137 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
138 func (ewo *ewo_CM) WeekdayAbbreviated(weekday time.Weekday) string {
139 return ewo.daysAbbreviated[weekday]
142 // WeekdaysAbbreviated returns the locales abbreviated weekdays
143 func (ewo *ewo_CM) WeekdaysAbbreviated() []string {
144 return ewo.daysAbbreviated
147 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
148 func (ewo *ewo_CM) WeekdayNarrow(weekday time.Weekday) string {
149 return ewo.daysNarrow[weekday]
152 // WeekdaysNarrow returns the locales narrow weekdays
153 func (ewo *ewo_CM) WeekdaysNarrow() []string {
154 return ewo.daysNarrow
157 // WeekdayShort returns the locales short weekday given the 'weekday' provided
158 func (ewo *ewo_CM) WeekdayShort(weekday time.Weekday) string {
159 return ewo.daysShort[weekday]
162 // WeekdaysShort returns the locales short weekdays
163 func (ewo *ewo_CM) WeekdaysShort() []string {
167 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
168 func (ewo *ewo_CM) WeekdayWide(weekday time.Weekday) string {
169 return ewo.daysWide[weekday]
172 // WeekdaysWide returns the locales wide weekdays
173 func (ewo *ewo_CM) WeekdaysWide() []string {
177 // Decimal returns the decimal point of number
178 func (ewo *ewo_CM) Decimal() string {
182 // Group returns the group of number
183 func (ewo *ewo_CM) Group() string {
187 // Group returns the minus sign of number
188 func (ewo *ewo_CM) Minus() string {
192 // FmtNumber returns 'num' with digits/precision of 'v' for 'ewo_CM' and handles both Whole and Real numbers based on 'v'
193 func (ewo *ewo_CM) FmtNumber(num float64, v uint64) string {
195 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
196 l := len(s) + 1 + 2*len(s[:len(s)-int(v)-1])/3
199 b := make([]byte, 0, l)
201 for i := len(s) - 1; i >= 0; i-- {
204 b = append(b, ewo.decimal[0])
211 for j := len(ewo.group) - 1; j >= 0; j-- {
212 b = append(b, ewo.group[j])
224 b = append(b, ewo.minus[0])
228 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
229 b[i], b[j] = b[j], b[i]
235 // FmtPercent returns 'num' with digits/precision of 'v' for 'ewo_CM' and handles both Whole and Real numbers based on 'v'
236 // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
237 func (ewo *ewo_CM) FmtPercent(num float64, v uint64) string {
238 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
240 b := make([]byte, 0, l)
242 for i := len(s) - 1; i >= 0; i-- {
245 b = append(b, ewo.decimal[0])
253 b = append(b, ewo.minus[0])
257 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
258 b[i], b[j] = b[j], b[i]
261 b = append(b, ewo.percent...)
266 // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'ewo_CM'
267 func (ewo *ewo_CM) FmtCurrency(num float64, v uint64, currency currency.Type) string {
269 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
270 symbol := ewo.currencies[currency]
271 l := len(s) + len(symbol) + 3 + 2*len(s[:len(s)-int(v)-1])/3
274 b := make([]byte, 0, l)
276 for i := len(s) - 1; i >= 0; i-- {
279 b = append(b, ewo.decimal[0])
286 for j := len(ewo.group) - 1; j >= 0; j-- {
287 b = append(b, ewo.group[j])
299 b = append(b, ewo.minus[0])
303 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
304 b[i], b[j] = b[j], b[i]
310 b = append(b, ewo.decimal...)
313 for i := 0; i < 2-int(v); i++ {
318 b = append(b, ewo.currencyPositiveSuffix...)
320 b = append(b, symbol...)
325 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ewo_CM'
326 // in accounting notation.
327 func (ewo *ewo_CM) FmtAccounting(num float64, v uint64, currency currency.Type) string {
329 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
330 symbol := ewo.currencies[currency]
331 l := len(s) + len(symbol) + 3 + 2*len(s[:len(s)-int(v)-1])/3
334 b := make([]byte, 0, l)
336 for i := len(s) - 1; i >= 0; i-- {
339 b = append(b, ewo.decimal[0])
346 for j := len(ewo.group) - 1; j >= 0; j-- {
347 b = append(b, ewo.group[j])
360 b = append(b, ewo.minus[0])
365 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
366 b[i], b[j] = b[j], b[i]
372 b = append(b, ewo.decimal...)
375 for i := 0; i < 2-int(v); i++ {
381 b = append(b, ewo.currencyNegativeSuffix...)
382 b = append(b, symbol...)
385 b = append(b, ewo.currencyPositiveSuffix...)
386 b = append(b, symbol...)
392 // FmtDateShort returns the short date representation of 't' for 'ewo_CM'
393 func (ewo *ewo_CM) FmtDateShort(t time.Time) string {
395 b := make([]byte, 0, 32)
397 b = strconv.AppendInt(b, int64(t.Day()), 10)
398 b = append(b, []byte{0x2f}...)
399 b = strconv.AppendInt(b, int64(t.Month()), 10)
400 b = append(b, []byte{0x2f}...)
403 b = strconv.AppendInt(b, int64(t.Year()), 10)
405 b = strconv.AppendInt(b, int64(-t.Year()), 10)
411 // FmtDateMedium returns the medium date representation of 't' for 'ewo_CM'
412 func (ewo *ewo_CM) FmtDateMedium(t time.Time) string {
414 b := make([]byte, 0, 32)
416 b = strconv.AppendInt(b, int64(t.Day()), 10)
417 b = append(b, []byte{0x20}...)
418 b = append(b, ewo.monthsAbbreviated[t.Month()]...)
419 b = append(b, []byte{0x20}...)
422 b = strconv.AppendInt(b, int64(t.Year()), 10)
424 b = strconv.AppendInt(b, int64(-t.Year()), 10)
430 // FmtDateLong returns the long date representation of 't' for 'ewo_CM'
431 func (ewo *ewo_CM) FmtDateLong(t time.Time) string {
433 b := make([]byte, 0, 32)
435 b = strconv.AppendInt(b, int64(t.Day()), 10)
436 b = append(b, []byte{0x20}...)
437 b = append(b, ewo.monthsWide[t.Month()]...)
438 b = append(b, []byte{0x20}...)
441 b = strconv.AppendInt(b, int64(t.Year()), 10)
443 b = strconv.AppendInt(b, int64(-t.Year()), 10)
449 // FmtDateFull returns the full date representation of 't' for 'ewo_CM'
450 func (ewo *ewo_CM) FmtDateFull(t time.Time) string {
452 b := make([]byte, 0, 32)
454 b = append(b, ewo.daysWide[t.Weekday()]...)
455 b = append(b, []byte{0x20}...)
456 b = strconv.AppendInt(b, int64(t.Day()), 10)
457 b = append(b, []byte{0x20}...)
458 b = append(b, ewo.monthsWide[t.Month()]...)
459 b = append(b, []byte{0x20}...)
462 b = strconv.AppendInt(b, int64(t.Year()), 10)
464 b = strconv.AppendInt(b, int64(-t.Year()), 10)
470 // FmtTimeShort returns the short time representation of 't' for 'ewo_CM'
471 func (ewo *ewo_CM) FmtTimeShort(t time.Time) string {
473 b := make([]byte, 0, 32)
479 b = strconv.AppendInt(b, int64(t.Hour()), 10)
480 b = append(b, ewo.timeSeparator...)
486 b = strconv.AppendInt(b, int64(t.Minute()), 10)
491 // FmtTimeMedium returns the medium time representation of 't' for 'ewo_CM'
492 func (ewo *ewo_CM) FmtTimeMedium(t time.Time) string {
494 b := make([]byte, 0, 32)
500 b = strconv.AppendInt(b, int64(t.Hour()), 10)
501 b = append(b, ewo.timeSeparator...)
507 b = strconv.AppendInt(b, int64(t.Minute()), 10)
508 b = append(b, ewo.timeSeparator...)
514 b = strconv.AppendInt(b, int64(t.Second()), 10)
519 // FmtTimeLong returns the long time representation of 't' for 'ewo_CM'
520 func (ewo *ewo_CM) FmtTimeLong(t time.Time) string {
522 b := make([]byte, 0, 32)
528 b = strconv.AppendInt(b, int64(t.Hour()), 10)
529 b = append(b, ewo.timeSeparator...)
535 b = strconv.AppendInt(b, int64(t.Minute()), 10)
536 b = append(b, ewo.timeSeparator...)
542 b = strconv.AppendInt(b, int64(t.Second()), 10)
543 b = append(b, []byte{0x20}...)
551 // FmtTimeFull returns the full time representation of 't' for 'ewo_CM'
552 func (ewo *ewo_CM) FmtTimeFull(t time.Time) string {
554 b := make([]byte, 0, 32)
560 b = strconv.AppendInt(b, int64(t.Hour()), 10)
561 b = append(b, ewo.timeSeparator...)
567 b = strconv.AppendInt(b, int64(t.Minute()), 10)
568 b = append(b, ewo.timeSeparator...)
574 b = strconv.AppendInt(b, int64(t.Second()), 10)
575 b = append(b, []byte{0x20}...)
579 if btz, ok := ewo.timezones[tz]; ok {
580 b = append(b, btz...)