8 "github.com/go-playground/locales"
9 "github.com/go-playground/locales/currency"
14 pluralsCardinal []locales.PluralRule
15 pluralsOrdinal []locales.PluralRule
16 pluralsRange []locales.PluralRule
24 currencies []string // idx = enum of currency code
25 currencyPositivePrefix string
26 currencyPositiveSuffix string
27 currencyNegativePrefix string
28 currencyNegativeSuffix string
29 monthsAbbreviated []string
32 daysAbbreviated []string
36 periodsAbbreviated []string
37 periodsNarrow []string
40 erasAbbreviated []string
43 timezones map[string]string
46 // New returns a new instance of translator for the 'mfe_MU' locale
47 func New() locales.Translator {
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"},
73 // Locale returns the current translators string locale
74 func (mfe *mfe_MU) Locale() string {
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
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
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
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
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
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
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]
113 // MonthsAbbreviated returns the locales abbreviated months
114 func (mfe *mfe_MU) MonthsAbbreviated() []string {
115 return mfe.monthsAbbreviated[1:]
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]
123 // MonthsNarrow returns the locales narrow months
124 func (mfe *mfe_MU) MonthsNarrow() []string {
125 return mfe.monthsNarrow[1:]
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]
133 // MonthsWide returns the locales wide months
134 func (mfe *mfe_MU) MonthsWide() []string {
135 return mfe.monthsWide[1:]
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]
143 // WeekdaysAbbreviated returns the locales abbreviated weekdays
144 func (mfe *mfe_MU) WeekdaysAbbreviated() []string {
145 return mfe.daysAbbreviated
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]
153 // WeekdaysNarrow returns the locales narrow weekdays
154 func (mfe *mfe_MU) WeekdaysNarrow() []string {
155 return mfe.daysNarrow
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]
163 // WeekdaysShort returns the locales short weekdays
164 func (mfe *mfe_MU) WeekdaysShort() []string {
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]
173 // WeekdaysWide returns the locales wide weekdays
174 func (mfe *mfe_MU) WeekdaysWide() []string {
178 // Decimal returns the decimal point of number
179 func (mfe *mfe_MU) Decimal() string {
183 // Group returns the group of number
184 func (mfe *mfe_MU) Group() string {
188 // Group returns the minus sign of number
189 func (mfe *mfe_MU) Minus() string {
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 {
196 return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
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)
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 {
208 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
209 symbol := mfe.currencies[currency]
210 l := len(s) + len(symbol) + 3
212 b := make([]byte, 0, l)
214 for i := len(s) - 1; i >= 0; i-- {
217 b = append(b, mfe.decimal[0])
224 for j := len(symbol) - 1; j >= 0; j-- {
225 b = append(b, symbol[j])
228 for j := len(mfe.currencyPositivePrefix) - 1; j >= 0; j-- {
229 b = append(b, mfe.currencyPositivePrefix[j])
233 b = append(b, mfe.minus[0])
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]
241 b = append(b, mfe.currencyPositiveSuffix...)
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 {
250 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
251 symbol := mfe.currencies[currency]
252 l := len(s) + len(symbol) + 3
254 b := make([]byte, 0, l)
256 for i := len(s) - 1; i >= 0; i-- {
259 b = append(b, mfe.decimal[0])
268 for j := len(symbol) - 1; j >= 0; j-- {
269 b = append(b, symbol[j])
272 for j := len(mfe.currencyNegativePrefix) - 1; j >= 0; j-- {
273 b = append(b, mfe.currencyNegativePrefix[j])
276 b = append(b, mfe.minus[0])
280 for j := len(symbol) - 1; j >= 0; j-- {
281 b = append(b, symbol[j])
284 for j := len(mfe.currencyPositivePrefix) - 1; j >= 0; j-- {
285 b = append(b, mfe.currencyPositivePrefix[j])
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]
296 b = append(b, mfe.currencyNegativeSuffix...)
299 b = append(b, mfe.currencyPositiveSuffix...)
305 // FmtDateShort returns the short date representation of 't' for 'mfe_MU'
306 func (mfe *mfe_MU) FmtDateShort(t time.Time) string {
308 b := make([]byte, 0, 32)
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}...)
316 b = strconv.AppendInt(b, int64(t.Year()), 10)
318 b = strconv.AppendInt(b, int64(-t.Year()), 10)
324 // FmtDateMedium returns the medium date representation of 't' for 'mfe_MU'
325 func (mfe *mfe_MU) FmtDateMedium(t time.Time) string {
327 b := make([]byte, 0, 32)
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}...)
335 b = strconv.AppendInt(b, int64(t.Year()), 10)
337 b = strconv.AppendInt(b, int64(-t.Year()), 10)
343 // FmtDateLong returns the long date representation of 't' for 'mfe_MU'
344 func (mfe *mfe_MU) FmtDateLong(t time.Time) string {
346 b := make([]byte, 0, 32)
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}...)
354 b = strconv.AppendInt(b, int64(t.Year()), 10)
356 b = strconv.AppendInt(b, int64(-t.Year()), 10)
362 // FmtDateFull returns the full date representation of 't' for 'mfe_MU'
363 func (mfe *mfe_MU) FmtDateFull(t time.Time) string {
365 b := make([]byte, 0, 32)
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}...)
375 b = strconv.AppendInt(b, int64(t.Year()), 10)
377 b = strconv.AppendInt(b, int64(-t.Year()), 10)
383 // FmtTimeShort returns the short time representation of 't' for 'mfe_MU'
384 func (mfe *mfe_MU) FmtTimeShort(t time.Time) string {
386 b := make([]byte, 0, 32)
392 b = strconv.AppendInt(b, int64(t.Hour()), 10)
393 b = append(b, mfe.timeSeparator...)
399 b = strconv.AppendInt(b, int64(t.Minute()), 10)
404 // FmtTimeMedium returns the medium time representation of 't' for 'mfe_MU'
405 func (mfe *mfe_MU) FmtTimeMedium(t time.Time) string {
407 b := make([]byte, 0, 32)
413 b = strconv.AppendInt(b, int64(t.Hour()), 10)
414 b = append(b, mfe.timeSeparator...)
420 b = strconv.AppendInt(b, int64(t.Minute()), 10)
421 b = append(b, mfe.timeSeparator...)
427 b = strconv.AppendInt(b, int64(t.Second()), 10)
432 // FmtTimeLong returns the long time representation of 't' for 'mfe_MU'
433 func (mfe *mfe_MU) FmtTimeLong(t time.Time) string {
435 b := make([]byte, 0, 32)
441 b = strconv.AppendInt(b, int64(t.Hour()), 10)
442 b = append(b, mfe.timeSeparator...)
448 b = strconv.AppendInt(b, int64(t.Minute()), 10)
449 b = append(b, mfe.timeSeparator...)
455 b = strconv.AppendInt(b, int64(t.Second()), 10)
456 b = append(b, []byte{0x20}...)
464 // FmtTimeFull returns the full time representation of 't' for 'mfe_MU'
465 func (mfe *mfe_MU) FmtTimeFull(t time.Time) string {
467 b := make([]byte, 0, 32)
473 b = strconv.AppendInt(b, int64(t.Hour()), 10)
474 b = append(b, mfe.timeSeparator...)
480 b = strconv.AppendInt(b, int64(t.Minute()), 10)
481 b = append(b, mfe.timeSeparator...)
487 b = strconv.AppendInt(b, int64(t.Second()), 10)
488 b = append(b, []byte{0x20}...)
492 if btz, ok := mfe.timezones[tz]; ok {
493 b = append(b, btz...)