1 package shi_Tfng_MA
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 shi_Tfng_MA 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 &shi_Tfng_MA{
45 locale: "shi_Tfng_MA",
46 pluralsCardinal: []locales.PluralRule{2, 4, 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{"", "ⵉⵏⵏ", "ⴱⵕⴰ", "ⵎⴰⵕ", "ⵉⴱⵔ", "ⵎⴰⵢ", "ⵢⵓⵏ", "ⵢⵓⵍ", "ⵖⵓⵛ", "ⵛⵓⵜ", "ⴽⵜⵓ", "ⵏⵓⵡ", "ⴷⵓⵊ"},
54 monthsNarrow: []string{"", "ⵉ", "ⴱ", "ⵎ", "ⵉ", "ⵎ", "ⵢ", "ⵢ", "ⵖ", "ⵛ", "ⴽ", "ⵏ", "ⴷ"},
55 monthsWide: []string{"", "ⵉⵏⵏⴰⵢⵔ", "ⴱⵕⴰⵢⵕ", "ⵎⴰⵕⵚ", "ⵉⴱⵔⵉⵔ", "ⵎⴰⵢⵢⵓ", "ⵢⵓⵏⵢⵓ", "ⵢⵓⵍⵢⵓⵣ", "ⵖⵓⵛⵜ", "ⵛⵓⵜⴰⵏⴱⵉⵔ", "ⴽⵜⵓⴱⵔ", "ⵏⵓⵡⴰⵏⴱⵉⵔ", "ⴷⵓⵊⴰⵏⴱⵉⵔ"},
56 daysAbbreviated: []string{"ⴰⵙⴰ", "ⴰⵢⵏ", "ⴰⵙⵉ", "ⴰⴽⵕ", "ⴰⴽⵡ", "ⴰⵙⵉⵎ", "ⴰⵙⵉⴹ"},
57 daysWide: []string{"ⴰⵙⴰⵎⴰⵙ", "ⴰⵢⵏⴰⵙ", "ⴰⵙⵉⵏⴰⵙ", "ⴰⴽⵕⴰⵙ", "ⴰⴽⵡⴰⵙ", "ⵙⵉⵎⵡⴰⵙ", "ⴰⵙⵉⴹⵢⴰⵙ"},
58 periodsAbbreviated: []string{"ⵜⵉⴼⴰⵡⵜ", "ⵜⴰⴷⴳⴳⵯⴰⵜ"},
59 periodsWide: []string{"ⵜⵉⴼⴰⵡⵜ", "ⵜⴰⴷⴳⴳⵯⴰⵜ"},
60 erasAbbreviated: []string{"ⴷⴰⵄ", "ⴷⴼⵄ"},
61 erasNarrow: []string{"", ""},
62 erasWide: []string{"ⴷⴰⵜ ⵏ ⵄⵉⵙⴰ", "ⴷⴼⴼⵉⵔ ⵏ ⵄⵉⵙⴰ"},
63 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", "∅∅∅": "∅∅∅"},
64 }
65 }
66
67
68 func (shi *shi_Tfng_MA) Locale() string {
69 return shi.locale
70 }
71
72
73 func (shi *shi_Tfng_MA) PluralsCardinal() []locales.PluralRule {
74 return shi.pluralsCardinal
75 }
76
77
78 func (shi *shi_Tfng_MA) PluralsOrdinal() []locales.PluralRule {
79 return shi.pluralsOrdinal
80 }
81
82
83 func (shi *shi_Tfng_MA) PluralsRange() []locales.PluralRule {
84 return shi.pluralsRange
85 }
86
87
88 func (shi *shi_Tfng_MA) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
89
90 n := math.Abs(num)
91 i := int64(n)
92
93 if (i == 0) || (n == 1) {
94 return locales.PluralRuleOne
95 } else if n >= 2 && n <= 10 {
96 return locales.PluralRuleFew
97 }
98
99 return locales.PluralRuleOther
100 }
101
102
103 func (shi *shi_Tfng_MA) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
104 return locales.PluralRuleUnknown
105 }
106
107
108 func (shi *shi_Tfng_MA) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
109 return locales.PluralRuleUnknown
110 }
111
112
113 func (shi *shi_Tfng_MA) MonthAbbreviated(month time.Month) string {
114 return shi.monthsAbbreviated[month]
115 }
116
117
118 func (shi *shi_Tfng_MA) MonthsAbbreviated() []string {
119 return shi.monthsAbbreviated[1:]
120 }
121
122
123 func (shi *shi_Tfng_MA) MonthNarrow(month time.Month) string {
124 return shi.monthsNarrow[month]
125 }
126
127
128 func (shi *shi_Tfng_MA) MonthsNarrow() []string {
129 return shi.monthsNarrow[1:]
130 }
131
132
133 func (shi *shi_Tfng_MA) MonthWide(month time.Month) string {
134 return shi.monthsWide[month]
135 }
136
137
138 func (shi *shi_Tfng_MA) MonthsWide() []string {
139 return shi.monthsWide[1:]
140 }
141
142
143 func (shi *shi_Tfng_MA) WeekdayAbbreviated(weekday time.Weekday) string {
144 return shi.daysAbbreviated[weekday]
145 }
146
147
148 func (shi *shi_Tfng_MA) WeekdaysAbbreviated() []string {
149 return shi.daysAbbreviated
150 }
151
152
153 func (shi *shi_Tfng_MA) WeekdayNarrow(weekday time.Weekday) string {
154 return shi.daysNarrow[weekday]
155 }
156
157
158 func (shi *shi_Tfng_MA) WeekdaysNarrow() []string {
159 return shi.daysNarrow
160 }
161
162
163 func (shi *shi_Tfng_MA) WeekdayShort(weekday time.Weekday) string {
164 return shi.daysShort[weekday]
165 }
166
167
168 func (shi *shi_Tfng_MA) WeekdaysShort() []string {
169 return shi.daysShort
170 }
171
172
173 func (shi *shi_Tfng_MA) WeekdayWide(weekday time.Weekday) string {
174 return shi.daysWide[weekday]
175 }
176
177
178 func (shi *shi_Tfng_MA) WeekdaysWide() []string {
179 return shi.daysWide
180 }
181
182
183 func (shi *shi_Tfng_MA) Decimal() string {
184 return shi.decimal
185 }
186
187
188 func (shi *shi_Tfng_MA) Group() string {
189 return shi.group
190 }
191
192
193 func (shi *shi_Tfng_MA) Minus() string {
194 return shi.minus
195 }
196
197
198 func (shi *shi_Tfng_MA) FmtNumber(num float64, v uint64) string {
199
200 return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
201 }
202
203
204
205 func (shi *shi_Tfng_MA) FmtPercent(num float64, v uint64) string {
206 return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
207 }
208
209
210 func (shi *shi_Tfng_MA) FmtCurrency(num float64, v uint64, currency currency.Type) string {
211
212 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
213 symbol := shi.currencies[currency]
214 l := len(s) + len(symbol) + 1 + 2*len(s[:len(s)-int(v)-1])/3
215 count := 0
216 inWhole := v == 0
217 b := make([]byte, 0, l)
218
219 for i := len(s) - 1; i >= 0; i-- {
220
221 if s[i] == '.' {
222 b = append(b, shi.decimal[0])
223 inWhole = true
224 continue
225 }
226
227 if inWhole {
228 if count == 3 {
229 for j := len(shi.group) - 1; j >= 0; j-- {
230 b = append(b, shi.group[j])
231 }
232 count = 1
233 } else {
234 count++
235 }
236 }
237
238 b = append(b, s[i])
239 }
240
241 if num < 0 {
242 b = append(b, shi.minus[0])
243 }
244
245
246 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
247 b[i], b[j] = b[j], b[i]
248 }
249
250 if int(v) < 2 {
251
252 if v == 0 {
253 b = append(b, shi.decimal...)
254 }
255
256 for i := 0; i < 2-int(v); i++ {
257 b = append(b, '0')
258 }
259 }
260
261 b = append(b, symbol...)
262
263 return string(b)
264 }
265
266
267
268 func (shi *shi_Tfng_MA) FmtAccounting(num float64, v uint64, currency currency.Type) string {
269
270 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
271 symbol := shi.currencies[currency]
272 l := len(s) + len(symbol) + 1 + 2*len(s[:len(s)-int(v)-1])/3
273 count := 0
274 inWhole := v == 0
275 b := make([]byte, 0, l)
276
277 for i := len(s) - 1; i >= 0; i-- {
278
279 if s[i] == '.' {
280 b = append(b, shi.decimal[0])
281 inWhole = true
282 continue
283 }
284
285 if inWhole {
286 if count == 3 {
287 for j := len(shi.group) - 1; j >= 0; j-- {
288 b = append(b, shi.group[j])
289 }
290 count = 1
291 } else {
292 count++
293 }
294 }
295
296 b = append(b, s[i])
297 }
298
299 if num < 0 {
300
301 b = append(b, shi.minus[0])
302
303 }
304
305
306 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
307 b[i], b[j] = b[j], b[i]
308 }
309
310 if int(v) < 2 {
311
312 if v == 0 {
313 b = append(b, shi.decimal...)
314 }
315
316 for i := 0; i < 2-int(v); i++ {
317 b = append(b, '0')
318 }
319 }
320
321 if num < 0 {
322 b = append(b, symbol...)
323 } else {
324
325 b = append(b, symbol...)
326 }
327
328 return string(b)
329 }
330
331
332 func (shi *shi_Tfng_MA) FmtDateShort(t time.Time) string {
333
334 b := make([]byte, 0, 32)
335
336 b = strconv.AppendInt(b, int64(t.Day()), 10)
337 b = append(b, []byte{0x2f}...)
338 b = strconv.AppendInt(b, int64(t.Month()), 10)
339 b = append(b, []byte{0x2f}...)
340
341 if t.Year() > 0 {
342 b = strconv.AppendInt(b, int64(t.Year()), 10)
343 } else {
344 b = strconv.AppendInt(b, int64(-t.Year()), 10)
345 }
346
347 return string(b)
348 }
349
350
351 func (shi *shi_Tfng_MA) FmtDateMedium(t time.Time) string {
352
353 b := make([]byte, 0, 32)
354
355 b = strconv.AppendInt(b, int64(t.Day()), 10)
356 b = append(b, []byte{0x20}...)
357 b = append(b, shi.monthsAbbreviated[t.Month()]...)
358 b = append(b, []byte{0x2c, 0x20}...)
359
360 if t.Year() > 0 {
361 b = strconv.AppendInt(b, int64(t.Year()), 10)
362 } else {
363 b = strconv.AppendInt(b, int64(-t.Year()), 10)
364 }
365
366 return string(b)
367 }
368
369
370 func (shi *shi_Tfng_MA) FmtDateLong(t time.Time) string {
371
372 b := make([]byte, 0, 32)
373
374 b = strconv.AppendInt(b, int64(t.Day()), 10)
375 b = append(b, []byte{0x20}...)
376 b = append(b, shi.monthsWide[t.Month()]...)
377 b = append(b, []byte{0x20}...)
378
379 if t.Year() > 0 {
380 b = strconv.AppendInt(b, int64(t.Year()), 10)
381 } else {
382 b = strconv.AppendInt(b, int64(-t.Year()), 10)
383 }
384
385 return string(b)
386 }
387
388
389 func (shi *shi_Tfng_MA) FmtDateFull(t time.Time) string {
390
391 b := make([]byte, 0, 32)
392
393 b = append(b, shi.daysWide[t.Weekday()]...)
394 b = append(b, []byte{0x20}...)
395 b = strconv.AppendInt(b, int64(t.Day()), 10)
396 b = append(b, []byte{0x20}...)
397 b = append(b, shi.monthsWide[t.Month()]...)
398 b = append(b, []byte{0x20}...)
399
400 if t.Year() > 0 {
401 b = strconv.AppendInt(b, int64(t.Year()), 10)
402 } else {
403 b = strconv.AppendInt(b, int64(-t.Year()), 10)
404 }
405
406 return string(b)
407 }
408
409
410 func (shi *shi_Tfng_MA) FmtTimeShort(t time.Time) string {
411
412 b := make([]byte, 0, 32)
413
414 return string(b)
415 }
416
417
418 func (shi *shi_Tfng_MA) FmtTimeMedium(t time.Time) string {
419
420 b := make([]byte, 0, 32)
421
422 return string(b)
423 }
424
425
426 func (shi *shi_Tfng_MA) FmtTimeLong(t time.Time) string {
427
428 b := make([]byte, 0, 32)
429
430 return string(b)
431 }
432
433
434 func (shi *shi_Tfng_MA) FmtTimeFull(t time.Time) string {
435
436 b := make([]byte, 0, 32)
437
438 return string(b)
439 }
440
View as plain text