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
24 currencies []string // idx = enum of currency code
25 monthsAbbreviated []string
28 daysAbbreviated []string
32 periodsAbbreviated []string
33 periodsNarrow []string
36 erasAbbreviated []string
39 timezones map[string]string
42 // New returns a new instance of translator for the 'lu_CD' locale
43 func New() locales.Translator {
52 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"},
53 monthsAbbreviated: []string{"", "Cio", "Lui", "Lus", "Muu", "Lum", "Luf", "Kab", "Lush", "Lut", "Lun", "Kas", "Cis"},
54 monthsNarrow: []string{"", "C", "L", "L", "M", "L", "L", "K", "L", "L", "L", "K", "C"},
55 monthsWide: []string{"", "Ciongo", "Lùishi", "Lusòlo", "Mùuyà", "Lumùngùlù", "Lufuimi", "Kabàlàshìpù", "Lùshìkà", "Lutongolo", "Lungùdi", "Kaswèkèsè", "Ciswà"},
56 daysAbbreviated: []string{"Lum", "Nko", "Ndy", "Ndg", "Njw", "Ngv", "Lub"},
57 daysNarrow: []string{"L", "N", "N", "N", "N", "N", "L"},
58 daysWide: []string{"Lumingu", "Nkodya", "Ndàayà", "Ndangù", "Njòwa", "Ngòvya", "Lubingu"},
59 periodsAbbreviated: []string{"Dinda", "Dilolo"},
60 periodsWide: []string{"Dinda", "Dilolo"},
61 erasAbbreviated: []string{"kmp. Y.K.", "kny. Y. K."},
62 erasNarrow: []string{"", ""},
63 erasWide: []string{"Kumpala kwa Yezu Kli", "Kunyima kwa Yezu Kli"},
64 timezones: map[string]string{"EDT": "EDT", "HNPMX": "HNPMX", "PDT": "PDT", "AWST": "AWST", "SRT": "SRT", "HNNOMX": "HNNOMX", "BOT": "BOT", "AWDT": "AWDT", "ACWDT": "ACWDT", "HENOMX": "HENOMX", "WAST": "WAST", "ACST": "ACST", "SGT": "SGT", "MYT": "MYT", "MESZ": "MESZ", "HADT": "HADT", "AST": "AST", "AEST": "AEST", "AKDT": "AKDT", "CHAST": "CHAST", "MEZ": "MEZ", "LHDT": "LHDT", "IST": "IST", "COT": "COT", "WEZ": "WEZ", "GMT": "GMT", "HNPM": "HNPM", "WARST": "WARST", "VET": "VET", "COST": "COST", "CDT": "CDT", "MDT": "MDT", "JST": "JST", "HKT": "HKT", "CLT": "CLT", "HEPMX": "HEPMX", "UYST": "UYST", "AEDT": "AEDT", "CLST": "CLST", "OEZ": "OEZ", "WART": "WART", "WAT": "WAT", "HNCU": "HNCU", "NZST": "NZST", "ADT": "ADT", "HKST": "HKST", "ECT": "ECT", "WESZ": "WESZ", "HEPM": "HEPM", "CST": "CST", "HEOG": "HEOG", "EAT": "EAT", "HNT": "HNT", "ACDT": "ACDT", "HECU": "HECU", "OESZ": "OESZ", "LHST": "LHST", "ARST": "ARST", "HNOG": "HNOG", "HEEG": "HEEG", "∅∅∅": "∅∅∅", "NZDT": "NZDT", "TMT": "TMT", "WITA": "WITA", "ART": "ART", "HNEG": "HNEG", "PST": "PST", "ACWST": "ACWST", "HAST": "HAST", "JDT": "JDT", "GYT": "GYT", "WIB": "WIB", "CHADT": "CHADT", "UYT": "UYT", "HAT": "HAT", "EST": "EST", "AKST": "AKST", "CAT": "CAT", "ChST": "ChST", "BT": "BT", "MST": "MST", "WIT": "WIT", "TMST": "TMST", "SAST": "SAST", "GFT": "GFT"},
68 // Locale returns the current translators string locale
69 func (lu *lu_CD) Locale() string {
73 // PluralsCardinal returns the list of cardinal plural rules associated with 'lu_CD'
74 func (lu *lu_CD) PluralsCardinal() []locales.PluralRule {
75 return lu.pluralsCardinal
78 // PluralsOrdinal returns the list of ordinal plural rules associated with 'lu_CD'
79 func (lu *lu_CD) PluralsOrdinal() []locales.PluralRule {
80 return lu.pluralsOrdinal
83 // PluralsRange returns the list of range plural rules associated with 'lu_CD'
84 func (lu *lu_CD) PluralsRange() []locales.PluralRule {
85 return lu.pluralsRange
88 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'lu_CD'
89 func (lu *lu_CD) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
90 return locales.PluralRuleUnknown
93 // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'lu_CD'
94 func (lu *lu_CD) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
95 return locales.PluralRuleUnknown
98 // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'lu_CD'
99 func (lu *lu_CD) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
100 return locales.PluralRuleUnknown
103 // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
104 func (lu *lu_CD) MonthAbbreviated(month time.Month) string {
105 return lu.monthsAbbreviated[month]
108 // MonthsAbbreviated returns the locales abbreviated months
109 func (lu *lu_CD) MonthsAbbreviated() []string {
110 return lu.monthsAbbreviated[1:]
113 // MonthNarrow returns the locales narrow month given the 'month' provided
114 func (lu *lu_CD) MonthNarrow(month time.Month) string {
115 return lu.monthsNarrow[month]
118 // MonthsNarrow returns the locales narrow months
119 func (lu *lu_CD) MonthsNarrow() []string {
120 return lu.monthsNarrow[1:]
123 // MonthWide returns the locales wide month given the 'month' provided
124 func (lu *lu_CD) MonthWide(month time.Month) string {
125 return lu.monthsWide[month]
128 // MonthsWide returns the locales wide months
129 func (lu *lu_CD) MonthsWide() []string {
130 return lu.monthsWide[1:]
133 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
134 func (lu *lu_CD) WeekdayAbbreviated(weekday time.Weekday) string {
135 return lu.daysAbbreviated[weekday]
138 // WeekdaysAbbreviated returns the locales abbreviated weekdays
139 func (lu *lu_CD) WeekdaysAbbreviated() []string {
140 return lu.daysAbbreviated
143 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
144 func (lu *lu_CD) WeekdayNarrow(weekday time.Weekday) string {
145 return lu.daysNarrow[weekday]
148 // WeekdaysNarrow returns the locales narrow weekdays
149 func (lu *lu_CD) WeekdaysNarrow() []string {
153 // WeekdayShort returns the locales short weekday given the 'weekday' provided
154 func (lu *lu_CD) WeekdayShort(weekday time.Weekday) string {
155 return lu.daysShort[weekday]
158 // WeekdaysShort returns the locales short weekdays
159 func (lu *lu_CD) WeekdaysShort() []string {
163 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
164 func (lu *lu_CD) WeekdayWide(weekday time.Weekday) string {
165 return lu.daysWide[weekday]
168 // WeekdaysWide returns the locales wide weekdays
169 func (lu *lu_CD) WeekdaysWide() []string {
173 // Decimal returns the decimal point of number
174 func (lu *lu_CD) Decimal() string {
178 // Group returns the group of number
179 func (lu *lu_CD) Group() string {
183 // Group returns the minus sign of number
184 func (lu *lu_CD) Minus() string {
188 // FmtNumber returns 'num' with digits/precision of 'v' for 'lu_CD' and handles both Whole and Real numbers based on 'v'
189 func (lu *lu_CD) FmtNumber(num float64, v uint64) string {
191 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
192 l := len(s) + 1 + 1*len(s[:len(s)-int(v)-1])/3
195 b := make([]byte, 0, l)
197 for i := len(s) - 1; i >= 0; i-- {
200 b = append(b, lu.decimal[0])
207 b = append(b, lu.group[0])
218 b = append(b, lu.minus[0])
222 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
223 b[i], b[j] = b[j], b[i]
229 // FmtPercent returns 'num' with digits/precision of 'v' for 'lu_CD' and handles both Whole and Real numbers based on 'v'
230 // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
231 func (lu *lu_CD) FmtPercent(num float64, v uint64) string {
232 return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
235 // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'lu_CD'
236 func (lu *lu_CD) FmtCurrency(num float64, v uint64, currency currency.Type) string {
238 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
239 symbol := lu.currencies[currency]
240 l := len(s) + len(symbol) + 1 + 1*len(s[:len(s)-int(v)-1])/3
243 b := make([]byte, 0, l)
245 for i := len(s) - 1; i >= 0; i-- {
248 b = append(b, lu.decimal[0])
255 b = append(b, lu.group[0])
266 b = append(b, lu.minus[0])
270 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
271 b[i], b[j] = b[j], b[i]
277 b = append(b, lu.decimal...)
280 for i := 0; i < 2-int(v); i++ {
285 b = append(b, symbol...)
290 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'lu_CD'
291 // in accounting notation.
292 func (lu *lu_CD) FmtAccounting(num float64, v uint64, currency currency.Type) string {
294 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
295 symbol := lu.currencies[currency]
296 l := len(s) + len(symbol) + 1 + 1*len(s[:len(s)-int(v)-1])/3
299 b := make([]byte, 0, l)
301 for i := len(s) - 1; i >= 0; i-- {
304 b = append(b, lu.decimal[0])
311 b = append(b, lu.group[0])
323 b = append(b, lu.minus[0])
328 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
329 b[i], b[j] = b[j], b[i]
335 b = append(b, lu.decimal...)
338 for i := 0; i < 2-int(v); i++ {
344 b = append(b, symbol...)
347 b = append(b, symbol...)
353 // FmtDateShort returns the short date representation of 't' for 'lu_CD'
354 func (lu *lu_CD) FmtDateShort(t time.Time) string {
356 b := make([]byte, 0, 32)
358 b = strconv.AppendInt(b, int64(t.Day()), 10)
359 b = append(b, []byte{0x2f}...)
360 b = strconv.AppendInt(b, int64(t.Month()), 10)
361 b = append(b, []byte{0x2f}...)
364 b = strconv.AppendInt(b, int64(t.Year()), 10)
366 b = strconv.AppendInt(b, int64(-t.Year()), 10)
372 // FmtDateMedium returns the medium date representation of 't' for 'lu_CD'
373 func (lu *lu_CD) FmtDateMedium(t time.Time) string {
375 b := make([]byte, 0, 32)
377 b = strconv.AppendInt(b, int64(t.Day()), 10)
378 b = append(b, []byte{0x20}...)
379 b = append(b, lu.monthsAbbreviated[t.Month()]...)
380 b = append(b, []byte{0x20}...)
383 b = strconv.AppendInt(b, int64(t.Year()), 10)
385 b = strconv.AppendInt(b, int64(-t.Year()), 10)
391 // FmtDateLong returns the long date representation of 't' for 'lu_CD'
392 func (lu *lu_CD) FmtDateLong(t time.Time) string {
394 b := make([]byte, 0, 32)
396 b = strconv.AppendInt(b, int64(t.Day()), 10)
397 b = append(b, []byte{0x20}...)
398 b = append(b, lu.monthsWide[t.Month()]...)
399 b = append(b, []byte{0x20}...)
402 b = strconv.AppendInt(b, int64(t.Year()), 10)
404 b = strconv.AppendInt(b, int64(-t.Year()), 10)
410 // FmtDateFull returns the full date representation of 't' for 'lu_CD'
411 func (lu *lu_CD) FmtDateFull(t time.Time) string {
413 b := make([]byte, 0, 32)
415 b = append(b, lu.daysWide[t.Weekday()]...)
416 b = append(b, []byte{0x20}...)
417 b = strconv.AppendInt(b, int64(t.Day()), 10)
418 b = append(b, []byte{0x20}...)
419 b = append(b, lu.monthsWide[t.Month()]...)
420 b = append(b, []byte{0x20}...)
423 b = strconv.AppendInt(b, int64(t.Year()), 10)
425 b = strconv.AppendInt(b, int64(-t.Year()), 10)
431 // FmtTimeShort returns the short time representation of 't' for 'lu_CD'
432 func (lu *lu_CD) FmtTimeShort(t time.Time) string {
434 b := make([]byte, 0, 32)
440 b = strconv.AppendInt(b, int64(t.Hour()), 10)
441 b = append(b, lu.timeSeparator...)
447 b = strconv.AppendInt(b, int64(t.Minute()), 10)
452 // FmtTimeMedium returns the medium time representation of 't' for 'lu_CD'
453 func (lu *lu_CD) FmtTimeMedium(t time.Time) string {
455 b := make([]byte, 0, 32)
461 b = strconv.AppendInt(b, int64(t.Hour()), 10)
462 b = append(b, lu.timeSeparator...)
468 b = strconv.AppendInt(b, int64(t.Minute()), 10)
469 b = append(b, lu.timeSeparator...)
475 b = strconv.AppendInt(b, int64(t.Second()), 10)
480 // FmtTimeLong returns the long time representation of 't' for 'lu_CD'
481 func (lu *lu_CD) FmtTimeLong(t time.Time) string {
483 b := make([]byte, 0, 32)
489 b = strconv.AppendInt(b, int64(t.Hour()), 10)
490 b = append(b, lu.timeSeparator...)
496 b = strconv.AppendInt(b, int64(t.Minute()), 10)
497 b = append(b, lu.timeSeparator...)
503 b = strconv.AppendInt(b, int64(t.Second()), 10)
504 b = append(b, []byte{0x20}...)
512 // FmtTimeFull returns the full time representation of 't' for 'lu_CD'
513 func (lu *lu_CD) FmtTimeFull(t time.Time) string {
515 b := make([]byte, 0, 32)
521 b = strconv.AppendInt(b, int64(t.Hour()), 10)
522 b = append(b, lu.timeSeparator...)
528 b = strconv.AppendInt(b, int64(t.Minute()), 10)
529 b = append(b, lu.timeSeparator...)
535 b = strconv.AppendInt(b, int64(t.Second()), 10)
536 b = append(b, []byte{0x20}...)
540 if btz, ok := lu.timezones[tz]; ok {
541 b = append(b, btz...)