1 package shi_Latn
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_Latn 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_Latn{
45 locale: "shi_Latn",
46 pluralsCardinal: []locales.PluralRule{2, 4, 6},
47 pluralsOrdinal: nil,
48 pluralsRange: nil,
49 decimal: ",",
50 group: " ",
51 minus: "-",
52 percent: "%",
53 perMille: "‰",
54 timeSeparator: ":",
55 inifinity: "∞",
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 monthsAbbreviated: []string{"", "inn", "bṛa", "maṛ", "ibr", "may", "yun", "yul", "ɣuc", "cut", "ktu", "nuw", "duj"},
58 monthsNarrow: []string{"", "i", "b", "m", "i", "m", "y", "y", "ɣ", "c", "k", "n", "d"},
59 monthsWide: []string{"", "innayr", "bṛayṛ", "maṛṣ", "ibrir", "mayyu", "yunyu", "yulyuz", "ɣuct", "cutanbir", "ktubr", "nuwanbir", "dujanbir"},
60 daysAbbreviated: []string{"asa", "ayn", "asi", "akṛ", "akw", "asim", "asiḍ"},
61 daysNarrow: []string{"S", "M", "T", "W", "T", "F", "S"},
62 daysWide: []string{"asamas", "aynas", "asinas", "akṛas", "akwas", "asimwas", "asiḍyas"},
63 periodsAbbreviated: []string{"tifawt", "tadggʷat"},
64 periodsNarrow: []string{"", ""},
65 periodsWide: []string{"tifawt", "tadggʷat"},
66 erasAbbreviated: []string{"daɛ", "dfɛ"},
67 erasNarrow: []string{"", ""},
68 erasWide: []string{"dat n ɛisa", "dffir n ɛisa"},
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 (shi *shi_Latn) Locale() string {
75 return shi.locale
76 }
77
78
79 func (shi *shi_Latn) PluralsCardinal() []locales.PluralRule {
80 return shi.pluralsCardinal
81 }
82
83
84 func (shi *shi_Latn) PluralsOrdinal() []locales.PluralRule {
85 return shi.pluralsOrdinal
86 }
87
88
89 func (shi *shi_Latn) PluralsRange() []locales.PluralRule {
90 return shi.pluralsRange
91 }
92
93
94 func (shi *shi_Latn) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
95
96 n := math.Abs(num)
97 i := int64(n)
98
99 if (i == 0) || (n == 1) {
100 return locales.PluralRuleOne
101 } else if n >= 2 && n <= 10 {
102 return locales.PluralRuleFew
103 }
104
105 return locales.PluralRuleOther
106 }
107
108
109 func (shi *shi_Latn) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
110 return locales.PluralRuleUnknown
111 }
112
113
114 func (shi *shi_Latn) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
115 return locales.PluralRuleUnknown
116 }
117
118
119 func (shi *shi_Latn) MonthAbbreviated(month time.Month) string {
120 return shi.monthsAbbreviated[month]
121 }
122
123
124 func (shi *shi_Latn) MonthsAbbreviated() []string {
125 return shi.monthsAbbreviated[1:]
126 }
127
128
129 func (shi *shi_Latn) MonthNarrow(month time.Month) string {
130 return shi.monthsNarrow[month]
131 }
132
133
134 func (shi *shi_Latn) MonthsNarrow() []string {
135 return shi.monthsNarrow[1:]
136 }
137
138
139 func (shi *shi_Latn) MonthWide(month time.Month) string {
140 return shi.monthsWide[month]
141 }
142
143
144 func (shi *shi_Latn) MonthsWide() []string {
145 return shi.monthsWide[1:]
146 }
147
148
149 func (shi *shi_Latn) WeekdayAbbreviated(weekday time.Weekday) string {
150 return shi.daysAbbreviated[weekday]
151 }
152
153
154 func (shi *shi_Latn) WeekdaysAbbreviated() []string {
155 return shi.daysAbbreviated
156 }
157
158
159 func (shi *shi_Latn) WeekdayNarrow(weekday time.Weekday) string {
160 return shi.daysNarrow[weekday]
161 }
162
163
164 func (shi *shi_Latn) WeekdaysNarrow() []string {
165 return shi.daysNarrow
166 }
167
168
169 func (shi *shi_Latn) WeekdayShort(weekday time.Weekday) string {
170 return shi.daysShort[weekday]
171 }
172
173
174 func (shi *shi_Latn) WeekdaysShort() []string {
175 return shi.daysShort
176 }
177
178
179 func (shi *shi_Latn) WeekdayWide(weekday time.Weekday) string {
180 return shi.daysWide[weekday]
181 }
182
183
184 func (shi *shi_Latn) WeekdaysWide() []string {
185 return shi.daysWide
186 }
187
188
189 func (shi *shi_Latn) Decimal() string {
190 return shi.decimal
191 }
192
193
194 func (shi *shi_Latn) Group() string {
195 return shi.group
196 }
197
198
199 func (shi *shi_Latn) Minus() string {
200 return shi.minus
201 }
202
203
204 func (shi *shi_Latn) FmtNumber(num float64, v uint64) string {
205
206 return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
207 }
208
209
210
211 func (shi *shi_Latn) FmtPercent(num float64, v uint64) string {
212 return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
213 }
214
215
216 func (shi *shi_Latn) FmtCurrency(num float64, v uint64, currency currency.Type) string {
217
218 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
219 symbol := shi.currencies[currency]
220 l := len(s) + len(symbol) + 2 + 2*len(s[:len(s)-int(v)-1])/3
221 count := 0
222 inWhole := v == 0
223 b := make([]byte, 0, l)
224
225 for i := len(s) - 1; i >= 0; i-- {
226
227 if s[i] == '.' {
228 b = append(b, shi.decimal[0])
229 inWhole = true
230 continue
231 }
232
233 if inWhole {
234 if count == 3 {
235 for j := len(shi.group) - 1; j >= 0; j-- {
236 b = append(b, shi.group[j])
237 }
238 count = 1
239 } else {
240 count++
241 }
242 }
243
244 b = append(b, s[i])
245 }
246
247 if num < 0 {
248 b = append(b, shi.minus[0])
249 }
250
251
252 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
253 b[i], b[j] = b[j], b[i]
254 }
255
256 if int(v) < 2 {
257
258 if v == 0 {
259 b = append(b, shi.decimal...)
260 }
261
262 for i := 0; i < 2-int(v); i++ {
263 b = append(b, '0')
264 }
265 }
266
267 b = append(b, symbol...)
268
269 return string(b)
270 }
271
272
273
274 func (shi *shi_Latn) FmtAccounting(num float64, v uint64, currency currency.Type) string {
275
276 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
277 symbol := shi.currencies[currency]
278 l := len(s) + len(symbol) + 2 + 2*len(s[:len(s)-int(v)-1])/3
279 count := 0
280 inWhole := v == 0
281 b := make([]byte, 0, l)
282
283 for i := len(s) - 1; i >= 0; i-- {
284
285 if s[i] == '.' {
286 b = append(b, shi.decimal[0])
287 inWhole = true
288 continue
289 }
290
291 if inWhole {
292 if count == 3 {
293 for j := len(shi.group) - 1; j >= 0; j-- {
294 b = append(b, shi.group[j])
295 }
296 count = 1
297 } else {
298 count++
299 }
300 }
301
302 b = append(b, s[i])
303 }
304
305 if num < 0 {
306
307 b = append(b, shi.minus[0])
308
309 }
310
311
312 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
313 b[i], b[j] = b[j], b[i]
314 }
315
316 if int(v) < 2 {
317
318 if v == 0 {
319 b = append(b, shi.decimal...)
320 }
321
322 for i := 0; i < 2-int(v); i++ {
323 b = append(b, '0')
324 }
325 }
326
327 if num < 0 {
328 b = append(b, symbol...)
329 } else {
330
331 b = append(b, symbol...)
332 }
333
334 return string(b)
335 }
336
337
338 func (shi *shi_Latn) FmtDateShort(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{0x2f}...)
344 b = strconv.AppendInt(b, int64(t.Month()), 10)
345 b = append(b, []byte{0x2f}...)
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 (shi *shi_Latn) FmtDateMedium(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, shi.monthsAbbreviated[t.Month()]...)
364 b = append(b, []byte{0x2c, 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 (shi *shi_Latn) FmtDateLong(t time.Time) string {
377
378 b := make([]byte, 0, 32)
379
380 b = strconv.AppendInt(b, int64(t.Day()), 10)
381 b = append(b, []byte{0x20}...)
382 b = append(b, shi.monthsWide[t.Month()]...)
383 b = append(b, []byte{0x20}...)
384
385 if t.Year() > 0 {
386 b = strconv.AppendInt(b, int64(t.Year()), 10)
387 } else {
388 b = strconv.AppendInt(b, int64(-t.Year()), 10)
389 }
390
391 return string(b)
392 }
393
394
395 func (shi *shi_Latn) FmtDateFull(t time.Time) string {
396
397 b := make([]byte, 0, 32)
398
399 b = append(b, shi.daysWide[t.Weekday()]...)
400 b = append(b, []byte{0x20}...)
401 b = strconv.AppendInt(b, int64(t.Day()), 10)
402 b = append(b, []byte{0x20}...)
403 b = append(b, shi.monthsWide[t.Month()]...)
404 b = append(b, []byte{0x20}...)
405
406 if t.Year() > 0 {
407 b = strconv.AppendInt(b, int64(t.Year()), 10)
408 } else {
409 b = strconv.AppendInt(b, int64(-t.Year()), 10)
410 }
411
412 return string(b)
413 }
414
415
416 func (shi *shi_Latn) FmtTimeShort(t time.Time) string {
417
418 b := make([]byte, 0, 32)
419
420 if t.Hour() < 10 {
421 b = append(b, '0')
422 }
423
424 b = strconv.AppendInt(b, int64(t.Hour()), 10)
425 b = append(b, shi.timeSeparator...)
426
427 if t.Minute() < 10 {
428 b = append(b, '0')
429 }
430
431 b = strconv.AppendInt(b, int64(t.Minute()), 10)
432
433 return string(b)
434 }
435
436
437 func (shi *shi_Latn) FmtTimeMedium(t time.Time) string {
438
439 b := make([]byte, 0, 32)
440
441 if t.Hour() < 10 {
442 b = append(b, '0')
443 }
444
445 b = strconv.AppendInt(b, int64(t.Hour()), 10)
446 b = append(b, shi.timeSeparator...)
447
448 if t.Minute() < 10 {
449 b = append(b, '0')
450 }
451
452 b = strconv.AppendInt(b, int64(t.Minute()), 10)
453 b = append(b, shi.timeSeparator...)
454
455 if t.Second() < 10 {
456 b = append(b, '0')
457 }
458
459 b = strconv.AppendInt(b, int64(t.Second()), 10)
460
461 return string(b)
462 }
463
464
465 func (shi *shi_Latn) FmtTimeLong(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, shi.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, shi.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 b = append(b, tz...)
492
493 return string(b)
494 }
495
496
497 func (shi *shi_Latn) FmtTimeFull(t time.Time) string {
498
499 b := make([]byte, 0, 32)
500
501 if t.Hour() < 10 {
502 b = append(b, '0')
503 }
504
505 b = strconv.AppendInt(b, int64(t.Hour()), 10)
506 b = append(b, shi.timeSeparator...)
507
508 if t.Minute() < 10 {
509 b = append(b, '0')
510 }
511
512 b = strconv.AppendInt(b, int64(t.Minute()), 10)
513 b = append(b, shi.timeSeparator...)
514
515 if t.Second() < 10 {
516 b = append(b, '0')
517 }
518
519 b = strconv.AppendInt(b, int64(t.Second()), 10)
520 b = append(b, []byte{0x20}...)
521
522 tz, _ := t.Zone()
523
524 if btz, ok := shi.timezones[tz]; ok {
525 b = append(b, btz...)
526 } else {
527 b = append(b, tz...)
528 }
529
530 return string(b)
531 }
532
View as plain text