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 monthsAbbreviated []string
29 daysAbbreviated []string
33 periodsAbbreviated []string
34 periodsNarrow []string
37 erasAbbreviated []string
40 timezones map[string]string
43 // New returns a new instance of translator for the 'kl_GL' locale
44 func New() locales.Translator {
47 pluralsCardinal: []locales.PluralRule{2, 6},
57 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"},
59 monthsAbbreviated: []string{"", "jan", "feb", "mar", "apr", "maj", "jun", "jul", "aug", "sep", "okt", "nov", "dec"},
60 monthsNarrow: []string{"", "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"},
61 monthsWide: []string{"", "januari", "februari", "martsi", "aprili", "maji", "juni", "juli", "augustusi", "septemberi", "oktoberi", "novemberi", "decemberi"},
62 daysAbbreviated: []string{"sab", "ata", "mar", "pin", "sis", "tal", "arf"},
63 daysNarrow: []string{"S", "A", "M", "P", "S", "T", "A"},
64 daysShort: []string{"sab", "ata", "mar", "pin", "sis", "tal", "arf"},
65 daysWide: []string{"sabaat", "ataasinngorneq", "marlunngorneq", "pingasunngorneq", "sisamanngorneq", "tallimanngorneq", "arfininngorneq"},
66 periodsAbbreviated: []string{"u.t.", "u.k."},
67 periodsWide: []string{"ulloqeqqata-tungaa", "ulloqeqqata-kingorna"},
68 erasAbbreviated: []string{"Kr.in.si.", "Kr.in.king."},
69 erasNarrow: []string{"Kr.s.", "Kr.k."},
70 erasWide: []string{"Kristusip inunngornerata siornagut", "Kristusip inunngornerata kingornagut"},
71 timezones: map[string]string{"VET": "VET", "HEOG": "HEOG", "GFT": "GFT", "CLST": "CLST", "EST": "EST", "GMT": "GMT", "CHADT": "CHADT", "ACWST": "ACWST", "HNCU": "HNCU", "ART": "ART", "ARST": "ARST", "HNOG": "HNOG", "HNEG": "HNEG", "ECT": "ECT", "OESZ": "OESZ", "MESZ": "MESZ", "HENOMX": "HENOMX", "WITA": "WITA", "JDT": "JDT", "LHST": "LHST", "LHDT": "LHDT", "COST": "COST", "AWST": "AWST", "EAT": "EAT", "HNT": "HNT", "HKST": "HKST", "WIT": "WIT", "NZST": "NZST", "WART": "WART", "WARST": "WARST", "AEST": "AEST", "WAT": "WAT", "HKT": "HKT", "WEZ": "WEZ", "MEZ": "MEZ", "HNPM": "HNPM", "AKST": "AKST", "CDT": "CDT", "HADT": "HADT", "HAT": "HAT", "ACDT": "ACDT", "CAT": "CAT", "CHAST": "CHAST", "ACWDT": "ACWDT", "COT": "COT", "HEPMX": "HEPMX", "IST": "IST", "MDT": "MDT", "AST": "AST", "ChST": "ChST", "BOT": "BOT", "MST": "MST", "UYT": "UYT", "TMT": "TMT", "AEDT": "AEDT", "AKDT": "AKDT", "SGT": "SGT", "BT": "BT", "JST": "JST", "CLT": "CLT", "WIB": "WIB", "MYT": "MYT", "UYST": "UYST", "HNNOMX": "HNNOMX", "WAST": "WAST", "HNPMX": "HNPMX", "HEPM": "HEPM", "SRT": "SRT", "GYT": "GYT", "SAST": "SAST", "TMST": "TMST", "OEZ": "OEZ", "ADT": "ADT", "EDT": "EDT", "ACST": "ACST", "WESZ": "WESZ", "CST": "CST", "HAST": "HAST", "PST": "PST", "PDT": "PDT", "HECU": "HECU", "∅∅∅": "∅∅∅", "NZDT": "NZDT", "HEEG": "HEEG", "AWDT": "AWDT"},
75 // Locale returns the current translators string locale
76 func (kl *kl_GL) Locale() string {
80 // PluralsCardinal returns the list of cardinal plural rules associated with 'kl_GL'
81 func (kl *kl_GL) PluralsCardinal() []locales.PluralRule {
82 return kl.pluralsCardinal
85 // PluralsOrdinal returns the list of ordinal plural rules associated with 'kl_GL'
86 func (kl *kl_GL) PluralsOrdinal() []locales.PluralRule {
87 return kl.pluralsOrdinal
90 // PluralsRange returns the list of range plural rules associated with 'kl_GL'
91 func (kl *kl_GL) PluralsRange() []locales.PluralRule {
92 return kl.pluralsRange
95 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'kl_GL'
96 func (kl *kl_GL) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
101 return locales.PluralRuleOne
104 return locales.PluralRuleOther
107 // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'kl_GL'
108 func (kl *kl_GL) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
109 return locales.PluralRuleUnknown
112 // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'kl_GL'
113 func (kl *kl_GL) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
114 return locales.PluralRuleUnknown
117 // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
118 func (kl *kl_GL) MonthAbbreviated(month time.Month) string {
119 return kl.monthsAbbreviated[month]
122 // MonthsAbbreviated returns the locales abbreviated months
123 func (kl *kl_GL) MonthsAbbreviated() []string {
124 return kl.monthsAbbreviated[1:]
127 // MonthNarrow returns the locales narrow month given the 'month' provided
128 func (kl *kl_GL) MonthNarrow(month time.Month) string {
129 return kl.monthsNarrow[month]
132 // MonthsNarrow returns the locales narrow months
133 func (kl *kl_GL) MonthsNarrow() []string {
134 return kl.monthsNarrow[1:]
137 // MonthWide returns the locales wide month given the 'month' provided
138 func (kl *kl_GL) MonthWide(month time.Month) string {
139 return kl.monthsWide[month]
142 // MonthsWide returns the locales wide months
143 func (kl *kl_GL) MonthsWide() []string {
144 return kl.monthsWide[1:]
147 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
148 func (kl *kl_GL) WeekdayAbbreviated(weekday time.Weekday) string {
149 return kl.daysAbbreviated[weekday]
152 // WeekdaysAbbreviated returns the locales abbreviated weekdays
153 func (kl *kl_GL) WeekdaysAbbreviated() []string {
154 return kl.daysAbbreviated
157 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
158 func (kl *kl_GL) WeekdayNarrow(weekday time.Weekday) string {
159 return kl.daysNarrow[weekday]
162 // WeekdaysNarrow returns the locales narrow weekdays
163 func (kl *kl_GL) WeekdaysNarrow() []string {
167 // WeekdayShort returns the locales short weekday given the 'weekday' provided
168 func (kl *kl_GL) WeekdayShort(weekday time.Weekday) string {
169 return kl.daysShort[weekday]
172 // WeekdaysShort returns the locales short weekdays
173 func (kl *kl_GL) WeekdaysShort() []string {
177 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
178 func (kl *kl_GL) WeekdayWide(weekday time.Weekday) string {
179 return kl.daysWide[weekday]
182 // WeekdaysWide returns the locales wide weekdays
183 func (kl *kl_GL) WeekdaysWide() []string {
187 // Decimal returns the decimal point of number
188 func (kl *kl_GL) Decimal() string {
192 // Group returns the group of number
193 func (kl *kl_GL) Group() string {
197 // Group returns the minus sign of number
198 func (kl *kl_GL) Minus() string {
202 // FmtNumber returns 'num' with digits/precision of 'v' for 'kl_GL' and handles both Whole and Real numbers based on 'v'
203 func (kl *kl_GL) FmtNumber(num float64, v uint64) string {
205 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
206 l := len(s) + 4 + 1*len(s[:len(s)-int(v)-1])/3
209 b := make([]byte, 0, l)
211 for i := len(s) - 1; i >= 0; i-- {
214 b = append(b, kl.decimal[0])
221 b = append(b, kl.group[0])
232 for j := len(kl.minus) - 1; j >= 0; j-- {
233 b = append(b, kl.minus[j])
238 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
239 b[i], b[j] = b[j], b[i]
245 // FmtPercent returns 'num' with digits/precision of 'v' for 'kl_GL' and handles both Whole and Real numbers based on 'v'
246 // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
247 func (kl *kl_GL) FmtPercent(num float64, v uint64) string {
248 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
250 b := make([]byte, 0, l)
252 for i := len(s) - 1; i >= 0; i-- {
255 b = append(b, kl.decimal[0])
263 for j := len(kl.minus) - 1; j >= 0; j-- {
264 b = append(b, kl.minus[j])
269 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
270 b[i], b[j] = b[j], b[i]
273 b = append(b, kl.percentSuffix...)
275 b = append(b, kl.percent...)
280 // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'kl_GL'
281 func (kl *kl_GL) FmtCurrency(num float64, v uint64, currency currency.Type) string {
283 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
284 symbol := kl.currencies[currency]
285 l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
288 b := make([]byte, 0, l)
290 for i := len(s) - 1; i >= 0; i-- {
293 b = append(b, kl.decimal[0])
300 b = append(b, kl.group[0])
310 for j := len(symbol) - 1; j >= 0; j-- {
311 b = append(b, symbol[j])
315 for j := len(kl.minus) - 1; j >= 0; j-- {
316 b = append(b, kl.minus[j])
321 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
322 b[i], b[j] = b[j], b[i]
328 b = append(b, kl.decimal...)
331 for i := 0; i < 2-int(v); i++ {
339 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'kl_GL'
340 // in accounting notation.
341 func (kl *kl_GL) FmtAccounting(num float64, v uint64, currency currency.Type) string {
343 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
344 symbol := kl.currencies[currency]
345 l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
348 b := make([]byte, 0, l)
350 for i := len(s) - 1; i >= 0; i-- {
353 b = append(b, kl.decimal[0])
360 b = append(b, kl.group[0])
372 for j := len(symbol) - 1; j >= 0; j-- {
373 b = append(b, symbol[j])
376 for j := len(kl.minus) - 1; j >= 0; j-- {
377 b = append(b, kl.minus[j])
382 for j := len(symbol) - 1; j >= 0; j-- {
383 b = append(b, symbol[j])
389 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
390 b[i], b[j] = b[j], b[i]
396 b = append(b, kl.decimal...)
399 for i := 0; i < 2-int(v); i++ {
407 // FmtDateShort returns the short date representation of 't' for 'kl_GL'
408 func (kl *kl_GL) FmtDateShort(t time.Time) string {
410 b := make([]byte, 0, 32)
413 b = strconv.AppendInt(b, int64(t.Year()), 10)
415 b = strconv.AppendInt(b, int64(-t.Year()), 10)
418 b = append(b, []byte{0x2d}...)
424 b = strconv.AppendInt(b, int64(t.Month()), 10)
426 b = append(b, []byte{0x2d}...)
432 b = strconv.AppendInt(b, int64(t.Day()), 10)
437 // FmtDateMedium returns the medium date representation of 't' for 'kl_GL'
438 func (kl *kl_GL) FmtDateMedium(t time.Time) string {
440 b := make([]byte, 0, 32)
442 b = append(b, kl.monthsAbbreviated[t.Month()]...)
443 b = append(b, []byte{0x20}...)
449 b = strconv.AppendInt(b, int64(t.Day()), 10)
450 b = append(b, []byte{0x2c, 0x20}...)
453 b = strconv.AppendInt(b, int64(t.Year()), 10)
455 b = strconv.AppendInt(b, int64(-t.Year()), 10)
461 // FmtDateLong returns the long date representation of 't' for 'kl_GL'
462 func (kl *kl_GL) FmtDateLong(t time.Time) string {
464 b := make([]byte, 0, 32)
470 b = strconv.AppendInt(b, int64(t.Day()), 10)
471 b = append(b, []byte{0x20}...)
472 b = append(b, kl.monthsWide[t.Month()]...)
473 b = append(b, []byte{0x20}...)
476 b = strconv.AppendInt(b, int64(t.Year()), 10)
478 b = strconv.AppendInt(b, int64(-t.Year()), 10)
484 // FmtDateFull returns the full date representation of 't' for 'kl_GL'
485 func (kl *kl_GL) FmtDateFull(t time.Time) string {
487 b := make([]byte, 0, 32)
489 b = append(b, kl.daysWide[t.Weekday()]...)
490 b = append(b, []byte{0x20}...)
496 b = strconv.AppendInt(b, int64(t.Day()), 10)
497 b = append(b, []byte{0x20}...)
498 b = append(b, kl.monthsWide[t.Month()]...)
499 b = append(b, []byte{0x20}...)
502 b = strconv.AppendInt(b, int64(t.Year()), 10)
504 b = strconv.AppendInt(b, int64(-t.Year()), 10)
510 // FmtTimeShort returns the short time representation of 't' for 'kl_GL'
511 func (kl *kl_GL) FmtTimeShort(t time.Time) string {
513 b := make([]byte, 0, 32)
521 b = strconv.AppendInt(b, int64(h), 10)
522 b = append(b, kl.timeSeparator...)
528 b = strconv.AppendInt(b, int64(t.Minute()), 10)
529 b = append(b, []byte{0x20}...)
532 b = append(b, kl.periodsAbbreviated[0]...)
534 b = append(b, kl.periodsAbbreviated[1]...)
540 // FmtTimeMedium returns the medium time representation of 't' for 'kl_GL'
541 func (kl *kl_GL) FmtTimeMedium(t time.Time) string {
543 b := make([]byte, 0, 32)
551 b = strconv.AppendInt(b, int64(h), 10)
552 b = append(b, kl.timeSeparator...)
558 b = strconv.AppendInt(b, int64(t.Minute()), 10)
559 b = append(b, kl.timeSeparator...)
565 b = strconv.AppendInt(b, int64(t.Second()), 10)
566 b = append(b, []byte{0x20}...)
569 b = append(b, kl.periodsAbbreviated[0]...)
571 b = append(b, kl.periodsAbbreviated[1]...)
577 // FmtTimeLong returns the long time representation of 't' for 'kl_GL'
578 func (kl *kl_GL) FmtTimeLong(t time.Time) string {
580 b := make([]byte, 0, 32)
588 b = strconv.AppendInt(b, int64(h), 10)
589 b = append(b, kl.timeSeparator...)
595 b = strconv.AppendInt(b, int64(t.Minute()), 10)
596 b = append(b, kl.timeSeparator...)
602 b = strconv.AppendInt(b, int64(t.Second()), 10)
603 b = append(b, []byte{0x20}...)
606 b = append(b, kl.periodsAbbreviated[0]...)
608 b = append(b, kl.periodsAbbreviated[1]...)
611 b = append(b, []byte{0x20}...)
619 // FmtTimeFull returns the full time representation of 't' for 'kl_GL'
620 func (kl *kl_GL) FmtTimeFull(t time.Time) string {
622 b := make([]byte, 0, 32)
630 b = strconv.AppendInt(b, int64(h), 10)
631 b = append(b, kl.timeSeparator...)
637 b = strconv.AppendInt(b, int64(t.Minute()), 10)
638 b = append(b, kl.timeSeparator...)
644 b = strconv.AppendInt(b, int64(t.Second()), 10)
645 b = append(b, []byte{0x20}...)
648 b = append(b, kl.periodsAbbreviated[0]...)
650 b = append(b, kl.periodsAbbreviated[1]...)
653 b = append(b, []byte{0x20}...)
657 if btz, ok := kl.timezones[tz]; ok {
658 b = append(b, btz...)