OSDN Git Service

new repo
[bytom/vapor.git] / vendor / github.com / go-playground / locales / mfe_MU / mfe_MU.go
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 // idx = enum of currency code
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 // New returns a new instance of translator for the 'mfe_MU' locale
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", "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", "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", "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", "UZS", "VEB", "VEF", "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{"CHAST": "CHAST", "JDT": "JDT", "EAT": "EAT", "AKST": "AKST", "GFT": "GFT", "CAT": "CAT", "AEST": "AEST", "GMT": "GMT", "CST": "CST", "MDT": "MDT", "HAST": "HAST", "LHST": "LHST", "ARST": "ARST", "AWDT": "AWDT", "OESZ": "OESZ", "ACDT": "ACDT", "SGT": "SGT", "ART": "ART", "CLT": "CLT", "EST": "EST", "WEZ": "WEZ", "HEOG": "HEOG", "SAST": "SAST", "HNT": "HNT", "AKDT": "AKDT", "HEPMX": "HEPMX", "HNCU": "HNCU", "MYT": "MYT", "TMT": "TMT", "LHDT": "LHDT", "IST": "IST", "WAST": "WAST", "WESZ": "WESZ", "HECU": "HECU", "CDT": "CDT", "NZDT": "NZDT", "VET": "VET", "OEZ": "OEZ", "PDT": "PDT", "MST": "MST", "WAT": "WAT", "CLST": "CLST", "HKST": "HKST", "ChST": "ChST", "ACWDT": "ACWDT", "TMST": "TMST", "WARST": "WARST", "HENOMX": "HENOMX", "HKT": "HKT", "NZST": "NZST", "HADT": "HADT", "WART": "WART", "∅∅∅": "∅∅∅", "AWST": "AWST", "UYT": "UYT", "WIT": "WIT", "ACWST": "ACWST", "EDT": "EDT", "GYT": "GYT", "WITA": "WITA", "JST": "JST", "HNOG": "HNOG", "ADT": "ADT", "HAT": "HAT", "BT": "BT", "BOT": "BOT", "AST": "AST", "ACST": "ACST", "HNPMX": "HNPMX", "HEEG": "HEEG", "HEPM": "HEPM", "SRT": "SRT", "UYST": "UYST", "HNNOMX": "HNNOMX", "HNEG": "HNEG", "WIB": "WIB", "HNPM": "HNPM", "PST": "PST", "MEZ": "MEZ", "MESZ": "MESZ", "COST": "COST", "CHADT": "CHADT", "AEDT": "AEDT", "COT": "COT", "ECT": "ECT"},
70         }
71 }
72
73 // Locale returns the current translators string locale
74 func (mfe *mfe_MU) Locale() string {
75         return mfe.locale
76 }
77
78 // PluralsCardinal returns the list of cardinal plural rules associated with 'mfe_MU'
79 func (mfe *mfe_MU) PluralsCardinal() []locales.PluralRule {
80         return mfe.pluralsCardinal
81 }
82
83 // PluralsOrdinal returns the list of ordinal plural rules associated with 'mfe_MU'
84 func (mfe *mfe_MU) PluralsOrdinal() []locales.PluralRule {
85         return mfe.pluralsOrdinal
86 }
87
88 // PluralsRange returns the list of range plural rules associated with 'mfe_MU'
89 func (mfe *mfe_MU) PluralsRange() []locales.PluralRule {
90         return mfe.pluralsRange
91 }
92
93 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'mfe_MU'
94 func (mfe *mfe_MU) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
95         return locales.PluralRuleUnknown
96 }
97
98 // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'mfe_MU'
99 func (mfe *mfe_MU) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
100         return locales.PluralRuleUnknown
101 }
102
103 // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'mfe_MU'
104 func (mfe *mfe_MU) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
105         return locales.PluralRuleUnknown
106 }
107
108 // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
109 func (mfe *mfe_MU) MonthAbbreviated(month time.Month) string {
110         return mfe.monthsAbbreviated[month]
111 }
112
113 // MonthsAbbreviated returns the locales abbreviated months
114 func (mfe *mfe_MU) MonthsAbbreviated() []string {
115         return mfe.monthsAbbreviated[1:]
116 }
117
118 // MonthNarrow returns the locales narrow month given the 'month' provided
119 func (mfe *mfe_MU) MonthNarrow(month time.Month) string {
120         return mfe.monthsNarrow[month]
121 }
122
123 // MonthsNarrow returns the locales narrow months
124 func (mfe *mfe_MU) MonthsNarrow() []string {
125         return mfe.monthsNarrow[1:]
126 }
127
128 // MonthWide returns the locales wide month given the 'month' provided
129 func (mfe *mfe_MU) MonthWide(month time.Month) string {
130         return mfe.monthsWide[month]
131 }
132
133 // MonthsWide returns the locales wide months
134 func (mfe *mfe_MU) MonthsWide() []string {
135         return mfe.monthsWide[1:]
136 }
137
138 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
139 func (mfe *mfe_MU) WeekdayAbbreviated(weekday time.Weekday) string {
140         return mfe.daysAbbreviated[weekday]
141 }
142
143 // WeekdaysAbbreviated returns the locales abbreviated weekdays
144 func (mfe *mfe_MU) WeekdaysAbbreviated() []string {
145         return mfe.daysAbbreviated
146 }
147
148 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
149 func (mfe *mfe_MU) WeekdayNarrow(weekday time.Weekday) string {
150         return mfe.daysNarrow[weekday]
151 }
152
153 // WeekdaysNarrow returns the locales narrow weekdays
154 func (mfe *mfe_MU) WeekdaysNarrow() []string {
155         return mfe.daysNarrow
156 }
157
158 // WeekdayShort returns the locales short weekday given the 'weekday' provided
159 func (mfe *mfe_MU) WeekdayShort(weekday time.Weekday) string {
160         return mfe.daysShort[weekday]
161 }
162
163 // WeekdaysShort returns the locales short weekdays
164 func (mfe *mfe_MU) WeekdaysShort() []string {
165         return mfe.daysShort
166 }
167
168 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
169 func (mfe *mfe_MU) WeekdayWide(weekday time.Weekday) string {
170         return mfe.daysWide[weekday]
171 }
172
173 // WeekdaysWide returns the locales wide weekdays
174 func (mfe *mfe_MU) WeekdaysWide() []string {
175         return mfe.daysWide
176 }
177
178 // Decimal returns the decimal point of number
179 func (mfe *mfe_MU) Decimal() string {
180         return mfe.decimal
181 }
182
183 // Group returns the group of number
184 func (mfe *mfe_MU) Group() string {
185         return mfe.group
186 }
187
188 // Group returns the minus sign of number
189 func (mfe *mfe_MU) Minus() string {
190         return mfe.minus
191 }
192
193 // FmtNumber returns 'num' with digits/precision of 'v' for 'mfe_MU' and handles both Whole and Real numbers based on 'v'
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 // FmtPercent returns 'num' with digits/precision of 'v' for 'mfe_MU' and handles both Whole and Real numbers based on 'v'
200 // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
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 // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'mfe_MU'
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         // reverse
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 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'mfe_MU'
247 // in accounting notation.
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         // reverse
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 // FmtDateShort returns the short date representation of 't' for 'mfe_MU'
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 // FmtDateMedium returns the medium date representation of 't' for 'mfe_MU'
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 // FmtDateLong returns the long date representation of 't' for 'mfe_MU'
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 // FmtDateFull returns the full date representation of 't' for 'mfe_MU'
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 // FmtTimeShort returns the short time representation of 't' for 'mfe_MU'
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 // FmtTimeMedium returns the medium time representation of 't' for 'mfe_MU'
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 // FmtTimeLong returns the long time representation of 't' for 'mfe_MU'
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 // FmtTimeFull returns the full time representation of 't' for 'mfe_MU'
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 }