1 package seh_MZ
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 seh_MZ 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 monthsAbbreviated []string
26 monthsNarrow []string
27 monthsWide []string
28 daysAbbreviated []string
29 daysNarrow []string
30 daysShort []string
31 daysWide []string
32 periodsAbbreviated []string
33 periodsNarrow []string
34 periodsShort []string
35 periodsWide []string
36 erasAbbreviated []string
37 erasNarrow []string
38 erasWide []string
39 timezones map[string]string
40 }
41
42
43 func New() locales.Translator {
44 return &seh_MZ{
45 locale: "seh_MZ",
46 pluralsCardinal: []locales.PluralRule{2, 6},
47 pluralsOrdinal: nil,
48 pluralsRange: nil,
49 decimal: ",",
50 group: ".",
51 timeSeparator: ":",
52 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"},
53 monthsAbbreviated: []string{"", "Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Aug", "Set", "Otu", "Nov", "Dec"},
54 monthsNarrow: []string{"", "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"},
55 monthsWide: []string{"", "Janeiro", "Fevreiro", "Marco", "Abril", "Maio", "Junho", "Julho", "Augusto", "Setembro", "Otubro", "Novembro", "Decembro"},
56 daysAbbreviated: []string{"Dim", "Pos", "Pir", "Tat", "Nai", "Sha", "Sab"},
57 daysNarrow: []string{"D", "P", "C", "T", "N", "S", "S"},
58 daysWide: []string{"Dimingu", "Chiposi", "Chipiri", "Chitatu", "Chinai", "Chishanu", "Sabudu"},
59 erasAbbreviated: []string{"AC", "AD"},
60 erasNarrow: []string{"", ""},
61 erasWide: []string{"Antes de Cristo", "Anno Domini"},
62 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", "∅∅∅": "∅∅∅"},
63 }
64 }
65
66
67 func (seh *seh_MZ) Locale() string {
68 return seh.locale
69 }
70
71
72 func (seh *seh_MZ) PluralsCardinal() []locales.PluralRule {
73 return seh.pluralsCardinal
74 }
75
76
77 func (seh *seh_MZ) PluralsOrdinal() []locales.PluralRule {
78 return seh.pluralsOrdinal
79 }
80
81
82 func (seh *seh_MZ) PluralsRange() []locales.PluralRule {
83 return seh.pluralsRange
84 }
85
86
87 func (seh *seh_MZ) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
88
89 n := math.Abs(num)
90
91 if n == 1 {
92 return locales.PluralRuleOne
93 }
94
95 return locales.PluralRuleOther
96 }
97
98
99 func (seh *seh_MZ) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
100 return locales.PluralRuleUnknown
101 }
102
103
104 func (seh *seh_MZ) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
105 return locales.PluralRuleUnknown
106 }
107
108
109 func (seh *seh_MZ) MonthAbbreviated(month time.Month) string {
110 return seh.monthsAbbreviated[month]
111 }
112
113
114 func (seh *seh_MZ) MonthsAbbreviated() []string {
115 return seh.monthsAbbreviated[1:]
116 }
117
118
119 func (seh *seh_MZ) MonthNarrow(month time.Month) string {
120 return seh.monthsNarrow[month]
121 }
122
123
124 func (seh *seh_MZ) MonthsNarrow() []string {
125 return seh.monthsNarrow[1:]
126 }
127
128
129 func (seh *seh_MZ) MonthWide(month time.Month) string {
130 return seh.monthsWide[month]
131 }
132
133
134 func (seh *seh_MZ) MonthsWide() []string {
135 return seh.monthsWide[1:]
136 }
137
138
139 func (seh *seh_MZ) WeekdayAbbreviated(weekday time.Weekday) string {
140 return seh.daysAbbreviated[weekday]
141 }
142
143
144 func (seh *seh_MZ) WeekdaysAbbreviated() []string {
145 return seh.daysAbbreviated
146 }
147
148
149 func (seh *seh_MZ) WeekdayNarrow(weekday time.Weekday) string {
150 return seh.daysNarrow[weekday]
151 }
152
153
154 func (seh *seh_MZ) WeekdaysNarrow() []string {
155 return seh.daysNarrow
156 }
157
158
159 func (seh *seh_MZ) WeekdayShort(weekday time.Weekday) string {
160 return seh.daysShort[weekday]
161 }
162
163
164 func (seh *seh_MZ) WeekdaysShort() []string {
165 return seh.daysShort
166 }
167
168
169 func (seh *seh_MZ) WeekdayWide(weekday time.Weekday) string {
170 return seh.daysWide[weekday]
171 }
172
173
174 func (seh *seh_MZ) WeekdaysWide() []string {
175 return seh.daysWide
176 }
177
178
179 func (seh *seh_MZ) Decimal() string {
180 return seh.decimal
181 }
182
183
184 func (seh *seh_MZ) Group() string {
185 return seh.group
186 }
187
188
189 func (seh *seh_MZ) Minus() string {
190 return seh.minus
191 }
192
193
194 func (seh *seh_MZ) FmtNumber(num float64, v uint64) string {
195
196 return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
197 }
198
199
200
201 func (seh *seh_MZ) FmtPercent(num float64, v uint64) string {
202 return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
203 }
204
205
206 func (seh *seh_MZ) FmtCurrency(num float64, v uint64, currency currency.Type) string {
207
208 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
209 symbol := seh.currencies[currency]
210 l := len(s) + len(symbol) + 1 + 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, seh.decimal[0])
219 inWhole = true
220 continue
221 }
222
223 if inWhole {
224 if count == 3 {
225 b = append(b, seh.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, seh.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 if int(v) < 2 {
245
246 if v == 0 {
247 b = append(b, seh.decimal...)
248 }
249
250 for i := 0; i < 2-int(v); i++ {
251 b = append(b, '0')
252 }
253 }
254
255 b = append(b, symbol...)
256
257 return string(b)
258 }
259
260
261
262 func (seh *seh_MZ) FmtAccounting(num float64, v uint64, currency currency.Type) string {
263
264 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
265 symbol := seh.currencies[currency]
266 l := len(s) + len(symbol) + 1 + 1*len(s[:len(s)-int(v)-1])/3
267 count := 0
268 inWhole := v == 0
269 b := make([]byte, 0, l)
270
271 for i := len(s) - 1; i >= 0; i-- {
272
273 if s[i] == '.' {
274 b = append(b, seh.decimal[0])
275 inWhole = true
276 continue
277 }
278
279 if inWhole {
280 if count == 3 {
281 b = append(b, seh.group[0])
282 count = 1
283 } else {
284 count++
285 }
286 }
287
288 b = append(b, s[i])
289 }
290
291 if num < 0 {
292
293 b = append(b, seh.minus[0])
294
295 }
296
297
298 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
299 b[i], b[j] = b[j], b[i]
300 }
301
302 if int(v) < 2 {
303
304 if v == 0 {
305 b = append(b, seh.decimal...)
306 }
307
308 for i := 0; i < 2-int(v); i++ {
309 b = append(b, '0')
310 }
311 }
312
313 if num < 0 {
314 b = append(b, symbol...)
315 } else {
316
317 b = append(b, symbol...)
318 }
319
320 return string(b)
321 }
322
323
324 func (seh *seh_MZ) FmtDateShort(t time.Time) string {
325
326 b := make([]byte, 0, 32)
327
328 b = strconv.AppendInt(b, int64(t.Day()), 10)
329 b = append(b, []byte{0x2f}...)
330 b = strconv.AppendInt(b, int64(t.Month()), 10)
331 b = append(b, []byte{0x2f}...)
332
333 if t.Year() > 0 {
334 b = strconv.AppendInt(b, int64(t.Year()), 10)
335 } else {
336 b = strconv.AppendInt(b, int64(-t.Year()), 10)
337 }
338
339 return string(b)
340 }
341
342
343 func (seh *seh_MZ) FmtDateMedium(t time.Time) string {
344
345 b := make([]byte, 0, 32)
346
347 b = strconv.AppendInt(b, int64(t.Day()), 10)
348 b = append(b, []byte{0x20, 0x64, 0x65}...)
349 b = append(b, []byte{0x20}...)
350 b = append(b, seh.monthsAbbreviated[t.Month()]...)
351 b = append(b, []byte{0x20, 0x64, 0x65}...)
352 b = append(b, []byte{0x20}...)
353
354 if t.Year() > 0 {
355 b = strconv.AppendInt(b, int64(t.Year()), 10)
356 } else {
357 b = strconv.AppendInt(b, int64(-t.Year()), 10)
358 }
359
360 return string(b)
361 }
362
363
364 func (seh *seh_MZ) FmtDateLong(t time.Time) string {
365
366 b := make([]byte, 0, 32)
367
368 b = strconv.AppendInt(b, int64(t.Day()), 10)
369 b = append(b, []byte{0x20, 0x64, 0x65}...)
370 b = append(b, []byte{0x20}...)
371 b = append(b, seh.monthsWide[t.Month()]...)
372 b = append(b, []byte{0x20, 0x64, 0x65}...)
373 b = append(b, []byte{0x20}...)
374
375 if t.Year() > 0 {
376 b = strconv.AppendInt(b, int64(t.Year()), 10)
377 } else {
378 b = strconv.AppendInt(b, int64(-t.Year()), 10)
379 }
380
381 return string(b)
382 }
383
384
385 func (seh *seh_MZ) FmtDateFull(t time.Time) string {
386
387 b := make([]byte, 0, 32)
388
389 b = append(b, seh.daysWide[t.Weekday()]...)
390 b = append(b, []byte{0x2c, 0x20}...)
391 b = strconv.AppendInt(b, int64(t.Day()), 10)
392 b = append(b, []byte{0x20, 0x64, 0x65}...)
393 b = append(b, []byte{0x20}...)
394 b = append(b, seh.monthsWide[t.Month()]...)
395 b = append(b, []byte{0x20, 0x64, 0x65}...)
396 b = append(b, []byte{0x20}...)
397
398 if t.Year() > 0 {
399 b = strconv.AppendInt(b, int64(t.Year()), 10)
400 } else {
401 b = strconv.AppendInt(b, int64(-t.Year()), 10)
402 }
403
404 return string(b)
405 }
406
407
408 func (seh *seh_MZ) FmtTimeShort(t time.Time) string {
409
410 b := make([]byte, 0, 32)
411
412 if t.Hour() < 10 {
413 b = append(b, '0')
414 }
415
416 b = strconv.AppendInt(b, int64(t.Hour()), 10)
417 b = append(b, seh.timeSeparator...)
418
419 if t.Minute() < 10 {
420 b = append(b, '0')
421 }
422
423 b = strconv.AppendInt(b, int64(t.Minute()), 10)
424
425 return string(b)
426 }
427
428
429 func (seh *seh_MZ) FmtTimeMedium(t time.Time) string {
430
431 b := make([]byte, 0, 32)
432
433 if t.Hour() < 10 {
434 b = append(b, '0')
435 }
436
437 b = strconv.AppendInt(b, int64(t.Hour()), 10)
438 b = append(b, seh.timeSeparator...)
439
440 if t.Minute() < 10 {
441 b = append(b, '0')
442 }
443
444 b = strconv.AppendInt(b, int64(t.Minute()), 10)
445 b = append(b, seh.timeSeparator...)
446
447 if t.Second() < 10 {
448 b = append(b, '0')
449 }
450
451 b = strconv.AppendInt(b, int64(t.Second()), 10)
452
453 return string(b)
454 }
455
456
457 func (seh *seh_MZ) FmtTimeLong(t time.Time) string {
458
459 b := make([]byte, 0, 32)
460
461 if t.Hour() < 10 {
462 b = append(b, '0')
463 }
464
465 b = strconv.AppendInt(b, int64(t.Hour()), 10)
466 b = append(b, seh.timeSeparator...)
467
468 if t.Minute() < 10 {
469 b = append(b, '0')
470 }
471
472 b = strconv.AppendInt(b, int64(t.Minute()), 10)
473 b = append(b, seh.timeSeparator...)
474
475 if t.Second() < 10 {
476 b = append(b, '0')
477 }
478
479 b = strconv.AppendInt(b, int64(t.Second()), 10)
480 b = append(b, []byte{0x20}...)
481
482 tz, _ := t.Zone()
483 b = append(b, tz...)
484
485 return string(b)
486 }
487
488
489 func (seh *seh_MZ) FmtTimeFull(t time.Time) string {
490
491 b := make([]byte, 0, 32)
492
493 if t.Hour() < 10 {
494 b = append(b, '0')
495 }
496
497 b = strconv.AppendInt(b, int64(t.Hour()), 10)
498 b = append(b, seh.timeSeparator...)
499
500 if t.Minute() < 10 {
501 b = append(b, '0')
502 }
503
504 b = strconv.AppendInt(b, int64(t.Minute()), 10)
505 b = append(b, seh.timeSeparator...)
506
507 if t.Second() < 10 {
508 b = append(b, '0')
509 }
510
511 b = strconv.AppendInt(b, int64(t.Second()), 10)
512 b = append(b, []byte{0x20}...)
513
514 tz, _ := t.Zone()
515
516 if btz, ok := seh.timezones[tz]; ok {
517 b = append(b, btz...)
518 } else {
519 b = append(b, tz...)
520 }
521
522 return string(b)
523 }
524
View as plain text