1 package mgh_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 mgh_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 currencyPositivePrefix string
26 currencyPositiveSuffix 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 &mgh_MZ{
49 locale: "mgh_MZ",
50 pluralsCardinal: nil,
51 pluralsOrdinal: nil,
52 pluralsRange: nil,
53 decimal: ",",
54 group: ".",
55 timeSeparator: ":",
56 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"},
57 currencyPositivePrefix: " ",
58 currencyPositiveSuffix: "K",
59 currencyNegativePrefix: " ",
60 currencyNegativeSuffix: "K",
61 monthsAbbreviated: []string{"", "Kwa", "Una", "Rar", "Che", "Tha", "Moc", "Sab", "Nan", "Tis", "Kum", "Moj", "Yel"},
62 monthsNarrow: []string{"", "K", "U", "R", "C", "T", "M", "S", "N", "T", "K", "M", "Y"},
63 monthsWide: []string{"", "Mweri wo kwanza", "Mweri wo unayeli", "Mweri wo uneraru", "Mweri wo unecheshe", "Mweri wo unethanu", "Mweri wo thanu na mocha", "Mweri wo saba", "Mweri wo nane", "Mweri wo tisa", "Mweri wo kumi", "Mweri wo kumi na moja", "Mweri wo kumi na yel’li"},
64 daysAbbreviated: []string{"Sab", "Jtt", "Jnn", "Jtn", "Ara", "Iju", "Jmo"},
65 daysNarrow: []string{"S", "J", "J", "J", "A", "I", "J"},
66 daysWide: []string{"Sabato", "Jumatatu", "Jumanne", "Jumatano", "Arahamisi", "Ijumaa", "Jumamosi"},
67 periodsAbbreviated: []string{"wichishu", "mchochil’l"},
68 periodsWide: []string{"wichishu", "mchochil’l"},
69 erasAbbreviated: []string{"HY", "YY"},
70 erasNarrow: []string{"", ""},
71 erasWide: []string{"Hinapiya yesu", "Yopia yesu"},
72 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", "∅∅∅": "∅∅∅"},
73 }
74 }
75
76
77 func (mgh *mgh_MZ) Locale() string {
78 return mgh.locale
79 }
80
81
82 func (mgh *mgh_MZ) PluralsCardinal() []locales.PluralRule {
83 return mgh.pluralsCardinal
84 }
85
86
87 func (mgh *mgh_MZ) PluralsOrdinal() []locales.PluralRule {
88 return mgh.pluralsOrdinal
89 }
90
91
92 func (mgh *mgh_MZ) PluralsRange() []locales.PluralRule {
93 return mgh.pluralsRange
94 }
95
96
97 func (mgh *mgh_MZ) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
98 return locales.PluralRuleUnknown
99 }
100
101
102 func (mgh *mgh_MZ) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
103 return locales.PluralRuleUnknown
104 }
105
106
107 func (mgh *mgh_MZ) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
108 return locales.PluralRuleUnknown
109 }
110
111
112 func (mgh *mgh_MZ) MonthAbbreviated(month time.Month) string {
113 return mgh.monthsAbbreviated[month]
114 }
115
116
117 func (mgh *mgh_MZ) MonthsAbbreviated() []string {
118 return mgh.monthsAbbreviated[1:]
119 }
120
121
122 func (mgh *mgh_MZ) MonthNarrow(month time.Month) string {
123 return mgh.monthsNarrow[month]
124 }
125
126
127 func (mgh *mgh_MZ) MonthsNarrow() []string {
128 return mgh.monthsNarrow[1:]
129 }
130
131
132 func (mgh *mgh_MZ) MonthWide(month time.Month) string {
133 return mgh.monthsWide[month]
134 }
135
136
137 func (mgh *mgh_MZ) MonthsWide() []string {
138 return mgh.monthsWide[1:]
139 }
140
141
142 func (mgh *mgh_MZ) WeekdayAbbreviated(weekday time.Weekday) string {
143 return mgh.daysAbbreviated[weekday]
144 }
145
146
147 func (mgh *mgh_MZ) WeekdaysAbbreviated() []string {
148 return mgh.daysAbbreviated
149 }
150
151
152 func (mgh *mgh_MZ) WeekdayNarrow(weekday time.Weekday) string {
153 return mgh.daysNarrow[weekday]
154 }
155
156
157 func (mgh *mgh_MZ) WeekdaysNarrow() []string {
158 return mgh.daysNarrow
159 }
160
161
162 func (mgh *mgh_MZ) WeekdayShort(weekday time.Weekday) string {
163 return mgh.daysShort[weekday]
164 }
165
166
167 func (mgh *mgh_MZ) WeekdaysShort() []string {
168 return mgh.daysShort
169 }
170
171
172 func (mgh *mgh_MZ) WeekdayWide(weekday time.Weekday) string {
173 return mgh.daysWide[weekday]
174 }
175
176
177 func (mgh *mgh_MZ) WeekdaysWide() []string {
178 return mgh.daysWide
179 }
180
181
182 func (mgh *mgh_MZ) Decimal() string {
183 return mgh.decimal
184 }
185
186
187 func (mgh *mgh_MZ) Group() string {
188 return mgh.group
189 }
190
191
192 func (mgh *mgh_MZ) Minus() string {
193 return mgh.minus
194 }
195
196
197 func (mgh *mgh_MZ) FmtNumber(num float64, v uint64) string {
198
199 return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
200 }
201
202
203
204 func (mgh *mgh_MZ) FmtPercent(num float64, v uint64) string {
205 return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
206 }
207
208
209 func (mgh *mgh_MZ) FmtCurrency(num float64, v uint64, currency currency.Type) string {
210
211 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
212 symbol := mgh.currencies[currency]
213 l := len(s) + len(symbol) + 4
214
215 b := make([]byte, 0, l)
216
217 for i := len(s) - 1; i >= 0; i-- {
218
219 if s[i] == '.' {
220 b = append(b, mgh.decimal[0])
221 continue
222 }
223
224 b = append(b, s[i])
225 }
226
227 for j := len(symbol) - 1; j >= 0; j-- {
228 b = append(b, symbol[j])
229 }
230
231 for j := len(mgh.currencyPositivePrefix) - 1; j >= 0; j-- {
232 b = append(b, mgh.currencyPositivePrefix[j])
233 }
234
235 if num < 0 {
236 b = append(b, mgh.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 b = append(b, mgh.currencyPositiveSuffix...)
245
246 return string(b)
247 }
248
249
250
251 func (mgh *mgh_MZ) FmtAccounting(num float64, v uint64, currency currency.Type) string {
252
253 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
254 symbol := mgh.currencies[currency]
255 l := len(s) + len(symbol) + 4
256
257 b := make([]byte, 0, l)
258
259 for i := len(s) - 1; i >= 0; i-- {
260
261 if s[i] == '.' {
262 b = append(b, mgh.decimal[0])
263 continue
264 }
265
266 b = append(b, s[i])
267 }
268
269 if num < 0 {
270
271 for j := len(symbol) - 1; j >= 0; j-- {
272 b = append(b, symbol[j])
273 }
274
275 for j := len(mgh.currencyNegativePrefix) - 1; j >= 0; j-- {
276 b = append(b, mgh.currencyNegativePrefix[j])
277 }
278
279 b = append(b, mgh.minus[0])
280
281 } else {
282
283 for j := len(symbol) - 1; j >= 0; j-- {
284 b = append(b, symbol[j])
285 }
286
287 for j := len(mgh.currencyPositivePrefix) - 1; j >= 0; j-- {
288 b = append(b, mgh.currencyPositivePrefix[j])
289 }
290
291 }
292
293
294 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
295 b[i], b[j] = b[j], b[i]
296 }
297
298 if num < 0 {
299 b = append(b, mgh.currencyNegativeSuffix...)
300 } else {
301
302 b = append(b, mgh.currencyPositiveSuffix...)
303 }
304
305 return string(b)
306 }
307
308
309 func (mgh *mgh_MZ) FmtDateShort(t time.Time) string {
310
311 b := make([]byte, 0, 32)
312
313 if t.Day() < 10 {
314 b = append(b, '0')
315 }
316
317 b = strconv.AppendInt(b, int64(t.Day()), 10)
318 b = append(b, []byte{0x2f}...)
319
320 if t.Month() < 10 {
321 b = append(b, '0')
322 }
323
324 b = strconv.AppendInt(b, int64(t.Month()), 10)
325
326 b = append(b, []byte{0x2f}...)
327
328 if t.Year() > 0 {
329 b = strconv.AppendInt(b, int64(t.Year()), 10)
330 } else {
331 b = strconv.AppendInt(b, int64(-t.Year()), 10)
332 }
333
334 return string(b)
335 }
336
337
338 func (mgh *mgh_MZ) FmtDateMedium(t time.Time) string {
339
340 b := make([]byte, 0, 32)
341
342 b = strconv.AppendInt(b, int64(t.Day()), 10)
343 b = append(b, []byte{0x20}...)
344 b = append(b, mgh.monthsAbbreviated[t.Month()]...)
345 b = append(b, []byte{0x20}...)
346
347 if t.Year() > 0 {
348 b = strconv.AppendInt(b, int64(t.Year()), 10)
349 } else {
350 b = strconv.AppendInt(b, int64(-t.Year()), 10)
351 }
352
353 return string(b)
354 }
355
356
357 func (mgh *mgh_MZ) FmtDateLong(t time.Time) string {
358
359 b := make([]byte, 0, 32)
360
361 b = strconv.AppendInt(b, int64(t.Day()), 10)
362 b = append(b, []byte{0x20}...)
363 b = append(b, mgh.monthsWide[t.Month()]...)
364 b = append(b, []byte{0x20}...)
365
366 if t.Year() > 0 {
367 b = strconv.AppendInt(b, int64(t.Year()), 10)
368 } else {
369 b = strconv.AppendInt(b, int64(-t.Year()), 10)
370 }
371
372 return string(b)
373 }
374
375
376 func (mgh *mgh_MZ) FmtDateFull(t time.Time) string {
377
378 b := make([]byte, 0, 32)
379
380 b = append(b, mgh.daysWide[t.Weekday()]...)
381 b = append(b, []byte{0x2c, 0x20}...)
382 b = strconv.AppendInt(b, int64(t.Day()), 10)
383 b = append(b, []byte{0x20}...)
384 b = append(b, mgh.monthsWide[t.Month()]...)
385 b = append(b, []byte{0x20}...)
386
387 if t.Year() > 0 {
388 b = strconv.AppendInt(b, int64(t.Year()), 10)
389 } else {
390 b = strconv.AppendInt(b, int64(-t.Year()), 10)
391 }
392
393 return string(b)
394 }
395
396
397 func (mgh *mgh_MZ) FmtTimeShort(t time.Time) string {
398
399 b := make([]byte, 0, 32)
400
401 if t.Hour() < 10 {
402 b = append(b, '0')
403 }
404
405 b = strconv.AppendInt(b, int64(t.Hour()), 10)
406 b = append(b, mgh.timeSeparator...)
407
408 if t.Minute() < 10 {
409 b = append(b, '0')
410 }
411
412 b = strconv.AppendInt(b, int64(t.Minute()), 10)
413
414 return string(b)
415 }
416
417
418 func (mgh *mgh_MZ) FmtTimeMedium(t time.Time) string {
419
420 b := make([]byte, 0, 32)
421
422 if t.Hour() < 10 {
423 b = append(b, '0')
424 }
425
426 b = strconv.AppendInt(b, int64(t.Hour()), 10)
427 b = append(b, mgh.timeSeparator...)
428
429 if t.Minute() < 10 {
430 b = append(b, '0')
431 }
432
433 b = strconv.AppendInt(b, int64(t.Minute()), 10)
434 b = append(b, mgh.timeSeparator...)
435
436 if t.Second() < 10 {
437 b = append(b, '0')
438 }
439
440 b = strconv.AppendInt(b, int64(t.Second()), 10)
441
442 return string(b)
443 }
444
445
446 func (mgh *mgh_MZ) FmtTimeLong(t time.Time) string {
447
448 b := make([]byte, 0, 32)
449
450 if t.Hour() < 10 {
451 b = append(b, '0')
452 }
453
454 b = strconv.AppendInt(b, int64(t.Hour()), 10)
455 b = append(b, mgh.timeSeparator...)
456
457 if t.Minute() < 10 {
458 b = append(b, '0')
459 }
460
461 b = strconv.AppendInt(b, int64(t.Minute()), 10)
462 b = append(b, mgh.timeSeparator...)
463
464 if t.Second() < 10 {
465 b = append(b, '0')
466 }
467
468 b = strconv.AppendInt(b, int64(t.Second()), 10)
469 b = append(b, []byte{0x20}...)
470
471 tz, _ := t.Zone()
472 b = append(b, tz...)
473
474 return string(b)
475 }
476
477
478 func (mgh *mgh_MZ) FmtTimeFull(t time.Time) string {
479
480 b := make([]byte, 0, 32)
481
482 if t.Hour() < 10 {
483 b = append(b, '0')
484 }
485
486 b = strconv.AppendInt(b, int64(t.Hour()), 10)
487 b = append(b, mgh.timeSeparator...)
488
489 if t.Minute() < 10 {
490 b = append(b, '0')
491 }
492
493 b = strconv.AppendInt(b, int64(t.Minute()), 10)
494 b = append(b, mgh.timeSeparator...)
495
496 if t.Second() < 10 {
497 b = append(b, '0')
498 }
499
500 b = strconv.AppendInt(b, int64(t.Second()), 10)
501 b = append(b, []byte{0x20}...)
502
503 tz, _ := t.Zone()
504
505 if btz, ok := mgh.timezones[tz]; ok {
506 b = append(b, btz...)
507 } else {
508 b = append(b, tz...)
509 }
510
511 return string(b)
512 }
513
View as plain text