1 package fur_IT
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 fur_IT 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 currencyPositivePrefix string
26 currencyNegativePrefix string
27 monthsAbbreviated []string
28 monthsNarrow []string
29 monthsWide []string
30 daysAbbreviated []string
31 daysNarrow []string
32 daysShort []string
33 daysWide []string
34 periodsAbbreviated []string
35 periodsNarrow []string
36 periodsShort []string
37 periodsWide []string
38 erasAbbreviated []string
39 erasNarrow []string
40 erasWide []string
41 timezones map[string]string
42 }
43
44
45 func New() locales.Translator {
46 return &fur_IT{
47 locale: "fur_IT",
48 pluralsCardinal: []locales.PluralRule{2, 6},
49 pluralsOrdinal: nil,
50 pluralsRange: nil,
51 decimal: ",",
52 group: ".",
53 minus: "-",
54 percent: "%",
55 perMille: "‰",
56 timeSeparator: ":",
57 inifinity: "∞",
58 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"},
59 currencyPositivePrefix: " ",
60 currencyNegativePrefix: " ",
61 monthsAbbreviated: []string{"", "Zen", "Fev", "Mar", "Avr", "Mai", "Jug", "Lui", "Avo", "Set", "Otu", "Nov", "Dic"},
62 monthsNarrow: []string{"", "Z", "F", "M", "A", "M", "J", "L", "A", "S", "O", "N", "D"},
63 monthsWide: []string{"", "Zenâr", "Fevrâr", "Març", "Avrîl", "Mai", "Jugn", "Lui", "Avost", "Setembar", "Otubar", "Novembar", "Dicembar"},
64 daysAbbreviated: []string{"dom", "lun", "mar", "mie", "joi", "vin", "sab"},
65 daysNarrow: []string{"D", "L", "M", "M", "J", "V", "S"},
66 daysWide: []string{"domenie", "lunis", "martars", "miercus", "joibe", "vinars", "sabide"},
67 periodsAbbreviated: []string{"a.", "p."},
68 periodsWide: []string{"a.", "p."},
69 erasAbbreviated: []string{"pdC", "ddC"},
70 erasNarrow: []string{"", ""},
71 erasWide: []string{"", ""},
72 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": "Ore estive de Europe centrâl", "MEZ": "Ore standard de Europe centrâl", "MST": "MST", "MYT": "MYT", "NZDT": "NZDT", "NZST": "NZST", "OESZ": "Ore estive de Europe orientâl", "OEZ": "Ore standard de Europe orientâl", "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": "Ore estive de Europe ocidentâl", "WEZ": "Ore standard de Europe ocidentâl", "WIB": "WIB", "WIT": "WIT", "WITA": "WITA", "∅∅∅": "∅∅∅"},
73 }
74 }
75
76
77 func (fur *fur_IT) Locale() string {
78 return fur.locale
79 }
80
81
82 func (fur *fur_IT) PluralsCardinal() []locales.PluralRule {
83 return fur.pluralsCardinal
84 }
85
86
87 func (fur *fur_IT) PluralsOrdinal() []locales.PluralRule {
88 return fur.pluralsOrdinal
89 }
90
91
92 func (fur *fur_IT) PluralsRange() []locales.PluralRule {
93 return fur.pluralsRange
94 }
95
96
97 func (fur *fur_IT) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
98
99 n := math.Abs(num)
100
101 if n == 1 {
102 return locales.PluralRuleOne
103 }
104
105 return locales.PluralRuleOther
106 }
107
108
109 func (fur *fur_IT) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
110 return locales.PluralRuleUnknown
111 }
112
113
114 func (fur *fur_IT) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
115 return locales.PluralRuleUnknown
116 }
117
118
119 func (fur *fur_IT) MonthAbbreviated(month time.Month) string {
120 return fur.monthsAbbreviated[month]
121 }
122
123
124 func (fur *fur_IT) MonthsAbbreviated() []string {
125 return fur.monthsAbbreviated[1:]
126 }
127
128
129 func (fur *fur_IT) MonthNarrow(month time.Month) string {
130 return fur.monthsNarrow[month]
131 }
132
133
134 func (fur *fur_IT) MonthsNarrow() []string {
135 return fur.monthsNarrow[1:]
136 }
137
138
139 func (fur *fur_IT) MonthWide(month time.Month) string {
140 return fur.monthsWide[month]
141 }
142
143
144 func (fur *fur_IT) MonthsWide() []string {
145 return fur.monthsWide[1:]
146 }
147
148
149 func (fur *fur_IT) WeekdayAbbreviated(weekday time.Weekday) string {
150 return fur.daysAbbreviated[weekday]
151 }
152
153
154 func (fur *fur_IT) WeekdaysAbbreviated() []string {
155 return fur.daysAbbreviated
156 }
157
158
159 func (fur *fur_IT) WeekdayNarrow(weekday time.Weekday) string {
160 return fur.daysNarrow[weekday]
161 }
162
163
164 func (fur *fur_IT) WeekdaysNarrow() []string {
165 return fur.daysNarrow
166 }
167
168
169 func (fur *fur_IT) WeekdayShort(weekday time.Weekday) string {
170 return fur.daysShort[weekday]
171 }
172
173
174 func (fur *fur_IT) WeekdaysShort() []string {
175 return fur.daysShort
176 }
177
178
179 func (fur *fur_IT) WeekdayWide(weekday time.Weekday) string {
180 return fur.daysWide[weekday]
181 }
182
183
184 func (fur *fur_IT) WeekdaysWide() []string {
185 return fur.daysWide
186 }
187
188
189 func (fur *fur_IT) Decimal() string {
190 return fur.decimal
191 }
192
193
194 func (fur *fur_IT) Group() string {
195 return fur.group
196 }
197
198
199 func (fur *fur_IT) Minus() string {
200 return fur.minus
201 }
202
203
204 func (fur *fur_IT) FmtNumber(num float64, v uint64) string {
205
206 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
207 l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
208 count := 0
209 inWhole := v == 0
210 b := make([]byte, 0, l)
211
212 for i := len(s) - 1; i >= 0; i-- {
213
214 if s[i] == '.' {
215 b = append(b, fur.decimal[0])
216 inWhole = true
217 continue
218 }
219
220 if inWhole {
221 if count == 3 {
222 b = append(b, fur.group[0])
223 count = 1
224 } else {
225 count++
226 }
227 }
228
229 b = append(b, s[i])
230 }
231
232 if num < 0 {
233 b = append(b, fur.minus[0])
234 }
235
236
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]
239 }
240
241 return string(b)
242 }
243
244
245
246 func (fur *fur_IT) FmtPercent(num float64, v uint64) string {
247 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
248 l := len(s) + 3
249 b := make([]byte, 0, l)
250
251 for i := len(s) - 1; i >= 0; i-- {
252
253 if s[i] == '.' {
254 b = append(b, fur.decimal[0])
255 continue
256 }
257
258 b = append(b, s[i])
259 }
260
261 if num < 0 {
262 b = append(b, fur.minus[0])
263 }
264
265
266 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
267 b[i], b[j] = b[j], b[i]
268 }
269
270 b = append(b, fur.percent...)
271
272 return string(b)
273 }
274
275
276 func (fur *fur_IT) FmtCurrency(num float64, v uint64, currency currency.Type) string {
277
278 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
279 symbol := fur.currencies[currency]
280 l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
281 count := 0
282 inWhole := v == 0
283 b := make([]byte, 0, l)
284
285 for i := len(s) - 1; i >= 0; i-- {
286
287 if s[i] == '.' {
288 b = append(b, fur.decimal[0])
289 inWhole = true
290 continue
291 }
292
293 if inWhole {
294 if count == 3 {
295 b = append(b, fur.group[0])
296 count = 1
297 } else {
298 count++
299 }
300 }
301
302 b = append(b, s[i])
303 }
304
305 for j := len(symbol) - 1; j >= 0; j-- {
306 b = append(b, symbol[j])
307 }
308
309 for j := len(fur.currencyPositivePrefix) - 1; j >= 0; j-- {
310 b = append(b, fur.currencyPositivePrefix[j])
311 }
312
313 if num < 0 {
314 b = append(b, fur.minus[0])
315 }
316
317
318 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
319 b[i], b[j] = b[j], b[i]
320 }
321
322 if int(v) < 2 {
323
324 if v == 0 {
325 b = append(b, fur.decimal...)
326 }
327
328 for i := 0; i < 2-int(v); i++ {
329 b = append(b, '0')
330 }
331 }
332
333 return string(b)
334 }
335
336
337
338 func (fur *fur_IT) FmtAccounting(num float64, v uint64, currency currency.Type) string {
339
340 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
341 symbol := fur.currencies[currency]
342 l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
343 count := 0
344 inWhole := v == 0
345 b := make([]byte, 0, l)
346
347 for i := len(s) - 1; i >= 0; i-- {
348
349 if s[i] == '.' {
350 b = append(b, fur.decimal[0])
351 inWhole = true
352 continue
353 }
354
355 if inWhole {
356 if count == 3 {
357 b = append(b, fur.group[0])
358 count = 1
359 } else {
360 count++
361 }
362 }
363
364 b = append(b, s[i])
365 }
366
367 if num < 0 {
368
369 for j := len(symbol) - 1; j >= 0; j-- {
370 b = append(b, symbol[j])
371 }
372
373 for j := len(fur.currencyNegativePrefix) - 1; j >= 0; j-- {
374 b = append(b, fur.currencyNegativePrefix[j])
375 }
376
377 b = append(b, fur.minus[0])
378
379 } else {
380
381 for j := len(symbol) - 1; j >= 0; j-- {
382 b = append(b, symbol[j])
383 }
384
385 for j := len(fur.currencyPositivePrefix) - 1; j >= 0; j-- {
386 b = append(b, fur.currencyPositivePrefix[j])
387 }
388
389 }
390
391
392 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
393 b[i], b[j] = b[j], b[i]
394 }
395
396 if int(v) < 2 {
397
398 if v == 0 {
399 b = append(b, fur.decimal...)
400 }
401
402 for i := 0; i < 2-int(v); i++ {
403 b = append(b, '0')
404 }
405 }
406
407 return string(b)
408 }
409
410
411 func (fur *fur_IT) FmtDateShort(t time.Time) string {
412
413 b := make([]byte, 0, 32)
414
415 if t.Day() < 10 {
416 b = append(b, '0')
417 }
418
419 b = strconv.AppendInt(b, int64(t.Day()), 10)
420 b = append(b, []byte{0x2f}...)
421
422 if t.Month() < 10 {
423 b = append(b, '0')
424 }
425
426 b = strconv.AppendInt(b, int64(t.Month()), 10)
427
428 b = append(b, []byte{0x2f}...)
429
430 if t.Year() > 9 {
431 b = append(b, strconv.Itoa(t.Year())[2:]...)
432 } else {
433 b = append(b, strconv.Itoa(t.Year())[1:]...)
434 }
435
436 return string(b)
437 }
438
439
440 func (fur *fur_IT) FmtDateMedium(t time.Time) string {
441
442 b := make([]byte, 0, 32)
443
444 if t.Day() < 10 {
445 b = append(b, '0')
446 }
447
448 b = strconv.AppendInt(b, int64(t.Day()), 10)
449 b = append(b, []byte{0x2f}...)
450
451 if t.Month() < 10 {
452 b = append(b, '0')
453 }
454
455 b = strconv.AppendInt(b, int64(t.Month()), 10)
456
457 b = append(b, []byte{0x2f}...)
458
459 if t.Year() > 0 {
460 b = strconv.AppendInt(b, int64(t.Year()), 10)
461 } else {
462 b = strconv.AppendInt(b, int64(-t.Year()), 10)
463 }
464
465 return string(b)
466 }
467
468
469 func (fur *fur_IT) FmtDateLong(t time.Time) string {
470
471 b := make([]byte, 0, 32)
472
473 b = strconv.AppendInt(b, int64(t.Day()), 10)
474 b = append(b, []byte{0x20, 0x64, 0x69}...)
475 b = append(b, []byte{0x20}...)
476 b = append(b, fur.monthsWide[t.Month()]...)
477 b = append(b, []byte{0x20, 0x64, 0x61, 0x6c}...)
478 b = append(b, []byte{0x20}...)
479
480 if t.Year() > 0 {
481 b = strconv.AppendInt(b, int64(t.Year()), 10)
482 } else {
483 b = strconv.AppendInt(b, int64(-t.Year()), 10)
484 }
485
486 return string(b)
487 }
488
489
490 func (fur *fur_IT) FmtDateFull(t time.Time) string {
491
492 b := make([]byte, 0, 32)
493
494 b = append(b, fur.daysWide[t.Weekday()]...)
495 b = append(b, []byte{0x20}...)
496 b = strconv.AppendInt(b, int64(t.Day()), 10)
497 b = append(b, []byte{0x20, 0x64, 0x69}...)
498 b = append(b, []byte{0x20}...)
499 b = append(b, fur.monthsWide[t.Month()]...)
500 b = append(b, []byte{0x20, 0x64, 0x61, 0x6c}...)
501 b = append(b, []byte{0x20}...)
502
503 if t.Year() > 0 {
504 b = strconv.AppendInt(b, int64(t.Year()), 10)
505 } else {
506 b = strconv.AppendInt(b, int64(-t.Year()), 10)
507 }
508
509 return string(b)
510 }
511
512
513 func (fur *fur_IT) FmtTimeShort(t time.Time) string {
514
515 b := make([]byte, 0, 32)
516
517 if t.Hour() < 10 {
518 b = append(b, '0')
519 }
520
521 b = strconv.AppendInt(b, int64(t.Hour()), 10)
522 b = append(b, fur.timeSeparator...)
523
524 if t.Minute() < 10 {
525 b = append(b, '0')
526 }
527
528 b = strconv.AppendInt(b, int64(t.Minute()), 10)
529
530 return string(b)
531 }
532
533
534 func (fur *fur_IT) FmtTimeMedium(t time.Time) string {
535
536 b := make([]byte, 0, 32)
537
538 if t.Hour() < 10 {
539 b = append(b, '0')
540 }
541
542 b = strconv.AppendInt(b, int64(t.Hour()), 10)
543 b = append(b, fur.timeSeparator...)
544
545 if t.Minute() < 10 {
546 b = append(b, '0')
547 }
548
549 b = strconv.AppendInt(b, int64(t.Minute()), 10)
550 b = append(b, fur.timeSeparator...)
551
552 if t.Second() < 10 {
553 b = append(b, '0')
554 }
555
556 b = strconv.AppendInt(b, int64(t.Second()), 10)
557
558 return string(b)
559 }
560
561
562 func (fur *fur_IT) FmtTimeLong(t time.Time) string {
563
564 b := make([]byte, 0, 32)
565
566 if t.Hour() < 10 {
567 b = append(b, '0')
568 }
569
570 b = strconv.AppendInt(b, int64(t.Hour()), 10)
571 b = append(b, fur.timeSeparator...)
572
573 if t.Minute() < 10 {
574 b = append(b, '0')
575 }
576
577 b = strconv.AppendInt(b, int64(t.Minute()), 10)
578 b = append(b, fur.timeSeparator...)
579
580 if t.Second() < 10 {
581 b = append(b, '0')
582 }
583
584 b = strconv.AppendInt(b, int64(t.Second()), 10)
585 b = append(b, []byte{0x20}...)
586
587 tz, _ := t.Zone()
588 b = append(b, tz...)
589
590 return string(b)
591 }
592
593
594 func (fur *fur_IT) FmtTimeFull(t time.Time) string {
595
596 b := make([]byte, 0, 32)
597
598 if t.Hour() < 10 {
599 b = append(b, '0')
600 }
601
602 b = strconv.AppendInt(b, int64(t.Hour()), 10)
603 b = append(b, fur.timeSeparator...)
604
605 if t.Minute() < 10 {
606 b = append(b, '0')
607 }
608
609 b = strconv.AppendInt(b, int64(t.Minute()), 10)
610 b = append(b, fur.timeSeparator...)
611
612 if t.Second() < 10 {
613 b = append(b, '0')
614 }
615
616 b = strconv.AppendInt(b, int64(t.Second()), 10)
617 b = append(b, []byte{0x20}...)
618
619 tz, _ := t.Zone()
620
621 if btz, ok := fur.timezones[tz]; ok {
622 b = append(b, btz...)
623 } else {
624 b = append(b, tz...)
625 }
626
627 return string(b)
628 }
629
View as plain text