1 package en_NL
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_NL 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 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_NL{
48 locale: "en_NL",
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 currencyPositivePrefix: " ",
61 currencyNegativePrefix: "( ",
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_NL) Locale() string {
82 return en.locale
83 }
84
85
86 func (en *en_NL) PluralsCardinal() []locales.PluralRule {
87 return en.pluralsCardinal
88 }
89
90
91 func (en *en_NL) PluralsOrdinal() []locales.PluralRule {
92 return en.pluralsOrdinal
93 }
94
95
96 func (en *en_NL) PluralsRange() []locales.PluralRule {
97 return en.pluralsRange
98 }
99
100
101 func (en *en_NL) 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_NL) 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_NL) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
133 return locales.PluralRuleOther
134 }
135
136
137 func (en *en_NL) MonthAbbreviated(month time.Month) string {
138 return en.monthsAbbreviated[month]
139 }
140
141
142 func (en *en_NL) MonthsAbbreviated() []string {
143 return en.monthsAbbreviated[1:]
144 }
145
146
147 func (en *en_NL) MonthNarrow(month time.Month) string {
148 return en.monthsNarrow[month]
149 }
150
151
152 func (en *en_NL) MonthsNarrow() []string {
153 return en.monthsNarrow[1:]
154 }
155
156
157 func (en *en_NL) MonthWide(month time.Month) string {
158 return en.monthsWide[month]
159 }
160
161
162 func (en *en_NL) MonthsWide() []string {
163 return en.monthsWide[1:]
164 }
165
166
167 func (en *en_NL) WeekdayAbbreviated(weekday time.Weekday) string {
168 return en.daysAbbreviated[weekday]
169 }
170
171
172 func (en *en_NL) WeekdaysAbbreviated() []string {
173 return en.daysAbbreviated
174 }
175
176
177 func (en *en_NL) WeekdayNarrow(weekday time.Weekday) string {
178 return en.daysNarrow[weekday]
179 }
180
181
182 func (en *en_NL) WeekdaysNarrow() []string {
183 return en.daysNarrow
184 }
185
186
187 func (en *en_NL) WeekdayShort(weekday time.Weekday) string {
188 return en.daysShort[weekday]
189 }
190
191
192 func (en *en_NL) WeekdaysShort() []string {
193 return en.daysShort
194 }
195
196
197 func (en *en_NL) WeekdayWide(weekday time.Weekday) string {
198 return en.daysWide[weekday]
199 }
200
201
202 func (en *en_NL) WeekdaysWide() []string {
203 return en.daysWide
204 }
205
206
207 func (en *en_NL) Decimal() string {
208 return en.decimal
209 }
210
211
212 func (en *en_NL) Group() string {
213 return en.group
214 }
215
216
217 func (en *en_NL) Minus() string {
218 return en.minus
219 }
220
221
222 func (en *en_NL) FmtNumber(num float64, v uint64) string {
223
224 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
225 l := len(s) + 2 + 1*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 b = append(b, en.group[0])
241 count = 1
242 } else {
243 count++
244 }
245 }
246
247 b = append(b, s[i])
248 }
249
250 if num < 0 {
251 b = append(b, en.minus[0])
252 }
253
254
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]
257 }
258
259 return string(b)
260 }
261
262
263
264 func (en *en_NL) FmtPercent(num float64, v uint64) string {
265 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
266 l := len(s) + 3
267 b := make([]byte, 0, l)
268
269 for i := len(s) - 1; i >= 0; i-- {
270
271 if s[i] == '.' {
272 b = append(b, en.decimal[0])
273 continue
274 }
275
276 b = append(b, s[i])
277 }
278
279 if num < 0 {
280 b = append(b, en.minus[0])
281 }
282
283
284 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
285 b[i], b[j] = b[j], b[i]
286 }
287
288 b = append(b, en.percent...)
289
290 return string(b)
291 }
292
293
294 func (en *en_NL) FmtCurrency(num float64, v uint64, currency currency.Type) string {
295
296 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
297 symbol := en.currencies[currency]
298 l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
299 count := 0
300 inWhole := v == 0
301 b := make([]byte, 0, l)
302
303 for i := len(s) - 1; i >= 0; i-- {
304
305 if s[i] == '.' {
306 b = append(b, en.decimal[0])
307 inWhole = true
308 continue
309 }
310
311 if inWhole {
312 if count == 3 {
313 b = append(b, en.group[0])
314 count = 1
315 } else {
316 count++
317 }
318 }
319
320 b = append(b, s[i])
321 }
322
323 for j := len(symbol) - 1; j >= 0; j-- {
324 b = append(b, symbol[j])
325 }
326
327 for j := len(en.currencyPositivePrefix) - 1; j >= 0; j-- {
328 b = append(b, en.currencyPositivePrefix[j])
329 }
330
331 if num < 0 {
332 b = append(b, en.minus[0])
333 }
334
335
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]
338 }
339
340 if int(v) < 2 {
341
342 if v == 0 {
343 b = append(b, en.decimal...)
344 }
345
346 for i := 0; i < 2-int(v); i++ {
347 b = append(b, '0')
348 }
349 }
350
351 return string(b)
352 }
353
354
355
356 func (en *en_NL) FmtAccounting(num float64, v uint64, currency currency.Type) string {
357
358 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
359 symbol := en.currencies[currency]
360 l := len(s) + len(symbol) + 6 + 1*len(s[:len(s)-int(v)-1])/3
361 count := 0
362 inWhole := v == 0
363 b := make([]byte, 0, l)
364
365 for i := len(s) - 1; i >= 0; i-- {
366
367 if s[i] == '.' {
368 b = append(b, en.decimal[0])
369 inWhole = true
370 continue
371 }
372
373 if inWhole {
374 if count == 3 {
375 b = append(b, en.group[0])
376 count = 1
377 } else {
378 count++
379 }
380 }
381
382 b = append(b, s[i])
383 }
384
385 if num < 0 {
386
387 for j := len(symbol) - 1; j >= 0; j-- {
388 b = append(b, symbol[j])
389 }
390
391 for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
392 b = append(b, en.currencyNegativePrefix[j])
393 }
394
395 } else {
396
397 for j := len(symbol) - 1; j >= 0; j-- {
398 b = append(b, symbol[j])
399 }
400
401 for j := len(en.currencyPositivePrefix) - 1; j >= 0; j-- {
402 b = append(b, en.currencyPositivePrefix[j])
403 }
404
405 }
406
407
408 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
409 b[i], b[j] = b[j], b[i]
410 }
411
412 if int(v) < 2 {
413
414 if v == 0 {
415 b = append(b, en.decimal...)
416 }
417
418 for i := 0; i < 2-int(v); i++ {
419 b = append(b, '0')
420 }
421 }
422
423 if num < 0 {
424 b = append(b, en.currencyNegativeSuffix...)
425 }
426
427 return string(b)
428 }
429
430
431 func (en *en_NL) FmtDateShort(t time.Time) string {
432
433 b := make([]byte, 0, 32)
434
435 b = strconv.AppendInt(b, int64(t.Month()), 10)
436 b = append(b, []byte{0x2f}...)
437 b = strconv.AppendInt(b, int64(t.Day()), 10)
438 b = append(b, []byte{0x2f}...)
439
440 if t.Year() > 9 {
441 b = append(b, strconv.Itoa(t.Year())[2:]...)
442 } else {
443 b = append(b, strconv.Itoa(t.Year())[1:]...)
444 }
445
446 return string(b)
447 }
448
449
450 func (en *en_NL) FmtDateMedium(t time.Time) string {
451
452 b := make([]byte, 0, 32)
453
454 b = append(b, en.monthsAbbreviated[t.Month()]...)
455 b = append(b, []byte{0x20}...)
456 b = strconv.AppendInt(b, int64(t.Day()), 10)
457 b = append(b, []byte{0x2c, 0x20}...)
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 (en *en_NL) FmtDateLong(t time.Time) string {
470
471 b := make([]byte, 0, 32)
472
473 b = append(b, en.monthsWide[t.Month()]...)
474 b = append(b, []byte{0x20}...)
475 b = strconv.AppendInt(b, int64(t.Day()), 10)
476 b = append(b, []byte{0x2c, 0x20}...)
477
478 if t.Year() > 0 {
479 b = strconv.AppendInt(b, int64(t.Year()), 10)
480 } else {
481 b = strconv.AppendInt(b, int64(-t.Year()), 10)
482 }
483
484 return string(b)
485 }
486
487
488 func (en *en_NL) FmtDateFull(t time.Time) string {
489
490 b := make([]byte, 0, 32)
491
492 b = append(b, en.daysWide[t.Weekday()]...)
493 b = append(b, []byte{0x2c, 0x20}...)
494 b = append(b, en.monthsWide[t.Month()]...)
495 b = append(b, []byte{0x20}...)
496 b = strconv.AppendInt(b, int64(t.Day()), 10)
497 b = append(b, []byte{0x2c, 0x20}...)
498
499 if t.Year() > 0 {
500 b = strconv.AppendInt(b, int64(t.Year()), 10)
501 } else {
502 b = strconv.AppendInt(b, int64(-t.Year()), 10)
503 }
504
505 return string(b)
506 }
507
508
509 func (en *en_NL) FmtTimeShort(t time.Time) string {
510
511 b := make([]byte, 0, 32)
512
513 if t.Hour() < 10 {
514 b = append(b, '0')
515 }
516
517 b = strconv.AppendInt(b, int64(t.Hour()), 10)
518 b = append(b, en.timeSeparator...)
519
520 if t.Minute() < 10 {
521 b = append(b, '0')
522 }
523
524 b = strconv.AppendInt(b, int64(t.Minute()), 10)
525
526 return string(b)
527 }
528
529
530 func (en *en_NL) FmtTimeMedium(t time.Time) string {
531
532 b := make([]byte, 0, 32)
533
534 if t.Hour() < 10 {
535 b = append(b, '0')
536 }
537
538 b = strconv.AppendInt(b, int64(t.Hour()), 10)
539 b = append(b, en.timeSeparator...)
540
541 if t.Minute() < 10 {
542 b = append(b, '0')
543 }
544
545 b = strconv.AppendInt(b, int64(t.Minute()), 10)
546 b = append(b, en.timeSeparator...)
547
548 if t.Second() < 10 {
549 b = append(b, '0')
550 }
551
552 b = strconv.AppendInt(b, int64(t.Second()), 10)
553
554 return string(b)
555 }
556
557
558 func (en *en_NL) FmtTimeLong(t time.Time) string {
559
560 b := make([]byte, 0, 32)
561
562 if t.Hour() < 10 {
563 b = append(b, '0')
564 }
565
566 b = strconv.AppendInt(b, int64(t.Hour()), 10)
567 b = append(b, en.timeSeparator...)
568
569 if t.Minute() < 10 {
570 b = append(b, '0')
571 }
572
573 b = strconv.AppendInt(b, int64(t.Minute()), 10)
574 b = append(b, en.timeSeparator...)
575
576 if t.Second() < 10 {
577 b = append(b, '0')
578 }
579
580 b = strconv.AppendInt(b, int64(t.Second()), 10)
581 b = append(b, []byte{0x20}...)
582
583 tz, _ := t.Zone()
584 b = append(b, tz...)
585
586 return string(b)
587 }
588
589
590 func (en *en_NL) FmtTimeFull(t time.Time) string {
591
592 b := make([]byte, 0, 32)
593
594 if t.Hour() < 10 {
595 b = append(b, '0')
596 }
597
598 b = strconv.AppendInt(b, int64(t.Hour()), 10)
599 b = append(b, en.timeSeparator...)
600
601 if t.Minute() < 10 {
602 b = append(b, '0')
603 }
604
605 b = strconv.AppendInt(b, int64(t.Minute()), 10)
606 b = append(b, en.timeSeparator...)
607
608 if t.Second() < 10 {
609 b = append(b, '0')
610 }
611
612 b = strconv.AppendInt(b, int64(t.Second()), 10)
613 b = append(b, []byte{0x20}...)
614
615 tz, _ := t.Zone()
616
617 if btz, ok := en.timezones[tz]; ok {
618 b = append(b, btz...)
619 } else {
620 b = append(b, tz...)
621 }
622
623 return string(b)
624 }
625
View as plain text