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 'sn_ZW' locale
45 func New() locales.Translator {
48 pluralsCardinal: []locales.PluralRule{2, 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{"", "Ndi", "Kuk", "Kur", "Kub", "Chv", "Chk", "Chg", "Nya", "Gun", "Gum", "Mbu", "Zvi"},
62 monthsNarrow: []string{"", "N", "K", "K", "K", "C", "C", "C", "N", "G", "G", "M", "Z"},
63 monthsWide: []string{"", "Ndira", "Kukadzi", "Kurume", "Kubvumbi", "Chivabvu", "Chikumi", "Chikunguru", "Nyamavhuvhu", "Gunyana", "Gumiguru", "Mbudzi", "Zvita"},
64 daysAbbreviated: []string{"Svo", "Muv", "Chp", "Cht", "Chn", "Chs", "Mug"},
65 daysNarrow: []string{"S", "M", "C", "C", "C", "C", "M"},
66 daysShort: []string{"Sv", "Mu", "Cp", "Ct", "Cn", "Cs", "Mg"},
67 daysWide: []string{"Svondo", "Muvhuro", "Chipiri", "Chitatu", "China", "Chishanu", "Mugovera"},
68 periodsAbbreviated: []string{"AM", "PM"},
69 periodsNarrow: []string{"a", "p"},
70 periodsWide: []string{"AM", "PM"},
71 erasAbbreviated: []string{"BC", "AD"},
72 erasNarrow: []string{"", ""},
73 erasWide: []string{"Kristo asati auya", "mugore ramambo vedu"},
74 timezones: map[string]string{"HNPM": "HNPM", "WART": "WART", "WARST": "WARST", "JDT": "JDT", "OESZ": "OESZ", "HKST": "HKST", "ChST": "ChST", "HEPM": "HEPM", "SRT": "SRT", "∅∅∅": "∅∅∅", "HNOG": "HNOG", "COT": "COT", "CAT": "CAT", "WEZ": "WEZ", "HNCU": "HNCU", "MST": "MST", "UYST": "UYST", "NZST": "NZST", "MESZ": "MESZ", "ECT": "ECT", "AST": "AST", "UYT": "UYT", "ACWST": "ACWST", "HADT": "HADT", "HENOMX": "HENOMX", "HEOG": "HEOG", "WIT": "WIT", "AEST": "AEST", "CLST": "CLST", "PDT": "PDT", "HNNOMX": "HNNOMX", "LHST": "LHST", "IST": "IST", "PST": "PST", "EDT": "EDT", "CHADT": "CHADT", "CST": "CST", "MEZ": "MEZ", "WAST": "WAST", "CLT": "CLT", "COST": "COST", "AWST": "AWST", "VET": "VET", "EAT": "EAT", "HNT": "HNT", "WIB": "WIB", "TMT": "TMT", "HEEG": "HEEG", "AKDT": "AKDT", "WESZ": "WESZ", "HNPMX": "HNPMX", "HNEG": "HNEG", "HAT": "HAT", "ACDT": "ACDT", "MYT": "MYT", "WITA": "WITA", "HKT": "HKT", "SGT": "SGT", "AKST": "AKST", "AWDT": "AWDT", "MDT": "MDT", "TMST": "TMST", "ARST": "ARST", "ADT": "ADT", "EST": "EST", "BOT": "BOT", "CDT": "CDT", "ACWDT": "ACWDT", "NZDT": "NZDT", "HAST": "HAST", "GFT": "GFT", "HECU": "HECU", "LHDT": "LHDT", "WAT": "WAT", "SAST": "SAST", "HEPMX": "HEPMX", "GMT": "GMT", "OEZ": "OEZ", "AEDT": "AEDT", "ACST": "ACST", "CHAST": "CHAST", "BT": "BT", "JST": "JST", "ART": "ART", "GYT": "GYT"},
78 // Locale returns the current translators string locale
79 func (sn *sn_ZW) Locale() string {
83 // PluralsCardinal returns the list of cardinal plural rules associated with 'sn_ZW'
84 func (sn *sn_ZW) PluralsCardinal() []locales.PluralRule {
85 return sn.pluralsCardinal
88 // PluralsOrdinal returns the list of ordinal plural rules associated with 'sn_ZW'
89 func (sn *sn_ZW) PluralsOrdinal() []locales.PluralRule {
90 return sn.pluralsOrdinal
93 // PluralsRange returns the list of range plural rules associated with 'sn_ZW'
94 func (sn *sn_ZW) PluralsRange() []locales.PluralRule {
95 return sn.pluralsRange
98 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'sn_ZW'
99 func (sn *sn_ZW) 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 'sn_ZW'
111 func (sn *sn_ZW) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
112 return locales.PluralRuleUnknown
115 // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'sn_ZW'
116 func (sn *sn_ZW) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
117 return locales.PluralRuleUnknown
120 // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
121 func (sn *sn_ZW) MonthAbbreviated(month time.Month) string {
122 return sn.monthsAbbreviated[month]
125 // MonthsAbbreviated returns the locales abbreviated months
126 func (sn *sn_ZW) MonthsAbbreviated() []string {
127 return sn.monthsAbbreviated[1:]
130 // MonthNarrow returns the locales narrow month given the 'month' provided
131 func (sn *sn_ZW) MonthNarrow(month time.Month) string {
132 return sn.monthsNarrow[month]
135 // MonthsNarrow returns the locales narrow months
136 func (sn *sn_ZW) MonthsNarrow() []string {
137 return sn.monthsNarrow[1:]
140 // MonthWide returns the locales wide month given the 'month' provided
141 func (sn *sn_ZW) MonthWide(month time.Month) string {
142 return sn.monthsWide[month]
145 // MonthsWide returns the locales wide months
146 func (sn *sn_ZW) MonthsWide() []string {
147 return sn.monthsWide[1:]
150 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
151 func (sn *sn_ZW) WeekdayAbbreviated(weekday time.Weekday) string {
152 return sn.daysAbbreviated[weekday]
155 // WeekdaysAbbreviated returns the locales abbreviated weekdays
156 func (sn *sn_ZW) WeekdaysAbbreviated() []string {
157 return sn.daysAbbreviated
160 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
161 func (sn *sn_ZW) WeekdayNarrow(weekday time.Weekday) string {
162 return sn.daysNarrow[weekday]
165 // WeekdaysNarrow returns the locales narrow weekdays
166 func (sn *sn_ZW) WeekdaysNarrow() []string {
170 // WeekdayShort returns the locales short weekday given the 'weekday' provided
171 func (sn *sn_ZW) WeekdayShort(weekday time.Weekday) string {
172 return sn.daysShort[weekday]
175 // WeekdaysShort returns the locales short weekdays
176 func (sn *sn_ZW) WeekdaysShort() []string {
180 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
181 func (sn *sn_ZW) WeekdayWide(weekday time.Weekday) string {
182 return sn.daysWide[weekday]
185 // WeekdaysWide returns the locales wide weekdays
186 func (sn *sn_ZW) WeekdaysWide() []string {
190 // Decimal returns the decimal point of number
191 func (sn *sn_ZW) Decimal() string {
195 // Group returns the group of number
196 func (sn *sn_ZW) Group() string {
200 // Group returns the minus sign of number
201 func (sn *sn_ZW) Minus() string {
205 // FmtNumber returns 'num' with digits/precision of 'v' for 'sn_ZW' and handles both Whole and Real numbers based on 'v'
206 func (sn *sn_ZW) FmtNumber(num float64, v uint64) string {
208 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
209 l := len(s) + 2 + 1*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, sn.decimal[0])
224 b = append(b, sn.group[0])
235 b = append(b, sn.minus[0])
239 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
240 b[i], b[j] = b[j], b[i]
246 // FmtPercent returns 'num' with digits/precision of 'v' for 'sn_ZW' and handles both Whole and Real numbers based on 'v'
247 // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
248 func (sn *sn_ZW) FmtPercent(num float64, v uint64) string {
249 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
251 b := make([]byte, 0, l)
253 for i := len(s) - 1; i >= 0; i-- {
256 b = append(b, sn.decimal[0])
264 b = append(b, sn.minus[0])
268 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
269 b[i], b[j] = b[j], b[i]
272 b = append(b, sn.percent...)
277 // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'sn_ZW'
278 func (sn *sn_ZW) FmtCurrency(num float64, v uint64, currency currency.Type) string {
280 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
281 symbol := sn.currencies[currency]
282 l := len(s) + len(symbol) + 2 + 1*len(s[:len(s)-int(v)-1])/3
285 b := make([]byte, 0, l)
287 for i := len(s) - 1; i >= 0; i-- {
290 b = append(b, sn.decimal[0])
297 b = append(b, sn.group[0])
307 for j := len(symbol) - 1; j >= 0; j-- {
308 b = append(b, symbol[j])
312 b = append(b, sn.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, sn.decimal...)
326 for i := 0; i < 2-int(v); i++ {
334 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sn_ZW'
335 // in accounting notation.
336 func (sn *sn_ZW) FmtAccounting(num float64, v uint64, currency currency.Type) string {
338 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
339 symbol := sn.currencies[currency]
340 l := len(s) + len(symbol) + 4 + 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, sn.decimal[0])
355 b = append(b, sn.group[0])
367 for j := len(symbol) - 1; j >= 0; j-- {
368 b = append(b, symbol[j])
371 b = append(b, sn.currencyNegativePrefix[0])
375 for j := len(symbol) - 1; j >= 0; j-- {
376 b = append(b, symbol[j])
382 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
383 b[i], b[j] = b[j], b[i]
389 b = append(b, sn.decimal...)
392 for i := 0; i < 2-int(v); i++ {
398 b = append(b, sn.currencyNegativeSuffix...)
404 // FmtDateShort returns the short date representation of 't' for 'sn_ZW'
405 func (sn *sn_ZW) FmtDateShort(t time.Time) string {
407 b := make([]byte, 0, 32)
410 b = strconv.AppendInt(b, int64(t.Year()), 10)
412 b = strconv.AppendInt(b, int64(-t.Year()), 10)
415 b = append(b, []byte{0x2d}...)
421 b = strconv.AppendInt(b, int64(t.Month()), 10)
423 b = append(b, []byte{0x2d}...)
429 b = strconv.AppendInt(b, int64(t.Day()), 10)
434 // FmtDateMedium returns the medium date representation of 't' for 'sn_ZW'
435 func (sn *sn_ZW) FmtDateMedium(t time.Time) string {
437 b := make([]byte, 0, 32)
440 b = strconv.AppendInt(b, int64(t.Year()), 10)
442 b = strconv.AppendInt(b, int64(-t.Year()), 10)
445 b = append(b, []byte{0x20}...)
446 b = append(b, sn.monthsAbbreviated[t.Month()]...)
447 b = append(b, []byte{0x20}...)
448 b = strconv.AppendInt(b, int64(t.Day()), 10)
453 // FmtDateLong returns the long date representation of 't' for 'sn_ZW'
454 func (sn *sn_ZW) FmtDateLong(t time.Time) string {
456 b := make([]byte, 0, 32)
459 b = strconv.AppendInt(b, int64(t.Year()), 10)
461 b = strconv.AppendInt(b, int64(-t.Year()), 10)
464 b = append(b, []byte{0x20}...)
465 b = append(b, sn.monthsWide[t.Month()]...)
466 b = append(b, []byte{0x20}...)
467 b = strconv.AppendInt(b, int64(t.Day()), 10)
472 // FmtDateFull returns the full date representation of 't' for 'sn_ZW'
473 func (sn *sn_ZW) FmtDateFull(t time.Time) string {
475 b := make([]byte, 0, 32)
478 b = strconv.AppendInt(b, int64(t.Year()), 10)
480 b = strconv.AppendInt(b, int64(-t.Year()), 10)
483 b = append(b, []byte{0x20}...)
484 b = append(b, sn.monthsWide[t.Month()]...)
485 b = append(b, []byte{0x20}...)
486 b = strconv.AppendInt(b, int64(t.Day()), 10)
487 b = append(b, []byte{0x2c, 0x20}...)
488 b = append(b, sn.daysWide[t.Weekday()]...)
493 // FmtTimeShort returns the short time representation of 't' for 'sn_ZW'
494 func (sn *sn_ZW) FmtTimeShort(t time.Time) string {
496 b := make([]byte, 0, 32)
502 b = strconv.AppendInt(b, int64(t.Hour()), 10)
503 b = append(b, sn.timeSeparator...)
509 b = strconv.AppendInt(b, int64(t.Minute()), 10)
514 // FmtTimeMedium returns the medium time representation of 't' for 'sn_ZW'
515 func (sn *sn_ZW) FmtTimeMedium(t time.Time) string {
517 b := make([]byte, 0, 32)
523 b = strconv.AppendInt(b, int64(t.Hour()), 10)
524 b = append(b, sn.timeSeparator...)
530 b = strconv.AppendInt(b, int64(t.Minute()), 10)
531 b = append(b, sn.timeSeparator...)
537 b = strconv.AppendInt(b, int64(t.Second()), 10)
542 // FmtTimeLong returns the long time representation of 't' for 'sn_ZW'
543 func (sn *sn_ZW) FmtTimeLong(t time.Time) string {
545 b := make([]byte, 0, 32)
551 b = strconv.AppendInt(b, int64(t.Hour()), 10)
552 b = append(b, sn.timeSeparator...)
558 b = strconv.AppendInt(b, int64(t.Minute()), 10)
559 b = append(b, sn.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 'sn_ZW'
575 func (sn *sn_ZW) FmtTimeFull(t time.Time) string {
577 b := make([]byte, 0, 32)
583 b = strconv.AppendInt(b, int64(t.Hour()), 10)
584 b = append(b, sn.timeSeparator...)
590 b = strconv.AppendInt(b, int64(t.Minute()), 10)
591 b = append(b, sn.timeSeparator...)
597 b = strconv.AppendInt(b, int64(t.Second()), 10)
598 b = append(b, []byte{0x20}...)
602 if btz, ok := sn.timezones[tz]; ok {
603 b = append(b, btz...)