1 package teo_KE
2
3 import (
4 "math"
5 "strconv"
6 "time"
7
8 "github.com/go-playground/locales"
9 "github.com/go-playground/locales/currency"
10 )
11
12 type teo_KE struct {
13 locale string
14 pluralsCardinal []locales.PluralRule
15 pluralsOrdinal []locales.PluralRule
16 pluralsRange []locales.PluralRule
17 decimal string
18 group string
19 minus string
20 percent string
21 perMille string
22 timeSeparator string
23 inifinity string
24 currencies []string
25 currencyNegativePrefix string
26 currencyNegativeSuffix string
27 monthsAbbreviated []string
28 monthsNarrow []string
29 monthsWide []string
30 daysAbbreviated []string
31 daysNarrow []string
32 daysShort []string
33 daysWide []string
34 periodsAbbreviated []string
35 periodsNarrow []string
36 periodsShort []string
37 periodsWide []string
38 erasAbbreviated []string
39 erasNarrow []string
40 erasWide []string
41 timezones map[string]string
42 }
43
44
45 func New() locales.Translator {
46 return &teo_KE{
47 locale: "teo_KE",
48 pluralsCardinal: []locales.PluralRule{2, 6},
49 pluralsOrdinal: nil,
50 pluralsRange: nil,
51 timeSeparator: ":",
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", "CNH", "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", "Ksh", "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", "MRU", "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", "STN", "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", "UYW", "UZS", "VEB", "VEF", "VES", "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{"", "Rar", "Muk", "Kwa", "Dun", "Mar", "Mod", "Jol", "Ped", "Sok", "Tib", "Lab", "Poo"},
56 monthsNarrow: []string{"", "R", "M", "K", "D", "M", "M", "J", "P", "S", "T", "L", "P"},
57 monthsWide: []string{"", "Orara", "Omuk", "Okwamg’", "Odung’el", "Omaruk", "Omodok’king’ol", "Ojola", "Opedel", "Osokosokoma", "Otibar", "Olabor", "Opoo"},
58 daysAbbreviated: []string{"Jum", "Bar", "Aar", "Uni", "Ung", "Kan", "Sab"},
59 daysNarrow: []string{"J", "B", "A", "U", "U", "K", "S"},
60 daysWide: []string{"Nakaejuma", "Nakaebarasa", "Nakaare", "Nakauni", "Nakaung’on", "Nakakany", "Nakasabiti"},
61 periodsAbbreviated: []string{"Taparachu", "Ebongi"},
62 periodsWide: []string{"Taparachu", "Ebongi"},
63 erasAbbreviated: []string{"KK", "BK"},
64 erasNarrow: []string{"", ""},
65 erasWide: []string{"Kabla ya Christo", "Baada ya Christo"},
66 timezones: map[string]string{"ACDT": "ACDT", "ACST": "ACST", "ACWDT": "ACWDT", "ACWST": "ACWST", "ADT": "ADT", "AEDT": "AEDT", "AEST": "AEST", "AKDT": "AKDT", "AKST": "AKST", "ARST": "ARST", "ART": "ART", "AST": "AST", "AWDT": "AWDT", "AWST": "AWST", "BOT": "BOT", "BT": "BT", "CAT": "CAT", "CDT": "CDT", "CHADT": "CHADT", "CHAST": "CHAST", "CLST": "CLST", "CLT": "CLT", "COST": "COST", "COT": "COT", "CST": "CST", "ChST": "ChST", "EAT": "EAT", "ECT": "ECT", "EDT": "EDT", "EST": "EST", "GFT": "GFT", "GMT": "GMT", "GST": "GST", "GYT": "GYT", "HADT": "HADT", "HAST": "HAST", "HAT": "HAT", "HECU": "HECU", "HEEG": "HEEG", "HENOMX": "HENOMX", "HEOG": "HEOG", "HEPM": "HEPM", "HEPMX": "HEPMX", "HKST": "HKST", "HKT": "HKT", "HNCU": "HNCU", "HNEG": "HNEG", "HNNOMX": "HNNOMX", "HNOG": "HNOG", "HNPM": "HNPM", "HNPMX": "HNPMX", "HNT": "HNT", "IST": "IST", "JDT": "JDT", "JST": "JST", "LHDT": "LHDT", "LHST": "LHST", "MDT": "MDT", "MESZ": "MESZ", "MEZ": "MEZ", "MST": "MST", "MYT": "MYT", "NZDT": "NZDT", "NZST": "NZST", "OESZ": "OESZ", "OEZ": "OEZ", "PDT": "PDT", "PST": "PST", "SAST": "SAST", "SGT": "SGT", "SRT": "SRT", "TMST": "TMST", "TMT": "TMT", "UYST": "UYST", "UYT": "UYT", "VET": "VET", "WARST": "WARST", "WART": "WART", "WAST": "WAST", "WAT": "WAT", "WESZ": "WESZ", "WEZ": "WEZ", "WIB": "WIB", "WIT": "WIT", "WITA": "WITA", "∅∅∅": "∅∅∅"},
67 }
68 }
69
70
71 func (teo *teo_KE) Locale() string {
72 return teo.locale
73 }
74
75
76 func (teo *teo_KE) PluralsCardinal() []locales.PluralRule {
77 return teo.pluralsCardinal
78 }
79
80
81 func (teo *teo_KE) PluralsOrdinal() []locales.PluralRule {
82 return teo.pluralsOrdinal
83 }
84
85
86 func (teo *teo_KE) PluralsRange() []locales.PluralRule {
87 return teo.pluralsRange
88 }
89
90
91 func (teo *teo_KE) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
92
93 n := math.Abs(num)
94
95 if n == 1 {
96 return locales.PluralRuleOne
97 }
98
99 return locales.PluralRuleOther
100 }
101
102
103 func (teo *teo_KE) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
104 return locales.PluralRuleUnknown
105 }
106
107
108 func (teo *teo_KE) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
109 return locales.PluralRuleUnknown
110 }
111
112
113 func (teo *teo_KE) MonthAbbreviated(month time.Month) string {
114 return teo.monthsAbbreviated[month]
115 }
116
117
118 func (teo *teo_KE) MonthsAbbreviated() []string {
119 return teo.monthsAbbreviated[1:]
120 }
121
122
123 func (teo *teo_KE) MonthNarrow(month time.Month) string {
124 return teo.monthsNarrow[month]
125 }
126
127
128 func (teo *teo_KE) MonthsNarrow() []string {
129 return teo.monthsNarrow[1:]
130 }
131
132
133 func (teo *teo_KE) MonthWide(month time.Month) string {
134 return teo.monthsWide[month]
135 }
136
137
138 func (teo *teo_KE) MonthsWide() []string {
139 return teo.monthsWide[1:]
140 }
141
142
143 func (teo *teo_KE) WeekdayAbbreviated(weekday time.Weekday) string {
144 return teo.daysAbbreviated[weekday]
145 }
146
147
148 func (teo *teo_KE) WeekdaysAbbreviated() []string {
149 return teo.daysAbbreviated
150 }
151
152
153 func (teo *teo_KE) WeekdayNarrow(weekday time.Weekday) string {
154 return teo.daysNarrow[weekday]
155 }
156
157
158 func (teo *teo_KE) WeekdaysNarrow() []string {
159 return teo.daysNarrow
160 }
161
162
163 func (teo *teo_KE) WeekdayShort(weekday time.Weekday) string {
164 return teo.daysShort[weekday]
165 }
166
167
168 func (teo *teo_KE) WeekdaysShort() []string {
169 return teo.daysShort
170 }
171
172
173 func (teo *teo_KE) WeekdayWide(weekday time.Weekday) string {
174 return teo.daysWide[weekday]
175 }
176
177
178 func (teo *teo_KE) WeekdaysWide() []string {
179 return teo.daysWide
180 }
181
182
183 func (teo *teo_KE) Decimal() string {
184 return teo.decimal
185 }
186
187
188 func (teo *teo_KE) Group() string {
189 return teo.group
190 }
191
192
193 func (teo *teo_KE) Minus() string {
194 return teo.minus
195 }
196
197
198 func (teo *teo_KE) FmtNumber(num float64, v uint64) string {
199
200 return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
201 }
202
203
204
205 func (teo *teo_KE) FmtPercent(num float64, v uint64) string {
206 return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
207 }
208
209
210 func (teo *teo_KE) FmtCurrency(num float64, v uint64, currency currency.Type) string {
211
212 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
213 symbol := teo.currencies[currency]
214 l := len(s) + len(symbol) + 0
215 count := 0
216 inWhole := v == 0
217 b := make([]byte, 0, l)
218
219 for i := len(s) - 1; i >= 0; i-- {
220
221 if s[i] == '.' {
222 b = append(b, teo.decimal[0])
223 inWhole = true
224 continue
225 }
226
227 if inWhole {
228 if count == 3 {
229 b = append(b, teo.group[0])
230 count = 1
231 } else {
232 count++
233 }
234 }
235
236 b = append(b, s[i])
237 }
238
239 for j := len(symbol) - 1; j >= 0; j-- {
240 b = append(b, symbol[j])
241 }
242
243 if num < 0 {
244 b = append(b, teo.minus[0])
245 }
246
247
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]
250 }
251
252 if int(v) < 2 {
253
254 if v == 0 {
255 b = append(b, teo.decimal...)
256 }
257
258 for i := 0; i < 2-int(v); i++ {
259 b = append(b, '0')
260 }
261 }
262
263 return string(b)
264 }
265
266
267
268 func (teo *teo_KE) FmtAccounting(num float64, v uint64, currency currency.Type) string {
269
270 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
271 symbol := teo.currencies[currency]
272 l := len(s) + len(symbol) + 2
273 count := 0
274 inWhole := v == 0
275 b := make([]byte, 0, l)
276
277 for i := len(s) - 1; i >= 0; i-- {
278
279 if s[i] == '.' {
280 b = append(b, teo.decimal[0])
281 inWhole = true
282 continue
283 }
284
285 if inWhole {
286 if count == 3 {
287 b = append(b, teo.group[0])
288 count = 1
289 } else {
290 count++
291 }
292 }
293
294 b = append(b, s[i])
295 }
296
297 if num < 0 {
298
299 for j := len(symbol) - 1; j >= 0; j-- {
300 b = append(b, symbol[j])
301 }
302
303 b = append(b, teo.currencyNegativePrefix[0])
304
305 } else {
306
307 for j := len(symbol) - 1; j >= 0; j-- {
308 b = append(b, symbol[j])
309 }
310
311 }
312
313
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]
316 }
317
318 if int(v) < 2 {
319
320 if v == 0 {
321 b = append(b, teo.decimal...)
322 }
323
324 for i := 0; i < 2-int(v); i++ {
325 b = append(b, '0')
326 }
327 }
328
329 if num < 0 {
330 b = append(b, teo.currencyNegativeSuffix...)
331 }
332
333 return string(b)
334 }
335
336
337 func (teo *teo_KE) FmtDateShort(t time.Time) string {
338
339 b := make([]byte, 0, 32)
340
341 if t.Day() < 10 {
342 b = append(b, '0')
343 }
344
345 b = strconv.AppendInt(b, int64(t.Day()), 10)
346 b = append(b, []byte{0x2f}...)
347
348 if t.Month() < 10 {
349 b = append(b, '0')
350 }
351
352 b = strconv.AppendInt(b, int64(t.Month()), 10)
353
354 b = append(b, []byte{0x2f}...)
355
356 if t.Year() > 0 {
357 b = strconv.AppendInt(b, int64(t.Year()), 10)
358 } else {
359 b = strconv.AppendInt(b, int64(-t.Year()), 10)
360 }
361
362 return string(b)
363 }
364
365
366 func (teo *teo_KE) FmtDateMedium(t time.Time) string {
367
368 b := make([]byte, 0, 32)
369
370 b = strconv.AppendInt(b, int64(t.Day()), 10)
371 b = append(b, []byte{0x20}...)
372 b = append(b, teo.monthsAbbreviated[t.Month()]...)
373 b = append(b, []byte{0x20}...)
374
375 if t.Year() > 0 {
376 b = strconv.AppendInt(b, int64(t.Year()), 10)
377 } else {
378 b = strconv.AppendInt(b, int64(-t.Year()), 10)
379 }
380
381 return string(b)
382 }
383
384
385 func (teo *teo_KE) FmtDateLong(t time.Time) string {
386
387 b := make([]byte, 0, 32)
388
389 b = strconv.AppendInt(b, int64(t.Day()), 10)
390 b = append(b, []byte{0x20}...)
391 b = append(b, teo.monthsWide[t.Month()]...)
392 b = append(b, []byte{0x20}...)
393
394 if t.Year() > 0 {
395 b = strconv.AppendInt(b, int64(t.Year()), 10)
396 } else {
397 b = strconv.AppendInt(b, int64(-t.Year()), 10)
398 }
399
400 return string(b)
401 }
402
403
404 func (teo *teo_KE) FmtDateFull(t time.Time) string {
405
406 b := make([]byte, 0, 32)
407
408 b = append(b, teo.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, teo.monthsWide[t.Month()]...)
413 b = append(b, []byte{0x20}...)
414
415 if t.Year() > 0 {
416 b = strconv.AppendInt(b, int64(t.Year()), 10)
417 } else {
418 b = strconv.AppendInt(b, int64(-t.Year()), 10)
419 }
420
421 return string(b)
422 }
423
424
425 func (teo *teo_KE) FmtTimeShort(t time.Time) string {
426
427 b := make([]byte, 0, 32)
428
429 if t.Hour() < 10 {
430 b = append(b, '0')
431 }
432
433 b = strconv.AppendInt(b, int64(t.Hour()), 10)
434 b = append(b, teo.timeSeparator...)
435
436 if t.Minute() < 10 {
437 b = append(b, '0')
438 }
439
440 b = strconv.AppendInt(b, int64(t.Minute()), 10)
441
442 return string(b)
443 }
444
445
446 func (teo *teo_KE) FmtTimeMedium(t time.Time) string {
447
448 b := make([]byte, 0, 32)
449
450 if t.Hour() < 10 {
451 b = append(b, '0')
452 }
453
454 b = strconv.AppendInt(b, int64(t.Hour()), 10)
455 b = append(b, teo.timeSeparator...)
456
457 if t.Minute() < 10 {
458 b = append(b, '0')
459 }
460
461 b = strconv.AppendInt(b, int64(t.Minute()), 10)
462 b = append(b, teo.timeSeparator...)
463
464 if t.Second() < 10 {
465 b = append(b, '0')
466 }
467
468 b = strconv.AppendInt(b, int64(t.Second()), 10)
469
470 return string(b)
471 }
472
473
474 func (teo *teo_KE) FmtTimeLong(t time.Time) string {
475
476 b := make([]byte, 0, 32)
477
478 if t.Hour() < 10 {
479 b = append(b, '0')
480 }
481
482 b = strconv.AppendInt(b, int64(t.Hour()), 10)
483 b = append(b, teo.timeSeparator...)
484
485 if t.Minute() < 10 {
486 b = append(b, '0')
487 }
488
489 b = strconv.AppendInt(b, int64(t.Minute()), 10)
490 b = append(b, teo.timeSeparator...)
491
492 if t.Second() < 10 {
493 b = append(b, '0')
494 }
495
496 b = strconv.AppendInt(b, int64(t.Second()), 10)
497 b = append(b, []byte{0x20}...)
498
499 tz, _ := t.Zone()
500 b = append(b, tz...)
501
502 return string(b)
503 }
504
505
506 func (teo *teo_KE) FmtTimeFull(t time.Time) string {
507
508 b := make([]byte, 0, 32)
509
510 if t.Hour() < 10 {
511 b = append(b, '0')
512 }
513
514 b = strconv.AppendInt(b, int64(t.Hour()), 10)
515 b = append(b, teo.timeSeparator...)
516
517 if t.Minute() < 10 {
518 b = append(b, '0')
519 }
520
521 b = strconv.AppendInt(b, int64(t.Minute()), 10)
522 b = append(b, teo.timeSeparator...)
523
524 if t.Second() < 10 {
525 b = append(b, '0')
526 }
527
528 b = strconv.AppendInt(b, int64(t.Second()), 10)
529 b = append(b, []byte{0x20}...)
530
531 tz, _ := t.Zone()
532
533 if btz, ok := teo.timezones[tz]; ok {
534 b = append(b, btz...)
535 } else {
536 b = append(b, tz...)
537 }
538
539 return string(b)
540 }
541
View as plain text