1 package rn_BI
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 rn_BI 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 percentSuffix string
22 perMille string
23 timeSeparator string
24 inifinity string
25 currencies []string
26 monthsAbbreviated []string
27 monthsNarrow []string
28 monthsWide []string
29 daysAbbreviated []string
30 daysNarrow []string
31 daysShort []string
32 daysWide []string
33 periodsAbbreviated []string
34 periodsNarrow []string
35 periodsShort []string
36 periodsWide []string
37 erasAbbreviated []string
38 erasNarrow []string
39 erasWide []string
40 timezones map[string]string
41 }
42
43
44 func New() locales.Translator {
45 return &rn_BI{
46 locale: "rn_BI",
47 pluralsCardinal: nil,
48 pluralsOrdinal: nil,
49 pluralsRange: nil,
50 decimal: ",",
51 group: ".",
52 timeSeparator: ":",
53 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"},
54 percentSuffix: " ",
55 monthsAbbreviated: []string{"", "Mut.", "Gas.", "Wer.", "Mat.", "Gic.", "Kam.", "Nya.", "Kan.", "Nze.", "Ukw.", "Ugu.", "Uku."},
56 monthsWide: []string{"", "Nzero", "Ruhuhuma", "Ntwarante", "Ndamukiza", "Rusama", "Ruheshi", "Mukakaro", "Nyandagaro", "Nyakanga", "Gitugutu", "Munyonyo", "Kigarama"},
57 daysAbbreviated: []string{"cu.", "mbe.", "kab.", "gtu.", "kan.", "gnu.", "gnd."},
58 daysWide: []string{"Ku w’indwi", "Ku wa mbere", "Ku wa kabiri", "Ku wa gatatu", "Ku wa kane", "Ku wa gatanu", "Ku wa gatandatu"},
59 periodsAbbreviated: []string{"Z.MU.", "Z.MW."},
60 periodsWide: []string{"Z.MU.", "Z.MW."},
61 erasAbbreviated: []string{"Mb.Y.", "Ny.Y"},
62 erasNarrow: []string{"", ""},
63 erasWide: []string{"Mbere ya Yezu", "Nyuma ya Yezu"},
64 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", "∅∅∅": "∅∅∅"},
65 }
66 }
67
68
69 func (rn *rn_BI) Locale() string {
70 return rn.locale
71 }
72
73
74 func (rn *rn_BI) PluralsCardinal() []locales.PluralRule {
75 return rn.pluralsCardinal
76 }
77
78
79 func (rn *rn_BI) PluralsOrdinal() []locales.PluralRule {
80 return rn.pluralsOrdinal
81 }
82
83
84 func (rn *rn_BI) PluralsRange() []locales.PluralRule {
85 return rn.pluralsRange
86 }
87
88
89 func (rn *rn_BI) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
90 return locales.PluralRuleUnknown
91 }
92
93
94 func (rn *rn_BI) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
95 return locales.PluralRuleUnknown
96 }
97
98
99 func (rn *rn_BI) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
100 return locales.PluralRuleUnknown
101 }
102
103
104 func (rn *rn_BI) MonthAbbreviated(month time.Month) string {
105 return rn.monthsAbbreviated[month]
106 }
107
108
109 func (rn *rn_BI) MonthsAbbreviated() []string {
110 return rn.monthsAbbreviated[1:]
111 }
112
113
114 func (rn *rn_BI) MonthNarrow(month time.Month) string {
115 return rn.monthsNarrow[month]
116 }
117
118
119 func (rn *rn_BI) MonthsNarrow() []string {
120 return nil
121 }
122
123
124 func (rn *rn_BI) MonthWide(month time.Month) string {
125 return rn.monthsWide[month]
126 }
127
128
129 func (rn *rn_BI) MonthsWide() []string {
130 return rn.monthsWide[1:]
131 }
132
133
134 func (rn *rn_BI) WeekdayAbbreviated(weekday time.Weekday) string {
135 return rn.daysAbbreviated[weekday]
136 }
137
138
139 func (rn *rn_BI) WeekdaysAbbreviated() []string {
140 return rn.daysAbbreviated
141 }
142
143
144 func (rn *rn_BI) WeekdayNarrow(weekday time.Weekday) string {
145 return rn.daysNarrow[weekday]
146 }
147
148
149 func (rn *rn_BI) WeekdaysNarrow() []string {
150 return rn.daysNarrow
151 }
152
153
154 func (rn *rn_BI) WeekdayShort(weekday time.Weekday) string {
155 return rn.daysShort[weekday]
156 }
157
158
159 func (rn *rn_BI) WeekdaysShort() []string {
160 return rn.daysShort
161 }
162
163
164 func (rn *rn_BI) WeekdayWide(weekday time.Weekday) string {
165 return rn.daysWide[weekday]
166 }
167
168
169 func (rn *rn_BI) WeekdaysWide() []string {
170 return rn.daysWide
171 }
172
173
174 func (rn *rn_BI) Decimal() string {
175 return rn.decimal
176 }
177
178
179 func (rn *rn_BI) Group() string {
180 return rn.group
181 }
182
183
184 func (rn *rn_BI) Minus() string {
185 return rn.minus
186 }
187
188
189 func (rn *rn_BI) FmtNumber(num float64, v uint64) string {
190
191 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
192 l := len(s) + 1 + 1*len(s[:len(s)-int(v)-1])/3
193 count := 0
194 inWhole := v == 0
195 b := make([]byte, 0, l)
196
197 for i := len(s) - 1; i >= 0; i-- {
198
199 if s[i] == '.' {
200 b = append(b, rn.decimal[0])
201 inWhole = true
202 continue
203 }
204
205 if inWhole {
206 if count == 3 {
207 b = append(b, rn.group[0])
208 count = 1
209 } else {
210 count++
211 }
212 }
213
214 b = append(b, s[i])
215 }
216
217 if num < 0 {
218 b = append(b, rn.minus[0])
219 }
220
221
222 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
223 b[i], b[j] = b[j], b[i]
224 }
225
226 return string(b)
227 }
228
229
230
231 func (rn *rn_BI) FmtPercent(num float64, v uint64) string {
232 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
233 l := len(s) + 3
234 b := make([]byte, 0, l)
235
236 for i := len(s) - 1; i >= 0; i-- {
237
238 if s[i] == '.' {
239 b = append(b, rn.decimal[0])
240 continue
241 }
242
243 b = append(b, s[i])
244 }
245
246 if num < 0 {
247 b = append(b, rn.minus[0])
248 }
249
250
251 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
252 b[i], b[j] = b[j], b[i]
253 }
254
255 b = append(b, rn.percentSuffix...)
256
257 b = append(b, rn.percent...)
258
259 return string(b)
260 }
261
262
263 func (rn *rn_BI) FmtCurrency(num float64, v uint64, currency currency.Type) string {
264
265 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
266 symbol := rn.currencies[currency]
267 l := len(s) + len(symbol) + 1 + 1*len(s[:len(s)-int(v)-1])/3
268 count := 0
269 inWhole := v == 0
270 b := make([]byte, 0, l)
271
272 for i := len(s) - 1; i >= 0; i-- {
273
274 if s[i] == '.' {
275 b = append(b, rn.decimal[0])
276 inWhole = true
277 continue
278 }
279
280 if inWhole {
281 if count == 3 {
282 b = append(b, rn.group[0])
283 count = 1
284 } else {
285 count++
286 }
287 }
288
289 b = append(b, s[i])
290 }
291
292 if num < 0 {
293 b = append(b, rn.minus[0])
294 }
295
296
297 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
298 b[i], b[j] = b[j], b[i]
299 }
300
301 if int(v) < 2 {
302
303 if v == 0 {
304 b = append(b, rn.decimal...)
305 }
306
307 for i := 0; i < 2-int(v); i++ {
308 b = append(b, '0')
309 }
310 }
311
312 b = append(b, symbol...)
313
314 return string(b)
315 }
316
317
318
319 func (rn *rn_BI) FmtAccounting(num float64, v uint64, currency currency.Type) string {
320
321 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
322 symbol := rn.currencies[currency]
323 l := len(s) + len(symbol) + 1 + 1*len(s[:len(s)-int(v)-1])/3
324 count := 0
325 inWhole := v == 0
326 b := make([]byte, 0, l)
327
328 for i := len(s) - 1; i >= 0; i-- {
329
330 if s[i] == '.' {
331 b = append(b, rn.decimal[0])
332 inWhole = true
333 continue
334 }
335
336 if inWhole {
337 if count == 3 {
338 b = append(b, rn.group[0])
339 count = 1
340 } else {
341 count++
342 }
343 }
344
345 b = append(b, s[i])
346 }
347
348 if num < 0 {
349
350 b = append(b, rn.minus[0])
351
352 }
353
354
355 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
356 b[i], b[j] = b[j], b[i]
357 }
358
359 if int(v) < 2 {
360
361 if v == 0 {
362 b = append(b, rn.decimal...)
363 }
364
365 for i := 0; i < 2-int(v); i++ {
366 b = append(b, '0')
367 }
368 }
369
370 if num < 0 {
371 b = append(b, symbol...)
372 } else {
373
374 b = append(b, symbol...)
375 }
376
377 return string(b)
378 }
379
380
381 func (rn *rn_BI) FmtDateShort(t time.Time) string {
382
383 b := make([]byte, 0, 32)
384
385 b = strconv.AppendInt(b, int64(t.Day()), 10)
386 b = append(b, []byte{0x2f}...)
387 b = strconv.AppendInt(b, int64(t.Month()), 10)
388 b = append(b, []byte{0x2f}...)
389
390 if t.Year() > 0 {
391 b = strconv.AppendInt(b, int64(t.Year()), 10)
392 } else {
393 b = strconv.AppendInt(b, int64(-t.Year()), 10)
394 }
395
396 return string(b)
397 }
398
399
400 func (rn *rn_BI) FmtDateMedium(t time.Time) string {
401
402 b := make([]byte, 0, 32)
403
404 b = strconv.AppendInt(b, int64(t.Day()), 10)
405 b = append(b, []byte{0x20}...)
406 b = append(b, rn.monthsAbbreviated[t.Month()]...)
407 b = append(b, []byte{0x20}...)
408
409 if t.Year() > 0 {
410 b = strconv.AppendInt(b, int64(t.Year()), 10)
411 } else {
412 b = strconv.AppendInt(b, int64(-t.Year()), 10)
413 }
414
415 return string(b)
416 }
417
418
419 func (rn *rn_BI) FmtDateLong(t time.Time) string {
420
421 b := make([]byte, 0, 32)
422
423 b = strconv.AppendInt(b, int64(t.Day()), 10)
424 b = append(b, []byte{0x20}...)
425 b = append(b, rn.monthsWide[t.Month()]...)
426 b = append(b, []byte{0x20}...)
427
428 if t.Year() > 0 {
429 b = strconv.AppendInt(b, int64(t.Year()), 10)
430 } else {
431 b = strconv.AppendInt(b, int64(-t.Year()), 10)
432 }
433
434 return string(b)
435 }
436
437
438 func (rn *rn_BI) FmtDateFull(t time.Time) string {
439
440 b := make([]byte, 0, 32)
441
442 b = append(b, rn.daysWide[t.Weekday()]...)
443 b = append(b, []byte{0x20}...)
444 b = strconv.AppendInt(b, int64(t.Day()), 10)
445 b = append(b, []byte{0x20}...)
446 b = append(b, rn.monthsWide[t.Month()]...)
447 b = append(b, []byte{0x20}...)
448
449 if t.Year() > 0 {
450 b = strconv.AppendInt(b, int64(t.Year()), 10)
451 } else {
452 b = strconv.AppendInt(b, int64(-t.Year()), 10)
453 }
454
455 return string(b)
456 }
457
458
459 func (rn *rn_BI) FmtTimeShort(t time.Time) string {
460
461 b := make([]byte, 0, 32)
462
463 if t.Hour() < 10 {
464 b = append(b, '0')
465 }
466
467 b = strconv.AppendInt(b, int64(t.Hour()), 10)
468 b = append(b, rn.timeSeparator...)
469
470 if t.Minute() < 10 {
471 b = append(b, '0')
472 }
473
474 b = strconv.AppendInt(b, int64(t.Minute()), 10)
475
476 return string(b)
477 }
478
479
480 func (rn *rn_BI) FmtTimeMedium(t time.Time) string {
481
482 b := make([]byte, 0, 32)
483
484 if t.Hour() < 10 {
485 b = append(b, '0')
486 }
487
488 b = strconv.AppendInt(b, int64(t.Hour()), 10)
489 b = append(b, rn.timeSeparator...)
490
491 if t.Minute() < 10 {
492 b = append(b, '0')
493 }
494
495 b = strconv.AppendInt(b, int64(t.Minute()), 10)
496 b = append(b, rn.timeSeparator...)
497
498 if t.Second() < 10 {
499 b = append(b, '0')
500 }
501
502 b = strconv.AppendInt(b, int64(t.Second()), 10)
503
504 return string(b)
505 }
506
507
508 func (rn *rn_BI) FmtTimeLong(t time.Time) string {
509
510 b := make([]byte, 0, 32)
511
512 if t.Hour() < 10 {
513 b = append(b, '0')
514 }
515
516 b = strconv.AppendInt(b, int64(t.Hour()), 10)
517 b = append(b, rn.timeSeparator...)
518
519 if t.Minute() < 10 {
520 b = append(b, '0')
521 }
522
523 b = strconv.AppendInt(b, int64(t.Minute()), 10)
524 b = append(b, rn.timeSeparator...)
525
526 if t.Second() < 10 {
527 b = append(b, '0')
528 }
529
530 b = strconv.AppendInt(b, int64(t.Second()), 10)
531 b = append(b, []byte{0x20}...)
532
533 tz, _ := t.Zone()
534 b = append(b, tz...)
535
536 return string(b)
537 }
538
539
540 func (rn *rn_BI) FmtTimeFull(t time.Time) string {
541
542 b := make([]byte, 0, 32)
543
544 if t.Hour() < 10 {
545 b = append(b, '0')
546 }
547
548 b = strconv.AppendInt(b, int64(t.Hour()), 10)
549 b = append(b, rn.timeSeparator...)
550
551 if t.Minute() < 10 {
552 b = append(b, '0')
553 }
554
555 b = strconv.AppendInt(b, int64(t.Minute()), 10)
556 b = append(b, rn.timeSeparator...)
557
558 if t.Second() < 10 {
559 b = append(b, '0')
560 }
561
562 b = strconv.AppendInt(b, int64(t.Second()), 10)
563 b = append(b, []byte{0x20}...)
564
565 tz, _ := t.Zone()
566
567 if btz, ok := rn.timezones[tz]; ok {
568 b = append(b, btz...)
569 } else {
570 b = append(b, tz...)
571 }
572
573 return string(b)
574 }
575
View as plain text