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