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 monthsAbbreviated []string
29 daysAbbreviated []string
33 periodsAbbreviated []string
34 periodsNarrow []string
37 erasAbbreviated []string
40 timezones map[string]string
43 // New returns a new instance of translator for the 'ig_NG' locale
44 func New() locales.Translator {
47 pluralsCardinal: []locales.PluralRule{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"},
57 monthsAbbreviated: []string{"", "Jen", "Feb", "Maa", "Epr", "Mee", "Juu", "Jul", "Ọgọ", "Sep", "Ọkt", "Nov", "Dis"},
58 monthsNarrow: []string{"", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"},
59 monthsWide: []string{"", "Jenụwarị", "Febrụwarị", "Maachị", "Eprel", "Mee", "Juun", "Julaị", "Ọgọọst", "Septemba", "Ọktoba", "Novemba", "Disemba"},
60 daysAbbreviated: []string{"Ụka", "Mọn", "Tiu", "Wen", "Tọọ", "Fraị", "Sat"},
61 daysNarrow: []string{"S", "M", "T", "W", "T", "F", "S"},
62 daysShort: []string{"Ụka", "Mọn", "Tiu", "Wen", "Tọọ", "Fraị", "Sat"},
63 daysWide: []string{"Mbọsị Ụka", "Mọnde", "Tiuzdee", "Wenezdee", "Tọọzdee", "Fraịdee", "Satọdee"},
64 periodsAbbreviated: []string{"A.M.", "P.M."},
65 periodsNarrow: []string{"A.M.", "P.M."},
66 periodsWide: []string{"A.M.", "P.M."},
67 erasAbbreviated: []string{"T.K.", "A.K."},
68 erasNarrow: []string{"T.K.", "A.K."},
69 erasWide: []string{"Tupu Kristi", "Afọ Kristi"},
70 timezones: map[string]string{"AEDT": "AEDT", "CDT": "CDT", "TMT": "TMT", "HNOG": "HNOG", "HEOG": "HEOG", "MYT": "MYT", "LHDT": "LHDT", "CLST": "CLST", "ACDT": "ACDT", "NZDT": "NZDT", "VET": "VET", "WITA": "WITA", "OEZ": "OEZ", "AKST": "AKST", "MDT": "MDT", "EAT": "EAT", "HAT": "HAT", "SGT": "SGT", "CAT": "CAT", "HNPMX": "HNPMX", "CHAST": "CHAST", "ART": "ART", "HEEG": "HEEG", "MEZ": "MEZ", "HNT": "HNT", "WESZ": "WESZ", "HNCU": "HNCU", "AWST": "AWST", "AEST": "AEST", "HNEG": "HNEG", "WAT": "WAT", "WAST": "WAST", "HKST": "HKST", "EDT": "EDT", "WEZ": "WEZ", "CST": "CST", "IST": "IST", "∅∅∅": "∅∅∅", "ACWST": "ACWST", "HEPMX": "HEPMX", "NZST": "NZST", "BOT": "BOT", "SRT": "SRT", "WIT": "WIT", "HKT": "HKT", "WIB": "WIB", "AWDT": "AWDT", "MESZ": "MESZ", "OESZ": "OESZ", "ACST": "ACST", "GMT": "GMT", "UYST": "UYST", "AST": "AST", "HEPM": "HEPM", "ACWDT": "ACWDT", "CLT": "CLT", "COT": "COT", "ChST": "ChST", "WART": "WART", "JST": "JST", "LHST": "LHST", "ADT": "ADT", "EST": "EST", "HECU": "HECU", "JDT": "JDT", "GFT": "GFT", "AKDT": "AKDT", "PST": "PST", "MST": "MST", "UYT": "UYT", "HADT": "HADT", "WARST": "WARST", "ARST": "ARST", "ECT": "ECT", "PDT": "PDT", "CHADT": "CHADT", "TMST": "TMST", "HNNOMX": "HNNOMX", "SAST": "SAST", "GYT": "GYT", "BT": "BT", "HAST": "HAST", "HENOMX": "HENOMX", "COST": "COST", "HNPM": "HNPM"},
74 // Locale returns the current translators string locale
75 func (ig *ig_NG) Locale() string {
79 // PluralsCardinal returns the list of cardinal plural rules associated with 'ig_NG'
80 func (ig *ig_NG) PluralsCardinal() []locales.PluralRule {
81 return ig.pluralsCardinal
84 // PluralsOrdinal returns the list of ordinal plural rules associated with 'ig_NG'
85 func (ig *ig_NG) PluralsOrdinal() []locales.PluralRule {
86 return ig.pluralsOrdinal
89 // PluralsRange returns the list of range plural rules associated with 'ig_NG'
90 func (ig *ig_NG) PluralsRange() []locales.PluralRule {
91 return ig.pluralsRange
94 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'ig_NG'
95 func (ig *ig_NG) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
96 return locales.PluralRuleOther
99 // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'ig_NG'
100 func (ig *ig_NG) 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 'ig_NG'
105 func (ig *ig_NG) 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 (ig *ig_NG) MonthAbbreviated(month time.Month) string {
111 return ig.monthsAbbreviated[month]
114 // MonthsAbbreviated returns the locales abbreviated months
115 func (ig *ig_NG) MonthsAbbreviated() []string {
116 return ig.monthsAbbreviated[1:]
119 // MonthNarrow returns the locales narrow month given the 'month' provided
120 func (ig *ig_NG) MonthNarrow(month time.Month) string {
121 return ig.monthsNarrow[month]
124 // MonthsNarrow returns the locales narrow months
125 func (ig *ig_NG) MonthsNarrow() []string {
126 return ig.monthsNarrow[1:]
129 // MonthWide returns the locales wide month given the 'month' provided
130 func (ig *ig_NG) MonthWide(month time.Month) string {
131 return ig.monthsWide[month]
134 // MonthsWide returns the locales wide months
135 func (ig *ig_NG) MonthsWide() []string {
136 return ig.monthsWide[1:]
139 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
140 func (ig *ig_NG) WeekdayAbbreviated(weekday time.Weekday) string {
141 return ig.daysAbbreviated[weekday]
144 // WeekdaysAbbreviated returns the locales abbreviated weekdays
145 func (ig *ig_NG) WeekdaysAbbreviated() []string {
146 return ig.daysAbbreviated
149 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
150 func (ig *ig_NG) WeekdayNarrow(weekday time.Weekday) string {
151 return ig.daysNarrow[weekday]
154 // WeekdaysNarrow returns the locales narrow weekdays
155 func (ig *ig_NG) WeekdaysNarrow() []string {
159 // WeekdayShort returns the locales short weekday given the 'weekday' provided
160 func (ig *ig_NG) WeekdayShort(weekday time.Weekday) string {
161 return ig.daysShort[weekday]
164 // WeekdaysShort returns the locales short weekdays
165 func (ig *ig_NG) WeekdaysShort() []string {
169 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
170 func (ig *ig_NG) WeekdayWide(weekday time.Weekday) string {
171 return ig.daysWide[weekday]
174 // WeekdaysWide returns the locales wide weekdays
175 func (ig *ig_NG) WeekdaysWide() []string {
179 // Decimal returns the decimal point of number
180 func (ig *ig_NG) Decimal() string {
184 // Group returns the group of number
185 func (ig *ig_NG) Group() string {
189 // Group returns the minus sign of number
190 func (ig *ig_NG) Minus() string {
194 // FmtNumber returns 'num' with digits/precision of 'v' for 'ig_NG' and handles both Whole and Real numbers based on 'v'
195 func (ig *ig_NG) FmtNumber(num float64, v uint64) string {
197 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
198 l := len(s) + 2 + 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 for j := len(ig.decimal) - 1; j >= 0; j-- {
207 b = append(b, ig.decimal[j])
215 for j := len(ig.group) - 1; j >= 0; j-- {
216 b = append(b, ig.group[j])
228 b = append(b, ig.minus[0])
232 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
233 b[i], b[j] = b[j], b[i]
239 // FmtPercent returns 'num' with digits/precision of 'v' for 'ig_NG' and handles both Whole and Real numbers based on 'v'
240 // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
241 func (ig *ig_NG) FmtPercent(num float64, v uint64) string {
242 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
244 b := make([]byte, 0, l)
246 for i := len(s) - 1; i >= 0; i-- {
249 for j := len(ig.decimal) - 1; j >= 0; j-- {
250 b = append(b, ig.decimal[j])
259 b = append(b, ig.minus[0])
263 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
264 b[i], b[j] = b[j], b[i]
267 b = append(b, ig.percentSuffix...)
269 b = append(b, ig.percent...)
274 // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'ig_NG'
275 func (ig *ig_NG) FmtCurrency(num float64, v uint64, currency currency.Type) string {
277 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
278 symbol := ig.currencies[currency]
279 l := len(s) + len(symbol) + 2 + 2*len(s[:len(s)-int(v)-1])/3
282 b := make([]byte, 0, l)
284 for i := len(s) - 1; i >= 0; i-- {
287 for j := len(ig.decimal) - 1; j >= 0; j-- {
288 b = append(b, ig.decimal[j])
296 for j := len(ig.group) - 1; j >= 0; j-- {
297 b = append(b, ig.group[j])
308 for j := len(symbol) - 1; j >= 0; j-- {
309 b = append(b, symbol[j])
313 b = append(b, ig.minus[0])
317 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
318 b[i], b[j] = b[j], b[i]
324 b = append(b, ig.decimal...)
327 for i := 0; i < 2-int(v); i++ {
335 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ig_NG'
336 // in accounting notation.
337 func (ig *ig_NG) FmtAccounting(num float64, v uint64, currency currency.Type) string {
339 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
340 symbol := ig.currencies[currency]
341 l := len(s) + len(symbol) + 2 + 2*len(s[:len(s)-int(v)-1])/3
344 b := make([]byte, 0, l)
346 for i := len(s) - 1; i >= 0; i-- {
349 for j := len(ig.decimal) - 1; j >= 0; j-- {
350 b = append(b, ig.decimal[j])
358 for j := len(ig.group) - 1; j >= 0; j-- {
359 b = append(b, ig.group[j])
372 for j := len(symbol) - 1; j >= 0; j-- {
373 b = append(b, symbol[j])
376 b = append(b, ig.minus[0])
380 for j := len(symbol) - 1; j >= 0; j-- {
381 b = append(b, symbol[j])
387 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
388 b[i], b[j] = b[j], b[i]
394 b = append(b, ig.decimal...)
397 for i := 0; i < 2-int(v); i++ {
405 // FmtDateShort returns the short date representation of 't' for 'ig_NG'
406 func (ig *ig_NG) FmtDateShort(t time.Time) string {
408 b := make([]byte, 0, 32)
414 b = strconv.AppendInt(b, int64(t.Day()), 10)
415 b = append(b, []byte{0x2f}...)
421 b = strconv.AppendInt(b, int64(t.Month()), 10)
423 b = append(b, []byte{0x2f}...)
426 b = strconv.AppendInt(b, int64(t.Year()), 10)
428 b = strconv.AppendInt(b, int64(-t.Year()), 10)
434 // FmtDateMedium returns the medium date representation of 't' for 'ig_NG'
435 func (ig *ig_NG) FmtDateMedium(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, ig.monthsAbbreviated[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 // FmtDateLong returns the long date representation of 't' for 'ig_NG'
454 func (ig *ig_NG) FmtDateLong(t time.Time) string {
456 b := make([]byte, 0, 32)
458 b = strconv.AppendInt(b, int64(t.Day()), 10)
459 b = append(b, []byte{0x20}...)
460 b = append(b, ig.monthsWide[t.Month()]...)
461 b = append(b, []byte{0x20}...)
464 b = strconv.AppendInt(b, int64(t.Year()), 10)
466 b = strconv.AppendInt(b, int64(-t.Year()), 10)
472 // FmtDateFull returns the full date representation of 't' for 'ig_NG'
473 func (ig *ig_NG) FmtDateFull(t time.Time) string {
475 b := make([]byte, 0, 32)
477 b = append(b, ig.daysWide[t.Weekday()]...)
478 b = append(b, []byte{0x2c, 0x20}...)
479 b = strconv.AppendInt(b, int64(t.Day()), 10)
480 b = append(b, []byte{0x20}...)
481 b = append(b, ig.monthsWide[t.Month()]...)
482 b = append(b, []byte{0x20}...)
485 b = strconv.AppendInt(b, int64(t.Year()), 10)
487 b = strconv.AppendInt(b, int64(-t.Year()), 10)
493 // FmtTimeShort returns the short time representation of 't' for 'ig_NG'
494 func (ig *ig_NG) FmtTimeShort(t time.Time) string {
496 b := make([]byte, 0, 32)
502 b = strconv.AppendInt(b, int64(t.Hour()), 10)
503 b = append(b, ig.timeSeparator...)
509 b = strconv.AppendInt(b, int64(t.Minute()), 10)
514 // FmtTimeMedium returns the medium time representation of 't' for 'ig_NG'
515 func (ig *ig_NG) FmtTimeMedium(t time.Time) string {
517 b := make([]byte, 0, 32)
523 b = strconv.AppendInt(b, int64(t.Hour()), 10)
524 b = append(b, ig.timeSeparator...)
530 b = strconv.AppendInt(b, int64(t.Minute()), 10)
531 b = append(b, ig.timeSeparator...)
537 b = strconv.AppendInt(b, int64(t.Second()), 10)
542 // FmtTimeLong returns the long time representation of 't' for 'ig_NG'
543 func (ig *ig_NG) FmtTimeLong(t time.Time) string {
545 b := make([]byte, 0, 32)
551 b = strconv.AppendInt(b, int64(t.Hour()), 10)
552 b = append(b, ig.timeSeparator...)
558 b = strconv.AppendInt(b, int64(t.Minute()), 10)
559 b = append(b, ig.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 'ig_NG'
575 func (ig *ig_NG) FmtTimeFull(t time.Time) string {
577 b := make([]byte, 0, 32)
583 b = strconv.AppendInt(b, int64(t.Hour()), 10)
584 b = append(b, ig.timeSeparator...)
590 b = strconv.AppendInt(b, int64(t.Minute()), 10)
591 b = append(b, ig.timeSeparator...)
597 b = strconv.AppendInt(b, int64(t.Second()), 10)
598 b = append(b, []byte{0x20}...)
602 if btz, ok := ig.timezones[tz]; ok {
603 b = append(b, btz...)