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