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 currencyPositiveSuffix string
27 currencyNegativeSuffix string
28 monthsAbbreviated []string
31 daysAbbreviated []string
35 periodsAbbreviated []string
36 periodsNarrow []string
39 erasAbbreviated []string
42 timezones map[string]string
45 // New returns a new instance of translator for the 'cs_CZ' locale
46 func New() locales.Translator {
49 pluralsCardinal: []locales.PluralRule{2, 4, 5, 6},
50 pluralsOrdinal: []locales.PluralRule{6},
51 pluralsRange: []locales.PluralRule{2, 4, 5, 6},
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", "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"},
61 currencyPositiveSuffix: " ",
62 currencyNegativeSuffix: " ",
63 monthsAbbreviated: []string{"", "led", "úno", "bře", "dub", "kvě", "čvn", "čvc", "srp", "zář", "říj", "lis", "pro"},
64 monthsNarrow: []string{"", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"},
65 monthsWide: []string{"", "ledna", "února", "března", "dubna", "května", "června", "července", "srpna", "září", "října", "listopadu", "prosince"},
66 daysAbbreviated: []string{"ne", "po", "út", "st", "čt", "pá", "so"},
67 daysNarrow: []string{"N", "P", "Ú", "S", "Č", "P", "S"},
68 daysShort: []string{"ne", "po", "út", "st", "čt", "pá", "so"},
69 daysWide: []string{"neděle", "pondělí", "úterý", "středa", "čtvrtek", "pátek", "sobota"},
70 periodsAbbreviated: []string{"dop.", "odp."},
71 periodsNarrow: []string{"dop.", "odp."},
72 periodsWide: []string{"dop.", "odp."},
73 erasAbbreviated: []string{"př. n. l.", "n. l."},
74 erasNarrow: []string{"př.n.l.", "n.l."},
75 erasWide: []string{"př. n. l.", "n. l."},
76 timezones: map[string]string{"WEZ": "Západoevropský standardní čas", "HEPM": "Pierre-miquelonský letní čas", "ACWDT": "Středozápadní australský letní čas", "NZDT": "Novozélandský letní čas", "ART": "Argentinský standardní čas", "HKST": "Hongkongský letní čas", "GYT": "Guyanský čas", "HEEG": "Východogrónský letní čas", "CAT": "Středoafrický čas", "HNPM": "Pierre-miquelonský standardní čas", "MESZ": "Středoevropský letní čas", "OESZ": "Východoevropský letní čas", "MST": "Severoamerický horský standardní čas", "WARST": "Západoargentinský letní čas", "VET": "Venezuelský čas", "AWDT": "Západoaustralský letní čas", "MYT": "Malajský čas", "JDT": "Japonský letní čas", "IST": "Indický čas", "ChST": "Chamorrský čas", "AWST": "Západoaustralský standardní čas", "WIB": "Západoindonéský čas", "ACWST": "Středozápadní australský standardní čas", "HAST": "Havajsko-aleutský standardní čas", "HKT": "Hongkongský standardní čas", "ECT": "Ekvádorský čas", "SGT": "Singapurský čas", "HNCU": "Kubánský standardní čas", "LHST": "Standardní čas ostrova lorda Howa", "LHDT": "Letní čas ostrova lorda Howa", "ARST": "Argentinský letní čas", "EDT": "Severoamerický východní letní čas", "GMT": "Greenwichský střední čas", "HENOMX": "Severozápadní mexický letní čas", "AEST": "Východoaustralský standardní čas", "HADT": "Havajsko-aleutský letní čas", "HAT": "Newfoundlandský letní čas", "CLST": "Chilský letní čas", "AKDT": "Aljašský letní čas", "HECU": "Kubánský letní čas", "CST": "Severoamerický centrální standardní čas", "CDT": "Severoamerický centrální letní čas", "SRT": "Surinamský čas", "WIT": "Východoindonéský čas", "ADT": "Atlantický letní čas", "HNEG": "Východogrónský standardní čas", "ACST": "Středoaustralský standardní čas", "BT": "Bhútánský čas", "AST": "Atlantický standardní čas", "SAST": "Jihoafrický čas", "COT": "Kolumbijský standardní čas", "COST": "Kolumbijský letní čas", "ACDT": "Středoaustralský letní čas", "UYST": "Uruguayský letní čas", "PDT": "Severoamerický pacifický letní čas", "UYT": "Uruguayský standardní čas", "MEZ": "Středoevropský standardní čas", "HNOG": "Západogrónský standardní čas", "HNT": "Newfoundlandský standardní čas", "EST": "Severoamerický východní standardní čas", "NZST": "Novozélandský standardní čas", "AEDT": "Východoaustralský letní čas", "CLT": "Chilský standardní čas", "CHADT": "Chathamský letní čas", "BOT": "Bolivijský čas", "CHAST": "Chathamský standardní čas", "WESZ": "Západoevropský letní čas", "HNPMX": "Mexický pacifický standardní čas", "HEPMX": "Mexický pacifický letní čas", "TMST": "Turkmenský letní čas", "WITA": "Středoindonéský čas", "JST": "Japonský standardní čas", "WAST": "Západoafrický letní čas", "GFT": "Francouzskoguyanský čas", "TMT": "Turkmenský standardní čas", "MDT": "Severoamerický horský letní čas", "WART": "Západoargentinský standardní čas", "HEOG": "Západogrónský letní čas", "WAT": "Západoafrický standardní čas", "PST": "Severoamerický pacifický standardní čas", "OEZ": "Východoevropský standardní čas", "HNNOMX": "Severozápadní mexický standardní čas", "∅∅∅": "Azorský letní čas", "EAT": "Východoafrický čas", "AKST": "Aljašský standardní čas"},
80 // Locale returns the current translators string locale
81 func (cs *cs_CZ) Locale() string {
85 // PluralsCardinal returns the list of cardinal plural rules associated with 'cs_CZ'
86 func (cs *cs_CZ) PluralsCardinal() []locales.PluralRule {
87 return cs.pluralsCardinal
90 // PluralsOrdinal returns the list of ordinal plural rules associated with 'cs_CZ'
91 func (cs *cs_CZ) PluralsOrdinal() []locales.PluralRule {
92 return cs.pluralsOrdinal
95 // PluralsRange returns the list of range plural rules associated with 'cs_CZ'
96 func (cs *cs_CZ) PluralsRange() []locales.PluralRule {
97 return cs.pluralsRange
100 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'cs_CZ'
101 func (cs *cs_CZ) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
106 if i == 1 && v == 0 {
107 return locales.PluralRuleOne
108 } else if i >= 2 && i <= 4 && v == 0 {
109 return locales.PluralRuleFew
111 return locales.PluralRuleMany
114 return locales.PluralRuleOther
117 // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'cs_CZ'
118 func (cs *cs_CZ) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
119 return locales.PluralRuleOther
122 // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'cs_CZ'
123 func (cs *cs_CZ) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
125 start := cs.CardinalPluralRule(num1, v1)
126 end := cs.CardinalPluralRule(num2, v2)
128 if start == locales.PluralRuleOne && end == locales.PluralRuleFew {
129 return locales.PluralRuleFew
130 } else if start == locales.PluralRuleOne && end == locales.PluralRuleMany {
131 return locales.PluralRuleMany
132 } else if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
133 return locales.PluralRuleOther
134 } else if start == locales.PluralRuleFew && end == locales.PluralRuleFew {
135 return locales.PluralRuleFew
136 } else if start == locales.PluralRuleFew && end == locales.PluralRuleMany {
137 return locales.PluralRuleMany
138 } else if start == locales.PluralRuleFew && end == locales.PluralRuleOther {
139 return locales.PluralRuleOther
140 } else if start == locales.PluralRuleMany && end == locales.PluralRuleOne {
141 return locales.PluralRuleOne
142 } else if start == locales.PluralRuleMany && end == locales.PluralRuleFew {
143 return locales.PluralRuleFew
144 } else if start == locales.PluralRuleMany && end == locales.PluralRuleMany {
145 return locales.PluralRuleMany
146 } else if start == locales.PluralRuleMany && end == locales.PluralRuleOther {
147 return locales.PluralRuleOther
148 } else if start == locales.PluralRuleOther && end == locales.PluralRuleOne {
149 return locales.PluralRuleOne
150 } else if start == locales.PluralRuleOther && end == locales.PluralRuleFew {
151 return locales.PluralRuleFew
152 } else if start == locales.PluralRuleOther && end == locales.PluralRuleMany {
153 return locales.PluralRuleMany
156 return locales.PluralRuleOther
160 // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
161 func (cs *cs_CZ) MonthAbbreviated(month time.Month) string {
162 return cs.monthsAbbreviated[month]
165 // MonthsAbbreviated returns the locales abbreviated months
166 func (cs *cs_CZ) MonthsAbbreviated() []string {
167 return cs.monthsAbbreviated[1:]
170 // MonthNarrow returns the locales narrow month given the 'month' provided
171 func (cs *cs_CZ) MonthNarrow(month time.Month) string {
172 return cs.monthsNarrow[month]
175 // MonthsNarrow returns the locales narrow months
176 func (cs *cs_CZ) MonthsNarrow() []string {
177 return cs.monthsNarrow[1:]
180 // MonthWide returns the locales wide month given the 'month' provided
181 func (cs *cs_CZ) MonthWide(month time.Month) string {
182 return cs.monthsWide[month]
185 // MonthsWide returns the locales wide months
186 func (cs *cs_CZ) MonthsWide() []string {
187 return cs.monthsWide[1:]
190 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
191 func (cs *cs_CZ) WeekdayAbbreviated(weekday time.Weekday) string {
192 return cs.daysAbbreviated[weekday]
195 // WeekdaysAbbreviated returns the locales abbreviated weekdays
196 func (cs *cs_CZ) WeekdaysAbbreviated() []string {
197 return cs.daysAbbreviated
200 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
201 func (cs *cs_CZ) WeekdayNarrow(weekday time.Weekday) string {
202 return cs.daysNarrow[weekday]
205 // WeekdaysNarrow returns the locales narrow weekdays
206 func (cs *cs_CZ) WeekdaysNarrow() []string {
210 // WeekdayShort returns the locales short weekday given the 'weekday' provided
211 func (cs *cs_CZ) WeekdayShort(weekday time.Weekday) string {
212 return cs.daysShort[weekday]
215 // WeekdaysShort returns the locales short weekdays
216 func (cs *cs_CZ) WeekdaysShort() []string {
220 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
221 func (cs *cs_CZ) WeekdayWide(weekday time.Weekday) string {
222 return cs.daysWide[weekday]
225 // WeekdaysWide returns the locales wide weekdays
226 func (cs *cs_CZ) WeekdaysWide() []string {
230 // Decimal returns the decimal point of number
231 func (cs *cs_CZ) Decimal() string {
235 // Group returns the group of number
236 func (cs *cs_CZ) Group() string {
240 // Group returns the minus sign of number
241 func (cs *cs_CZ) Minus() string {
245 // FmtNumber returns 'num' with digits/precision of 'v' for 'cs_CZ' and handles both Whole and Real numbers based on 'v'
246 func (cs *cs_CZ) FmtNumber(num float64, v uint64) string {
248 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
249 l := len(s) + 2 + 2*len(s[:len(s)-int(v)-1])/3
252 b := make([]byte, 0, l)
254 for i := len(s) - 1; i >= 0; i-- {
257 b = append(b, cs.decimal[0])
264 for j := len(cs.group) - 1; j >= 0; j-- {
265 b = append(b, cs.group[j])
277 b = append(b, cs.minus[0])
281 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
282 b[i], b[j] = b[j], b[i]
288 // FmtPercent returns 'num' with digits/precision of 'v' for 'cs_CZ' and handles both Whole and Real numbers based on 'v'
289 // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
290 func (cs *cs_CZ) FmtPercent(num float64, v uint64) string {
291 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
293 b := make([]byte, 0, l)
295 for i := len(s) - 1; i >= 0; i-- {
298 b = append(b, cs.decimal[0])
306 b = append(b, cs.minus[0])
310 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
311 b[i], b[j] = b[j], b[i]
314 b = append(b, cs.percentSuffix...)
316 b = append(b, cs.percent...)
321 // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'cs_CZ'
322 func (cs *cs_CZ) FmtCurrency(num float64, v uint64, currency currency.Type) string {
324 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
325 symbol := cs.currencies[currency]
326 l := len(s) + len(symbol) + 4 + 2*len(s[:len(s)-int(v)-1])/3
329 b := make([]byte, 0, l)
331 for i := len(s) - 1; i >= 0; i-- {
334 b = append(b, cs.decimal[0])
341 for j := len(cs.group) - 1; j >= 0; j-- {
342 b = append(b, cs.group[j])
354 b = append(b, cs.minus[0])
358 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
359 b[i], b[j] = b[j], b[i]
365 b = append(b, cs.decimal...)
368 for i := 0; i < 2-int(v); i++ {
373 b = append(b, cs.currencyPositiveSuffix...)
375 b = append(b, symbol...)
380 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'cs_CZ'
381 // in accounting notation.
382 func (cs *cs_CZ) FmtAccounting(num float64, v uint64, currency currency.Type) string {
384 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
385 symbol := cs.currencies[currency]
386 l := len(s) + len(symbol) + 4 + 2*len(s[:len(s)-int(v)-1])/3
389 b := make([]byte, 0, l)
391 for i := len(s) - 1; i >= 0; i-- {
394 b = append(b, cs.decimal[0])
401 for j := len(cs.group) - 1; j >= 0; j-- {
402 b = append(b, cs.group[j])
415 b = append(b, cs.minus[0])
420 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
421 b[i], b[j] = b[j], b[i]
427 b = append(b, cs.decimal...)
430 for i := 0; i < 2-int(v); i++ {
436 b = append(b, cs.currencyNegativeSuffix...)
437 b = append(b, symbol...)
440 b = append(b, cs.currencyPositiveSuffix...)
441 b = append(b, symbol...)
447 // FmtDateShort returns the short date representation of 't' for 'cs_CZ'
448 func (cs *cs_CZ) FmtDateShort(t time.Time) string {
450 b := make([]byte, 0, 32)
456 b = strconv.AppendInt(b, int64(t.Day()), 10)
457 b = append(b, []byte{0x2e}...)
463 b = strconv.AppendInt(b, int64(t.Month()), 10)
465 b = append(b, []byte{0x2e}...)
468 b = append(b, strconv.Itoa(t.Year())[2:]...)
470 b = append(b, strconv.Itoa(t.Year())[1:]...)
476 // FmtDateMedium returns the medium date representation of 't' for 'cs_CZ'
477 func (cs *cs_CZ) FmtDateMedium(t time.Time) string {
479 b := make([]byte, 0, 32)
481 b = strconv.AppendInt(b, int64(t.Day()), 10)
482 b = append(b, []byte{0x2e, 0x20}...)
483 b = strconv.AppendInt(b, int64(t.Month()), 10)
484 b = append(b, []byte{0x2e, 0x20}...)
487 b = strconv.AppendInt(b, int64(t.Year()), 10)
489 b = strconv.AppendInt(b, int64(-t.Year()), 10)
495 // FmtDateLong returns the long date representation of 't' for 'cs_CZ'
496 func (cs *cs_CZ) FmtDateLong(t time.Time) string {
498 b := make([]byte, 0, 32)
500 b = strconv.AppendInt(b, int64(t.Day()), 10)
501 b = append(b, []byte{0x2e, 0x20}...)
502 b = append(b, cs.monthsWide[t.Month()]...)
503 b = append(b, []byte{0x20}...)
506 b = strconv.AppendInt(b, int64(t.Year()), 10)
508 b = strconv.AppendInt(b, int64(-t.Year()), 10)
514 // FmtDateFull returns the full date representation of 't' for 'cs_CZ'
515 func (cs *cs_CZ) FmtDateFull(t time.Time) string {
517 b := make([]byte, 0, 32)
519 b = append(b, cs.daysWide[t.Weekday()]...)
520 b = append(b, []byte{0x20}...)
521 b = strconv.AppendInt(b, int64(t.Day()), 10)
522 b = append(b, []byte{0x2e, 0x20}...)
523 b = append(b, cs.monthsWide[t.Month()]...)
524 b = append(b, []byte{0x20}...)
527 b = strconv.AppendInt(b, int64(t.Year()), 10)
529 b = strconv.AppendInt(b, int64(-t.Year()), 10)
535 // FmtTimeShort returns the short time representation of 't' for 'cs_CZ'
536 func (cs *cs_CZ) FmtTimeShort(t time.Time) string {
538 b := make([]byte, 0, 32)
540 b = strconv.AppendInt(b, int64(t.Hour()), 10)
541 b = append(b, cs.timeSeparator...)
547 b = strconv.AppendInt(b, int64(t.Minute()), 10)
552 // FmtTimeMedium returns the medium time representation of 't' for 'cs_CZ'
553 func (cs *cs_CZ) FmtTimeMedium(t time.Time) string {
555 b := make([]byte, 0, 32)
557 b = strconv.AppendInt(b, int64(t.Hour()), 10)
558 b = append(b, cs.timeSeparator...)
564 b = strconv.AppendInt(b, int64(t.Minute()), 10)
565 b = append(b, cs.timeSeparator...)
571 b = strconv.AppendInt(b, int64(t.Second()), 10)
576 // FmtTimeLong returns the long time representation of 't' for 'cs_CZ'
577 func (cs *cs_CZ) FmtTimeLong(t time.Time) string {
579 b := make([]byte, 0, 32)
581 b = strconv.AppendInt(b, int64(t.Hour()), 10)
582 b = append(b, cs.timeSeparator...)
588 b = strconv.AppendInt(b, int64(t.Minute()), 10)
589 b = append(b, cs.timeSeparator...)
595 b = strconv.AppendInt(b, int64(t.Second()), 10)
596 b = append(b, []byte{0x20}...)
604 // FmtTimeFull returns the full time representation of 't' for 'cs_CZ'
605 func (cs *cs_CZ) FmtTimeFull(t time.Time) string {
607 b := make([]byte, 0, 32)
609 b = strconv.AppendInt(b, int64(t.Hour()), 10)
610 b = append(b, cs.timeSeparator...)
616 b = strconv.AppendInt(b, int64(t.Minute()), 10)
617 b = append(b, cs.timeSeparator...)
623 b = strconv.AppendInt(b, int64(t.Second()), 10)
624 b = append(b, []byte{0x20}...)
628 if btz, ok := cs.timezones[tz]; ok {
629 b = append(b, btz...)