1 package kkj_CM
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 kkj_CM 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 currencyPositivePrefix string
26 currencyPositiveSuffix string
27 currencyNegativePrefix string
28 currencyNegativeSuffix string
29 monthsAbbreviated []string
30 monthsNarrow []string
31 monthsWide []string
32 daysAbbreviated []string
33 daysNarrow []string
34 daysShort []string
35 daysWide []string
36 periodsAbbreviated []string
37 periodsNarrow []string
38 periodsShort []string
39 periodsWide []string
40 erasAbbreviated []string
41 erasNarrow []string
42 erasWide []string
43 timezones map[string]string
44 }
45
46
47 func New() locales.Translator {
48 return &kkj_CM{
49 locale: "kkj_CM",
50 pluralsCardinal: []locales.PluralRule{2, 6},
51 pluralsOrdinal: nil,
52 pluralsRange: nil,
53 decimal: ",",
54 group: ".",
55 timeSeparator: ":",
56 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", "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", "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"},
57 currencyPositivePrefix: " ",
58 currencyPositiveSuffix: "K",
59 currencyNegativePrefix: " ",
60 currencyNegativeSuffix: "K",
61 monthsWide: []string{"", "pamba", "wanja", "mbiyɔ mɛndoŋgɔ", "Nyɔlɔmbɔŋgɔ", "Mɔnɔ ŋgbanja", "Nyaŋgwɛ ŋgbanja", "kuŋgwɛ", "fɛ", "njapi", "nyukul", "11", "ɓulɓusɛ"},
62 daysAbbreviated: []string{"sɔndi", "lundi", "mardi", "mɛrkɛrɛdi", "yedi", "vaŋdɛrɛdi", "mɔnɔ sɔndi"},
63 daysNarrow: []string{"so", "lu", "ma", "mɛ", "ye", "va", "ms"},
64 daysShort: []string{"sɔndi", "lundi", "mardi", "mɛrkɛrɛdi", "yedi", "vaŋdɛrɛdi", "mɔnɔ sɔndi"},
65 daysWide: []string{"sɔndi", "lundi", "mardi", "mɛrkɛrɛdi", "yedi", "vaŋdɛrɛdi", "mɔnɔ sɔndi"},
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 (kkj *kkj_CM) Locale() string {
72 return kkj.locale
73 }
74
75
76 func (kkj *kkj_CM) PluralsCardinal() []locales.PluralRule {
77 return kkj.pluralsCardinal
78 }
79
80
81 func (kkj *kkj_CM) PluralsOrdinal() []locales.PluralRule {
82 return kkj.pluralsOrdinal
83 }
84
85
86 func (kkj *kkj_CM) PluralsRange() []locales.PluralRule {
87 return kkj.pluralsRange
88 }
89
90
91 func (kkj *kkj_CM) 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 (kkj *kkj_CM) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
104 return locales.PluralRuleUnknown
105 }
106
107
108 func (kkj *kkj_CM) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
109 return locales.PluralRuleUnknown
110 }
111
112
113 func (kkj *kkj_CM) MonthAbbreviated(month time.Month) string {
114 return kkj.monthsAbbreviated[month]
115 }
116
117
118 func (kkj *kkj_CM) MonthsAbbreviated() []string {
119 return nil
120 }
121
122
123 func (kkj *kkj_CM) MonthNarrow(month time.Month) string {
124 return kkj.monthsNarrow[month]
125 }
126
127
128 func (kkj *kkj_CM) MonthsNarrow() []string {
129 return nil
130 }
131
132
133 func (kkj *kkj_CM) MonthWide(month time.Month) string {
134 return kkj.monthsWide[month]
135 }
136
137
138 func (kkj *kkj_CM) MonthsWide() []string {
139 return kkj.monthsWide[1:]
140 }
141
142
143 func (kkj *kkj_CM) WeekdayAbbreviated(weekday time.Weekday) string {
144 return kkj.daysAbbreviated[weekday]
145 }
146
147
148 func (kkj *kkj_CM) WeekdaysAbbreviated() []string {
149 return kkj.daysAbbreviated
150 }
151
152
153 func (kkj *kkj_CM) WeekdayNarrow(weekday time.Weekday) string {
154 return kkj.daysNarrow[weekday]
155 }
156
157
158 func (kkj *kkj_CM) WeekdaysNarrow() []string {
159 return kkj.daysNarrow
160 }
161
162
163 func (kkj *kkj_CM) WeekdayShort(weekday time.Weekday) string {
164 return kkj.daysShort[weekday]
165 }
166
167
168 func (kkj *kkj_CM) WeekdaysShort() []string {
169 return kkj.daysShort
170 }
171
172
173 func (kkj *kkj_CM) WeekdayWide(weekday time.Weekday) string {
174 return kkj.daysWide[weekday]
175 }
176
177
178 func (kkj *kkj_CM) WeekdaysWide() []string {
179 return kkj.daysWide
180 }
181
182
183 func (kkj *kkj_CM) Decimal() string {
184 return kkj.decimal
185 }
186
187
188 func (kkj *kkj_CM) Group() string {
189 return kkj.group
190 }
191
192
193 func (kkj *kkj_CM) Minus() string {
194 return kkj.minus
195 }
196
197
198 func (kkj *kkj_CM) FmtNumber(num float64, v uint64) string {
199
200 return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
201 }
202
203
204
205 func (kkj *kkj_CM) FmtPercent(num float64, v uint64) string {
206 return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
207 }
208
209
210 func (kkj *kkj_CM) FmtCurrency(num float64, v uint64, currency currency.Type) string {
211
212 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
213 symbol := kkj.currencies[currency]
214 l := len(s) + len(symbol) + 4
215
216 b := make([]byte, 0, l)
217
218 for i := len(s) - 1; i >= 0; i-- {
219
220 if s[i] == '.' {
221 b = append(b, kkj.decimal[0])
222 continue
223 }
224
225 b = append(b, s[i])
226 }
227
228 for j := len(symbol) - 1; j >= 0; j-- {
229 b = append(b, symbol[j])
230 }
231
232 for j := len(kkj.currencyPositivePrefix) - 1; j >= 0; j-- {
233 b = append(b, kkj.currencyPositivePrefix[j])
234 }
235
236 if num < 0 {
237 b = append(b, kkj.minus[0])
238 }
239
240
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]
243 }
244
245 b = append(b, kkj.currencyPositiveSuffix...)
246
247 return string(b)
248 }
249
250
251
252 func (kkj *kkj_CM) FmtAccounting(num float64, v uint64, currency currency.Type) string {
253
254 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
255 symbol := kkj.currencies[currency]
256 l := len(s) + len(symbol) + 4
257
258 b := make([]byte, 0, l)
259
260 for i := len(s) - 1; i >= 0; i-- {
261
262 if s[i] == '.' {
263 b = append(b, kkj.decimal[0])
264 continue
265 }
266
267 b = append(b, s[i])
268 }
269
270 if num < 0 {
271
272 for j := len(symbol) - 1; j >= 0; j-- {
273 b = append(b, symbol[j])
274 }
275
276 for j := len(kkj.currencyNegativePrefix) - 1; j >= 0; j-- {
277 b = append(b, kkj.currencyNegativePrefix[j])
278 }
279
280 b = append(b, kkj.minus[0])
281
282 } else {
283
284 for j := len(symbol) - 1; j >= 0; j-- {
285 b = append(b, symbol[j])
286 }
287
288 for j := len(kkj.currencyPositivePrefix) - 1; j >= 0; j-- {
289 b = append(b, kkj.currencyPositivePrefix[j])
290 }
291
292 }
293
294
295 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
296 b[i], b[j] = b[j], b[i]
297 }
298
299 if num < 0 {
300 b = append(b, kkj.currencyNegativeSuffix...)
301 } else {
302
303 b = append(b, kkj.currencyPositiveSuffix...)
304 }
305
306 return string(b)
307 }
308
309
310 func (kkj *kkj_CM) FmtDateShort(t time.Time) string {
311
312 b := make([]byte, 0, 32)
313
314 if t.Day() < 10 {
315 b = append(b, '0')
316 }
317
318 b = strconv.AppendInt(b, int64(t.Day()), 10)
319 b = append(b, []byte{0x2f}...)
320
321 if t.Month() < 10 {
322 b = append(b, '0')
323 }
324
325 b = strconv.AppendInt(b, int64(t.Month()), 10)
326
327 b = append(b, []byte{0x20}...)
328
329 if t.Year() > 0 {
330 b = strconv.AppendInt(b, int64(t.Year()), 10)
331 } else {
332 b = strconv.AppendInt(b, int64(-t.Year()), 10)
333 }
334
335 return string(b)
336 }
337
338
339 func (kkj *kkj_CM) FmtDateMedium(t time.Time) string {
340
341 b := make([]byte, 0, 32)
342
343 b = strconv.AppendInt(b, int64(t.Day()), 10)
344 b = append(b, []byte{0x20}...)
345 b = append(b, kkj.monthsAbbreviated[t.Month()]...)
346 b = append(b, []byte{0x20}...)
347
348 if t.Year() > 0 {
349 b = strconv.AppendInt(b, int64(t.Year()), 10)
350 } else {
351 b = strconv.AppendInt(b, int64(-t.Year()), 10)
352 }
353
354 return string(b)
355 }
356
357
358 func (kkj *kkj_CM) FmtDateLong(t time.Time) string {
359
360 b := make([]byte, 0, 32)
361
362 b = strconv.AppendInt(b, int64(t.Day()), 10)
363 b = append(b, []byte{0x20}...)
364 b = append(b, kkj.monthsWide[t.Month()]...)
365 b = append(b, []byte{0x20}...)
366
367 if t.Year() > 0 {
368 b = strconv.AppendInt(b, int64(t.Year()), 10)
369 } else {
370 b = strconv.AppendInt(b, int64(-t.Year()), 10)
371 }
372
373 return string(b)
374 }
375
376
377 func (kkj *kkj_CM) FmtDateFull(t time.Time) string {
378
379 b := make([]byte, 0, 32)
380
381 b = append(b, kkj.daysWide[t.Weekday()]...)
382 b = append(b, []byte{0x20}...)
383
384 if t.Day() < 10 {
385 b = append(b, '0')
386 }
387
388 b = strconv.AppendInt(b, int64(t.Day()), 10)
389 b = append(b, []byte{0x20}...)
390 b = append(b, kkj.monthsWide[t.Month()]...)
391 b = append(b, []byte{0x20}...)
392
393 if t.Year() > 0 {
394 b = strconv.AppendInt(b, int64(t.Year()), 10)
395 } else {
396 b = strconv.AppendInt(b, int64(-t.Year()), 10)
397 }
398
399 return string(b)
400 }
401
402
403 func (kkj *kkj_CM) FmtTimeShort(t time.Time) string {
404
405 b := make([]byte, 0, 32)
406
407 if t.Hour() < 10 {
408 b = append(b, '0')
409 }
410
411 b = strconv.AppendInt(b, int64(t.Hour()), 10)
412 b = append(b, kkj.timeSeparator...)
413
414 if t.Minute() < 10 {
415 b = append(b, '0')
416 }
417
418 b = strconv.AppendInt(b, int64(t.Minute()), 10)
419
420 return string(b)
421 }
422
423
424 func (kkj *kkj_CM) FmtTimeMedium(t time.Time) string {
425
426 b := make([]byte, 0, 32)
427
428 if t.Hour() < 10 {
429 b = append(b, '0')
430 }
431
432 b = strconv.AppendInt(b, int64(t.Hour()), 10)
433 b = append(b, kkj.timeSeparator...)
434
435 if t.Minute() < 10 {
436 b = append(b, '0')
437 }
438
439 b = strconv.AppendInt(b, int64(t.Minute()), 10)
440 b = append(b, kkj.timeSeparator...)
441
442 if t.Second() < 10 {
443 b = append(b, '0')
444 }
445
446 b = strconv.AppendInt(b, int64(t.Second()), 10)
447
448 return string(b)
449 }
450
451
452 func (kkj *kkj_CM) FmtTimeLong(t time.Time) string {
453
454 b := make([]byte, 0, 32)
455
456 return string(b)
457 }
458
459
460 func (kkj *kkj_CM) FmtTimeFull(t time.Time) string {
461
462 b := make([]byte, 0, 32)
463
464 return string(b)
465 }
466
View as plain text