1 package es_UY
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_UY 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 currencyPositivePrefix 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 &es_UY{
49 locale: "es_UY",
50 pluralsCardinal: []locales.PluralRule{2, 6},
51 pluralsOrdinal: []locales.PluralRule{6},
52 pluralsRange: []locales.PluralRule{6},
53 decimal: ",",
54 group: ".",
55 minus: "-",
56 percent: "%",
57 perMille: "‰",
58 timeSeparator: ":",
59 inifinity: "∞",
60 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", "US$", "USN", "USS", "UYI", "UYP", "$", "UP", "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"},
61 percentSuffix: " ",
62 currencyPositivePrefix: " ",
63 currencyNegativePrefix: "( ",
64 currencyNegativeSuffix: ")",
65 monthsAbbreviated: []string{"", "ene.", "feb.", "mar.", "abr.", "may.", "jun.", "jul.", "ago.", "set.", "oct.", "nov.", "dic."},
66 monthsNarrow: []string{"", "E", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"},
67 monthsWide: []string{"", "enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "setiembre", "octubre", "noviembre", "diciembre"},
68 daysAbbreviated: []string{"dom.", "lun.", "mar.", "mié.", "jue.", "vie.", "sáb."},
69 daysNarrow: []string{"d", "l", "m", "m", "j", "v", "s"},
70 daysShort: []string{"DO", "LU", "MA", "MI", "JU", "VI", "SA"},
71 daysWide: []string{"domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado"},
72 periodsAbbreviated: []string{"a.\u00a0m.", "p.\u00a0m."},
73 periodsNarrow: []string{"a.\u00a0m.", "p.\u00a0m."},
74 periodsWide: []string{"a.\u00a0m.", "p.\u00a0m."},
75 erasAbbreviated: []string{"a. C.", "d. C."},
76 erasNarrow: []string{"", ""},
77 erasWide: []string{"antes de Cristo", "después de Cristo"},
78 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 las Azores"},
79 }
80 }
81
82
83 func (es *es_UY) Locale() string {
84 return es.locale
85 }
86
87
88 func (es *es_UY) PluralsCardinal() []locales.PluralRule {
89 return es.pluralsCardinal
90 }
91
92
93 func (es *es_UY) PluralsOrdinal() []locales.PluralRule {
94 return es.pluralsOrdinal
95 }
96
97
98 func (es *es_UY) PluralsRange() []locales.PluralRule {
99 return es.pluralsRange
100 }
101
102
103 func (es *es_UY) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
104
105 n := math.Abs(num)
106
107 if n == 1 {
108 return locales.PluralRuleOne
109 }
110
111 return locales.PluralRuleOther
112 }
113
114
115 func (es *es_UY) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
116 return locales.PluralRuleOther
117 }
118
119
120 func (es *es_UY) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
121 return locales.PluralRuleOther
122 }
123
124
125 func (es *es_UY) MonthAbbreviated(month time.Month) string {
126 return es.monthsAbbreviated[month]
127 }
128
129
130 func (es *es_UY) MonthsAbbreviated() []string {
131 return es.monthsAbbreviated[1:]
132 }
133
134
135 func (es *es_UY) MonthNarrow(month time.Month) string {
136 return es.monthsNarrow[month]
137 }
138
139
140 func (es *es_UY) MonthsNarrow() []string {
141 return es.monthsNarrow[1:]
142 }
143
144
145 func (es *es_UY) MonthWide(month time.Month) string {
146 return es.monthsWide[month]
147 }
148
149
150 func (es *es_UY) MonthsWide() []string {
151 return es.monthsWide[1:]
152 }
153
154
155 func (es *es_UY) WeekdayAbbreviated(weekday time.Weekday) string {
156 return es.daysAbbreviated[weekday]
157 }
158
159
160 func (es *es_UY) WeekdaysAbbreviated() []string {
161 return es.daysAbbreviated
162 }
163
164
165 func (es *es_UY) WeekdayNarrow(weekday time.Weekday) string {
166 return es.daysNarrow[weekday]
167 }
168
169
170 func (es *es_UY) WeekdaysNarrow() []string {
171 return es.daysNarrow
172 }
173
174
175 func (es *es_UY) WeekdayShort(weekday time.Weekday) string {
176 return es.daysShort[weekday]
177 }
178
179
180 func (es *es_UY) WeekdaysShort() []string {
181 return es.daysShort
182 }
183
184
185 func (es *es_UY) WeekdayWide(weekday time.Weekday) string {
186 return es.daysWide[weekday]
187 }
188
189
190 func (es *es_UY) WeekdaysWide() []string {
191 return es.daysWide
192 }
193
194
195 func (es *es_UY) Decimal() string {
196 return es.decimal
197 }
198
199
200 func (es *es_UY) Group() string {
201 return es.group
202 }
203
204
205 func (es *es_UY) Minus() string {
206 return es.minus
207 }
208
209
210 func (es *es_UY) FmtNumber(num float64, v uint64) string {
211
212 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
213 l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
214 count := 0
215 inWhole := v == 0
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, es.decimal[0])
222 inWhole = true
223 continue
224 }
225
226 if inWhole {
227 if count == 3 {
228 b = append(b, es.group[0])
229 count = 1
230 } else {
231 count++
232 }
233 }
234
235 b = append(b, s[i])
236 }
237
238 if num < 0 {
239 b = append(b, es.minus[0])
240 }
241
242
243 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
244 b[i], b[j] = b[j], b[i]
245 }
246
247 return string(b)
248 }
249
250
251
252 func (es *es_UY) FmtPercent(num float64, v uint64) string {
253 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
254 l := len(s) + 5
255 b := make([]byte, 0, l)
256
257 for i := len(s) - 1; i >= 0; i-- {
258
259 if s[i] == '.' {
260 b = append(b, es.decimal[0])
261 continue
262 }
263
264 b = append(b, s[i])
265 }
266
267 if num < 0 {
268 b = append(b, es.minus[0])
269 }
270
271
272 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
273 b[i], b[j] = b[j], b[i]
274 }
275
276 b = append(b, es.percentSuffix...)
277
278 b = append(b, es.percent...)
279
280 return string(b)
281 }
282
283
284 func (es *es_UY) FmtCurrency(num float64, v uint64, currency currency.Type) string {
285
286 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
287 symbol := es.currencies[currency]
288 l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
289 count := 0
290 inWhole := v == 0
291 b := make([]byte, 0, l)
292
293 for i := len(s) - 1; i >= 0; i-- {
294
295 if s[i] == '.' {
296 b = append(b, es.decimal[0])
297 inWhole = true
298 continue
299 }
300
301 if inWhole {
302 if count == 3 {
303 b = append(b, es.group[0])
304 count = 1
305 } else {
306 count++
307 }
308 }
309
310 b = append(b, s[i])
311 }
312
313 for j := len(symbol) - 1; j >= 0; j-- {
314 b = append(b, symbol[j])
315 }
316
317 for j := len(es.currencyPositivePrefix) - 1; j >= 0; j-- {
318 b = append(b, es.currencyPositivePrefix[j])
319 }
320
321 if num < 0 {
322 b = append(b, es.minus[0])
323 }
324
325
326 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
327 b[i], b[j] = b[j], b[i]
328 }
329
330 if int(v) < 2 {
331
332 if v == 0 {
333 b = append(b, es.decimal...)
334 }
335
336 for i := 0; i < 2-int(v); i++ {
337 b = append(b, '0')
338 }
339 }
340
341 return string(b)
342 }
343
344
345
346 func (es *es_UY) FmtAccounting(num float64, v uint64, currency currency.Type) string {
347
348 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
349 symbol := es.currencies[currency]
350 l := len(s) + len(symbol) + 6 + 1*len(s[:len(s)-int(v)-1])/3
351 count := 0
352 inWhole := v == 0
353 b := make([]byte, 0, l)
354
355 for i := len(s) - 1; i >= 0; i-- {
356
357 if s[i] == '.' {
358 b = append(b, es.decimal[0])
359 inWhole = true
360 continue
361 }
362
363 if inWhole {
364 if count == 3 {
365 b = append(b, es.group[0])
366 count = 1
367 } else {
368 count++
369 }
370 }
371
372 b = append(b, s[i])
373 }
374
375 if num < 0 {
376
377 for j := len(symbol) - 1; j >= 0; j-- {
378 b = append(b, symbol[j])
379 }
380
381 for j := len(es.currencyNegativePrefix) - 1; j >= 0; j-- {
382 b = append(b, es.currencyNegativePrefix[j])
383 }
384
385 } else {
386
387 for j := len(symbol) - 1; j >= 0; j-- {
388 b = append(b, symbol[j])
389 }
390
391 for j := len(es.currencyPositivePrefix) - 1; j >= 0; j-- {
392 b = append(b, es.currencyPositivePrefix[j])
393 }
394
395 }
396
397
398 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
399 b[i], b[j] = b[j], b[i]
400 }
401
402 if int(v) < 2 {
403
404 if v == 0 {
405 b = append(b, es.decimal...)
406 }
407
408 for i := 0; i < 2-int(v); i++ {
409 b = append(b, '0')
410 }
411 }
412
413 if num < 0 {
414 b = append(b, es.currencyNegativeSuffix...)
415 }
416
417 return string(b)
418 }
419
420
421 func (es *es_UY) FmtDateShort(t time.Time) string {
422
423 b := make([]byte, 0, 32)
424
425 b = strconv.AppendInt(b, int64(t.Day()), 10)
426 b = append(b, []byte{0x2f}...)
427 b = strconv.AppendInt(b, int64(t.Month()), 10)
428 b = append(b, []byte{0x2f}...)
429
430 if t.Year() > 9 {
431 b = append(b, strconv.Itoa(t.Year())[2:]...)
432 } else {
433 b = append(b, strconv.Itoa(t.Year())[1:]...)
434 }
435
436 return string(b)
437 }
438
439
440 func (es *es_UY) FmtDateMedium(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}...)
446 b = append(b, es.monthsAbbreviated[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 (es *es_UY) FmtDateLong(t time.Time) string {
460
461 b := make([]byte, 0, 32)
462
463 b = strconv.AppendInt(b, int64(t.Day()), 10)
464 b = append(b, []byte{0x20, 0x64, 0x65}...)
465 b = append(b, []byte{0x20}...)
466 b = append(b, es.monthsWide[t.Month()]...)
467 b = append(b, []byte{0x20, 0x64, 0x65}...)
468 b = append(b, []byte{0x20}...)
469
470 if t.Year() > 0 {
471 b = strconv.AppendInt(b, int64(t.Year()), 10)
472 } else {
473 b = strconv.AppendInt(b, int64(-t.Year()), 10)
474 }
475
476 return string(b)
477 }
478
479
480 func (es *es_UY) FmtDateFull(t time.Time) string {
481
482 b := make([]byte, 0, 32)
483
484 b = append(b, es.daysWide[t.Weekday()]...)
485 b = append(b, []byte{0x2c, 0x20}...)
486 b = strconv.AppendInt(b, int64(t.Day()), 10)
487 b = append(b, []byte{0x20, 0x64, 0x65}...)
488 b = append(b, []byte{0x20}...)
489 b = append(b, es.monthsWide[t.Month()]...)
490 b = append(b, []byte{0x20, 0x64, 0x65}...)
491 b = append(b, []byte{0x20}...)
492
493 if t.Year() > 0 {
494 b = strconv.AppendInt(b, int64(t.Year()), 10)
495 } else {
496 b = strconv.AppendInt(b, int64(-t.Year()), 10)
497 }
498
499 return string(b)
500 }
501
502
503 func (es *es_UY) FmtTimeShort(t time.Time) string {
504
505 b := make([]byte, 0, 32)
506
507 if t.Hour() < 10 {
508 b = append(b, '0')
509 }
510
511 b = strconv.AppendInt(b, int64(t.Hour()), 10)
512 b = append(b, es.timeSeparator...)
513
514 if t.Minute() < 10 {
515 b = append(b, '0')
516 }
517
518 b = strconv.AppendInt(b, int64(t.Minute()), 10)
519
520 return string(b)
521 }
522
523
524 func (es *es_UY) FmtTimeMedium(t time.Time) string {
525
526 b := make([]byte, 0, 32)
527
528 if t.Hour() < 10 {
529 b = append(b, '0')
530 }
531
532 b = strconv.AppendInt(b, int64(t.Hour()), 10)
533 b = append(b, es.timeSeparator...)
534
535 if t.Minute() < 10 {
536 b = append(b, '0')
537 }
538
539 b = strconv.AppendInt(b, int64(t.Minute()), 10)
540 b = append(b, es.timeSeparator...)
541
542 if t.Second() < 10 {
543 b = append(b, '0')
544 }
545
546 b = strconv.AppendInt(b, int64(t.Second()), 10)
547
548 return string(b)
549 }
550
551
552 func (es *es_UY) FmtTimeLong(t time.Time) string {
553
554 b := make([]byte, 0, 32)
555
556 if t.Hour() < 10 {
557 b = append(b, '0')
558 }
559
560 b = strconv.AppendInt(b, int64(t.Hour()), 10)
561 b = append(b, es.timeSeparator...)
562
563 if t.Minute() < 10 {
564 b = append(b, '0')
565 }
566
567 b = strconv.AppendInt(b, int64(t.Minute()), 10)
568 b = append(b, es.timeSeparator...)
569
570 if t.Second() < 10 {
571 b = append(b, '0')
572 }
573
574 b = strconv.AppendInt(b, int64(t.Second()), 10)
575 b = append(b, []byte{0x20}...)
576
577 tz, _ := t.Zone()
578 b = append(b, tz...)
579
580 return string(b)
581 }
582
583
584 func (es *es_UY) FmtTimeFull(t time.Time) string {
585
586 b := make([]byte, 0, 32)
587
588 if t.Hour() < 10 {
589 b = append(b, '0')
590 }
591
592 b = strconv.AppendInt(b, int64(t.Hour()), 10)
593 b = append(b, es.timeSeparator...)
594
595 if t.Minute() < 10 {
596 b = append(b, '0')
597 }
598
599 b = strconv.AppendInt(b, int64(t.Minute()), 10)
600 b = append(b, es.timeSeparator...)
601
602 if t.Second() < 10 {
603 b = append(b, '0')
604 }
605
606 b = strconv.AppendInt(b, int64(t.Second()), 10)
607 b = append(b, []byte{0x20}...)
608
609 tz, _ := t.Zone()
610
611 if btz, ok := es.timezones[tz]; ok {
612 b = append(b, btz...)
613 } else {
614 b = append(b, tz...)
615 }
616
617 return string(b)
618 }
619
View as plain text