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 'ha_NE' locale
45 func New() locales.Translator {
48 pluralsCardinal: []locales.PluralRule{2, 6},
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 currencyPositivePrefix: " ",
56 currencyNegativePrefix: " ",
57 monthsAbbreviated: []string{"", "Jan", "Fab", "Mar", "Afi", "May", "Yun", "Yul", "Agu", "Sat", "Okt", "Nuw", "Dis"},
58 monthsNarrow: []string{"", "J", "F", "M", "A", "M", "Y", "Y", "A", "S", "O", "N", "D"},
59 monthsWide: []string{"", "Janairu", "Faburairu", "Maris", "Afirilu", "Mayu", "Yuni", "Yuli", "Agusta", "Satumba", "Oktoba", "Nuwamba", "Disamba"},
60 daysAbbreviated: []string{"Lah", "Lit", "Tal", "Lar", "Alh", "Jum", "Asa"},
61 daysNarrow: []string{"L", "L", "T", "L", "A", "J", "A"},
62 daysShort: []string{"Lh", "Li", "Ta", "Lr", "Al", "Ju", "As"},
63 daysWide: []string{"Lahadi", "Litinin", "Talata", "Laraba", "Alhamis", "Jummaʼa", "Asabar"},
64 periodsAbbreviated: []string{"AM", "PM"},
65 periodsNarrow: []string{"AM", "PM"},
66 periodsWide: []string{"AM", "PM"},
67 erasAbbreviated: []string{"KHAI", "BHAI"},
68 erasNarrow: []string{"", ""},
69 erasWide: []string{"Kafin haihuwar annab", "Bayan haihuwar annab"},
70 timezones: map[string]string{"LHST": "LHST", "HNOG": "HNOG", "HNT": "HNT", "COST": "COST", "EST": "EST", "HNPM": "HNPM", "WITA": "WITA", "UYT": "UYT", "MEZ": "MEZ", "WARST": "WARST", "AST": "AST", "HAT": "HAT", "GYT": "GYT", "WEZ": "WEZ", "ACWST": "ACWST", "JDT": "JDT", "ART": "ART", "SAST": "SAST", "HNEG": "HNEG", "NZDT": "NZDT", "MDT": "MDT", "ADT": "ADT", "AEDT": "AEDT", "COT": "COT", "WESZ": "WESZ", "CHADT": "CHADT", "HECU": "HECU", "HENOMX": "HENOMX", "HEOG": "HEOG", "ACDT": "ACDT", "HAST": "HAST", "EAT": "EAT", "WAT": "WAT", "WAST": "WAST", "HEEG": "HEEG", "HKST": "HKST", "PST": "PST", "CHAST": "CHAST", "LHDT": "LHDT", "CDT": "CDT", "CAT": "CAT", "ChST": "ChST", "AEST": "AEST", "GFT": "GFT", "ECT": "ECT", "HEPM": "HEPM", "ACWDT": "ACWDT", "JST": "JST", "HEPMX": "HEPMX", "SRT": "SRT", "TMST": "TMST", "HNNOMX": "HNNOMX", "AKST": "AKST", "WIB": "WIB", "TMT": "TMT", "OEZ": "OEZ", "PDT": "PDT", "MESZ": "MESZ", "CLST": "CLST", "GMT": "GMT", "AWST": "AWST", "VET": "VET", "∅∅∅": "∅∅∅", "CLT": "CLT", "AKDT": "AKDT", "AWDT": "AWDT", "WART": "WART", "HADT": "HADT", "ARST": "ARST", "SGT": "SGT", "UYST": "UYST", "WIT": "WIT", "NZST": "NZST", "OESZ": "OESZ", "HKT": "HKT", "ACST": "ACST", "HNCU": "HNCU", "BT": "BT", "MYT": "MYT", "BOT": "BOT", "IST": "IST", "EDT": "EDT", "HNPMX": "HNPMX", "CST": "CST", "MST": "MST"},
74 // Locale returns the current translators string locale
75 func (ha *ha_NE) Locale() string {
79 // PluralsCardinal returns the list of cardinal plural rules associated with 'ha_NE'
80 func (ha *ha_NE) PluralsCardinal() []locales.PluralRule {
81 return ha.pluralsCardinal
84 // PluralsOrdinal returns the list of ordinal plural rules associated with 'ha_NE'
85 func (ha *ha_NE) PluralsOrdinal() []locales.PluralRule {
86 return ha.pluralsOrdinal
89 // PluralsRange returns the list of range plural rules associated with 'ha_NE'
90 func (ha *ha_NE) PluralsRange() []locales.PluralRule {
91 return ha.pluralsRange
94 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'ha_NE'
95 func (ha *ha_NE) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
100 return locales.PluralRuleOne
103 return locales.PluralRuleOther
106 // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'ha_NE'
107 func (ha *ha_NE) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
108 return locales.PluralRuleUnknown
111 // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'ha_NE'
112 func (ha *ha_NE) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
113 return locales.PluralRuleUnknown
116 // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
117 func (ha *ha_NE) MonthAbbreviated(month time.Month) string {
118 return ha.monthsAbbreviated[month]
121 // MonthsAbbreviated returns the locales abbreviated months
122 func (ha *ha_NE) MonthsAbbreviated() []string {
123 return ha.monthsAbbreviated[1:]
126 // MonthNarrow returns the locales narrow month given the 'month' provided
127 func (ha *ha_NE) MonthNarrow(month time.Month) string {
128 return ha.monthsNarrow[month]
131 // MonthsNarrow returns the locales narrow months
132 func (ha *ha_NE) MonthsNarrow() []string {
133 return ha.monthsNarrow[1:]
136 // MonthWide returns the locales wide month given the 'month' provided
137 func (ha *ha_NE) MonthWide(month time.Month) string {
138 return ha.monthsWide[month]
141 // MonthsWide returns the locales wide months
142 func (ha *ha_NE) MonthsWide() []string {
143 return ha.monthsWide[1:]
146 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
147 func (ha *ha_NE) WeekdayAbbreviated(weekday time.Weekday) string {
148 return ha.daysAbbreviated[weekday]
151 // WeekdaysAbbreviated returns the locales abbreviated weekdays
152 func (ha *ha_NE) WeekdaysAbbreviated() []string {
153 return ha.daysAbbreviated
156 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
157 func (ha *ha_NE) WeekdayNarrow(weekday time.Weekday) string {
158 return ha.daysNarrow[weekday]
161 // WeekdaysNarrow returns the locales narrow weekdays
162 func (ha *ha_NE) WeekdaysNarrow() []string {
166 // WeekdayShort returns the locales short weekday given the 'weekday' provided
167 func (ha *ha_NE) WeekdayShort(weekday time.Weekday) string {
168 return ha.daysShort[weekday]
171 // WeekdaysShort returns the locales short weekdays
172 func (ha *ha_NE) WeekdaysShort() []string {
176 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
177 func (ha *ha_NE) WeekdayWide(weekday time.Weekday) string {
178 return ha.daysWide[weekday]
181 // WeekdaysWide returns the locales wide weekdays
182 func (ha *ha_NE) WeekdaysWide() []string {
186 // Decimal returns the decimal point of number
187 func (ha *ha_NE) Decimal() string {
191 // Group returns the group of number
192 func (ha *ha_NE) Group() string {
196 // Group returns the minus sign of number
197 func (ha *ha_NE) Minus() string {
201 // FmtNumber returns 'num' with digits/precision of 'v' for 'ha_NE' and handles both Whole and Real numbers based on 'v'
202 func (ha *ha_NE) FmtNumber(num float64, v uint64) string {
204 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
205 l := len(s) + 1 + 1*len(s[:len(s)-int(v)-1])/3
208 b := make([]byte, 0, l)
210 for i := len(s) - 1; i >= 0; i-- {
213 b = append(b, ha.decimal[0])
220 b = append(b, ha.group[0])
231 b = append(b, ha.minus[0])
235 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
236 b[i], b[j] = b[j], b[i]
242 // FmtPercent returns 'num' with digits/precision of 'v' for 'ha_NE' and handles both Whole and Real numbers based on 'v'
243 // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
244 func (ha *ha_NE) FmtPercent(num float64, v uint64) string {
245 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
247 b := make([]byte, 0, l)
249 for i := len(s) - 1; i >= 0; i-- {
252 b = append(b, ha.decimal[0])
260 b = append(b, ha.minus[0])
264 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
265 b[i], b[j] = b[j], b[i]
268 b = append(b, ha.percent...)
273 // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'ha_NE'
274 func (ha *ha_NE) FmtCurrency(num float64, v uint64, currency currency.Type) string {
276 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
277 symbol := ha.currencies[currency]
278 l := len(s) + len(symbol) + 3 + 1*len(s[:len(s)-int(v)-1])/3
281 b := make([]byte, 0, l)
283 for i := len(s) - 1; i >= 0; i-- {
286 b = append(b, ha.decimal[0])
293 b = append(b, ha.group[0])
303 for j := len(symbol) - 1; j >= 0; j-- {
304 b = append(b, symbol[j])
307 for j := len(ha.currencyPositivePrefix) - 1; j >= 0; j-- {
308 b = append(b, ha.currencyPositivePrefix[j])
312 b = append(b, ha.minus[0])
316 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
317 b[i], b[j] = b[j], b[i]
323 b = append(b, ha.decimal...)
326 for i := 0; i < 2-int(v); i++ {
334 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ha_NE'
335 // in accounting notation.
336 func (ha *ha_NE) FmtAccounting(num float64, v uint64, currency currency.Type) string {
338 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
339 symbol := ha.currencies[currency]
340 l := len(s) + len(symbol) + 3 + 1*len(s[:len(s)-int(v)-1])/3
343 b := make([]byte, 0, l)
345 for i := len(s) - 1; i >= 0; i-- {
348 b = append(b, ha.decimal[0])
355 b = append(b, ha.group[0])
367 for j := len(symbol) - 1; j >= 0; j-- {
368 b = append(b, symbol[j])
371 for j := len(ha.currencyNegativePrefix) - 1; j >= 0; j-- {
372 b = append(b, ha.currencyNegativePrefix[j])
375 b = append(b, ha.minus[0])
379 for j := len(symbol) - 1; j >= 0; j-- {
380 b = append(b, symbol[j])
383 for j := len(ha.currencyPositivePrefix) - 1; j >= 0; j-- {
384 b = append(b, ha.currencyPositivePrefix[j])
390 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
391 b[i], b[j] = b[j], b[i]
397 b = append(b, ha.decimal...)
400 for i := 0; i < 2-int(v); i++ {
408 // FmtDateShort returns the short date representation of 't' for 'ha_NE'
409 func (ha *ha_NE) FmtDateShort(t time.Time) string {
411 b := make([]byte, 0, 32)
413 b = strconv.AppendInt(b, int64(t.Day()), 10)
414 b = append(b, []byte{0x2f}...)
415 b = strconv.AppendInt(b, int64(t.Month()), 10)
416 b = append(b, []byte{0x2f}...)
419 b = append(b, strconv.Itoa(t.Year())[2:]...)
421 b = append(b, strconv.Itoa(t.Year())[1:]...)
427 // FmtDateMedium returns the medium date representation of 't' for 'ha_NE'
428 func (ha *ha_NE) FmtDateMedium(t time.Time) string {
430 b := make([]byte, 0, 32)
432 b = strconv.AppendInt(b, int64(t.Day()), 10)
433 b = append(b, []byte{0x20}...)
434 b = append(b, ha.monthsAbbreviated[t.Month()]...)
435 b = append(b, []byte{0x2c, 0x20}...)
438 b = strconv.AppendInt(b, int64(t.Year()), 10)
440 b = strconv.AppendInt(b, int64(-t.Year()), 10)
446 // FmtDateLong returns the long date representation of 't' for 'ha_NE'
447 func (ha *ha_NE) FmtDateLong(t time.Time) string {
449 b := make([]byte, 0, 32)
451 b = strconv.AppendInt(b, int64(t.Day()), 10)
452 b = append(b, []byte{0x20}...)
453 b = append(b, ha.monthsWide[t.Month()]...)
454 b = append(b, []byte{0x2c, 0x20}...)
457 b = strconv.AppendInt(b, int64(t.Year()), 10)
459 b = strconv.AppendInt(b, int64(-t.Year()), 10)
465 // FmtDateFull returns the full date representation of 't' for 'ha_NE'
466 func (ha *ha_NE) FmtDateFull(t time.Time) string {
468 b := make([]byte, 0, 32)
470 b = append(b, ha.daysWide[t.Weekday()]...)
471 b = append(b, []byte{0x2c, 0x20}...)
472 b = strconv.AppendInt(b, int64(t.Day()), 10)
473 b = append(b, []byte{0x20}...)
474 b = append(b, ha.monthsWide[t.Month()]...)
475 b = append(b, []byte{0x2c, 0x20}...)
478 b = strconv.AppendInt(b, int64(t.Year()), 10)
480 b = strconv.AppendInt(b, int64(-t.Year()), 10)
486 // FmtTimeShort returns the short time representation of 't' for 'ha_NE'
487 func (ha *ha_NE) FmtTimeShort(t time.Time) string {
489 b := make([]byte, 0, 32)
495 b = strconv.AppendInt(b, int64(t.Hour()), 10)
496 b = append(b, ha.timeSeparator...)
502 b = strconv.AppendInt(b, int64(t.Minute()), 10)
507 // FmtTimeMedium returns the medium time representation of 't' for 'ha_NE'
508 func (ha *ha_NE) FmtTimeMedium(t time.Time) string {
510 b := make([]byte, 0, 32)
516 b = strconv.AppendInt(b, int64(t.Hour()), 10)
517 b = append(b, ha.timeSeparator...)
523 b = strconv.AppendInt(b, int64(t.Minute()), 10)
524 b = append(b, ha.timeSeparator...)
530 b = strconv.AppendInt(b, int64(t.Second()), 10)
535 // FmtTimeLong returns the long time representation of 't' for 'ha_NE'
536 func (ha *ha_NE) FmtTimeLong(t time.Time) string {
538 b := make([]byte, 0, 32)
544 b = strconv.AppendInt(b, int64(t.Hour()), 10)
545 b = append(b, ha.timeSeparator...)
551 b = strconv.AppendInt(b, int64(t.Minute()), 10)
552 b = append(b, ha.timeSeparator...)
558 b = strconv.AppendInt(b, int64(t.Second()), 10)
559 b = append(b, []byte{0x20}...)
567 // FmtTimeFull returns the full time representation of 't' for 'ha_NE'
568 func (ha *ha_NE) FmtTimeFull(t time.Time) string {
570 b := make([]byte, 0, 32)
576 b = strconv.AppendInt(b, int64(t.Hour()), 10)
577 b = append(b, ha.timeSeparator...)
583 b = strconv.AppendInt(b, int64(t.Minute()), 10)
584 b = append(b, ha.timeSeparator...)
590 b = strconv.AppendInt(b, int64(t.Second()), 10)
591 b = append(b, []byte{0x20}...)
595 if btz, ok := ha.timezones[tz]; ok {
596 b = append(b, btz...)