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