1 package en_FI
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 en_FI 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 percentSuffix string
22 perMille string
23 timeSeparator string
24 inifinity string
25 currencies []string
26 currencyPositiveSuffix string
27 currencyNegativeSuffix string
28 monthsAbbreviated []string
29 monthsNarrow []string
30 monthsWide []string
31 daysAbbreviated []string
32 daysNarrow []string
33 daysShort []string
34 daysWide []string
35 periodsAbbreviated []string
36 periodsNarrow []string
37 periodsShort []string
38 periodsWide []string
39 erasAbbreviated []string
40 erasNarrow []string
41 erasWide []string
42 timezones map[string]string
43 }
44
45
46 func New() locales.Translator {
47 return &en_FI{
48 locale: "en_FI",
49 pluralsCardinal: []locales.PluralRule{2, 6},
50 pluralsOrdinal: []locales.PluralRule{2, 3, 4, 6},
51 pluralsRange: []locales.PluralRule{6},
52 decimal: ",",
53 group: " ",
54 minus: "-",
55 percent: "%",
56 perMille: "‰",
57 timeSeparator: ".",
58 inifinity: "∞",
59 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"},
60 percentSuffix: " ",
61 currencyPositiveSuffix: " ",
62 currencyNegativeSuffix: " ",
63 monthsAbbreviated: []string{"", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"},
64 monthsNarrow: []string{"", "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"},
65 monthsWide: []string{"", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"},
66 daysAbbreviated: []string{"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"},
67 daysNarrow: []string{"S", "M", "T", "W", "T", "F", "S"},
68 daysShort: []string{"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"},
69 daysWide: []string{"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"},
70 periodsAbbreviated: []string{"am", "pm"},
71 periodsNarrow: []string{"a", "p"},
72 periodsWide: []string{"am", "pm"},
73 erasAbbreviated: []string{"BC", "AD"},
74 erasNarrow: []string{"B", "A"},
75 erasWide: []string{"Before Christ", "Anno Domini"},
76 timezones: map[string]string{"ACDT": "Australian Central Daylight Time", "ACST": "Australian Central Standard Time", "ACWDT": "Australian Central Western Daylight Time", "ACWST": "Australian Central Western Standard Time", "ADT": "Atlantic Daylight Time", "AEDT": "Australian Eastern Daylight Time", "AEST": "Australian Eastern Standard Time", "AKDT": "Alaska Daylight Time", "AKST": "Alaska Standard Time", "ARST": "Argentina Summer Time", "ART": "Argentina Standard Time", "AST": "Atlantic Standard Time", "AWDT": "Australian Western Daylight Time", "AWST": "Australian Western Standard Time", "BOT": "Bolivia Time", "BT": "Bhutan Time", "CAT": "Central Africa Time", "CDT": "Central Daylight Time", "CHADT": "Chatham Daylight Time", "CHAST": "Chatham Standard Time", "CLST": "Chile Summer Time", "CLT": "Chile Standard Time", "COST": "Colombia Summer Time", "COT": "Colombia Standard Time", "CST": "Central Standard Time", "ChST": "Chamorro Standard Time", "EAT": "East Africa Time", "ECT": "Ecuador Time", "EDT": "Eastern Daylight Time", "EST": "Eastern Standard Time", "GFT": "French Guiana Time", "GMT": "Greenwich Mean Time", "GST": "Gulf Standard Time", "GYT": "Guyana Time", "HADT": "Hawaii-Aleutian Daylight Time", "HAST": "Hawaii-Aleutian Standard Time", "HAT": "Newfoundland Daylight Time", "HECU": "Cuba Daylight Time", "HEEG": "East Greenland Summer Time", "HENOMX": "Northwest Mexico Daylight Time", "HEOG": "West Greenland Summer Time", "HEPM": "St. Pierre & Miquelon Daylight Time", "HEPMX": "Mexican Pacific Daylight Time", "HKST": "Hong Kong Summer Time", "HKT": "Hong Kong Standard Time", "HNCU": "Cuba Standard Time", "HNEG": "East Greenland Standard Time", "HNNOMX": "Northwest Mexico Standard Time", "HNOG": "West Greenland Standard Time", "HNPM": "St. Pierre & Miquelon Standard Time", "HNPMX": "Mexican Pacific Standard Time", "HNT": "Newfoundland Standard Time", "IST": "India Standard Time", "JDT": "Japan Daylight Time", "JST": "Japan Standard Time", "LHDT": "Lord Howe Daylight Time", "LHST": "Lord Howe Standard Time", "MDT": "Mountain Daylight Time", "MESZ": "Central European Summer Time", "MEZ": "Central European Standard Time", "MST": "Mountain Standard Time", "MYT": "Malaysia Time", "NZDT": "New Zealand Daylight Time", "NZST": "New Zealand Standard Time", "OESZ": "Eastern European Summer Time", "OEZ": "Eastern European Standard Time", "PDT": "Pacific Daylight Time", "PST": "Pacific Standard Time", "SAST": "South Africa Standard Time", "SGT": "Singapore Standard Time", "SRT": "Suriname Time", "TMST": "Turkmenistan Summer Time", "TMT": "Turkmenistan Standard Time", "UYST": "Uruguay Summer Time", "UYT": "Uruguay Standard Time", "VET": "Venezuela Time", "WARST": "Western Argentina Summer Time", "WART": "Western Argentina Standard Time", "WAST": "West Africa Summer Time", "WAT": "West Africa Standard Time", "WESZ": "Western European Summer Time", "WEZ": "Western European Standard Time", "WIB": "Western Indonesia Time", "WIT": "Eastern Indonesia Time", "WITA": "Central Indonesia Time", "∅∅∅": "Brasilia Summer Time"},
77 }
78 }
79
80
81 func (en *en_FI) Locale() string {
82 return en.locale
83 }
84
85
86 func (en *en_FI) PluralsCardinal() []locales.PluralRule {
87 return en.pluralsCardinal
88 }
89
90
91 func (en *en_FI) PluralsOrdinal() []locales.PluralRule {
92 return en.pluralsOrdinal
93 }
94
95
96 func (en *en_FI) PluralsRange() []locales.PluralRule {
97 return en.pluralsRange
98 }
99
100
101 func (en *en_FI) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
102
103 n := math.Abs(num)
104 i := int64(n)
105
106 if i == 1 && v == 0 {
107 return locales.PluralRuleOne
108 }
109
110 return locales.PluralRuleOther
111 }
112
113
114 func (en *en_FI) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
115
116 n := math.Abs(num)
117 nMod10 := math.Mod(n, 10)
118 nMod100 := math.Mod(n, 100)
119
120 if nMod10 == 1 && nMod100 != 11 {
121 return locales.PluralRuleOne
122 } else if nMod10 == 2 && nMod100 != 12 {
123 return locales.PluralRuleTwo
124 } else if nMod10 == 3 && nMod100 != 13 {
125 return locales.PluralRuleFew
126 }
127
128 return locales.PluralRuleOther
129 }
130
131
132 func (en *en_FI) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
133 return locales.PluralRuleOther
134 }
135
136
137 func (en *en_FI) MonthAbbreviated(month time.Month) string {
138 return en.monthsAbbreviated[month]
139 }
140
141
142 func (en *en_FI) MonthsAbbreviated() []string {
143 return en.monthsAbbreviated[1:]
144 }
145
146
147 func (en *en_FI) MonthNarrow(month time.Month) string {
148 return en.monthsNarrow[month]
149 }
150
151
152 func (en *en_FI) MonthsNarrow() []string {
153 return en.monthsNarrow[1:]
154 }
155
156
157 func (en *en_FI) MonthWide(month time.Month) string {
158 return en.monthsWide[month]
159 }
160
161
162 func (en *en_FI) MonthsWide() []string {
163 return en.monthsWide[1:]
164 }
165
166
167 func (en *en_FI) WeekdayAbbreviated(weekday time.Weekday) string {
168 return en.daysAbbreviated[weekday]
169 }
170
171
172 func (en *en_FI) WeekdaysAbbreviated() []string {
173 return en.daysAbbreviated
174 }
175
176
177 func (en *en_FI) WeekdayNarrow(weekday time.Weekday) string {
178 return en.daysNarrow[weekday]
179 }
180
181
182 func (en *en_FI) WeekdaysNarrow() []string {
183 return en.daysNarrow
184 }
185
186
187 func (en *en_FI) WeekdayShort(weekday time.Weekday) string {
188 return en.daysShort[weekday]
189 }
190
191
192 func (en *en_FI) WeekdaysShort() []string {
193 return en.daysShort
194 }
195
196
197 func (en *en_FI) WeekdayWide(weekday time.Weekday) string {
198 return en.daysWide[weekday]
199 }
200
201
202 func (en *en_FI) WeekdaysWide() []string {
203 return en.daysWide
204 }
205
206
207 func (en *en_FI) Decimal() string {
208 return en.decimal
209 }
210
211
212 func (en *en_FI) Group() string {
213 return en.group
214 }
215
216
217 func (en *en_FI) Minus() string {
218 return en.minus
219 }
220
221
222 func (en *en_FI) FmtNumber(num float64, v uint64) string {
223
224 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
225 l := len(s) + 2 + 2*len(s[:len(s)-int(v)-1])/3
226 count := 0
227 inWhole := v == 0
228 b := make([]byte, 0, l)
229
230 for i := len(s) - 1; i >= 0; i-- {
231
232 if s[i] == '.' {
233 b = append(b, en.decimal[0])
234 inWhole = true
235 continue
236 }
237
238 if inWhole {
239 if count == 3 {
240 for j := len(en.group) - 1; j >= 0; j-- {
241 b = append(b, en.group[j])
242 }
243 count = 1
244 } else {
245 count++
246 }
247 }
248
249 b = append(b, s[i])
250 }
251
252 if num < 0 {
253 b = append(b, en.minus[0])
254 }
255
256
257 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
258 b[i], b[j] = b[j], b[i]
259 }
260
261 return string(b)
262 }
263
264
265
266 func (en *en_FI) FmtPercent(num float64, v uint64) string {
267 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
268 l := len(s) + 5
269 b := make([]byte, 0, l)
270
271 for i := len(s) - 1; i >= 0; i-- {
272
273 if s[i] == '.' {
274 b = append(b, en.decimal[0])
275 continue
276 }
277
278 b = append(b, s[i])
279 }
280
281 if num < 0 {
282 b = append(b, en.minus[0])
283 }
284
285
286 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
287 b[i], b[j] = b[j], b[i]
288 }
289
290 b = append(b, en.percentSuffix...)
291
292 b = append(b, en.percent...)
293
294 return string(b)
295 }
296
297
298 func (en *en_FI) FmtCurrency(num float64, v uint64, currency currency.Type) string {
299
300 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
301 symbol := en.currencies[currency]
302 l := len(s) + len(symbol) + 4 + 2*len(s[:len(s)-int(v)-1])/3
303 count := 0
304 inWhole := v == 0
305 b := make([]byte, 0, l)
306
307 for i := len(s) - 1; i >= 0; i-- {
308
309 if s[i] == '.' {
310 b = append(b, en.decimal[0])
311 inWhole = true
312 continue
313 }
314
315 if inWhole {
316 if count == 3 {
317 for j := len(en.group) - 1; j >= 0; j-- {
318 b = append(b, en.group[j])
319 }
320 count = 1
321 } else {
322 count++
323 }
324 }
325
326 b = append(b, s[i])
327 }
328
329 if num < 0 {
330 b = append(b, en.minus[0])
331 }
332
333
334 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
335 b[i], b[j] = b[j], b[i]
336 }
337
338 if int(v) < 2 {
339
340 if v == 0 {
341 b = append(b, en.decimal...)
342 }
343
344 for i := 0; i < 2-int(v); i++ {
345 b = append(b, '0')
346 }
347 }
348
349 b = append(b, en.currencyPositiveSuffix...)
350
351 b = append(b, symbol...)
352
353 return string(b)
354 }
355
356
357
358 func (en *en_FI) FmtAccounting(num float64, v uint64, currency currency.Type) string {
359
360 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
361 symbol := en.currencies[currency]
362 l := len(s) + len(symbol) + 4 + 2*len(s[:len(s)-int(v)-1])/3
363 count := 0
364 inWhole := v == 0
365 b := make([]byte, 0, l)
366
367 for i := len(s) - 1; i >= 0; i-- {
368
369 if s[i] == '.' {
370 b = append(b, en.decimal[0])
371 inWhole = true
372 continue
373 }
374
375 if inWhole {
376 if count == 3 {
377 for j := len(en.group) - 1; j >= 0; j-- {
378 b = append(b, en.group[j])
379 }
380 count = 1
381 } else {
382 count++
383 }
384 }
385
386 b = append(b, s[i])
387 }
388
389 if num < 0 {
390
391 b = append(b, en.minus[0])
392
393 }
394
395
396 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
397 b[i], b[j] = b[j], b[i]
398 }
399
400 if int(v) < 2 {
401
402 if v == 0 {
403 b = append(b, en.decimal...)
404 }
405
406 for i := 0; i < 2-int(v); i++ {
407 b = append(b, '0')
408 }
409 }
410
411 if num < 0 {
412 b = append(b, en.currencyNegativeSuffix...)
413 b = append(b, symbol...)
414 } else {
415
416 b = append(b, en.currencyPositiveSuffix...)
417 b = append(b, symbol...)
418 }
419
420 return string(b)
421 }
422
423
424 func (en *en_FI) FmtDateShort(t time.Time) string {
425
426 b := make([]byte, 0, 32)
427
428 b = strconv.AppendInt(b, int64(t.Month()), 10)
429 b = append(b, []byte{0x2f}...)
430 b = strconv.AppendInt(b, int64(t.Day()), 10)
431 b = append(b, []byte{0x2f}...)
432
433 if t.Year() > 9 {
434 b = append(b, strconv.Itoa(t.Year())[2:]...)
435 } else {
436 b = append(b, strconv.Itoa(t.Year())[1:]...)
437 }
438
439 return string(b)
440 }
441
442
443 func (en *en_FI) FmtDateMedium(t time.Time) string {
444
445 b := make([]byte, 0, 32)
446
447 b = append(b, en.monthsAbbreviated[t.Month()]...)
448 b = append(b, []byte{0x20}...)
449 b = strconv.AppendInt(b, int64(t.Day()), 10)
450 b = append(b, []byte{0x2c, 0x20}...)
451
452 if t.Year() > 0 {
453 b = strconv.AppendInt(b, int64(t.Year()), 10)
454 } else {
455 b = strconv.AppendInt(b, int64(-t.Year()), 10)
456 }
457
458 return string(b)
459 }
460
461
462 func (en *en_FI) FmtDateLong(t time.Time) string {
463
464 b := make([]byte, 0, 32)
465
466 b = append(b, en.monthsWide[t.Month()]...)
467 b = append(b, []byte{0x20}...)
468 b = strconv.AppendInt(b, int64(t.Day()), 10)
469 b = append(b, []byte{0x2c, 0x20}...)
470
471 if t.Year() > 0 {
472 b = strconv.AppendInt(b, int64(t.Year()), 10)
473 } else {
474 b = strconv.AppendInt(b, int64(-t.Year()), 10)
475 }
476
477 return string(b)
478 }
479
480
481 func (en *en_FI) FmtDateFull(t time.Time) string {
482
483 b := make([]byte, 0, 32)
484
485 b = append(b, en.daysWide[t.Weekday()]...)
486 b = append(b, []byte{0x2c, 0x20}...)
487 b = append(b, en.monthsWide[t.Month()]...)
488 b = append(b, []byte{0x20}...)
489 b = strconv.AppendInt(b, int64(t.Day()), 10)
490 b = append(b, []byte{0x2c, 0x20}...)
491
492 if t.Year() > 0 {
493 b = strconv.AppendInt(b, int64(t.Year()), 10)
494 } else {
495 b = strconv.AppendInt(b, int64(-t.Year()), 10)
496 }
497
498 return string(b)
499 }
500
501
502 func (en *en_FI) FmtTimeShort(t time.Time) string {
503
504 b := make([]byte, 0, 32)
505
506 b = strconv.AppendInt(b, int64(t.Hour()), 10)
507 b = append(b, []byte{0x2e}...)
508
509 if t.Minute() < 10 {
510 b = append(b, '0')
511 }
512
513 b = strconv.AppendInt(b, int64(t.Minute()), 10)
514
515 return string(b)
516 }
517
518
519 func (en *en_FI) FmtTimeMedium(t time.Time) string {
520
521 b := make([]byte, 0, 32)
522
523 b = strconv.AppendInt(b, int64(t.Hour()), 10)
524 b = append(b, []byte{0x2e}...)
525
526 if t.Minute() < 10 {
527 b = append(b, '0')
528 }
529
530 b = strconv.AppendInt(b, int64(t.Minute()), 10)
531 b = append(b, []byte{0x2e}...)
532
533 if t.Second() < 10 {
534 b = append(b, '0')
535 }
536
537 b = strconv.AppendInt(b, int64(t.Second()), 10)
538
539 return string(b)
540 }
541
542
543 func (en *en_FI) FmtTimeLong(t time.Time) string {
544
545 b := make([]byte, 0, 32)
546
547 b = strconv.AppendInt(b, int64(t.Hour()), 10)
548 b = append(b, []byte{0x2e}...)
549
550 if t.Minute() < 10 {
551 b = append(b, '0')
552 }
553
554 b = strconv.AppendInt(b, int64(t.Minute()), 10)
555 b = append(b, []byte{0x2e}...)
556
557 if t.Second() < 10 {
558 b = append(b, '0')
559 }
560
561 b = strconv.AppendInt(b, int64(t.Second()), 10)
562 b = append(b, []byte{0x20}...)
563
564 tz, _ := t.Zone()
565 b = append(b, tz...)
566
567 return string(b)
568 }
569
570
571 func (en *en_FI) FmtTimeFull(t time.Time) string {
572
573 b := make([]byte, 0, 32)
574
575 b = strconv.AppendInt(b, int64(t.Hour()), 10)
576 b = append(b, []byte{0x2e}...)
577
578 if t.Minute() < 10 {
579 b = append(b, '0')
580 }
581
582 b = strconv.AppendInt(b, int64(t.Minute()), 10)
583 b = append(b, []byte{0x2e}...)
584
585 if t.Second() < 10 {
586 b = append(b, '0')
587 }
588
589 b = strconv.AppendInt(b, int64(t.Second()), 10)
590 b = append(b, []byte{0x20}...)
591
592 tz, _ := t.Zone()
593
594 if btz, ok := en.timezones[tz]; ok {
595 b = append(b, btz...)
596 } else {
597 b = append(b, tz...)
598 }
599
600 return string(b)
601 }
602
View as plain text