OSDN Git Service

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