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 'saq_KE' locale
45 func New() locales.Translator {
48 pluralsCardinal: []locales.PluralRule{2, 6},
52 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"},
53 currencyNegativePrefix: "(",
54 currencyNegativeSuffix: ")",
55 monthsAbbreviated: []string{"", "Obo", "Waa", "Oku", "Ong", "Ime", "Ile", "Sap", "Isi", "Saa", "Tom", "Tob", "Tow"},
56 monthsNarrow: []string{"", "O", "W", "O", "O", "I", "I", "S", "I", "S", "T", "T", "T"},
57 monthsWide: []string{"", "Lapa le obo", "Lapa le waare", "Lapa le okuni", "Lapa le ong’wan", "Lapa le imet", "Lapa le ile", "Lapa le sapa", "Lapa le isiet", "Lapa le saal", "Lapa le tomon", "Lapa le tomon obo", "Lapa le tomon waare"},
58 daysAbbreviated: []string{"Are", "Kun", "Ong", "Ine", "Ile", "Sap", "Kwe"},
59 daysNarrow: []string{"A", "K", "O", "I", "I", "S", "K"},
60 daysWide: []string{"Mderot ee are", "Mderot ee kuni", "Mderot ee ong’wan", "Mderot ee inet", "Mderot ee ile", "Mderot ee sapa", "Mderot ee kwe"},
61 periodsAbbreviated: []string{"Tesiran", "Teipa"},
62 periodsWide: []string{"Tesiran", "Teipa"},
63 erasAbbreviated: []string{"KK", "BK"},
64 erasNarrow: []string{"", ""},
65 erasWide: []string{"Kabla ya Christo", "Baada ya Christo"},
66 timezones: map[string]string{"JDT": "JDT", "OEZ": "OEZ", "AEST": "AEST", "WAT": "WAT", "EDT": "EDT", "AKDT": "AKDT", "ChST": "ChST", "NZST": "NZST", "CHAST": "CHAST", "WART": "WART", "WITA": "WITA", "WESZ": "WESZ", "UYT": "UYT", "AEDT": "AEDT", "HAT": "HAT", "SGT": "SGT", "HEPMX": "HEPMX", "HAST": "HAST", "MYT": "MYT", "NZDT": "NZDT", "WARST": "WARST", "PST": "PST", "HNCU": "HNCU", "SRT": "SRT", "AWDT": "AWDT", "EAT": "EAT", "WAST": "WAST", "AKST": "AKST", "MDT": "MDT", "CAT": "CAT", "WEZ": "WEZ", "VET": "VET", "AST": "AST", "GFT": "GFT", "HNPM": "HNPM", "IST": "IST", "CST": "CST", "BOT": "BOT", "ART": "ART", "HNEG": "HNEG", "HEEG": "HEEG", "ACST": "ACST", "GMT": "GMT", "CHADT": "CHADT", "CDT": "CDT", "JST": "JST", "HKST": "HKST", "WIB": "WIB", "HNPMX": "HNPMX", "UYST": "UYST", "HENOMX": "HENOMX", "LHDT": "LHDT", "HNT": "HNT", "MESZ": "MESZ", "ACWDT": "ACWDT", "TMST": "TMST", "HEOG": "HEOG", "ADT": "ADT", "GYT": "GYT", "HECU": "HECU", "BT": "BT", "WIT": "WIT", "MEZ": "MEZ", "LHST": "LHST", "HNOG": "HNOG", "SAST": "SAST", "PDT": "PDT", "∅∅∅": "∅∅∅", "OESZ": "OESZ", "COT": "COT", "COST": "COST", "CLT": "CLT", "HEPM": "HEPM", "AWST": "AWST", "TMT": "TMT", "HNNOMX": "HNNOMX", "HKT": "HKT", "EST": "EST", "MST": "MST", "HADT": "HADT", "ARST": "ARST", "CLST": "CLST", "ACDT": "ACDT", "ECT": "ECT", "ACWST": "ACWST"},
70 // Locale returns the current translators string locale
71 func (saq *saq_KE) Locale() string {
75 // PluralsCardinal returns the list of cardinal plural rules associated with 'saq_KE'
76 func (saq *saq_KE) PluralsCardinal() []locales.PluralRule {
77 return saq.pluralsCardinal
80 // PluralsOrdinal returns the list of ordinal plural rules associated with 'saq_KE'
81 func (saq *saq_KE) PluralsOrdinal() []locales.PluralRule {
82 return saq.pluralsOrdinal
85 // PluralsRange returns the list of range plural rules associated with 'saq_KE'
86 func (saq *saq_KE) PluralsRange() []locales.PluralRule {
87 return saq.pluralsRange
90 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'saq_KE'
91 func (saq *saq_KE) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
96 return locales.PluralRuleOne
99 return locales.PluralRuleOther
102 // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'saq_KE'
103 func (saq *saq_KE) 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 'saq_KE'
108 func (saq *saq_KE) 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 (saq *saq_KE) MonthAbbreviated(month time.Month) string {
114 return saq.monthsAbbreviated[month]
117 // MonthsAbbreviated returns the locales abbreviated months
118 func (saq *saq_KE) MonthsAbbreviated() []string {
119 return saq.monthsAbbreviated[1:]
122 // MonthNarrow returns the locales narrow month given the 'month' provided
123 func (saq *saq_KE) MonthNarrow(month time.Month) string {
124 return saq.monthsNarrow[month]
127 // MonthsNarrow returns the locales narrow months
128 func (saq *saq_KE) MonthsNarrow() []string {
129 return saq.monthsNarrow[1:]
132 // MonthWide returns the locales wide month given the 'month' provided
133 func (saq *saq_KE) MonthWide(month time.Month) string {
134 return saq.monthsWide[month]
137 // MonthsWide returns the locales wide months
138 func (saq *saq_KE) MonthsWide() []string {
139 return saq.monthsWide[1:]
142 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
143 func (saq *saq_KE) WeekdayAbbreviated(weekday time.Weekday) string {
144 return saq.daysAbbreviated[weekday]
147 // WeekdaysAbbreviated returns the locales abbreviated weekdays
148 func (saq *saq_KE) WeekdaysAbbreviated() []string {
149 return saq.daysAbbreviated
152 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
153 func (saq *saq_KE) WeekdayNarrow(weekday time.Weekday) string {
154 return saq.daysNarrow[weekday]
157 // WeekdaysNarrow returns the locales narrow weekdays
158 func (saq *saq_KE) WeekdaysNarrow() []string {
159 return saq.daysNarrow
162 // WeekdayShort returns the locales short weekday given the 'weekday' provided
163 func (saq *saq_KE) WeekdayShort(weekday time.Weekday) string {
164 return saq.daysShort[weekday]
167 // WeekdaysShort returns the locales short weekdays
168 func (saq *saq_KE) WeekdaysShort() []string {
172 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
173 func (saq *saq_KE) WeekdayWide(weekday time.Weekday) string {
174 return saq.daysWide[weekday]
177 // WeekdaysWide returns the locales wide weekdays
178 func (saq *saq_KE) WeekdaysWide() []string {
182 // Decimal returns the decimal point of number
183 func (saq *saq_KE) Decimal() string {
187 // Group returns the group of number
188 func (saq *saq_KE) Group() string {
192 // Group returns the minus sign of number
193 func (saq *saq_KE) Minus() string {
197 // FmtNumber returns 'num' with digits/precision of 'v' for 'saq_KE' and handles both Whole and Real numbers based on 'v'
198 func (saq *saq_KE) FmtNumber(num float64, v uint64) string {
200 return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
203 // FmtPercent returns 'num' with digits/precision of 'v' for 'saq_KE' and handles both Whole and Real numbers based on 'v'
204 // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
205 func (saq *saq_KE) FmtPercent(num float64, v uint64) string {
206 return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
209 // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'saq_KE'
210 func (saq *saq_KE) FmtCurrency(num float64, v uint64, currency currency.Type) string {
212 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
213 symbol := saq.currencies[currency]
214 l := len(s) + len(symbol) + 0
217 b := make([]byte, 0, l)
219 for i := len(s) - 1; i >= 0; i-- {
222 b = append(b, saq.decimal[0])
229 b = append(b, saq.group[0])
239 for j := len(symbol) - 1; j >= 0; j-- {
240 b = append(b, symbol[j])
244 b = append(b, saq.minus[0])
248 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
249 b[i], b[j] = b[j], b[i]
255 b = append(b, saq.decimal...)
258 for i := 0; i < 2-int(v); i++ {
266 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'saq_KE'
267 // in accounting notation.
268 func (saq *saq_KE) FmtAccounting(num float64, v uint64, currency currency.Type) string {
270 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
271 symbol := saq.currencies[currency]
272 l := len(s) + len(symbol) + 2
275 b := make([]byte, 0, l)
277 for i := len(s) - 1; i >= 0; i-- {
280 b = append(b, saq.decimal[0])
287 b = append(b, saq.group[0])
299 for j := len(symbol) - 1; j >= 0; j-- {
300 b = append(b, symbol[j])
303 b = append(b, saq.currencyNegativePrefix[0])
307 for j := len(symbol) - 1; j >= 0; j-- {
308 b = append(b, symbol[j])
314 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
315 b[i], b[j] = b[j], b[i]
321 b = append(b, saq.decimal...)
324 for i := 0; i < 2-int(v); i++ {
330 b = append(b, saq.currencyNegativeSuffix...)
336 // FmtDateShort returns the short date representation of 't' for 'saq_KE'
337 func (saq *saq_KE) FmtDateShort(t time.Time) string {
339 b := make([]byte, 0, 32)
345 b = strconv.AppendInt(b, int64(t.Day()), 10)
346 b = append(b, []byte{0x2f}...)
352 b = strconv.AppendInt(b, int64(t.Month()), 10)
354 b = append(b, []byte{0x2f}...)
357 b = strconv.AppendInt(b, int64(t.Year()), 10)
359 b = strconv.AppendInt(b, int64(-t.Year()), 10)
365 // FmtDateMedium returns the medium date representation of 't' for 'saq_KE'
366 func (saq *saq_KE) FmtDateMedium(t time.Time) string {
368 b := make([]byte, 0, 32)
370 b = strconv.AppendInt(b, int64(t.Day()), 10)
371 b = append(b, []byte{0x20}...)
372 b = append(b, saq.monthsAbbreviated[t.Month()]...)
373 b = append(b, []byte{0x20}...)
376 b = strconv.AppendInt(b, int64(t.Year()), 10)
378 b = strconv.AppendInt(b, int64(-t.Year()), 10)
384 // FmtDateLong returns the long date representation of 't' for 'saq_KE'
385 func (saq *saq_KE) FmtDateLong(t time.Time) string {
387 b := make([]byte, 0, 32)
389 b = strconv.AppendInt(b, int64(t.Day()), 10)
390 b = append(b, []byte{0x20}...)
391 b = append(b, saq.monthsWide[t.Month()]...)
392 b = append(b, []byte{0x20}...)
395 b = strconv.AppendInt(b, int64(t.Year()), 10)
397 b = strconv.AppendInt(b, int64(-t.Year()), 10)
403 // FmtDateFull returns the full date representation of 't' for 'saq_KE'
404 func (saq *saq_KE) FmtDateFull(t time.Time) string {
406 b := make([]byte, 0, 32)
408 b = append(b, saq.daysWide[t.Weekday()]...)
409 b = append(b, []byte{0x2c, 0x20}...)
410 b = strconv.AppendInt(b, int64(t.Day()), 10)
411 b = append(b, []byte{0x20}...)
412 b = append(b, saq.monthsWide[t.Month()]...)
413 b = append(b, []byte{0x20}...)
416 b = strconv.AppendInt(b, int64(t.Year()), 10)
418 b = strconv.AppendInt(b, int64(-t.Year()), 10)
424 // FmtTimeShort returns the short time representation of 't' for 'saq_KE'
425 func (saq *saq_KE) FmtTimeShort(t time.Time) string {
427 b := make([]byte, 0, 32)
433 b = strconv.AppendInt(b, int64(t.Hour()), 10)
434 b = append(b, saq.timeSeparator...)
440 b = strconv.AppendInt(b, int64(t.Minute()), 10)
445 // FmtTimeMedium returns the medium time representation of 't' for 'saq_KE'
446 func (saq *saq_KE) FmtTimeMedium(t time.Time) string {
448 b := make([]byte, 0, 32)
454 b = strconv.AppendInt(b, int64(t.Hour()), 10)
455 b = append(b, saq.timeSeparator...)
461 b = strconv.AppendInt(b, int64(t.Minute()), 10)
462 b = append(b, saq.timeSeparator...)
468 b = strconv.AppendInt(b, int64(t.Second()), 10)
473 // FmtTimeLong returns the long time representation of 't' for 'saq_KE'
474 func (saq *saq_KE) FmtTimeLong(t time.Time) string {
476 b := make([]byte, 0, 32)
482 b = strconv.AppendInt(b, int64(t.Hour()), 10)
483 b = append(b, saq.timeSeparator...)
489 b = strconv.AppendInt(b, int64(t.Minute()), 10)
490 b = append(b, saq.timeSeparator...)
496 b = strconv.AppendInt(b, int64(t.Second()), 10)
497 b = append(b, []byte{0x20}...)
505 // FmtTimeFull returns the full time representation of 't' for 'saq_KE'
506 func (saq *saq_KE) FmtTimeFull(t time.Time) string {
508 b := make([]byte, 0, 32)
514 b = strconv.AppendInt(b, int64(t.Hour()), 10)
515 b = append(b, saq.timeSeparator...)
521 b = strconv.AppendInt(b, int64(t.Minute()), 10)
522 b = append(b, saq.timeSeparator...)
528 b = strconv.AppendInt(b, int64(t.Second()), 10)
529 b = append(b, []byte{0x20}...)
533 if btz, ok := saq.timezones[tz]; ok {
534 b = append(b, btz...)