8 "github.com/go-playground/locales"
9 "github.com/go-playground/locales/currency"
14 pluralsCardinal []locales.PluralRule
15 pluralsOrdinal []locales.PluralRule
16 pluralsRange []locales.PluralRule
25 currencies []string // idx = enum of currency code
26 currencyPositiveSuffix string
27 currencyNegativeSuffix string
28 monthsAbbreviated []string
31 daysAbbreviated []string
35 periodsAbbreviated []string
36 periodsNarrow []string
39 erasAbbreviated []string
42 timezones map[string]string
45 // New returns a new instance of translator for the 'sv_FI' locale
46 func New() locales.Translator {
49 pluralsCardinal: []locales.PluralRule{2, 6},
50 pluralsOrdinal: []locales.PluralRule{2, 6},
51 pluralsRange: []locales.PluralRule{6},
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", "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"},
61 currencyPositiveSuffix: " ",
62 currencyNegativeSuffix: " ",
63 monthsAbbreviated: []string{"", "jan.", "feb.", "mars", "apr.", "maj", "juni", "juli", "aug.", "sep.", "okt.", "nov.", "dec."},
64 monthsNarrow: []string{"", "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"},
65 monthsWide: []string{"", "januari", "februari", "mars", "april", "maj", "juni", "juli", "augusti", "september", "oktober", "november", "december"},
66 daysAbbreviated: []string{"sön", "mån", "tis", "ons", "tors", "fre", "lör"},
67 daysNarrow: []string{"S", "M", "T", "O", "T", "F", "L"},
68 daysShort: []string{"sö", "må", "ti", "on", "to", "fr", "lö"},
69 daysWide: []string{"söndag", "måndag", "tisdag", "onsdag", "torsdag", "fredag", "lördag"},
70 periodsAbbreviated: []string{"fm", "em"},
71 periodsNarrow: []string{"fm", "em"},
72 periodsWide: []string{"fm", "em"},
73 erasAbbreviated: []string{"f.Kr.", "e.Kr."},
74 erasNarrow: []string{"f.Kr.", "e.Kr."},
75 erasWide: []string{"före Kristus", "efter Kristus"},
76 timezones: map[string]string{"HNCU": "kubansk normaltid", "HEPM": "S:t Pierre och Miquelon, sommartid", "UYST": "uruguayansk sommartid", "HAST": "Honolulu, normaltid", "EAT": "östafrikansk tid", "HNT": "Newfoundland, normaltid", "EST": "östnordamerikansk normaltid", "GMT": "Greenwichtid", "ChST": "Chamorrotid", "AWST": "västaustralisk normaltid", "ACWST": "västcentralaustralisk normaltid", "MYT": "malaysisk tid", "UYT": "uruguayansk normaltid", "MEZ": "centraleuropeisk normaltid", "NZST": "nyzeeländsk normaltid", "WAST": "västafrikansk sommartid", "CLT": "chilensk normaltid", "EDT": "östnordamerikansk sommartid", "HEPMX": "mexikansk stillahavstid, sommartid", "HADT": "Honolulu, sommartid", "JST": "japansk normaltid", "ARST": "östargentinsk sommartid", "HNOG": "västgrönländsk normaltid", "COT": "colombiansk normaltid", "COST": "colombiansk sommartid", "AKST": "Alaska, normaltid", "AKDT": "Alaska, sommartid", "HENOMX": "nordvästmexikansk sommartid", "AST": "nordamerikansk atlantnormaltid", "CHADT": "Chatham, sommartid", "TMT": "turkmensk normaltid", "HNNOMX": "nordvästmexikansk normaltid", "ART": "östargentinsk normaltid", "PDT": "västnordamerikansk sommartid", "CHAST": "Chatham, normaltid", "HECU": "kubansk sommartid", "BT": "bhutansk tid", "NZDT": "nyzeeländsk sommartid", "SAST": "sydafrikansk tid", "HAT": "Newfoundland, sommartid", "MDT": "Macausommartid", "MESZ": "centraleuropeisk sommartid", "WEZ": "västeuropeisk normaltid", "WESZ": "västeuropeisk sommartid", "SGT": "Singaporetid", "WART": "västargentinsk normaltid", "IST": "indisk tid", "AEDT": "östaustralisk sommartid", "WIB": "västindonesisk tid", "PST": "västnordamerikansk normaltid", "VET": "venezuelansk tid", "ADT": "nordamerikansk atlantsommartid", "BOT": "boliviansk tid", "SRT": "Surinamtid", "TMST": "turkmensk sommartid", "WARST": "västargentinsk sommartid", "HEOG": "västgrönländsk sommartid", "HNEG": "östgrönländsk normaltid", "GFT": "Franska Guyanatid", "ACST": "centralaustralisk normaltid", "CST": "centralnordamerikansk normaltid", "CDT": "centralnordamerikansk sommartid", "MST": "Macaunormaltid", "OEZ": "östeuropeisk normaltid", "WITA": "centralindonesisk tid", "WAT": "västafrikansk normaltid", "HEEG": "östgrönländsk sommartid", "ACDT": "centralaustralisk sommartid", "ECT": "ecuadoriansk tid", "CAT": "centralafrikansk tid", "OESZ": "östeuropeisk sommartid", "∅∅∅": "peruansk sommartid", "HNPMX": "mexikansk stillahavstid, normaltid", "AWDT": "västaustralisk sommartid", "ACWDT": "västcentralaustralisk sommartid", "HKST": "Hongkong, sommartid", "CLST": "chilensk sommartid", "HNPM": "S:t Pierre och Miquelon, normaltid", "LHST": "Lord Howe, normaltid", "LHDT": "Lord Howe, sommartid", "HKT": "Hongkong, normaltid", "GYT": "Guyanatid", "WIT": "östindonesisk tid", "JDT": "japansk sommartid", "AEST": "östaustralisk normaltid"},
80 // Locale returns the current translators string locale
81 func (sv *sv_FI) Locale() string {
85 // PluralsCardinal returns the list of cardinal plural rules associated with 'sv_FI'
86 func (sv *sv_FI) PluralsCardinal() []locales.PluralRule {
87 return sv.pluralsCardinal
90 // PluralsOrdinal returns the list of ordinal plural rules associated with 'sv_FI'
91 func (sv *sv_FI) PluralsOrdinal() []locales.PluralRule {
92 return sv.pluralsOrdinal
95 // PluralsRange returns the list of range plural rules associated with 'sv_FI'
96 func (sv *sv_FI) PluralsRange() []locales.PluralRule {
97 return sv.pluralsRange
100 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'sv_FI'
101 func (sv *sv_FI) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
106 if i == 1 && v == 0 {
107 return locales.PluralRuleOne
110 return locales.PluralRuleOther
113 // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'sv_FI'
114 func (sv *sv_FI) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
117 nMod10 := math.Mod(n, 10)
118 nMod100 := math.Mod(n, 100)
120 if (nMod10 == 1 || nMod10 == 2) && (nMod100 != 11 && nMod100 != 12) {
121 return locales.PluralRuleOne
124 return locales.PluralRuleOther
127 // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'sv_FI'
128 func (sv *sv_FI) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
129 return locales.PluralRuleOther
132 // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
133 func (sv *sv_FI) MonthAbbreviated(month time.Month) string {
134 return sv.monthsAbbreviated[month]
137 // MonthsAbbreviated returns the locales abbreviated months
138 func (sv *sv_FI) MonthsAbbreviated() []string {
139 return sv.monthsAbbreviated[1:]
142 // MonthNarrow returns the locales narrow month given the 'month' provided
143 func (sv *sv_FI) MonthNarrow(month time.Month) string {
144 return sv.monthsNarrow[month]
147 // MonthsNarrow returns the locales narrow months
148 func (sv *sv_FI) MonthsNarrow() []string {
149 return sv.monthsNarrow[1:]
152 // MonthWide returns the locales wide month given the 'month' provided
153 func (sv *sv_FI) MonthWide(month time.Month) string {
154 return sv.monthsWide[month]
157 // MonthsWide returns the locales wide months
158 func (sv *sv_FI) MonthsWide() []string {
159 return sv.monthsWide[1:]
162 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
163 func (sv *sv_FI) WeekdayAbbreviated(weekday time.Weekday) string {
164 return sv.daysAbbreviated[weekday]
167 // WeekdaysAbbreviated returns the locales abbreviated weekdays
168 func (sv *sv_FI) WeekdaysAbbreviated() []string {
169 return sv.daysAbbreviated
172 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
173 func (sv *sv_FI) WeekdayNarrow(weekday time.Weekday) string {
174 return sv.daysNarrow[weekday]
177 // WeekdaysNarrow returns the locales narrow weekdays
178 func (sv *sv_FI) WeekdaysNarrow() []string {
182 // WeekdayShort returns the locales short weekday given the 'weekday' provided
183 func (sv *sv_FI) WeekdayShort(weekday time.Weekday) string {
184 return sv.daysShort[weekday]
187 // WeekdaysShort returns the locales short weekdays
188 func (sv *sv_FI) WeekdaysShort() []string {
192 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
193 func (sv *sv_FI) WeekdayWide(weekday time.Weekday) string {
194 return sv.daysWide[weekday]
197 // WeekdaysWide returns the locales wide weekdays
198 func (sv *sv_FI) WeekdaysWide() []string {
202 // Decimal returns the decimal point of number
203 func (sv *sv_FI) Decimal() string {
207 // Group returns the group of number
208 func (sv *sv_FI) Group() string {
212 // Group returns the minus sign of number
213 func (sv *sv_FI) Minus() string {
217 // FmtNumber returns 'num' with digits/precision of 'v' for 'sv_FI' and handles both Whole and Real numbers based on 'v'
218 func (sv *sv_FI) FmtNumber(num float64, v uint64) string {
220 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
221 l := len(s) + 4 + 2*len(s[:len(s)-int(v)-1])/3
224 b := make([]byte, 0, l)
226 for i := len(s) - 1; i >= 0; i-- {
229 b = append(b, sv.decimal[0])
236 for j := len(sv.group) - 1; j >= 0; j-- {
237 b = append(b, sv.group[j])
249 for j := len(sv.minus) - 1; j >= 0; j-- {
250 b = append(b, sv.minus[j])
255 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
256 b[i], b[j] = b[j], b[i]
262 // FmtPercent returns 'num' with digits/precision of 'v' for 'sv_FI' and handles both Whole and Real numbers based on 'v'
263 // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
264 func (sv *sv_FI) FmtPercent(num float64, v uint64) string {
265 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
267 b := make([]byte, 0, l)
269 for i := len(s) - 1; i >= 0; i-- {
272 b = append(b, sv.decimal[0])
280 for j := len(sv.minus) - 1; j >= 0; j-- {
281 b = append(b, sv.minus[j])
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]
290 b = append(b, sv.percentSuffix...)
292 b = append(b, sv.percent...)
297 // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'sv_FI'
298 func (sv *sv_FI) FmtCurrency(num float64, v uint64, currency currency.Type) string {
300 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
301 symbol := sv.currencies[currency]
302 l := len(s) + len(symbol) + 6 + 2*len(s[:len(s)-int(v)-1])/3
305 b := make([]byte, 0, l)
307 for i := len(s) - 1; i >= 0; i-- {
310 b = append(b, sv.decimal[0])
317 for j := len(sv.group) - 1; j >= 0; j-- {
318 b = append(b, sv.group[j])
330 for j := len(sv.minus) - 1; j >= 0; j-- {
331 b = append(b, sv.minus[j])
336 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
337 b[i], b[j] = b[j], b[i]
343 b = append(b, sv.decimal...)
346 for i := 0; i < 2-int(v); i++ {
351 b = append(b, sv.currencyPositiveSuffix...)
353 b = append(b, symbol...)
358 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sv_FI'
359 // in accounting notation.
360 func (sv *sv_FI) FmtAccounting(num float64, v uint64, currency currency.Type) string {
362 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
363 symbol := sv.currencies[currency]
364 l := len(s) + len(symbol) + 6 + 2*len(s[:len(s)-int(v)-1])/3
367 b := make([]byte, 0, l)
369 for i := len(s) - 1; i >= 0; i-- {
372 b = append(b, sv.decimal[0])
379 for j := len(sv.group) - 1; j >= 0; j-- {
380 b = append(b, sv.group[j])
393 for j := len(sv.minus) - 1; j >= 0; j-- {
394 b = append(b, sv.minus[j])
400 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
401 b[i], b[j] = b[j], b[i]
407 b = append(b, sv.decimal...)
410 for i := 0; i < 2-int(v); i++ {
416 b = append(b, sv.currencyNegativeSuffix...)
417 b = append(b, symbol...)
420 b = append(b, sv.currencyPositiveSuffix...)
421 b = append(b, symbol...)
427 // FmtDateShort returns the short date representation of 't' for 'sv_FI'
428 func (sv *sv_FI) FmtDateShort(t time.Time) string {
430 b := make([]byte, 0, 32)
436 b = strconv.AppendInt(b, int64(t.Day()), 10)
437 b = append(b, []byte{0x2d}...)
443 b = strconv.AppendInt(b, int64(t.Month()), 10)
445 b = append(b, []byte{0x2d}...)
448 b = strconv.AppendInt(b, int64(t.Year()), 10)
450 b = strconv.AppendInt(b, int64(-t.Year()), 10)
456 // FmtDateMedium returns the medium date representation of 't' for 'sv_FI'
457 func (sv *sv_FI) FmtDateMedium(t time.Time) string {
459 b := make([]byte, 0, 32)
461 b = strconv.AppendInt(b, int64(t.Day()), 10)
462 b = append(b, []byte{0x20}...)
463 b = append(b, sv.monthsAbbreviated[t.Month()]...)
464 b = append(b, []byte{0x20}...)
467 b = strconv.AppendInt(b, int64(t.Year()), 10)
469 b = strconv.AppendInt(b, int64(-t.Year()), 10)
475 // FmtDateLong returns the long date representation of 't' for 'sv_FI'
476 func (sv *sv_FI) FmtDateLong(t time.Time) string {
478 b := make([]byte, 0, 32)
480 b = strconv.AppendInt(b, int64(t.Day()), 10)
481 b = append(b, []byte{0x20}...)
482 b = append(b, sv.monthsWide[t.Month()]...)
483 b = append(b, []byte{0x20}...)
486 b = strconv.AppendInt(b, int64(t.Year()), 10)
488 b = strconv.AppendInt(b, int64(-t.Year()), 10)
494 // FmtDateFull returns the full date representation of 't' for 'sv_FI'
495 func (sv *sv_FI) FmtDateFull(t time.Time) string {
497 b := make([]byte, 0, 32)
499 b = append(b, sv.daysWide[t.Weekday()]...)
500 b = append(b, []byte{0x20}...)
501 b = strconv.AppendInt(b, int64(t.Day()), 10)
502 b = append(b, []byte{0x20}...)
503 b = append(b, sv.monthsWide[t.Month()]...)
504 b = append(b, []byte{0x20}...)
507 b = strconv.AppendInt(b, int64(t.Year()), 10)
509 b = strconv.AppendInt(b, int64(-t.Year()), 10)
515 // FmtTimeShort returns the short time representation of 't' for 'sv_FI'
516 func (sv *sv_FI) FmtTimeShort(t time.Time) string {
518 b := make([]byte, 0, 32)
524 b = strconv.AppendInt(b, int64(t.Hour()), 10)
525 b = append(b, sv.timeSeparator...)
531 b = strconv.AppendInt(b, int64(t.Minute()), 10)
536 // FmtTimeMedium returns the medium time representation of 't' for 'sv_FI'
537 func (sv *sv_FI) FmtTimeMedium(t time.Time) string {
539 b := make([]byte, 0, 32)
545 b = strconv.AppendInt(b, int64(t.Hour()), 10)
546 b = append(b, sv.timeSeparator...)
552 b = strconv.AppendInt(b, int64(t.Minute()), 10)
553 b = append(b, sv.timeSeparator...)
559 b = strconv.AppendInt(b, int64(t.Second()), 10)
564 // FmtTimeLong returns the long time representation of 't' for 'sv_FI'
565 func (sv *sv_FI) FmtTimeLong(t time.Time) string {
567 b := make([]byte, 0, 32)
573 b = strconv.AppendInt(b, int64(t.Hour()), 10)
574 b = append(b, sv.timeSeparator...)
580 b = strconv.AppendInt(b, int64(t.Minute()), 10)
581 b = append(b, sv.timeSeparator...)
587 b = strconv.AppendInt(b, int64(t.Second()), 10)
588 b = append(b, []byte{0x20}...)
596 // FmtTimeFull returns the full time representation of 't' for 'sv_FI'
597 func (sv *sv_FI) FmtTimeFull(t time.Time) string {
599 b := make([]byte, 0, 32)
601 b = append(b, []byte{0x6b, 0x6c}...)
602 b = append(b, []byte{0x2e, 0x20}...)
608 b = strconv.AppendInt(b, int64(t.Hour()), 10)
609 b = append(b, sv.timeSeparator...)
615 b = strconv.AppendInt(b, int64(t.Minute()), 10)
616 b = append(b, sv.timeSeparator...)
622 b = strconv.AppendInt(b, int64(t.Second()), 10)
623 b = append(b, []byte{0x20}...)
627 if btz, ok := sv.timezones[tz]; ok {
628 b = append(b, btz...)