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