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 'zh_Hant' locale
43 func New() locales.Translator {
46 pluralsCardinal: []locales.PluralRule{6},
47 pluralsOrdinal: []locales.PluralRule{6},
48 pluralsRange: []locales.PluralRule{6},
56 currencies: []string{"ADP", "AED", "AFA", "AFN", "ALK", "ALL", "AMD", "ANG", "AOA", "AOK", "AON", "AOR", "ARA", "ARL", "ARM", "ARP", "ARS", "ATS", "AU$", "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", "R$", "BRN", "BRR", "BRZ", "BSD", "BTN", "BUK", "BWP", "BYB", "BYN", "BYR", "BZD", "CA$", "CDF", "CHE", "CHF", "CHW", "CLE", "CLF", "CLP", "CNX", "CN¥", "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", "€", "FIM", "FJD", "FKP", "FRF", "£", "GEK", "GEL", "GHC", "GHS", "GIP", "GMD", "GNF", "GNS", "GQE", "GRD", "GTQ", "GWE", "GWP", "GYD", "HK$", "HNL", "HRD", "HRK", "HTG", "HUF", "IDR", "IEP", "ILP", "ILR", "₪", "₹", "IQD", "IRR", "ISJ", "ISK", "ITL", "JMD", "JOD", "¥", "KES", "KGS", "KHR", "KMF", "KPW", "KRH", "KRO", "₩", "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", "MX$", "MXP", "MXV", "MYR", "MZE", "MZM", "MZN", "NAD", "NGN", "NIC", "NIO", "NLG", "NOK", "NPR", "NZ$", "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", "$", "TZS", "UAH", "UAK", "UGS", "UGX", "US$", "USN", "USS", "UYI", "UYP", "UYU", "UZS", "VEB", "VEF", "₫", "VNN", "VUV", "WST", "FCFA", "XAG", "XAU", "XBA", "XBB", "XBC", "XBD", "EC$", "XDR", "XEU", "XFO", "XFU", "CFA", "XPD", "CFPF", "XPT", "XRE", "XSU", "XTS", "XUA", "XXX", "YDD", "YER", "YUD", "YUM", "YUN", "YUR", "ZAL", "ZAR", "ZMK", "ZMW", "ZRN", "ZRZ", "ZWD", "ZWL", "ZWR"},
57 monthsAbbreviated: []string{"", "1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"},
58 monthsNarrow: []string{"", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"},
59 monthsWide: []string{"", "1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"},
60 daysAbbreviated: []string{"週日", "週一", "週二", "週三", "週四", "週五", "週六"},
61 daysNarrow: []string{"日", "一", "二", "三", "四", "五", "六"},
62 daysShort: []string{"日", "一", "二", "三", "四", "五", "六"},
63 daysWide: []string{"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"},
64 periodsAbbreviated: []string{"上午", "下午"},
65 periodsNarrow: []string{"上午", "下午"},
66 periodsWide: []string{"上午", "下午"},
67 erasAbbreviated: []string{"西元前", "西元"},
68 erasNarrow: []string{"西元前", "西元"},
69 erasWide: []string{"西元前", "西元"},
70 timezones: map[string]string{"∅∅∅": "巴西利亞夏令時間", "AWST": "澳洲西部標準時間", "AEDT": "澳洲東部夏令時間", "ADT": "大西洋夏令時間", "WIB": "印尼西部時間", "CHADT": "查坦群島夏令時間", "TMT": "土庫曼標準時間", "EAT": "東非時間", "MEZ": "中歐標準時間", "WARST": "阿根廷西部夏令時間", "WAT": "西非標準時間", "HNPMX": "墨西哥太平洋標準時間", "HECU": "古巴夏令時間", "HNPM": "聖皮埃爾和密克隆群島標準時間", "HEPM": "聖皮埃爾和密克隆群島夏令時間", "AWDT": "澳洲西部夏令時間", "HEEG": "格陵蘭東部夏令時間", "HKT": "香港標準時間", "EDT": "東部夏令時間", "HEPMX": "墨西哥太平洋夏令時間", "PST": "太平洋標準時間", "UYT": "烏拉圭標準時間", "COT": "哥倫比亞標準時間", "ChST": "查莫洛時間", "OEZ": "東歐標準時間", "AST": "大西洋標準時間", "SAST": "南非標準時間", "HNEG": "格陵蘭東部標準時間", "BOT": "玻利維亞時間", "CST": "中部標準時間", "TMST": "土庫曼夏令時間", "EST": "東部標準時間", "CLST": "智利夏令時間", "GYT": "蓋亞那時間", "ACDT": "澳洲中部夏令時間", "MST": "澳門標準時間", "LHDT": "豪勳爵島夏令時間", "ARST": "阿根廷夏令時間", "HNOG": "格陵蘭西部標準時間", "CLT": "智利標準時間", "SGT": "新加坡標準時間", "ART": "阿根廷標準時間", "COST": "哥倫比亞夏令時間", "GFT": "法屬圭亞那時間", "BT": "不丹時間", "WART": "阿根廷西部標準時間", "HENOMX": "墨西哥西北部夏令時間", "JST": "日本標準時間", "AEST": "澳洲東部標準時間", "AKST": "阿拉斯加標準時間", "HKST": "香港夏令時間", "AKDT": "阿拉斯加夏令時間", "WEZ": "西歐標準時間", "HNCU": "古巴標準時間", "SRT": "蘇利南時間", "ACWDT": "澳洲中西部夏令時間", "WITA": "印尼中部時間", "HEOG": "格陵蘭西部夏令時間", "CDT": "中部夏令時間", "WIT": "印尼東部時間", "WESZ": "西歐夏令時間", "HNT": "紐芬蘭標準時間", "HAT": "紐芬蘭夏令時間", "ECT": "厄瓜多時間", "CHAST": "查坦群島標準時間", "MDT": "澳門夏令時間", "MYT": "馬來西亞時間", "VET": "委內瑞拉時間", "JDT": "日本夏令時間", "GMT": "格林威治標準時間", "UYST": "烏拉圭夏令時間", "HNNOMX": "墨西哥西北部標準時間", "OESZ": "東歐夏令時間", "WAST": "西非夏令時間", "HAST": "夏威夷-阿留申標準時間", "HADT": "夏威夷-阿留申夏令時間", "MESZ": "中歐夏令時間", "IST": "印度標準時間", "ACWST": "澳洲中西部標準時間", "NZDT": "紐西蘭夏令時間", "ACST": "澳洲中部標準時間", "CAT": "中非時間", "PDT": "太平洋夏令時間", "NZST": "紐西蘭標準時間", "LHST": "豪勳爵島標準時間"},
74 // Locale returns the current translators string locale
75 func (zh *zh_Hant) Locale() string {
79 // PluralsCardinal returns the list of cardinal plural rules associated with 'zh_Hant'
80 func (zh *zh_Hant) PluralsCardinal() []locales.PluralRule {
81 return zh.pluralsCardinal
84 // PluralsOrdinal returns the list of ordinal plural rules associated with 'zh_Hant'
85 func (zh *zh_Hant) PluralsOrdinal() []locales.PluralRule {
86 return zh.pluralsOrdinal
89 // PluralsRange returns the list of range plural rules associated with 'zh_Hant'
90 func (zh *zh_Hant) PluralsRange() []locales.PluralRule {
91 return zh.pluralsRange
94 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'zh_Hant'
95 func (zh *zh_Hant) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
96 return locales.PluralRuleOther
99 // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'zh_Hant'
100 func (zh *zh_Hant) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
101 return locales.PluralRuleOther
104 // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'zh_Hant'
105 func (zh *zh_Hant) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
106 return locales.PluralRuleOther
109 // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
110 func (zh *zh_Hant) MonthAbbreviated(month time.Month) string {
111 return zh.monthsAbbreviated[month]
114 // MonthsAbbreviated returns the locales abbreviated months
115 func (zh *zh_Hant) MonthsAbbreviated() []string {
116 return zh.monthsAbbreviated[1:]
119 // MonthNarrow returns the locales narrow month given the 'month' provided
120 func (zh *zh_Hant) MonthNarrow(month time.Month) string {
121 return zh.monthsNarrow[month]
124 // MonthsNarrow returns the locales narrow months
125 func (zh *zh_Hant) MonthsNarrow() []string {
126 return zh.monthsNarrow[1:]
129 // MonthWide returns the locales wide month given the 'month' provided
130 func (zh *zh_Hant) MonthWide(month time.Month) string {
131 return zh.monthsWide[month]
134 // MonthsWide returns the locales wide months
135 func (zh *zh_Hant) MonthsWide() []string {
136 return zh.monthsWide[1:]
139 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
140 func (zh *zh_Hant) WeekdayAbbreviated(weekday time.Weekday) string {
141 return zh.daysAbbreviated[weekday]
144 // WeekdaysAbbreviated returns the locales abbreviated weekdays
145 func (zh *zh_Hant) WeekdaysAbbreviated() []string {
146 return zh.daysAbbreviated
149 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
150 func (zh *zh_Hant) WeekdayNarrow(weekday time.Weekday) string {
151 return zh.daysNarrow[weekday]
154 // WeekdaysNarrow returns the locales narrow weekdays
155 func (zh *zh_Hant) WeekdaysNarrow() []string {
159 // WeekdayShort returns the locales short weekday given the 'weekday' provided
160 func (zh *zh_Hant) WeekdayShort(weekday time.Weekday) string {
161 return zh.daysShort[weekday]
164 // WeekdaysShort returns the locales short weekdays
165 func (zh *zh_Hant) WeekdaysShort() []string {
169 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
170 func (zh *zh_Hant) WeekdayWide(weekday time.Weekday) string {
171 return zh.daysWide[weekday]
174 // WeekdaysWide returns the locales wide weekdays
175 func (zh *zh_Hant) WeekdaysWide() []string {
179 // Decimal returns the decimal point of number
180 func (zh *zh_Hant) Decimal() string {
184 // Group returns the group of number
185 func (zh *zh_Hant) Group() string {
189 // Group returns the minus sign of number
190 func (zh *zh_Hant) Minus() string {
194 // FmtNumber returns 'num' with digits/precision of 'v' for 'zh_Hant' and handles both Whole and Real numbers based on 'v'
195 func (zh *zh_Hant) FmtNumber(num float64, v uint64) string {
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
201 b := make([]byte, 0, l)
203 for i := len(s) - 1; i >= 0; i-- {
206 b = append(b, zh.decimal[0])
213 b = append(b, zh.group[0])
224 b = append(b, zh.minus[0])
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]
235 // FmtPercent returns 'num' with digits/precision of 'v' for 'zh_Hant' and handles both Whole and Real numbers based on 'v'
236 // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
237 func (zh *zh_Hant) FmtPercent(num float64, v uint64) string {
238 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
240 b := make([]byte, 0, l)
242 for i := len(s) - 1; i >= 0; i-- {
245 b = append(b, zh.decimal[0])
253 b = append(b, zh.minus[0])
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]
261 b = append(b, zh.percent...)
266 // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'zh_Hant'
267 func (zh *zh_Hant) FmtCurrency(num float64, v uint64, currency currency.Type) string {
269 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
270 symbol := zh.currencies[currency]
271 l := len(s) + len(symbol) + 2 + 1*len(s[:len(s)-int(v)-1])/3
274 b := make([]byte, 0, l)
276 for i := len(s) - 1; i >= 0; i-- {
279 b = append(b, zh.decimal[0])
286 b = append(b, zh.group[0])
296 for j := len(symbol) - 1; j >= 0; j-- {
297 b = append(b, symbol[j])
301 b = append(b, zh.minus[0])
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]
312 b = append(b, zh.decimal...)
315 for i := 0; i < 2-int(v); i++ {
323 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'zh_Hant'
324 // in accounting notation.
325 func (zh *zh_Hant) FmtAccounting(num float64, v uint64, currency currency.Type) string {
327 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
328 symbol := zh.currencies[currency]
329 l := len(s) + len(symbol) + 2 + 1*len(s[:len(s)-int(v)-1])/3
332 b := make([]byte, 0, l)
334 for i := len(s) - 1; i >= 0; i-- {
337 b = append(b, zh.decimal[0])
344 b = append(b, zh.group[0])
356 for j := len(symbol) - 1; j >= 0; j-- {
357 b = append(b, symbol[j])
360 b = append(b, zh.minus[0])
364 for j := len(symbol) - 1; j >= 0; j-- {
365 b = append(b, symbol[j])
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]
378 b = append(b, zh.decimal...)
381 for i := 0; i < 2-int(v); i++ {
389 // FmtDateShort returns the short date representation of 't' for 'zh_Hant'
390 func (zh *zh_Hant) FmtDateShort(t time.Time) string {
392 b := make([]byte, 0, 32)
395 b = strconv.AppendInt(b, int64(t.Year()), 10)
397 b = strconv.AppendInt(b, int64(-t.Year()), 10)
400 b = append(b, []byte{0x2f}...)
401 b = strconv.AppendInt(b, int64(t.Month()), 10)
402 b = append(b, []byte{0x2f}...)
403 b = strconv.AppendInt(b, int64(t.Day()), 10)
408 // FmtDateMedium returns the medium date representation of 't' for 'zh_Hant'
409 func (zh *zh_Hant) FmtDateMedium(t time.Time) string {
411 b := make([]byte, 0, 32)
414 b = strconv.AppendInt(b, int64(t.Year()), 10)
416 b = strconv.AppendInt(b, int64(-t.Year()), 10)
419 b = append(b, []byte{0xe5, 0xb9, 0xb4}...)
420 b = strconv.AppendInt(b, int64(t.Month()), 10)
421 b = append(b, []byte{0xe6, 0x9c, 0x88}...)
422 b = strconv.AppendInt(b, int64(t.Day()), 10)
423 b = append(b, []byte{0xe6, 0x97, 0xa5}...)
428 // FmtDateLong returns the long date representation of 't' for 'zh_Hant'
429 func (zh *zh_Hant) FmtDateLong(t time.Time) string {
431 b := make([]byte, 0, 32)
434 b = strconv.AppendInt(b, int64(t.Year()), 10)
436 b = strconv.AppendInt(b, int64(-t.Year()), 10)
439 b = append(b, []byte{0xe5, 0xb9, 0xb4}...)
440 b = strconv.AppendInt(b, int64(t.Month()), 10)
441 b = append(b, []byte{0xe6, 0x9c, 0x88}...)
442 b = strconv.AppendInt(b, int64(t.Day()), 10)
443 b = append(b, []byte{0xe6, 0x97, 0xa5}...)
448 // FmtDateFull returns the full date representation of 't' for 'zh_Hant'
449 func (zh *zh_Hant) FmtDateFull(t time.Time) string {
451 b := make([]byte, 0, 32)
454 b = strconv.AppendInt(b, int64(t.Year()), 10)
456 b = strconv.AppendInt(b, int64(-t.Year()), 10)
459 b = append(b, []byte{0xe5, 0xb9, 0xb4}...)
460 b = strconv.AppendInt(b, int64(t.Month()), 10)
461 b = append(b, []byte{0xe6, 0x9c, 0x88}...)
462 b = strconv.AppendInt(b, int64(t.Day()), 10)
463 b = append(b, []byte{0xe6, 0x97, 0xa5, 0x20}...)
464 b = append(b, zh.daysWide[t.Weekday()]...)
469 // FmtTimeShort returns the short time representation of 't' for 'zh_Hant'
470 func (zh *zh_Hant) FmtTimeShort(t time.Time) string {
472 b := make([]byte, 0, 32)
475 b = append(b, zh.periodsAbbreviated[0]...)
477 b = append(b, zh.periodsAbbreviated[1]...)
486 b = strconv.AppendInt(b, int64(h), 10)
487 b = append(b, zh.timeSeparator...)
493 b = strconv.AppendInt(b, int64(t.Minute()), 10)
498 // FmtTimeMedium returns the medium time representation of 't' for 'zh_Hant'
499 func (zh *zh_Hant) FmtTimeMedium(t time.Time) string {
501 b := make([]byte, 0, 32)
504 b = append(b, zh.periodsAbbreviated[0]...)
506 b = append(b, zh.periodsAbbreviated[1]...)
515 b = strconv.AppendInt(b, int64(h), 10)
516 b = append(b, zh.timeSeparator...)
522 b = strconv.AppendInt(b, int64(t.Minute()), 10)
523 b = append(b, zh.timeSeparator...)
529 b = strconv.AppendInt(b, int64(t.Second()), 10)
534 // FmtTimeLong returns the long time representation of 't' for 'zh_Hant'
535 func (zh *zh_Hant) FmtTimeLong(t time.Time) string {
537 b := make([]byte, 0, 32)
540 b = append(b, zh.periodsAbbreviated[0]...)
542 b = append(b, zh.periodsAbbreviated[1]...)
551 b = strconv.AppendInt(b, int64(h), 10)
552 b = append(b, zh.timeSeparator...)
558 b = strconv.AppendInt(b, int64(t.Minute()), 10)
559 b = append(b, zh.timeSeparator...)
565 b = strconv.AppendInt(b, int64(t.Second()), 10)
566 b = append(b, []byte{0x20, 0x5b}...)
571 b = append(b, []byte{0x5d}...)
576 // FmtTimeFull returns the full time representation of 't' for 'zh_Hant'
577 func (zh *zh_Hant) FmtTimeFull(t time.Time) string {
579 b := make([]byte, 0, 32)
582 b = append(b, zh.periodsAbbreviated[0]...)
584 b = append(b, zh.periodsAbbreviated[1]...)
593 b = strconv.AppendInt(b, int64(h), 10)
594 b = append(b, zh.timeSeparator...)
600 b = strconv.AppendInt(b, int64(t.Minute()), 10)
601 b = append(b, zh.timeSeparator...)
607 b = strconv.AppendInt(b, int64(t.Second()), 10)
608 b = append(b, []byte{0x20, 0x5b}...)
612 if btz, ok := zh.timezones[tz]; ok {
613 b = append(b, btz...)
618 b = append(b, []byte{0x5d}...)