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 'af_NA' locale
45 func New() locales.Translator {
48 pluralsCardinal: []locales.PluralRule{2, 6},
49 pluralsOrdinal: []locales.PluralRule{6},
50 pluralsRange: []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", "$", "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{"", "Jan.", "Feb.", "Mrt.", "Apr.", "Mei", "Jun.", "Jul.", "Aug.", "Sep.", "Okt.", "Nov.", "Des."},
62 monthsNarrow: []string{"", "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"},
63 monthsWide: []string{"", "Januarie", "Februarie", "Maart", "April", "Mei", "Junie", "Julie", "Augustus", "September", "Oktober", "November", "Desember"},
64 daysAbbreviated: []string{"So.", "Ma.", "Di.", "Wo.", "Do.", "Vr.", "Sa."},
65 daysNarrow: []string{"S", "M", "D", "W", "D", "V", "S"},
66 daysShort: []string{"So.", "Ma.", "Di.", "Wo.", "Do.", "Vr.", "Sa."},
67 daysWide: []string{"Sondag", "Maandag", "Dinsdag", "Woensdag", "Donderdag", "Vrydag", "Saterdag"},
68 periodsAbbreviated: []string{"vm.", "nm."},
69 periodsNarrow: []string{"v", "n"},
70 periodsWide: []string{"vm.", "nm."},
71 erasAbbreviated: []string{"v.C.", "n.C."},
72 erasNarrow: []string{"v.C.", "n.C."},
73 erasWide: []string{"voor Christus", "na Christus"},
74 timezones: map[string]string{"LHDT": "Lord Howe-dagligtyd", "∅∅∅": "Asore-somertyd", "CAT": "Sentraal-Afrika-tyd", "HNPM": "Sint-Pierre en Miquelon-standaardtyd", "WIT": "Oos-Indonesië-tyd", "WEZ": "Wes-Europese standaardtyd", "WAT": "Wes-Afrika-standaardtyd", "HNEG": "Oos-Groenland-standaardtyd", "HAT": "Newfoundland-dagligtyd", "AKST": "Alaska-standaardtyd", "ECT": "Ecuador-tyd", "HNCU": "Kuba-standaardtyd", "HECU": "Kuba-dagligtyd", "BOT": "Bolivia-tyd", "JDT": "Japan-dagligtyd", "COT": "Colombië-standaardtyd", "ACDT": "Australiese sentrale dagligtyd", "HEPMX": "Meksikaanse Pasifiese dagligtyd", "CHAST": "Chatham-standaardtyd", "TMST": "Turkmenistan-somertyd", "OESZ": "Oos-Europese somertyd", "CLST": "Chili-somertyd", "GFT": "Frans-Guiana-tyd", "WESZ": "Wes-Europese somertyd", "PST": "Pasifiese standaardtyd", "IST": "Indië-standaardtyd", "AEST": "Australiese Oostelike standaardtyd", "CLT": "Chili-standaardtyd", "PDT": "Pasifiese dagligtyd", "AWDT": "Australiese Westelike dagligtyd", "EAT": "Oos-Afrika-tyd", "SGT": "Singapoer-standaardtyd", "NZDT": "Nieu-Seeland-dagligtyd", "HNOG": "Wes-Groenland-standaardtyd", "SAST": "Suid-Afrika-standaardtyd", "HKST": "Hongkong-somertyd", "GMT": "Greenwich-mediaantyd", "UYT": "Uruguay-standaardtyd", "CDT": "Sentrale dagligtyd", "HAST": "Hawaii-Aleusiër-standaardtyd", "AEDT": "Australiese Oostelike dagligtyd", "HEOG": "Wes-Groenland-somertyd", "AKDT": "Alaska-dagligtyd", "ChST": "Chamorro-standaardtyd", "HEPM": "Sint-Pierre en Miquelon-dagligtyd", "AST": "Atlantiese standaardtyd", "GYT": "Guyana-tyd", "ACST": "Australiese sentraal-standaardtyd", "HNNOMX": "Noordwes-Meksiko-standaardtyd", "JST": "Japan-standaardtyd", "OEZ": "Oos-Europese standaardtyd", "MST": "Berg-standaardtyd", "VET": "Venezuela-tyd", "MDT": "Berg-dagligtyd", "EST": "Oostelike standaardtyd", "MESZ": "Sentraal-Europese somertyd", "WAST": "Wes-Afrika-somertyd", "HNPMX": "Meksikaanse Pasifiese standaardtyd", "AWST": "Australiese Westelike standaardtyd", "MEZ": "Sentraal-Europese standaardtyd", "BT": "Bhoetan-tyd", "ACWST": "Australiese sentraal-Westelike standaard-tyd", "ACWDT": "Australiese sentraal-Westelike dagligtyd", "WARST": "Wes-Argentinië-somertyd", "ADT": "Atlantiese dagligtyd", "ART": "Argentinië-standaardtyd", "ARST": "Argentinië-somertyd", "HNT": "Newfoundland-standaardtyd", "LHST": "Lord Howe-standaardtyd", "EDT": "Oostelike dagligtyd", "WIB": "Wes-Indonesië-tyd", "TMT": "Turkmenistan-standaardtyd", "NZST": "Nieu-Seeland-standaardtyd", "HENOMX": "Noordwes-Meksiko-dagligtyd", "WITA": "Sentraal Indonesië-tyd", "WART": "Wes-Argentinië-standaardtyd", "COST": "Colombië-somertyd", "SRT": "Suriname-tyd", "HKT": "Hongkong-standaardtyd", "HADT": "Hawaii-Aleusiër-dagligtyd", "HEEG": "Oos-Groenland-somertyd", "CHADT": "Chatham-dagligtyd", "CST": "Sentrale standaardtyd", "MYT": "Maleisië-tyd", "UYST": "Uruguay-somertyd"},
78 // Locale returns the current translators string locale
79 func (af *af_NA) Locale() string {
83 // PluralsCardinal returns the list of cardinal plural rules associated with 'af_NA'
84 func (af *af_NA) PluralsCardinal() []locales.PluralRule {
85 return af.pluralsCardinal
88 // PluralsOrdinal returns the list of ordinal plural rules associated with 'af_NA'
89 func (af *af_NA) PluralsOrdinal() []locales.PluralRule {
90 return af.pluralsOrdinal
93 // PluralsRange returns the list of range plural rules associated with 'af_NA'
94 func (af *af_NA) PluralsRange() []locales.PluralRule {
95 return af.pluralsRange
98 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'af_NA'
99 func (af *af_NA) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
104 return locales.PluralRuleOne
107 return locales.PluralRuleOther
110 // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'af_NA'
111 func (af *af_NA) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
112 return locales.PluralRuleOther
115 // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'af_NA'
116 func (af *af_NA) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
117 return locales.PluralRuleOther
120 // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
121 func (af *af_NA) MonthAbbreviated(month time.Month) string {
122 return af.monthsAbbreviated[month]
125 // MonthsAbbreviated returns the locales abbreviated months
126 func (af *af_NA) MonthsAbbreviated() []string {
127 return af.monthsAbbreviated[1:]
130 // MonthNarrow returns the locales narrow month given the 'month' provided
131 func (af *af_NA) MonthNarrow(month time.Month) string {
132 return af.monthsNarrow[month]
135 // MonthsNarrow returns the locales narrow months
136 func (af *af_NA) MonthsNarrow() []string {
137 return af.monthsNarrow[1:]
140 // MonthWide returns the locales wide month given the 'month' provided
141 func (af *af_NA) MonthWide(month time.Month) string {
142 return af.monthsWide[month]
145 // MonthsWide returns the locales wide months
146 func (af *af_NA) MonthsWide() []string {
147 return af.monthsWide[1:]
150 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
151 func (af *af_NA) WeekdayAbbreviated(weekday time.Weekday) string {
152 return af.daysAbbreviated[weekday]
155 // WeekdaysAbbreviated returns the locales abbreviated weekdays
156 func (af *af_NA) WeekdaysAbbreviated() []string {
157 return af.daysAbbreviated
160 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
161 func (af *af_NA) WeekdayNarrow(weekday time.Weekday) string {
162 return af.daysNarrow[weekday]
165 // WeekdaysNarrow returns the locales narrow weekdays
166 func (af *af_NA) WeekdaysNarrow() []string {
170 // WeekdayShort returns the locales short weekday given the 'weekday' provided
171 func (af *af_NA) WeekdayShort(weekday time.Weekday) string {
172 return af.daysShort[weekday]
175 // WeekdaysShort returns the locales short weekdays
176 func (af *af_NA) WeekdaysShort() []string {
180 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
181 func (af *af_NA) WeekdayWide(weekday time.Weekday) string {
182 return af.daysWide[weekday]
185 // WeekdaysWide returns the locales wide weekdays
186 func (af *af_NA) WeekdaysWide() []string {
190 // Decimal returns the decimal point of number
191 func (af *af_NA) Decimal() string {
195 // Group returns the group of number
196 func (af *af_NA) Group() string {
200 // Group returns the minus sign of number
201 func (af *af_NA) Minus() string {
205 // FmtNumber returns 'num' with digits/precision of 'v' for 'af_NA' and handles both Whole and Real numbers based on 'v'
206 func (af *af_NA) FmtNumber(num float64, v uint64) string {
208 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
209 l := len(s) + 2 + 2*len(s[:len(s)-int(v)-1])/3
212 b := make([]byte, 0, l)
214 for i := len(s) - 1; i >= 0; i-- {
217 b = append(b, af.decimal[0])
224 for j := len(af.group) - 1; j >= 0; j-- {
225 b = append(b, af.group[j])
237 b = append(b, af.minus[0])
241 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
242 b[i], b[j] = b[j], b[i]
248 // FmtPercent returns 'num' with digits/precision of 'v' for 'af_NA' and handles both Whole and Real numbers based on 'v'
249 // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
250 func (af *af_NA) FmtPercent(num float64, v uint64) string {
251 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
253 b := make([]byte, 0, l)
255 for i := len(s) - 1; i >= 0; i-- {
258 b = append(b, af.decimal[0])
266 b = append(b, af.minus[0])
270 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
271 b[i], b[j] = b[j], b[i]
274 b = append(b, af.percent...)
279 // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'af_NA'
280 func (af *af_NA) FmtCurrency(num float64, v uint64, currency currency.Type) string {
282 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
283 symbol := af.currencies[currency]
284 l := len(s) + len(symbol) + 2 + 2*len(s[:len(s)-int(v)-1])/3
287 b := make([]byte, 0, l)
289 for i := len(s) - 1; i >= 0; i-- {
292 b = append(b, af.decimal[0])
299 for j := len(af.group) - 1; j >= 0; j-- {
300 b = append(b, af.group[j])
311 for j := len(symbol) - 1; j >= 0; j-- {
312 b = append(b, symbol[j])
316 b = append(b, af.minus[0])
320 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
321 b[i], b[j] = b[j], b[i]
327 b = append(b, af.decimal...)
330 for i := 0; i < 2-int(v); i++ {
338 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'af_NA'
339 // in accounting notation.
340 func (af *af_NA) FmtAccounting(num float64, v uint64, currency currency.Type) string {
342 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
343 symbol := af.currencies[currency]
344 l := len(s) + len(symbol) + 4 + 2*len(s[:len(s)-int(v)-1])/3
347 b := make([]byte, 0, l)
349 for i := len(s) - 1; i >= 0; i-- {
352 b = append(b, af.decimal[0])
359 for j := len(af.group) - 1; j >= 0; j-- {
360 b = append(b, af.group[j])
373 for j := len(symbol) - 1; j >= 0; j-- {
374 b = append(b, symbol[j])
377 b = append(b, af.currencyNegativePrefix[0])
381 for j := len(symbol) - 1; j >= 0; j-- {
382 b = append(b, symbol[j])
388 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
389 b[i], b[j] = b[j], b[i]
395 b = append(b, af.decimal...)
398 for i := 0; i < 2-int(v); i++ {
404 b = append(b, af.currencyNegativeSuffix...)
410 // FmtDateShort returns the short date representation of 't' for 'af_NA'
411 func (af *af_NA) FmtDateShort(t time.Time) string {
413 b := make([]byte, 0, 32)
416 b = strconv.AppendInt(b, int64(t.Year()), 10)
418 b = strconv.AppendInt(b, int64(-t.Year()), 10)
421 b = append(b, []byte{0x2d}...)
427 b = strconv.AppendInt(b, int64(t.Month()), 10)
429 b = append(b, []byte{0x2d}...)
435 b = strconv.AppendInt(b, int64(t.Day()), 10)
440 // FmtDateMedium returns the medium date representation of 't' for 'af_NA'
441 func (af *af_NA) FmtDateMedium(t time.Time) string {
443 b := make([]byte, 0, 32)
445 b = strconv.AppendInt(b, int64(t.Day()), 10)
446 b = append(b, []byte{0x20}...)
447 b = append(b, af.monthsAbbreviated[t.Month()]...)
448 b = append(b, []byte{0x20}...)
451 b = strconv.AppendInt(b, int64(t.Year()), 10)
453 b = strconv.AppendInt(b, int64(-t.Year()), 10)
459 // FmtDateLong returns the long date representation of 't' for 'af_NA'
460 func (af *af_NA) FmtDateLong(t time.Time) string {
462 b := make([]byte, 0, 32)
464 b = strconv.AppendInt(b, int64(t.Day()), 10)
465 b = append(b, []byte{0x20}...)
466 b = append(b, af.monthsWide[t.Month()]...)
467 b = append(b, []byte{0x20}...)
470 b = strconv.AppendInt(b, int64(t.Year()), 10)
472 b = strconv.AppendInt(b, int64(-t.Year()), 10)
478 // FmtDateFull returns the full date representation of 't' for 'af_NA'
479 func (af *af_NA) FmtDateFull(t time.Time) string {
481 b := make([]byte, 0, 32)
483 b = append(b, af.daysWide[t.Weekday()]...)
484 b = append(b, []byte{0x20}...)
485 b = strconv.AppendInt(b, int64(t.Day()), 10)
486 b = append(b, []byte{0x20}...)
487 b = append(b, af.monthsWide[t.Month()]...)
488 b = append(b, []byte{0x20}...)
491 b = strconv.AppendInt(b, int64(t.Year()), 10)
493 b = strconv.AppendInt(b, int64(-t.Year()), 10)
499 // FmtTimeShort returns the short time representation of 't' for 'af_NA'
500 func (af *af_NA) FmtTimeShort(t time.Time) string {
502 b := make([]byte, 0, 32)
508 b = strconv.AppendInt(b, int64(t.Hour()), 10)
509 b = append(b, af.timeSeparator...)
515 b = strconv.AppendInt(b, int64(t.Minute()), 10)
520 // FmtTimeMedium returns the medium time representation of 't' for 'af_NA'
521 func (af *af_NA) FmtTimeMedium(t time.Time) string {
523 b := make([]byte, 0, 32)
529 b = strconv.AppendInt(b, int64(t.Hour()), 10)
530 b = append(b, af.timeSeparator...)
536 b = strconv.AppendInt(b, int64(t.Minute()), 10)
537 b = append(b, af.timeSeparator...)
543 b = strconv.AppendInt(b, int64(t.Second()), 10)
548 // FmtTimeLong returns the long time representation of 't' for 'af_NA'
549 func (af *af_NA) FmtTimeLong(t time.Time) string {
551 b := make([]byte, 0, 32)
557 b = strconv.AppendInt(b, int64(t.Hour()), 10)
558 b = append(b, af.timeSeparator...)
564 b = strconv.AppendInt(b, int64(t.Minute()), 10)
565 b = append(b, af.timeSeparator...)
571 b = strconv.AppendInt(b, int64(t.Second()), 10)
572 b = append(b, []byte{0x20}...)
580 // FmtTimeFull returns the full time representation of 't' for 'af_NA'
581 func (af *af_NA) FmtTimeFull(t time.Time) string {
583 b := make([]byte, 0, 32)
589 b = strconv.AppendInt(b, int64(t.Hour()), 10)
590 b = append(b, af.timeSeparator...)
596 b = strconv.AppendInt(b, int64(t.Minute()), 10)
597 b = append(b, af.timeSeparator...)
603 b = strconv.AppendInt(b, int64(t.Second()), 10)
604 b = append(b, []byte{0x20}...)
608 if btz, ok := af.timezones[tz]; ok {
609 b = append(b, btz...)