8 "github.com/go-playground/locales"
9 "github.com/go-playground/locales/currency"
12 type zh_Hant_HK struct {
14 pluralsCardinal []locales.PluralRule
15 pluralsOrdinal []locales.PluralRule
16 pluralsRange []locales.PluralRule
24 currencies []string // idx = enum of currency code
25 currencyPositiveSuffix string
26 currencyNegativeSuffix string
27 monthsAbbreviated []string
30 daysAbbreviated []string
34 periodsAbbreviated []string
35 periodsNarrow []string
38 erasAbbreviated []string
41 timezones map[string]string
44 // New returns a new instance of translator for the 'zh_Hant_HK' locale
45 func New() locales.Translator {
48 pluralsCardinal: []locales.PluralRule{6},
49 pluralsOrdinal: []locales.PluralRule{6},
50 pluralsRange: []locales.PluralRule{6},
58 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", "₩", "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", "NT$", "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 currencyPositiveSuffix: "K",
60 currencyNegativeSuffix: "K",
61 monthsAbbreviated: []string{"", "1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"},
62 monthsNarrow: []string{"", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"},
63 monthsWide: []string{"", "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"},
64 daysAbbreviated: []string{"周日", "周一", "周二", "周三", "周四", "周五", "周六"},
65 daysNarrow: []string{"日", "一", "二", "三", "四", "五", "六"},
66 daysShort: []string{"周日", "周一", "周二", "周三", "周四", "周五", "周六"},
67 daysWide: []string{"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"},
68 periodsAbbreviated: []string{"上午", "下午"},
69 periodsNarrow: []string{"上午", "下午"},
70 periodsWide: []string{"上午", "下午"},
71 erasAbbreviated: []string{"公元前", "公元"},
72 erasNarrow: []string{"", ""},
73 erasWide: []string{"公元前", "公元"},
74 timezones: map[string]string{"HNPM": "圣皮埃尔和密克隆群岛标准时间", "HEPM": "圣皮埃尔和密克隆群岛夏令时间", "AWST": "澳大利亚西部标准时间", "NZDT": "新西兰夏令时间", "HENOMX": "墨西哥西北部夏令时间", "ADT": "大西洋夏令时间", "HKT": "香港标准时间", "COST": "哥伦比亚夏令时间", "WIT": "印度尼西亚东部时间", "PDT": "北美太平洋夏令時間", "CST": "北美中部標準時間", "MYT": "马来西亚时间", "EDT": "北美東部夏令時間", "HNPMX": "墨西哥太平洋标准时间", "CHADT": "查坦夏令时间", "UYST": "乌拉圭夏令时间", "NZST": "新西兰标准时间", "WAST": "西部非洲夏令时间", "HAT": "纽芬兰夏令时间", "WART": "阿根廷西部标准时间", "HEOG": "格陵兰岛西部夏令时间", "AKDT": "阿拉斯加夏令时间", "PST": "北美太平洋標準時間", "BT": "不丹时间", "MEZ": "中欧标准时间", "MST": "北美山區標準時間", "MDT": "北美山區夏令時間", "WEZ": "西欧标准时间", "HEPMX": "墨西哥太平洋夏令时间", "HKST": "香港夏令时间", "CLST": "智利夏令时间", "EST": "北美東部標準時間", "AST": "大西洋标准时间", "LHDT": "豪勋爵岛夏令时间", "JDT": "日本夏令时间", "ART": "阿根廷标准时间", "SRT": "蘇里南時間", "TMST": "土库曼斯坦夏令时间", "AEDT": "澳大利亚东部夏令时间", "COT": "哥伦比亚标准时间", "VET": "委内瑞拉时间", "HEEG": "格陵兰岛东部夏令时间", "ACST": "澳大利亚中部标准时间", "EAT": "东部非洲时间", "ECT": "厄瓜多爾時間", "ChST": "查莫罗时间", "HAST": "夏威夷-阿留申标准时间", "IST": "印度時間", "HNEG": "格陵兰岛东部标准时间", "AEST": "澳大利亚东部标准时间", "GFT": "法属圭亚那标准时间", "ACWST": "澳大利亚中西部标准时间", "TMT": "土库曼斯坦标准时间", "WITA": "印度尼西亚中部时间", "JST": "日本标准时间", "HNT": "纽芬兰标准时间", "SGT": "新加坡時間", "GMT": "格林尼治标准时间", "AWDT": "澳大利亚西部夏令时间", "CDT": "中部夏令時間", "HADT": "夏威夷-阿留申夏令时间", "WARST": "阿根廷西部夏令时间", "CLT": "智利标准时间", "BOT": "玻利维亚标准时间", "∅∅∅": "亚速尔群岛夏令时间", "WAT": "西部非洲标准时间", "AKST": "阿拉斯加标准时间", "UYT": "乌拉圭标准时间", "HNNOMX": "墨西哥西北部标准时间", "CHAST": "查坦标准时间", "HECU": "古巴夏令时间", "GYT": "圭亞那時間", "WESZ": "西欧夏令时间", "WIB": "印度尼西亚西部时间", "MESZ": "中欧夏令时间", "OEZ": "东欧标准时间", "OESZ": "东欧夏令时间", "SAST": "南非時間", "ACDT": "澳大利亚中部夏令时间", "CAT": "中部非洲时间", "HNCU": "古巴标准时间", "ACWDT": "澳大利亚中西部夏令时间", "LHST": "豪勋爵岛标准时间", "ARST": "阿根廷夏令时间", "HNOG": "格陵兰岛西部标准时间"},
78 // Locale returns the current translators string locale
79 func (zh *zh_Hant_HK) Locale() string {
83 // PluralsCardinal returns the list of cardinal plural rules associated with 'zh_Hant_HK'
84 func (zh *zh_Hant_HK) PluralsCardinal() []locales.PluralRule {
85 return zh.pluralsCardinal
88 // PluralsOrdinal returns the list of ordinal plural rules associated with 'zh_Hant_HK'
89 func (zh *zh_Hant_HK) PluralsOrdinal() []locales.PluralRule {
90 return zh.pluralsOrdinal
93 // PluralsRange returns the list of range plural rules associated with 'zh_Hant_HK'
94 func (zh *zh_Hant_HK) PluralsRange() []locales.PluralRule {
95 return zh.pluralsRange
98 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'zh_Hant_HK'
99 func (zh *zh_Hant_HK) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
100 return locales.PluralRuleOther
103 // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'zh_Hant_HK'
104 func (zh *zh_Hant_HK) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
105 return locales.PluralRuleOther
108 // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'zh_Hant_HK'
109 func (zh *zh_Hant_HK) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
110 return locales.PluralRuleOther
113 // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
114 func (zh *zh_Hant_HK) MonthAbbreviated(month time.Month) string {
115 return zh.monthsAbbreviated[month]
118 // MonthsAbbreviated returns the locales abbreviated months
119 func (zh *zh_Hant_HK) MonthsAbbreviated() []string {
120 return zh.monthsAbbreviated[1:]
123 // MonthNarrow returns the locales narrow month given the 'month' provided
124 func (zh *zh_Hant_HK) MonthNarrow(month time.Month) string {
125 return zh.monthsNarrow[month]
128 // MonthsNarrow returns the locales narrow months
129 func (zh *zh_Hant_HK) MonthsNarrow() []string {
130 return zh.monthsNarrow[1:]
133 // MonthWide returns the locales wide month given the 'month' provided
134 func (zh *zh_Hant_HK) MonthWide(month time.Month) string {
135 return zh.monthsWide[month]
138 // MonthsWide returns the locales wide months
139 func (zh *zh_Hant_HK) MonthsWide() []string {
140 return zh.monthsWide[1:]
143 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
144 func (zh *zh_Hant_HK) WeekdayAbbreviated(weekday time.Weekday) string {
145 return zh.daysAbbreviated[weekday]
148 // WeekdaysAbbreviated returns the locales abbreviated weekdays
149 func (zh *zh_Hant_HK) WeekdaysAbbreviated() []string {
150 return zh.daysAbbreviated
153 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
154 func (zh *zh_Hant_HK) WeekdayNarrow(weekday time.Weekday) string {
155 return zh.daysNarrow[weekday]
158 // WeekdaysNarrow returns the locales narrow weekdays
159 func (zh *zh_Hant_HK) WeekdaysNarrow() []string {
163 // WeekdayShort returns the locales short weekday given the 'weekday' provided
164 func (zh *zh_Hant_HK) WeekdayShort(weekday time.Weekday) string {
165 return zh.daysShort[weekday]
168 // WeekdaysShort returns the locales short weekdays
169 func (zh *zh_Hant_HK) WeekdaysShort() []string {
173 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
174 func (zh *zh_Hant_HK) WeekdayWide(weekday time.Weekday) string {
175 return zh.daysWide[weekday]
178 // WeekdaysWide returns the locales wide weekdays
179 func (zh *zh_Hant_HK) WeekdaysWide() []string {
183 // Decimal returns the decimal point of number
184 func (zh *zh_Hant_HK) Decimal() string {
188 // Group returns the group of number
189 func (zh *zh_Hant_HK) Group() string {
193 // Group returns the minus sign of number
194 func (zh *zh_Hant_HK) Minus() string {
198 // FmtNumber returns 'num' with digits/precision of 'v' for 'zh_Hant_HK' and handles both Whole and Real numbers based on 'v'
199 func (zh *zh_Hant_HK) FmtNumber(num float64, v uint64) string {
201 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
202 l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
205 b := make([]byte, 0, l)
207 for i := len(s) - 1; i >= 0; i-- {
210 b = append(b, zh.decimal[0])
217 b = append(b, zh.group[0])
228 b = append(b, zh.minus[0])
232 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
233 b[i], b[j] = b[j], b[i]
239 // FmtPercent returns 'num' with digits/precision of 'v' for 'zh_Hant_HK' and handles both Whole and Real numbers based on 'v'
240 // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
241 func (zh *zh_Hant_HK) FmtPercent(num float64, v uint64) string {
242 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
244 b := make([]byte, 0, l)
246 for i := len(s) - 1; i >= 0; i-- {
249 b = append(b, zh.decimal[0])
257 b = append(b, zh.minus[0])
261 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
262 b[i], b[j] = b[j], b[i]
265 b = append(b, zh.percent...)
270 // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'zh_Hant_HK'
271 func (zh *zh_Hant_HK) FmtCurrency(num float64, v uint64, currency currency.Type) string {
273 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
274 symbol := zh.currencies[currency]
275 l := len(s) + len(symbol) + 3
277 b := make([]byte, 0, l)
279 for i := len(s) - 1; i >= 0; i-- {
282 b = append(b, zh.decimal[0])
289 for j := len(symbol) - 1; j >= 0; j-- {
290 b = append(b, symbol[j])
294 b = append(b, zh.minus[0])
298 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
299 b[i], b[j] = b[j], b[i]
302 b = append(b, zh.currencyPositiveSuffix...)
307 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'zh_Hant_HK'
308 // in accounting notation.
309 func (zh *zh_Hant_HK) FmtAccounting(num float64, v uint64, currency currency.Type) string {
311 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
312 symbol := zh.currencies[currency]
313 l := len(s) + len(symbol) + 3
315 b := make([]byte, 0, l)
317 for i := len(s) - 1; i >= 0; i-- {
320 b = append(b, zh.decimal[0])
329 for j := len(symbol) - 1; j >= 0; j-- {
330 b = append(b, symbol[j])
333 b = append(b, zh.minus[0])
337 for j := len(symbol) - 1; j >= 0; j-- {
338 b = append(b, symbol[j])
344 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
345 b[i], b[j] = b[j], b[i]
349 b = append(b, zh.currencyNegativeSuffix...)
352 b = append(b, zh.currencyPositiveSuffix...)
358 // FmtDateShort returns the short date representation of 't' for 'zh_Hant_HK'
359 func (zh *zh_Hant_HK) FmtDateShort(t time.Time) string {
361 b := make([]byte, 0, 32)
363 b = strconv.AppendInt(b, int64(t.Day()), 10)
364 b = append(b, []byte{0x2f}...)
365 b = strconv.AppendInt(b, int64(t.Month()), 10)
366 b = append(b, []byte{0x2f}...)
369 b = strconv.AppendInt(b, int64(t.Year()), 10)
371 b = strconv.AppendInt(b, int64(-t.Year()), 10)
377 // FmtDateMedium returns the medium date representation of 't' for 'zh_Hant_HK'
378 func (zh *zh_Hant_HK) FmtDateMedium(t time.Time) string {
380 b := make([]byte, 0, 32)
383 b = strconv.AppendInt(b, int64(t.Year()), 10)
385 b = strconv.AppendInt(b, int64(-t.Year()), 10)
388 b = append(b, []byte{0xe5, 0xb9, 0xb4}...)
389 b = strconv.AppendInt(b, int64(t.Month()), 10)
390 b = append(b, []byte{0xe6, 0x9c, 0x88}...)
391 b = strconv.AppendInt(b, int64(t.Day()), 10)
392 b = append(b, []byte{0xe6, 0x97, 0xa5}...)
397 // FmtDateLong returns the long date representation of 't' for 'zh_Hant_HK'
398 func (zh *zh_Hant_HK) FmtDateLong(t time.Time) string {
400 b := make([]byte, 0, 32)
403 b = strconv.AppendInt(b, int64(t.Year()), 10)
405 b = strconv.AppendInt(b, int64(-t.Year()), 10)
408 b = append(b, []byte{0xe5, 0xb9, 0xb4}...)
409 b = strconv.AppendInt(b, int64(t.Month()), 10)
410 b = append(b, []byte{0xe6, 0x9c, 0x88}...)
411 b = strconv.AppendInt(b, int64(t.Day()), 10)
412 b = append(b, []byte{0xe6, 0x97, 0xa5}...)
417 // FmtDateFull returns the full date representation of 't' for 'zh_Hant_HK'
418 func (zh *zh_Hant_HK) FmtDateFull(t time.Time) string {
420 b := make([]byte, 0, 32)
423 b = strconv.AppendInt(b, int64(t.Year()), 10)
425 b = strconv.AppendInt(b, int64(-t.Year()), 10)
428 b = append(b, []byte{0xe5, 0xb9, 0xb4}...)
429 b = strconv.AppendInt(b, int64(t.Month()), 10)
430 b = append(b, []byte{0xe6, 0x9c, 0x88}...)
431 b = strconv.AppendInt(b, int64(t.Day()), 10)
432 b = append(b, []byte{0xe6, 0x97, 0xa5}...)
433 b = append(b, zh.daysWide[t.Weekday()]...)
438 // FmtTimeShort returns the short time representation of 't' for 'zh_Hant_HK'
439 func (zh *zh_Hant_HK) FmtTimeShort(t time.Time) string {
441 b := make([]byte, 0, 32)
444 b = append(b, zh.periodsAbbreviated[0]...)
446 b = append(b, zh.periodsAbbreviated[1]...)
455 b = strconv.AppendInt(b, int64(h), 10)
456 b = append(b, zh.timeSeparator...)
462 b = strconv.AppendInt(b, int64(t.Minute()), 10)
467 // FmtTimeMedium returns the medium time representation of 't' for 'zh_Hant_HK'
468 func (zh *zh_Hant_HK) FmtTimeMedium(t time.Time) string {
470 b := make([]byte, 0, 32)
473 b = append(b, zh.periodsAbbreviated[0]...)
475 b = append(b, zh.periodsAbbreviated[1]...)
484 b = strconv.AppendInt(b, int64(h), 10)
485 b = append(b, zh.timeSeparator...)
491 b = strconv.AppendInt(b, int64(t.Minute()), 10)
492 b = append(b, zh.timeSeparator...)
498 b = strconv.AppendInt(b, int64(t.Second()), 10)
503 // FmtTimeLong returns the long time representation of 't' for 'zh_Hant_HK'
504 func (zh *zh_Hant_HK) FmtTimeLong(t time.Time) string {
506 b := make([]byte, 0, 32)
511 b = append(b, []byte{0x20}...)
514 b = append(b, zh.periodsAbbreviated[0]...)
516 b = append(b, zh.periodsAbbreviated[1]...)
525 b = strconv.AppendInt(b, int64(h), 10)
526 b = append(b, zh.timeSeparator...)
532 b = strconv.AppendInt(b, int64(t.Minute()), 10)
533 b = append(b, zh.timeSeparator...)
539 b = strconv.AppendInt(b, int64(t.Second()), 10)
544 // FmtTimeFull returns the full time representation of 't' for 'zh_Hant_HK'
545 func (zh *zh_Hant_HK) FmtTimeFull(t time.Time) string {
547 b := make([]byte, 0, 32)
551 if btz, ok := zh.timezones[tz]; ok {
552 b = append(b, btz...)
557 b = append(b, []byte{0x20}...)
560 b = append(b, zh.periodsAbbreviated[0]...)
562 b = append(b, zh.periodsAbbreviated[1]...)
571 b = strconv.AppendInt(b, int64(h), 10)
572 b = append(b, zh.timeSeparator...)
578 b = strconv.AppendInt(b, int64(t.Minute()), 10)
579 b = append(b, zh.timeSeparator...)
585 b = strconv.AppendInt(b, int64(t.Second()), 10)