8 "github.com/go-playground/locales"
9 "github.com/go-playground/locales/currency"
12 type zh_Hans_CN struct {
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_Hans_CN' 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", "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"},
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{"", "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"},
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{"UYT": "乌拉圭标准时间", "TMT": "土库曼斯坦标准时间", "HNNOMX": "墨西哥西北部标准时间", "WIB": "印度尼西亚西部时间", "CDT": "北美中部夏令时间", "AWST": "澳大利亚西部标准时间", "WIT": "印度尼西亚东部时间", "AEST": "澳大利亚东部标准时间", "ECT": "厄瓜多尔标准时间", "MST": "澳门标准时间", "MESZ": "中欧夏令时间", "HAST": "夏威夷-阿留申标准时间", "JST": "日本标准时间", "IST": "印度时间", "ARST": "阿根廷夏令时间", "WAST": "西部非洲夏令时间", "HEEG": "格陵兰岛东部夏令时间", "CHAST": "查坦标准时间", "WESZ": "西欧夏令时间", "NZST": "新西兰标准时间", "OEZ": "东欧标准时间", "PDT": "北美太平洋夏令时间", "LHDT": "豪勋爵岛夏令时间", "HENOMX": "墨西哥西北部夏令时间", "HEOG": "格陵兰岛西部夏令时间", "HNEG": "格陵兰岛东部标准时间", "COT": "哥伦比亚标准时间", "HNPMX": "墨西哥太平洋标准时间", "AWDT": "澳大利亚西部夏令时间", "HNPM": "圣皮埃尔和密克隆群岛标准时间", "BT": "不丹时间", "CST": "北美中部标准时间", "ACWST": "澳大利亚中西部标准时间", "WARST": "阿根廷西部夏令时间", "ADT": "大西洋夏令时间", "HNOG": "格陵兰岛西部标准时间", "HECU": "古巴夏令时间", "HKST": "香港夏令时间", "COST": "哥伦比亚夏令时间", "CAT": "中部非洲时间", "HNT": "纽芬兰标准时间", "AEDT": "澳大利亚东部夏令时间", "AKST": "阿拉斯加标准时间", "CHADT": "查坦夏令时间", "WAT": "西部非洲标准时间", "CLT": "智利标准时间", "ACST": "澳大利亚中部标准时间", "HADT": "夏威夷-阿留申夏令时间", "EST": "北美东部标准时间", "VET": "委内瑞拉时间", "NZDT": "新西兰夏令时间", "UYST": "乌拉圭夏令时间", "∅∅∅": "巴西利亚夏令时间", "BOT": "玻利维亚标准时间", "SRT": "苏里南时间", "MYT": "马来西亚时间", "TMST": "土库曼斯坦夏令时间", "OESZ": "东欧夏令时间", "LHST": "豪勋爵岛标准时间", "HEPM": "圣皮埃尔和密克隆群岛夏令时间", "GFT": "法属圭亚那标准时间", "EDT": "北美东部夏令时间", "ChST": "查莫罗时间", "SAST": "南部非洲时间", "CLST": "智利夏令时间", "WEZ": "西欧标准时间", "SGT": "新加坡标准时间", "HEPMX": "墨西哥太平洋夏令时间", "ACWDT": "澳大利亚中西部夏令时间", "MDT": "澳门夏令时间", "WART": "阿根廷西部标准时间", "ART": "阿根廷标准时间", "EAT": "东部非洲时间", "HNCU": "古巴标准时间", "HAT": "纽芬兰夏令时间", "AST": "大西洋标准时间", "JDT": "日本夏令时间", "PST": "北美太平洋标准时间", "WITA": "印度尼西亚中部时间", "HKT": "香港标准时间", "GYT": "圭亚那时间", "AKDT": "阿拉斯加夏令时间", "ACDT": "澳大利亚中部夏令时间", "GMT": "格林尼治标准时间", "MEZ": "中欧标准时间"},
74 // Locale returns the current translators string locale
75 func (zh *zh_Hans_CN) Locale() string {
79 // PluralsCardinal returns the list of cardinal plural rules associated with 'zh_Hans_CN'
80 func (zh *zh_Hans_CN) PluralsCardinal() []locales.PluralRule {
81 return zh.pluralsCardinal
84 // PluralsOrdinal returns the list of ordinal plural rules associated with 'zh_Hans_CN'
85 func (zh *zh_Hans_CN) PluralsOrdinal() []locales.PluralRule {
86 return zh.pluralsOrdinal
89 // PluralsRange returns the list of range plural rules associated with 'zh_Hans_CN'
90 func (zh *zh_Hans_CN) PluralsRange() []locales.PluralRule {
91 return zh.pluralsRange
94 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'zh_Hans_CN'
95 func (zh *zh_Hans_CN) 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_Hans_CN'
100 func (zh *zh_Hans_CN) 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_Hans_CN'
105 func (zh *zh_Hans_CN) 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_Hans_CN) MonthAbbreviated(month time.Month) string {
111 return zh.monthsAbbreviated[month]
114 // MonthsAbbreviated returns the locales abbreviated months
115 func (zh *zh_Hans_CN) MonthsAbbreviated() []string {
116 return zh.monthsAbbreviated[1:]
119 // MonthNarrow returns the locales narrow month given the 'month' provided
120 func (zh *zh_Hans_CN) MonthNarrow(month time.Month) string {
121 return zh.monthsNarrow[month]
124 // MonthsNarrow returns the locales narrow months
125 func (zh *zh_Hans_CN) MonthsNarrow() []string {
126 return zh.monthsNarrow[1:]
129 // MonthWide returns the locales wide month given the 'month' provided
130 func (zh *zh_Hans_CN) MonthWide(month time.Month) string {
131 return zh.monthsWide[month]
134 // MonthsWide returns the locales wide months
135 func (zh *zh_Hans_CN) MonthsWide() []string {
136 return zh.monthsWide[1:]
139 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
140 func (zh *zh_Hans_CN) WeekdayAbbreviated(weekday time.Weekday) string {
141 return zh.daysAbbreviated[weekday]
144 // WeekdaysAbbreviated returns the locales abbreviated weekdays
145 func (zh *zh_Hans_CN) WeekdaysAbbreviated() []string {
146 return zh.daysAbbreviated
149 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
150 func (zh *zh_Hans_CN) WeekdayNarrow(weekday time.Weekday) string {
151 return zh.daysNarrow[weekday]
154 // WeekdaysNarrow returns the locales narrow weekdays
155 func (zh *zh_Hans_CN) WeekdaysNarrow() []string {
159 // WeekdayShort returns the locales short weekday given the 'weekday' provided
160 func (zh *zh_Hans_CN) WeekdayShort(weekday time.Weekday) string {
161 return zh.daysShort[weekday]
164 // WeekdaysShort returns the locales short weekdays
165 func (zh *zh_Hans_CN) WeekdaysShort() []string {
169 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
170 func (zh *zh_Hans_CN) WeekdayWide(weekday time.Weekday) string {
171 return zh.daysWide[weekday]
174 // WeekdaysWide returns the locales wide weekdays
175 func (zh *zh_Hans_CN) WeekdaysWide() []string {
179 // Decimal returns the decimal point of number
180 func (zh *zh_Hans_CN) Decimal() string {
184 // Group returns the group of number
185 func (zh *zh_Hans_CN) Group() string {
189 // Group returns the minus sign of number
190 func (zh *zh_Hans_CN) Minus() string {
194 // FmtNumber returns 'num' with digits/precision of 'v' for 'zh_Hans_CN' and handles both Whole and Real numbers based on 'v'
195 func (zh *zh_Hans_CN) 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_Hans_CN' 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_Hans_CN) 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_Hans_CN'
267 func (zh *zh_Hans_CN) 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_Hans_CN'
324 // in accounting notation.
325 func (zh *zh_Hans_CN) 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_Hans_CN'
390 func (zh *zh_Hans_CN) 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_Hans_CN'
409 func (zh *zh_Hans_CN) 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_Hans_CN'
429 func (zh *zh_Hans_CN) 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_Hans_CN'
449 func (zh *zh_Hans_CN) 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}...)
464 b = append(b, zh.daysWide[t.Weekday()]...)
469 // FmtTimeShort returns the short time representation of 't' for 'zh_Hans_CN'
470 func (zh *zh_Hans_CN) 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_Hans_CN'
499 func (zh *zh_Hans_CN) 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_Hans_CN'
535 func (zh *zh_Hans_CN) FmtTimeLong(t time.Time) string {
537 b := make([]byte, 0, 32)
542 b = append(b, []byte{0x20}...)
545 b = append(b, zh.periodsAbbreviated[0]...)
547 b = append(b, zh.periodsAbbreviated[1]...)
556 b = strconv.AppendInt(b, int64(h), 10)
557 b = append(b, zh.timeSeparator...)
563 b = strconv.AppendInt(b, int64(t.Minute()), 10)
564 b = append(b, zh.timeSeparator...)
570 b = strconv.AppendInt(b, int64(t.Second()), 10)
575 // FmtTimeFull returns the full time representation of 't' for 'zh_Hans_CN'
576 func (zh *zh_Hans_CN) FmtTimeFull(t time.Time) string {
578 b := make([]byte, 0, 32)
582 if btz, ok := zh.timezones[tz]; ok {
583 b = append(b, btz...)
588 b = append(b, []byte{0x20}...)
591 b = append(b, zh.periodsAbbreviated[0]...)
593 b = append(b, zh.periodsAbbreviated[1]...)
602 b = strconv.AppendInt(b, int64(h), 10)
603 b = append(b, zh.timeSeparator...)
609 b = strconv.AppendInt(b, int64(t.Minute()), 10)
610 b = append(b, zh.timeSeparator...)
616 b = strconv.AppendInt(b, int64(t.Second()), 10)