1 package es_BO
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 es_BO 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 &es_BO{
46 locale: "es_BO",
47 pluralsCardinal: []locales.PluralRule{2, 6},
48 pluralsOrdinal: []locales.PluralRule{6},
49 pluralsRange: []locales.PluralRule{6},
50 decimal: ",",
51 group: ".",
52 minus: "-",
53 percent: "%",
54 perMille: "‰",
55 timeSeparator: ":",
56 inifinity: "∞",
57 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", "Bs", "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"},
58 percentSuffix: " ",
59 monthsAbbreviated: []string{"", "ene.", "feb.", "mar.", "abr.", "may.", "jun.", "jul.", "ago.", "sep.", "oct.", "nov.", "dic."},
60 monthsNarrow: []string{"", "E", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"},
61 monthsWide: []string{"", "enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"},
62 daysAbbreviated: []string{"dom.", "lun.", "mar.", "mié.", "jue.", "vie.", "sáb."},
63 daysNarrow: []string{"d", "l", "m", "m", "j", "v", "s"},
64 daysShort: []string{"DO", "LU", "MA", "MI", "JU", "VI", "SA"},
65 daysWide: []string{"domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado"},
66 periodsAbbreviated: []string{"a.\u00a0m.", "p.\u00a0m."},
67 periodsNarrow: []string{"a.\u00a0m.", "p.\u00a0m."},
68 periodsWide: []string{"a.\u00a0m.", "p.\u00a0m."},
69 erasAbbreviated: []string{"a. C.", "d. C."},
70 erasNarrow: []string{"", ""},
71 erasWide: []string{"antes de Cristo", "después de Cristo"},
72 timezones: map[string]string{"ACDT": "hora de verano de Australia central", "ACST": "hora estándar de Australia central", "ACWDT": "hora de verano de Australia centroccidental", "ACWST": "hora estándar de Australia centroccidental", "ADT": "hora de verano del Atlántico", "AEDT": "hora de verano de Australia oriental", "AEST": "hora estándar de Australia oriental", "AKDT": "hora de verano de Alaska", "AKST": "hora estándar de Alaska", "ARST": "hora de verano de Argentina", "ART": "hora estándar de Argentina", "AST": "hora estándar del Atlántico", "AWDT": "hora de verano de Australia occidental", "AWST": "hora estándar de Australia occidental", "BOT": "hora de Bolivia", "BT": "hora de Bután", "CAT": "hora de África central", "CDT": "hora de verano central", "CHADT": "hora de verano de Chatham", "CHAST": "hora estándar de Chatham", "CLST": "hora de verano de Chile", "CLT": "hora estándar de Chile", "COST": "hora de verano de Colombia", "COT": "hora estándar de Colombia", "CST": "hora estándar central", "ChST": "hora estándar de Chamorro", "EAT": "hora de África oriental", "ECT": "hora de Ecuador", "EDT": "hora de verano oriental", "EST": "hora estándar oriental", "GFT": "hora de la Guayana Francesa", "GMT": "hora del meridiano de Greenwich", "GST": "hora estándar del Golfo", "GYT": "hora de Guyana", "HADT": "hora de verano de Hawái-Aleutianas", "HAST": "hora estándar de Hawái-Aleutianas", "HAT": "hora de verano de Terranova", "HECU": "hora de verano de Cuba", "HEEG": "hora de verano de Groenlandia oriental", "HENOMX": "hora de verano del noroeste de México", "HEOG": "hora de verano de Groenlandia occidental", "HEPM": "hora de verano de San Pedro y Miquelón", "HEPMX": "hora de verano del Pacífico de México", "HKST": "hora de verano de Hong Kong", "HKT": "hora estándar de Hong Kong", "HNCU": "hora estándar de Cuba", "HNEG": "hora estándar de Groenlandia oriental", "HNNOMX": "hora estándar del noroeste de México", "HNOG": "hora estándar de Groenlandia occidental", "HNPM": "hora estándar de San Pedro y Miquelón", "HNPMX": "hora estándar del Pacífico de México", "HNT": "hora estándar de Terranova", "IST": "hora de India", "JDT": "hora de verano de Japón", "JST": "hora estándar de Japón", "LHDT": "hora de verano de Lord Howe", "LHST": "hora estándar de Lord Howe", "MDT": "hora de verano de la montaña", "MESZ": "hora de verano de Europa central", "MEZ": "hora estándar de Europa central", "MST": "hora estándar de la montaña", "MYT": "hora de Malasia", "NZDT": "hora de verano de Nueva Zelanda", "NZST": "hora estándar de Nueva Zelanda", "OESZ": "hora de verano de Europa del Este", "OEZ": "hora estándar de Europa del Este", "PDT": "hora de verano del Pacífico", "PST": "hora estándar del Pacífico", "SAST": "hora de Sudáfrica", "SGT": "hora de Singapur", "SRT": "hora de Surinam", "TMST": "hora de verano de Turkmenistán", "TMT": "hora estándar de Turkmenistán", "UYST": "hora de verano de Uruguay", "UYT": "hora estándar de Uruguay", "VET": "hora de Venezuela", "WARST": "hora de verano de Argentina occidental", "WART": "hora estándar de Argentina occidental", "WAST": "hora de verano de África occidental", "WAT": "hora estándar de África occidental", "WESZ": "hora de verano de Europa del Oeste", "WEZ": "hora estándar de Europa del Oeste", "WIB": "hora de Indonesia occidental", "WIT": "hora de Indonesia oriental", "WITA": "hora de Indonesia central", "∅∅∅": "hora de verano de Perú"},
73 }
74 }
75
76
77 func (es *es_BO) Locale() string {
78 return es.locale
79 }
80
81
82 func (es *es_BO) PluralsCardinal() []locales.PluralRule {
83 return es.pluralsCardinal
84 }
85
86
87 func (es *es_BO) PluralsOrdinal() []locales.PluralRule {
88 return es.pluralsOrdinal
89 }
90
91
92 func (es *es_BO) PluralsRange() []locales.PluralRule {
93 return es.pluralsRange
94 }
95
96
97 func (es *es_BO) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
98
99 n := math.Abs(num)
100
101 if n == 1 {
102 return locales.PluralRuleOne
103 }
104
105 return locales.PluralRuleOther
106 }
107
108
109 func (es *es_BO) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
110 return locales.PluralRuleOther
111 }
112
113
114 func (es *es_BO) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
115 return locales.PluralRuleOther
116 }
117
118
119 func (es *es_BO) MonthAbbreviated(month time.Month) string {
120 return es.monthsAbbreviated[month]
121 }
122
123
124 func (es *es_BO) MonthsAbbreviated() []string {
125 return es.monthsAbbreviated[1:]
126 }
127
128
129 func (es *es_BO) MonthNarrow(month time.Month) string {
130 return es.monthsNarrow[month]
131 }
132
133
134 func (es *es_BO) MonthsNarrow() []string {
135 return es.monthsNarrow[1:]
136 }
137
138
139 func (es *es_BO) MonthWide(month time.Month) string {
140 return es.monthsWide[month]
141 }
142
143
144 func (es *es_BO) MonthsWide() []string {
145 return es.monthsWide[1:]
146 }
147
148
149 func (es *es_BO) WeekdayAbbreviated(weekday time.Weekday) string {
150 return es.daysAbbreviated[weekday]
151 }
152
153
154 func (es *es_BO) WeekdaysAbbreviated() []string {
155 return es.daysAbbreviated
156 }
157
158
159 func (es *es_BO) WeekdayNarrow(weekday time.Weekday) string {
160 return es.daysNarrow[weekday]
161 }
162
163
164 func (es *es_BO) WeekdaysNarrow() []string {
165 return es.daysNarrow
166 }
167
168
169 func (es *es_BO) WeekdayShort(weekday time.Weekday) string {
170 return es.daysShort[weekday]
171 }
172
173
174 func (es *es_BO) WeekdaysShort() []string {
175 return es.daysShort
176 }
177
178
179 func (es *es_BO) WeekdayWide(weekday time.Weekday) string {
180 return es.daysWide[weekday]
181 }
182
183
184 func (es *es_BO) WeekdaysWide() []string {
185 return es.daysWide
186 }
187
188
189 func (es *es_BO) Decimal() string {
190 return es.decimal
191 }
192
193
194 func (es *es_BO) Group() string {
195 return es.group
196 }
197
198
199 func (es *es_BO) Minus() string {
200 return es.minus
201 }
202
203
204 func (es *es_BO) FmtNumber(num float64, v uint64) string {
205
206 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
207 l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
208 count := 0
209 inWhole := v == 0
210 b := make([]byte, 0, l)
211
212 for i := len(s) - 1; i >= 0; i-- {
213
214 if s[i] == '.' {
215 b = append(b, es.decimal[0])
216 inWhole = true
217 continue
218 }
219
220 if inWhole {
221 if count == 3 {
222 b = append(b, es.group[0])
223 count = 1
224 } else {
225 count++
226 }
227 }
228
229 b = append(b, s[i])
230 }
231
232 if num < 0 {
233 b = append(b, es.minus[0])
234 }
235
236
237 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
238 b[i], b[j] = b[j], b[i]
239 }
240
241 return string(b)
242 }
243
244
245
246 func (es *es_BO) FmtPercent(num float64, v uint64) string {
247 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
248 l := len(s) + 5
249 b := make([]byte, 0, l)
250
251 for i := len(s) - 1; i >= 0; i-- {
252
253 if s[i] == '.' {
254 b = append(b, es.decimal[0])
255 continue
256 }
257
258 b = append(b, s[i])
259 }
260
261 if num < 0 {
262 b = append(b, es.minus[0])
263 }
264
265
266 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
267 b[i], b[j] = b[j], b[i]
268 }
269
270 b = append(b, es.percentSuffix...)
271
272 b = append(b, es.percent...)
273
274 return string(b)
275 }
276
277
278 func (es *es_BO) FmtCurrency(num float64, v uint64, currency currency.Type) string {
279
280 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
281 symbol := es.currencies[currency]
282 l := len(s) + len(symbol) + 2 + 1*len(s[:len(s)-int(v)-1])/3
283 count := 0
284 inWhole := v == 0
285 b := make([]byte, 0, l)
286
287 for i := len(s) - 1; i >= 0; i-- {
288
289 if s[i] == '.' {
290 b = append(b, es.decimal[0])
291 inWhole = true
292 continue
293 }
294
295 if inWhole {
296 if count == 3 {
297 b = append(b, es.group[0])
298 count = 1
299 } else {
300 count++
301 }
302 }
303
304 b = append(b, s[i])
305 }
306
307 for j := len(symbol) - 1; j >= 0; j-- {
308 b = append(b, symbol[j])
309 }
310
311 if num < 0 {
312 b = append(b, es.minus[0])
313 }
314
315
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]
318 }
319
320 if int(v) < 2 {
321
322 if v == 0 {
323 b = append(b, es.decimal...)
324 }
325
326 for i := 0; i < 2-int(v); i++ {
327 b = append(b, '0')
328 }
329 }
330
331 return string(b)
332 }
333
334
335
336 func (es *es_BO) FmtAccounting(num float64, v uint64, currency currency.Type) string {
337
338 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
339 symbol := es.currencies[currency]
340 l := len(s) + len(symbol) + 2 + 1*len(s[:len(s)-int(v)-1])/3
341 count := 0
342 inWhole := v == 0
343 b := make([]byte, 0, l)
344
345 for i := len(s) - 1; i >= 0; i-- {
346
347 if s[i] == '.' {
348 b = append(b, es.decimal[0])
349 inWhole = true
350 continue
351 }
352
353 if inWhole {
354 if count == 3 {
355 b = append(b, es.group[0])
356 count = 1
357 } else {
358 count++
359 }
360 }
361
362 b = append(b, s[i])
363 }
364
365 if num < 0 {
366
367 for j := len(symbol) - 1; j >= 0; j-- {
368 b = append(b, symbol[j])
369 }
370
371 b = append(b, es.minus[0])
372
373 } else {
374
375 for j := len(symbol) - 1; j >= 0; j-- {
376 b = append(b, symbol[j])
377 }
378
379 }
380
381
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]
384 }
385
386 if int(v) < 2 {
387
388 if v == 0 {
389 b = append(b, es.decimal...)
390 }
391
392 for i := 0; i < 2-int(v); i++ {
393 b = append(b, '0')
394 }
395 }
396
397 return string(b)
398 }
399
400
401 func (es *es_BO) FmtDateShort(t time.Time) string {
402
403 b := make([]byte, 0, 32)
404
405 b = strconv.AppendInt(b, int64(t.Day()), 10)
406 b = append(b, []byte{0x2f}...)
407 b = strconv.AppendInt(b, int64(t.Month()), 10)
408 b = append(b, []byte{0x2f}...)
409
410 if t.Year() > 9 {
411 b = append(b, strconv.Itoa(t.Year())[2:]...)
412 } else {
413 b = append(b, strconv.Itoa(t.Year())[1:]...)
414 }
415
416 return string(b)
417 }
418
419
420 func (es *es_BO) FmtDateMedium(t time.Time) string {
421
422 b := make([]byte, 0, 32)
423
424 b = strconv.AppendInt(b, int64(t.Day()), 10)
425 b = append(b, []byte{0x20}...)
426 b = append(b, es.monthsAbbreviated[t.Month()]...)
427 b = append(b, []byte{0x20, 0x64, 0x65}...)
428 b = append(b, []byte{0x20}...)
429
430 if t.Year() > 0 {
431 b = strconv.AppendInt(b, int64(t.Year()), 10)
432 } else {
433 b = strconv.AppendInt(b, int64(-t.Year()), 10)
434 }
435
436 return string(b)
437 }
438
439
440 func (es *es_BO) FmtDateLong(t time.Time) string {
441
442 b := make([]byte, 0, 32)
443
444 b = strconv.AppendInt(b, int64(t.Day()), 10)
445 b = append(b, []byte{0x20, 0x64, 0x65}...)
446 b = append(b, []byte{0x20}...)
447 b = append(b, es.monthsWide[t.Month()]...)
448 b = append(b, []byte{0x20, 0x64, 0x65}...)
449 b = append(b, []byte{0x20}...)
450
451 if t.Year() > 0 {
452 b = strconv.AppendInt(b, int64(t.Year()), 10)
453 } else {
454 b = strconv.AppendInt(b, int64(-t.Year()), 10)
455 }
456
457 return string(b)
458 }
459
460
461 func (es *es_BO) FmtDateFull(t time.Time) string {
462
463 b := make([]byte, 0, 32)
464
465 b = append(b, es.daysWide[t.Weekday()]...)
466 b = append(b, []byte{0x2c, 0x20}...)
467 b = strconv.AppendInt(b, int64(t.Day()), 10)
468 b = append(b, []byte{0x20, 0x64, 0x65}...)
469 b = append(b, []byte{0x20}...)
470 b = append(b, es.monthsWide[t.Month()]...)
471 b = append(b, []byte{0x20, 0x64, 0x65}...)
472 b = append(b, []byte{0x20}...)
473
474 if t.Year() > 0 {
475 b = strconv.AppendInt(b, int64(t.Year()), 10)
476 } else {
477 b = strconv.AppendInt(b, int64(-t.Year()), 10)
478 }
479
480 return string(b)
481 }
482
483
484 func (es *es_BO) FmtTimeShort(t time.Time) string {
485
486 b := make([]byte, 0, 32)
487
488 if t.Hour() < 10 {
489 b = append(b, '0')
490 }
491
492 b = strconv.AppendInt(b, int64(t.Hour()), 10)
493 b = append(b, es.timeSeparator...)
494
495 if t.Minute() < 10 {
496 b = append(b, '0')
497 }
498
499 b = strconv.AppendInt(b, int64(t.Minute()), 10)
500
501 return string(b)
502 }
503
504
505 func (es *es_BO) FmtTimeMedium(t time.Time) string {
506
507 b := make([]byte, 0, 32)
508
509 if t.Hour() < 10 {
510 b = append(b, '0')
511 }
512
513 b = strconv.AppendInt(b, int64(t.Hour()), 10)
514 b = append(b, es.timeSeparator...)
515
516 if t.Minute() < 10 {
517 b = append(b, '0')
518 }
519
520 b = strconv.AppendInt(b, int64(t.Minute()), 10)
521 b = append(b, es.timeSeparator...)
522
523 if t.Second() < 10 {
524 b = append(b, '0')
525 }
526
527 b = strconv.AppendInt(b, int64(t.Second()), 10)
528
529 return string(b)
530 }
531
532
533 func (es *es_BO) FmtTimeLong(t time.Time) string {
534
535 b := make([]byte, 0, 32)
536
537 if t.Hour() < 10 {
538 b = append(b, '0')
539 }
540
541 b = strconv.AppendInt(b, int64(t.Hour()), 10)
542 b = append(b, es.timeSeparator...)
543
544 if t.Minute() < 10 {
545 b = append(b, '0')
546 }
547
548 b = strconv.AppendInt(b, int64(t.Minute()), 10)
549 b = append(b, es.timeSeparator...)
550
551 if t.Second() < 10 {
552 b = append(b, '0')
553 }
554
555 b = strconv.AppendInt(b, int64(t.Second()), 10)
556 b = append(b, []byte{0x20}...)
557
558 tz, _ := t.Zone()
559 b = append(b, tz...)
560
561 return string(b)
562 }
563
564
565 func (es *es_BO) FmtTimeFull(t time.Time) string {
566
567 b := make([]byte, 0, 32)
568
569 if t.Hour() < 10 {
570 b = append(b, '0')
571 }
572
573 b = strconv.AppendInt(b, int64(t.Hour()), 10)
574 b = append(b, es.timeSeparator...)
575
576 if t.Minute() < 10 {
577 b = append(b, '0')
578 }
579
580 b = strconv.AppendInt(b, int64(t.Minute()), 10)
581 b = append(b, es.timeSeparator...)
582
583 if t.Second() < 10 {
584 b = append(b, '0')
585 }
586
587 b = strconv.AppendInt(b, int64(t.Second()), 10)
588 b = append(b, []byte{0x20}...)
589
590 tz, _ := t.Zone()
591
592 if btz, ok := es.timezones[tz]; ok {
593 b = append(b, btz...)
594 } else {
595 b = append(b, tz...)
596 }
597
598 return string(b)
599 }
600
View as plain text