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 currencyNegativePrefix 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 'yo_BJ' locale
45 func New() locales.Translator {
48 pluralsCardinal: []locales.PluralRule{6},
58 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"},
59 currencyNegativePrefix: "(",
60 currencyNegativeSuffix: ")",
61 monthsAbbreviated: []string{"", "Shɛ́rɛ́", "Èrèlè", "Ɛrɛ̀nà", "Ìgbé", "Ɛ̀bibi", "Òkúdu", "Agɛmɔ", "Ògún", "Owewe", "Ɔ̀wàrà", "Bélú", "Ɔ̀pɛ̀"},
62 monthsNarrow: []string{"", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"},
63 monthsWide: []string{"", "Oshù Shɛ́rɛ́", "Oshù Èrèlè", "Oshù Ɛrɛ̀nà", "Oshù Ìgbé", "Oshù Ɛ̀bibi", "Oshù Òkúdu", "Oshù Agɛmɔ", "Oshù Ògún", "Oshù Owewe", "Oshù Ɔ̀wàrà", "Oshù Bélú", "Oshù Ɔ̀pɛ̀"},
64 daysAbbreviated: []string{"Àìkú", "Ajé", "Ìsɛ́gun", "Ɔjɔ́rú", "Ɔjɔ́bɔ", "Ɛtì", "Àbámɛ́ta"},
65 daysShort: []string{"Àìkú", "Ajé", "Ìsɛ́gun", "Ɔjɔ́rú", "Ɔjɔ́bɔ", "Ɛtì", "Àbámɛ́ta"},
66 daysWide: []string{"Ɔjɔ́ Àìkú", "Ɔjɔ́ Ajé", "Ɔjɔ́ Ìsɛ́gun", "Ɔjɔ́rú", "Ɔjɔ́bɔ", "Ɔjɔ́ Ɛtì", "Ɔjɔ́ Àbámɛ́ta"},
67 periodsAbbreviated: []string{"Àárɔ̀", "Ɔ̀sán"},
68 periodsNarrow: []string{"Àárɔ̀", "Ɔ̀sán"},
69 periodsWide: []string{"Àárɔ̀", "Ɔ̀sán"},
70 erasAbbreviated: []string{"", ""},
71 erasNarrow: []string{"", ""},
72 erasWide: []string{"Saju Kristi", "Lehin Kristi"},
73 timezones: map[string]string{"MESZ": "MESZ", "GFT": "GFT", "ACST": "ACST", "HNPM": "HNPM", "AWDT": "AWDT", "WEZ": "WEZ", "ACWDT": "ACWDT", "MEZ": "MEZ", "JST": "JST", "HENOMX": "HENOMX", "AEDT": "AEDT", "CHAST": "CHAST", "WART": "WART", "CLT": "CLT", "COST": "COST", "HEPMX": "HEPMX", "PDT": "PDT", "ART": "ART", "AKDT": "AKDT", "NZDT": "NZDT", "WITA": "WITA", "LHDT": "LHDT", "BT": "BT", "BOT": "BOT", "CHADT": "CHADT", "HNCU": "HNCU", "MYT": "MYT", "HAST": "HAST", "HADT": "HADT", "LHST": "LHST", "ECT": "ECT", "UYST": "UYST", "VET": "VET", "HKT": "HKT", "WESZ": "WESZ", "AKST": "AKST", "PST": "PST", "NZST": "NZST", "HNNOMX": "HNNOMX", "ARST": "ARST", "EAT": "EAT", "COT": "COT", "TMT": "TMT", "HNOG": "HNOG", "SGT": "SGT", "ChST": "ChST", "HEPM": "HEPM", "AWST": "AWST", "ACWST": "ACWST", "WIT": "WIT", "AEST": "AEST", "SAST": "SAST", "WIB": "WIB", "IST": "IST", "HEEG": "HEEG", "HAT": "HAT", "EDT": "EDT", "SRT": "SRT", "GYT": "GYT", "ACDT": "ACDT", "CST": "CST", "UYT": "UYT", "OESZ": "OESZ", "MDT": "MDT", "ADT": "ADT", "WAT": "WAT", "HNEG": "HNEG", "HNT": "HNT", "JDT": "JDT", "∅∅∅": "∅∅∅", "AST": "AST", "HEOG": "HEOG", "WAST": "WAST", "HNPMX": "HNPMX", "HECU": "HECU", "OEZ": "OEZ", "MST": "MST", "WARST": "WARST", "CAT": "CAT", "GMT": "GMT", "TMST": "TMST", "HKST": "HKST", "CLST": "CLST", "EST": "EST", "CDT": "CDT"},
77 // Locale returns the current translators string locale
78 func (yo *yo_BJ) Locale() string {
82 // PluralsCardinal returns the list of cardinal plural rules associated with 'yo_BJ'
83 func (yo *yo_BJ) PluralsCardinal() []locales.PluralRule {
84 return yo.pluralsCardinal
87 // PluralsOrdinal returns the list of ordinal plural rules associated with 'yo_BJ'
88 func (yo *yo_BJ) PluralsOrdinal() []locales.PluralRule {
89 return yo.pluralsOrdinal
92 // PluralsRange returns the list of range plural rules associated with 'yo_BJ'
93 func (yo *yo_BJ) PluralsRange() []locales.PluralRule {
94 return yo.pluralsRange
97 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'yo_BJ'
98 func (yo *yo_BJ) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
99 return locales.PluralRuleOther
102 // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'yo_BJ'
103 func (yo *yo_BJ) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
104 return locales.PluralRuleUnknown
107 // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'yo_BJ'
108 func (yo *yo_BJ) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
109 return locales.PluralRuleUnknown
112 // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
113 func (yo *yo_BJ) MonthAbbreviated(month time.Month) string {
114 return yo.monthsAbbreviated[month]
117 // MonthsAbbreviated returns the locales abbreviated months
118 func (yo *yo_BJ) MonthsAbbreviated() []string {
119 return yo.monthsAbbreviated[1:]
122 // MonthNarrow returns the locales narrow month given the 'month' provided
123 func (yo *yo_BJ) MonthNarrow(month time.Month) string {
124 return yo.monthsNarrow[month]
127 // MonthsNarrow returns the locales narrow months
128 func (yo *yo_BJ) MonthsNarrow() []string {
129 return yo.monthsNarrow[1:]
132 // MonthWide returns the locales wide month given the 'month' provided
133 func (yo *yo_BJ) MonthWide(month time.Month) string {
134 return yo.monthsWide[month]
137 // MonthsWide returns the locales wide months
138 func (yo *yo_BJ) MonthsWide() []string {
139 return yo.monthsWide[1:]
142 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
143 func (yo *yo_BJ) WeekdayAbbreviated(weekday time.Weekday) string {
144 return yo.daysAbbreviated[weekday]
147 // WeekdaysAbbreviated returns the locales abbreviated weekdays
148 func (yo *yo_BJ) WeekdaysAbbreviated() []string {
149 return yo.daysAbbreviated
152 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
153 func (yo *yo_BJ) WeekdayNarrow(weekday time.Weekday) string {
154 return yo.daysNarrow[weekday]
157 // WeekdaysNarrow returns the locales narrow weekdays
158 func (yo *yo_BJ) WeekdaysNarrow() []string {
162 // WeekdayShort returns the locales short weekday given the 'weekday' provided
163 func (yo *yo_BJ) WeekdayShort(weekday time.Weekday) string {
164 return yo.daysShort[weekday]
167 // WeekdaysShort returns the locales short weekdays
168 func (yo *yo_BJ) WeekdaysShort() []string {
172 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
173 func (yo *yo_BJ) WeekdayWide(weekday time.Weekday) string {
174 return yo.daysWide[weekday]
177 // WeekdaysWide returns the locales wide weekdays
178 func (yo *yo_BJ) WeekdaysWide() []string {
182 // Decimal returns the decimal point of number
183 func (yo *yo_BJ) Decimal() string {
187 // Group returns the group of number
188 func (yo *yo_BJ) Group() string {
192 // Group returns the minus sign of number
193 func (yo *yo_BJ) Minus() string {
197 // FmtNumber returns 'num' with digits/precision of 'v' for 'yo_BJ' and handles both Whole and Real numbers based on 'v'
198 func (yo *yo_BJ) FmtNumber(num float64, v uint64) string {
200 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
201 l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
204 b := make([]byte, 0, l)
206 for i := len(s) - 1; i >= 0; i-- {
209 b = append(b, yo.decimal[0])
216 b = append(b, yo.group[0])
227 b = append(b, yo.minus[0])
231 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
232 b[i], b[j] = b[j], b[i]
238 // FmtPercent returns 'num' with digits/precision of 'v' for 'yo_BJ' and handles both Whole and Real numbers based on 'v'
239 // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
240 func (yo *yo_BJ) FmtPercent(num float64, v uint64) string {
241 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
243 b := make([]byte, 0, l)
245 for i := len(s) - 1; i >= 0; i-- {
248 b = append(b, yo.decimal[0])
256 b = append(b, yo.minus[0])
260 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
261 b[i], b[j] = b[j], b[i]
264 b = append(b, yo.percent...)
269 // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'yo_BJ'
270 func (yo *yo_BJ) FmtCurrency(num float64, v uint64, currency currency.Type) string {
272 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
273 symbol := yo.currencies[currency]
274 l := len(s) + len(symbol) + 2 + 1*len(s[:len(s)-int(v)-1])/3
277 b := make([]byte, 0, l)
279 for i := len(s) - 1; i >= 0; i-- {
282 b = append(b, yo.decimal[0])
289 b = append(b, yo.group[0])
299 for j := len(symbol) - 1; j >= 0; j-- {
300 b = append(b, symbol[j])
304 b = append(b, yo.minus[0])
308 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
309 b[i], b[j] = b[j], b[i]
315 b = append(b, yo.decimal...)
318 for i := 0; i < 2-int(v); i++ {
326 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'yo_BJ'
327 // in accounting notation.
328 func (yo *yo_BJ) FmtAccounting(num float64, v uint64, currency currency.Type) string {
330 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
331 symbol := yo.currencies[currency]
332 l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
335 b := make([]byte, 0, l)
337 for i := len(s) - 1; i >= 0; i-- {
340 b = append(b, yo.decimal[0])
347 b = append(b, yo.group[0])
359 for j := len(symbol) - 1; j >= 0; j-- {
360 b = append(b, symbol[j])
363 b = append(b, yo.currencyNegativePrefix[0])
367 for j := len(symbol) - 1; j >= 0; j-- {
368 b = append(b, symbol[j])
374 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
375 b[i], b[j] = b[j], b[i]
381 b = append(b, yo.decimal...)
384 for i := 0; i < 2-int(v); i++ {
390 b = append(b, yo.currencyNegativeSuffix...)
396 // FmtDateShort returns the short date representation of 't' for 'yo_BJ'
397 func (yo *yo_BJ) FmtDateShort(t time.Time) string {
399 b := make([]byte, 0, 32)
405 b = strconv.AppendInt(b, int64(t.Day()), 10)
406 b = append(b, []byte{0x2f}...)
412 b = strconv.AppendInt(b, int64(t.Month()), 10)
414 b = append(b, []byte{0x2f}...)
417 b = strconv.AppendInt(b, int64(t.Year()), 10)
419 b = strconv.AppendInt(b, int64(-t.Year()), 10)
425 // FmtDateMedium returns the medium date representation of 't' for 'yo_BJ'
426 func (yo *yo_BJ) FmtDateMedium(t time.Time) string {
428 b := make([]byte, 0, 32)
430 b = strconv.AppendInt(b, int64(t.Day()), 10)
431 b = append(b, []byte{0x20}...)
432 b = append(b, yo.monthsAbbreviated[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 // FmtDateLong returns the long date representation of 't' for 'yo_BJ'
445 func (yo *yo_BJ) FmtDateLong(t time.Time) string {
447 b := make([]byte, 0, 32)
449 b = strconv.AppendInt(b, int64(t.Day()), 10)
450 b = append(b, []byte{0x20}...)
451 b = append(b, yo.monthsWide[t.Month()]...)
452 b = append(b, []byte{0x20}...)
455 b = strconv.AppendInt(b, int64(t.Year()), 10)
457 b = strconv.AppendInt(b, int64(-t.Year()), 10)
463 // FmtDateFull returns the full date representation of 't' for 'yo_BJ'
464 func (yo *yo_BJ) FmtDateFull(t time.Time) string {
466 b := make([]byte, 0, 32)
468 b = append(b, yo.daysWide[t.Weekday()]...)
469 b = append(b, []byte{0x2c, 0x20}...)
470 b = strconv.AppendInt(b, int64(t.Day()), 10)
471 b = append(b, []byte{0x20}...)
472 b = append(b, yo.monthsWide[t.Month()]...)
473 b = append(b, []byte{0x20}...)
476 b = strconv.AppendInt(b, int64(t.Year()), 10)
478 b = strconv.AppendInt(b, int64(-t.Year()), 10)
484 // FmtTimeShort returns the short time representation of 't' for 'yo_BJ'
485 func (yo *yo_BJ) FmtTimeShort(t time.Time) string {
487 b := make([]byte, 0, 32)
493 b = strconv.AppendInt(b, int64(t.Hour()), 10)
494 b = append(b, yo.timeSeparator...)
500 b = strconv.AppendInt(b, int64(t.Minute()), 10)
505 // FmtTimeMedium returns the medium time representation of 't' for 'yo_BJ'
506 func (yo *yo_BJ) FmtTimeMedium(t time.Time) string {
508 b := make([]byte, 0, 32)
514 b = strconv.AppendInt(b, int64(t.Hour()), 10)
515 b = append(b, yo.timeSeparator...)
521 b = strconv.AppendInt(b, int64(t.Minute()), 10)
522 b = append(b, yo.timeSeparator...)
528 b = strconv.AppendInt(b, int64(t.Second()), 10)
533 // FmtTimeLong returns the long time representation of 't' for 'yo_BJ'
534 func (yo *yo_BJ) FmtTimeLong(t time.Time) string {
536 b := make([]byte, 0, 32)
542 b = strconv.AppendInt(b, int64(t.Hour()), 10)
543 b = append(b, yo.timeSeparator...)
549 b = strconv.AppendInt(b, int64(t.Minute()), 10)
550 b = append(b, yo.timeSeparator...)
556 b = strconv.AppendInt(b, int64(t.Second()), 10)
557 b = append(b, []byte{0x20}...)
565 // FmtTimeFull returns the full time representation of 't' for 'yo_BJ'
566 func (yo *yo_BJ) FmtTimeFull(t time.Time) string {
568 b := make([]byte, 0, 32)
574 b = strconv.AppendInt(b, int64(t.Hour()), 10)
575 b = append(b, yo.timeSeparator...)
581 b = strconv.AppendInt(b, int64(t.Minute()), 10)
582 b = append(b, yo.timeSeparator...)
588 b = strconv.AppendInt(b, int64(t.Second()), 10)
589 b = append(b, []byte{0x20}...)
593 if btz, ok := yo.timezones[tz]; ok {
594 b = append(b, btz...)