OSDN Git Service

delete miner
[bytom/vapor.git] / vendor / github.com / go-playground / locales / luo / luo.go
1 package luo
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 luo 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         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 // New returns a new instance of translator for the 'luo' locale
43 func New() locales.Translator {
44         return &luo{
45                 locale:             "luo",
46                 pluralsCardinal:    nil,
47                 pluralsOrdinal:     nil,
48                 pluralsRange:       nil,
49                 timeSeparator:      ":",
50                 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", "Ksh", "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"},
51                 monthsAbbreviated:  []string{"", "DAC", "DAR", "DAD", "DAN", "DAH", "DAU", "DAO", "DAB", "DOC", "DAP", "DGI", "DAG"},
52                 monthsNarrow:       []string{"", "C", "R", "D", "N", "B", "U", "B", "B", "C", "P", "C", "P"},
53                 monthsWide:         []string{"", "Dwe mar Achiel", "Dwe mar Ariyo", "Dwe mar Adek", "Dwe mar Ang’wen", "Dwe mar Abich", "Dwe mar Auchiel", "Dwe mar Abiriyo", "Dwe mar Aboro", "Dwe mar Ochiko", "Dwe mar Apar", "Dwe mar gi achiel", "Dwe mar Apar gi ariyo"},
54                 daysAbbreviated:    []string{"JMP", "WUT", "TAR", "TAD", "TAN", "TAB", "NGS"},
55                 daysNarrow:         []string{"J", "W", "T", "T", "T", "T", "N"},
56                 daysWide:           []string{"Jumapil", "Wuok Tich", "Tich Ariyo", "Tich Adek", "Tich Ang’wen", "Tich Abich", "Ngeso"},
57                 periodsAbbreviated: []string{"OD", "OT"},
58                 periodsWide:        []string{"OD", "OT"},
59                 erasAbbreviated:    []string{"BC", "AD"},
60                 erasNarrow:         []string{"", ""},
61                 erasWide:           []string{"Kapok Kristo obiro", "Ka Kristo osebiro"},
62                 timezones:          map[string]string{"∅∅∅": "∅∅∅", "EDT": "EDT", "AKST": "AKST", "JST": "JST", "HNT": "HNT", "CDT": "CDT", "LHST": "LHST", "HEEG": "HEEG", "GFT": "GFT", "AKDT": "AKDT", "ACST": "ACST", "ECT": "ECT", "AST": "AST", "AEDT": "AEDT", "CAT": "CAT", "HNNOMX": "HNNOMX", "ART": "ART", "HAT": "HAT", "CLST": "CLST", "GYT": "GYT", "NZDT": "NZDT", "WART": "WART", "ADT": "ADT", "HNOG": "HNOG", "WAST": "WAST", "MDT": "MDT", "AWST": "AWST", "UYST": "UYST", "ARST": "ARST", "HEOG": "HEOG", "ACWST": "ACWST", "MEZ": "MEZ", "OEZ": "OEZ", "HENOMX": "HENOMX", "EAT": "EAT", "HNEG": "HNEG", "WESZ": "WESZ", "HECU": "HECU", "WITA": "WITA", "HKST": "HKST", "WEZ": "WEZ", "GMT": "GMT", "AEST": "AEST", "WAT": "WAT", "HNPM": "HNPM", "BOT": "BOT", "TMST": "TMST", "TMT": "TMT", "UYT": "UYT", "HAST": "HAST", "CLT": "CLT", "EST": "EST", "ACDT": "ACDT", "SGT": "SGT", "BT": "BT", "MYT": "MYT", "HADT": "HADT", "OESZ": "OESZ", "CHAST": "CHAST", "AWDT": "AWDT", "SRT": "SRT", "CHADT": "CHADT", "ACWDT": "ACWDT", "WIT": "WIT", "JDT": "JDT", "HEPM": "HEPM", "NZST": "NZST", "IST": "IST", "SAST": "SAST", "HKT": "HKT", "HEPMX": "HEPMX", "WIB": "WIB", "PST": "PST", "LHDT": "LHDT", "VET": "VET", "CST": "CST", "MST": "MST", "COT": "COT", "COST": "COST", "ChST": "ChST", "HNPMX": "HNPMX", "PDT": "PDT", "HNCU": "HNCU", "MESZ": "MESZ", "WARST": "WARST"},
63         }
64 }
65
66 // Locale returns the current translators string locale
67 func (luo *luo) Locale() string {
68         return luo.locale
69 }
70
71 // PluralsCardinal returns the list of cardinal plural rules associated with 'luo'
72 func (luo *luo) PluralsCardinal() []locales.PluralRule {
73         return luo.pluralsCardinal
74 }
75
76 // PluralsOrdinal returns the list of ordinal plural rules associated with 'luo'
77 func (luo *luo) PluralsOrdinal() []locales.PluralRule {
78         return luo.pluralsOrdinal
79 }
80
81 // PluralsRange returns the list of range plural rules associated with 'luo'
82 func (luo *luo) PluralsRange() []locales.PluralRule {
83         return luo.pluralsRange
84 }
85
86 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'luo'
87 func (luo *luo) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
88         return locales.PluralRuleUnknown
89 }
90
91 // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'luo'
92 func (luo *luo) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
93         return locales.PluralRuleUnknown
94 }
95
96 // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'luo'
97 func (luo *luo) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
98         return locales.PluralRuleUnknown
99 }
100
101 // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
102 func (luo *luo) MonthAbbreviated(month time.Month) string {
103         return luo.monthsAbbreviated[month]
104 }
105
106 // MonthsAbbreviated returns the locales abbreviated months
107 func (luo *luo) MonthsAbbreviated() []string {
108         return luo.monthsAbbreviated[1:]
109 }
110
111 // MonthNarrow returns the locales narrow month given the 'month' provided
112 func (luo *luo) MonthNarrow(month time.Month) string {
113         return luo.monthsNarrow[month]
114 }
115
116 // MonthsNarrow returns the locales narrow months
117 func (luo *luo) MonthsNarrow() []string {
118         return luo.monthsNarrow[1:]
119 }
120
121 // MonthWide returns the locales wide month given the 'month' provided
122 func (luo *luo) MonthWide(month time.Month) string {
123         return luo.monthsWide[month]
124 }
125
126 // MonthsWide returns the locales wide months
127 func (luo *luo) MonthsWide() []string {
128         return luo.monthsWide[1:]
129 }
130
131 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
132 func (luo *luo) WeekdayAbbreviated(weekday time.Weekday) string {
133         return luo.daysAbbreviated[weekday]
134 }
135
136 // WeekdaysAbbreviated returns the locales abbreviated weekdays
137 func (luo *luo) WeekdaysAbbreviated() []string {
138         return luo.daysAbbreviated
139 }
140
141 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
142 func (luo *luo) WeekdayNarrow(weekday time.Weekday) string {
143         return luo.daysNarrow[weekday]
144 }
145
146 // WeekdaysNarrow returns the locales narrow weekdays
147 func (luo *luo) WeekdaysNarrow() []string {
148         return luo.daysNarrow
149 }
150
151 // WeekdayShort returns the locales short weekday given the 'weekday' provided
152 func (luo *luo) WeekdayShort(weekday time.Weekday) string {
153         return luo.daysShort[weekday]
154 }
155
156 // WeekdaysShort returns the locales short weekdays
157 func (luo *luo) WeekdaysShort() []string {
158         return luo.daysShort
159 }
160
161 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
162 func (luo *luo) WeekdayWide(weekday time.Weekday) string {
163         return luo.daysWide[weekday]
164 }
165
166 // WeekdaysWide returns the locales wide weekdays
167 func (luo *luo) WeekdaysWide() []string {
168         return luo.daysWide
169 }
170
171 // Decimal returns the decimal point of number
172 func (luo *luo) Decimal() string {
173         return luo.decimal
174 }
175
176 // Group returns the group of number
177 func (luo *luo) Group() string {
178         return luo.group
179 }
180
181 // Group returns the minus sign of number
182 func (luo *luo) Minus() string {
183         return luo.minus
184 }
185
186 // FmtNumber returns 'num' with digits/precision of 'v' for 'luo' and handles both Whole and Real numbers based on 'v'
187 func (luo *luo) FmtNumber(num float64, v uint64) string {
188
189         return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
190 }
191
192 // FmtPercent returns 'num' with digits/precision of 'v' for 'luo' and handles both Whole and Real numbers based on 'v'
193 // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
194 func (luo *luo) FmtPercent(num float64, v uint64) string {
195         return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
196 }
197
198 // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'luo'
199 func (luo *luo) FmtCurrency(num float64, v uint64, currency currency.Type) string {
200
201         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
202         symbol := luo.currencies[currency]
203         l := len(s) + len(symbol) + 0
204         count := 0
205         inWhole := v == 0
206         b := make([]byte, 0, l)
207
208         for i := len(s) - 1; i >= 0; i-- {
209
210                 if s[i] == '.' {
211                         b = append(b, luo.decimal[0])
212                         inWhole = true
213                         continue
214                 }
215
216                 if inWhole {
217                         if count == 3 {
218                                 b = append(b, luo.group[0])
219                                 count = 1
220                         } else {
221                                 count++
222                         }
223                 }
224
225                 b = append(b, s[i])
226         }
227
228         if num < 0 {
229                 b = append(b, luo.minus[0])
230         }
231
232         // reverse
233         for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
234                 b[i], b[j] = b[j], b[i]
235         }
236
237         if int(v) < 2 {
238
239                 if v == 0 {
240                         b = append(b, luo.decimal...)
241                 }
242
243                 for i := 0; i < 2-int(v); i++ {
244                         b = append(b, '0')
245                 }
246         }
247
248         b = append(b, symbol...)
249
250         return string(b)
251 }
252
253 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'luo'
254 // in accounting notation.
255 func (luo *luo) FmtAccounting(num float64, v uint64, currency currency.Type) string {
256
257         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
258         symbol := luo.currencies[currency]
259         l := len(s) + len(symbol) + 0
260         count := 0
261         inWhole := v == 0
262         b := make([]byte, 0, l)
263
264         for i := len(s) - 1; i >= 0; i-- {
265
266                 if s[i] == '.' {
267                         b = append(b, luo.decimal[0])
268                         inWhole = true
269                         continue
270                 }
271
272                 if inWhole {
273                         if count == 3 {
274                                 b = append(b, luo.group[0])
275                                 count = 1
276                         } else {
277                                 count++
278                         }
279                 }
280
281                 b = append(b, s[i])
282         }
283
284         if num < 0 {
285
286                 b = append(b, luo.minus[0])
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 int(v) < 2 {
296
297                 if v == 0 {
298                         b = append(b, luo.decimal...)
299                 }
300
301                 for i := 0; i < 2-int(v); i++ {
302                         b = append(b, '0')
303                 }
304         }
305
306         if num < 0 {
307                 b = append(b, symbol...)
308         } else {
309
310                 b = append(b, symbol...)
311         }
312
313         return string(b)
314 }
315
316 // FmtDateShort returns the short date representation of 't' for 'luo'
317 func (luo *luo) FmtDateShort(t time.Time) string {
318
319         b := make([]byte, 0, 32)
320
321         if t.Day() < 10 {
322                 b = append(b, '0')
323         }
324
325         b = strconv.AppendInt(b, int64(t.Day()), 10)
326         b = append(b, []byte{0x2f}...)
327
328         if t.Month() < 10 {
329                 b = append(b, '0')
330         }
331
332         b = strconv.AppendInt(b, int64(t.Month()), 10)
333
334         b = append(b, []byte{0x2f}...)
335
336         if t.Year() > 0 {
337                 b = strconv.AppendInt(b, int64(t.Year()), 10)
338         } else {
339                 b = strconv.AppendInt(b, int64(-t.Year()), 10)
340         }
341
342         return string(b)
343 }
344
345 // FmtDateMedium returns the medium date representation of 't' for 'luo'
346 func (luo *luo) FmtDateMedium(t time.Time) string {
347
348         b := make([]byte, 0, 32)
349
350         b = strconv.AppendInt(b, int64(t.Day()), 10)
351         b = append(b, []byte{0x20}...)
352         b = append(b, luo.monthsAbbreviated[t.Month()]...)
353         b = append(b, []byte{0x20}...)
354
355         if t.Year() > 0 {
356                 b = strconv.AppendInt(b, int64(t.Year()), 10)
357         } else {
358                 b = strconv.AppendInt(b, int64(-t.Year()), 10)
359         }
360
361         return string(b)
362 }
363
364 // FmtDateLong returns the long date representation of 't' for 'luo'
365 func (luo *luo) FmtDateLong(t time.Time) string {
366
367         b := make([]byte, 0, 32)
368
369         b = strconv.AppendInt(b, int64(t.Day()), 10)
370         b = append(b, []byte{0x20}...)
371         b = append(b, luo.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 // FmtDateFull returns the full date representation of 't' for 'luo'
384 func (luo *luo) FmtDateFull(t time.Time) string {
385
386         b := make([]byte, 0, 32)
387
388         b = append(b, luo.daysWide[t.Weekday()]...)
389         b = append(b, []byte{0x2c, 0x20}...)
390         b = strconv.AppendInt(b, int64(t.Day()), 10)
391         b = append(b, []byte{0x20}...)
392         b = append(b, luo.monthsWide[t.Month()]...)
393         b = append(b, []byte{0x20}...)
394
395         if t.Year() > 0 {
396                 b = strconv.AppendInt(b, int64(t.Year()), 10)
397         } else {
398                 b = strconv.AppendInt(b, int64(-t.Year()), 10)
399         }
400
401         return string(b)
402 }
403
404 // FmtTimeShort returns the short time representation of 't' for 'luo'
405 func (luo *luo) FmtTimeShort(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, luo.timeSeparator...)
415
416         if t.Minute() < 10 {
417                 b = append(b, '0')
418         }
419
420         b = strconv.AppendInt(b, int64(t.Minute()), 10)
421
422         return string(b)
423 }
424
425 // FmtTimeMedium returns the medium time representation of 't' for 'luo'
426 func (luo *luo) FmtTimeMedium(t time.Time) string {
427
428         b := make([]byte, 0, 32)
429
430         if t.Hour() < 10 {
431                 b = append(b, '0')
432         }
433
434         b = strconv.AppendInt(b, int64(t.Hour()), 10)
435         b = append(b, luo.timeSeparator...)
436
437         if t.Minute() < 10 {
438                 b = append(b, '0')
439         }
440
441         b = strconv.AppendInt(b, int64(t.Minute()), 10)
442         b = append(b, luo.timeSeparator...)
443
444         if t.Second() < 10 {
445                 b = append(b, '0')
446         }
447
448         b = strconv.AppendInt(b, int64(t.Second()), 10)
449
450         return string(b)
451 }
452
453 // FmtTimeLong returns the long time representation of 't' for 'luo'
454 func (luo *luo) FmtTimeLong(t time.Time) string {
455
456         b := make([]byte, 0, 32)
457
458         if t.Hour() < 10 {
459                 b = append(b, '0')
460         }
461
462         b = strconv.AppendInt(b, int64(t.Hour()), 10)
463         b = append(b, luo.timeSeparator...)
464
465         if t.Minute() < 10 {
466                 b = append(b, '0')
467         }
468
469         b = strconv.AppendInt(b, int64(t.Minute()), 10)
470         b = append(b, luo.timeSeparator...)
471
472         if t.Second() < 10 {
473                 b = append(b, '0')
474         }
475
476         b = strconv.AppendInt(b, int64(t.Second()), 10)
477         b = append(b, []byte{0x20}...)
478
479         tz, _ := t.Zone()
480         b = append(b, tz...)
481
482         return string(b)
483 }
484
485 // FmtTimeFull returns the full time representation of 't' for 'luo'
486 func (luo *luo) FmtTimeFull(t time.Time) string {
487
488         b := make([]byte, 0, 32)
489
490         if t.Hour() < 10 {
491                 b = append(b, '0')
492         }
493
494         b = strconv.AppendInt(b, int64(t.Hour()), 10)
495         b = append(b, luo.timeSeparator...)
496
497         if t.Minute() < 10 {
498                 b = append(b, '0')
499         }
500
501         b = strconv.AppendInt(b, int64(t.Minute()), 10)
502         b = append(b, luo.timeSeparator...)
503
504         if t.Second() < 10 {
505                 b = append(b, '0')
506         }
507
508         b = strconv.AppendInt(b, int64(t.Second()), 10)
509         b = append(b, []byte{0x20}...)
510
511         tz, _ := t.Zone()
512
513         if btz, ok := luo.timezones[tz]; ok {
514                 b = append(b, btz...)
515         } else {
516                 b = append(b, tz...)
517         }
518
519         return string(b)
520 }