...

Source file src/github.com/go-playground/locales/zh_Hant_MO/zh_Hant_MO.go

Documentation: github.com/go-playground/locales/zh_Hant_MO

     1  package zh_Hant_MO
     2  
     3  import (
     4  	"math"
     5  	"strconv"
     6  	"time"
     7  
     8  	"github.com/go-playground/locales"
     9  	"github.com/go-playground/locales/currency"
    10  )
    11  
    12  type zh_Hant_MO struct {
    13  	locale                 string
    14  	pluralsCardinal        []locales.PluralRule
    15  	pluralsOrdinal         []locales.PluralRule
    16  	pluralsRange           []locales.PluralRule
    17  	decimal                string
    18  	group                  string
    19  	minus                  string
    20  	percent                string
    21  	perMille               string
    22  	timeSeparator          string
    23  	inifinity              string
    24  	currencies             []string // idx = enum of currency code
    25  	currencyPositiveSuffix string
    26  	currencyNegativeSuffix string
    27  	monthsAbbreviated      []string
    28  	monthsNarrow           []string
    29  	monthsWide             []string
    30  	daysAbbreviated        []string
    31  	daysNarrow             []string
    32  	daysShort              []string
    33  	daysWide               []string
    34  	periodsAbbreviated     []string
    35  	periodsNarrow          []string
    36  	periodsShort           []string
    37  	periodsWide            []string
    38  	erasAbbreviated        []string
    39  	erasNarrow             []string
    40  	erasWide               []string
    41  	timezones              map[string]string
    42  }
    43  
    44  // New returns a new instance of translator for the 'zh_Hant_MO' locale
    45  func New() locales.Translator {
    46  	return &zh_Hant_MO{
    47  		locale:                 "zh_Hant_MO",
    48  		pluralsCardinal:        []locales.PluralRule{6},
    49  		pluralsOrdinal:         []locales.PluralRule{6},
    50  		pluralsRange:           []locales.PluralRule{6},
    51  		decimal:                ".",
    52  		group:                  ",",
    53  		minus:                  "-",
    54  		percent:                "%",
    55  		perMille:               "‰",
    56  		timeSeparator:          ":",
    57  		inifinity:              "∞",
    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", "CNH", "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", "MRU", "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", "STN", "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", "UYW", "UZS", "VEB", "VEF", "VES", "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{"ACDT": "澳大利亚中部夏令时间", "ACST": "澳大利亚中部标准时间", "ACWDT": "澳大利亚中西部夏令时间", "ACWST": "澳大利亚中西部标准时间", "ADT": "大西洋夏令时间", "AEDT": "澳大利亚东部夏令时间", "AEST": "澳大利亚东部标准时间", "AKDT": "阿拉斯加夏令时间", "AKST": "阿拉斯加标准时间", "ARST": "阿根廷夏令时间", "ART": "阿根廷标准时间", "AST": "大西洋标准时间", "AWDT": "澳大利亚西部夏令时间", "AWST": "澳大利亚西部标准时间", "BOT": "玻利维亚标准时间", "BT": "不丹时间", "CAT": "中部非洲时间", "CDT": "北美中部夏令時間", "CHADT": "查坦夏令时间", "CHAST": "查坦标准时间", "CLST": "智利夏令时间", "CLT": "智利标准时间", "COST": "哥伦比亚夏令时间", "COT": "哥伦比亚标准时间", "CST": "北美中部標準時間", "ChST": "查莫罗时间", "EAT": "东部非洲时间", "ECT": "厄瓜多爾時間", "EDT": "北美東部夏令時間", "EST": "北美東部標準時間", "GFT": "法属圭亚那标准时间", "GMT": "格林尼治标准时间", "GST": "波斯灣海域時間", "GYT": "圭亞那時間", "HADT": "夏威夷-阿留申夏令时间", "HAST": "夏威夷-阿留申标准时间", "HAT": "纽芬兰夏令时间", "HECU": "古巴夏令时间", "HEEG": "格陵兰岛东部夏令时间", "HENOMX": "墨西哥西北部夏令时间", "HEOG": "格陵兰岛西部夏令时间", "HEPM": "圣皮埃尔和密克隆群岛夏令时间", "HEPMX": "墨西哥太平洋夏令时间", "HKST": "香港夏令时间", "HKT": "香港标准时间", "HNCU": "古巴标准时间", "HNEG": "格陵兰岛东部标准时间", "HNNOMX": "墨西哥西北部标准时间", "HNOG": "格陵兰岛西部标准时间", "HNPM": "圣皮埃尔和密克隆群岛标准时间", "HNPMX": "墨西哥太平洋标准时间", "HNT": "纽芬兰标准时间", "IST": "印度時間", "JDT": "日本夏令时间", "JST": "日本标准时间", "LHDT": "豪勋爵岛夏令时间", "LHST": "豪勋爵岛标准时间", "MDT": "北美山區夏令時間", "MESZ": "中欧夏令时间", "MEZ": "中欧标准时间", "MST": "北美山區標準時間", "MYT": "马来西亚时间", "NZDT": "新西兰夏令时间", "NZST": "新西兰标准时间", "OESZ": "东欧夏令时间", "OEZ": "东欧标准时间", "PDT": "北美太平洋夏令時間", "PST": "北美太平洋標準時間", "SAST": "南非時間", "SGT": "新加坡時間", "SRT": "蘇里南時間", "TMST": "土库曼斯坦夏令时间", "TMT": "土库曼斯坦标准时间", "UYST": "乌拉圭夏令时间", "UYT": "乌拉圭标准时间", "VET": "委内瑞拉时间", "WARST": "阿根廷西部夏令时间", "WART": "阿根廷西部标准时间", "WAST": "西部非洲夏令时间", "WAT": "西部非洲标准时间", "WESZ": "西欧夏令时间", "WEZ": "西欧标准时间", "WIB": "印度尼西亚西部时间", "WIT": "印度尼西亚东部时间", "WITA": "印度尼西亚中部时间", "∅∅∅": "巴西利亚夏令时间"},
    75  	}
    76  }
    77  
    78  // Locale returns the current translators string locale
    79  func (zh *zh_Hant_MO) Locale() string {
    80  	return zh.locale
    81  }
    82  
    83  // PluralsCardinal returns the list of cardinal plural rules associated with 'zh_Hant_MO'
    84  func (zh *zh_Hant_MO) PluralsCardinal() []locales.PluralRule {
    85  	return zh.pluralsCardinal
    86  }
    87  
    88  // PluralsOrdinal returns the list of ordinal plural rules associated with 'zh_Hant_MO'
    89  func (zh *zh_Hant_MO) PluralsOrdinal() []locales.PluralRule {
    90  	return zh.pluralsOrdinal
    91  }
    92  
    93  // PluralsRange returns the list of range plural rules associated with 'zh_Hant_MO'
    94  func (zh *zh_Hant_MO) PluralsRange() []locales.PluralRule {
    95  	return zh.pluralsRange
    96  }
    97  
    98  // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'zh_Hant_MO'
    99  func (zh *zh_Hant_MO) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
   100  	return locales.PluralRuleOther
   101  }
   102  
   103  // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'zh_Hant_MO'
   104  func (zh *zh_Hant_MO) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
   105  	return locales.PluralRuleOther
   106  }
   107  
   108  // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'zh_Hant_MO'
   109  func (zh *zh_Hant_MO) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
   110  	return locales.PluralRuleOther
   111  }
   112  
   113  // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
   114  func (zh *zh_Hant_MO) MonthAbbreviated(month time.Month) string {
   115  	return zh.monthsAbbreviated[month]
   116  }
   117  
   118  // MonthsAbbreviated returns the locales abbreviated months
   119  func (zh *zh_Hant_MO) MonthsAbbreviated() []string {
   120  	return zh.monthsAbbreviated[1:]
   121  }
   122  
   123  // MonthNarrow returns the locales narrow month given the 'month' provided
   124  func (zh *zh_Hant_MO) MonthNarrow(month time.Month) string {
   125  	return zh.monthsNarrow[month]
   126  }
   127  
   128  // MonthsNarrow returns the locales narrow months
   129  func (zh *zh_Hant_MO) MonthsNarrow() []string {
   130  	return zh.monthsNarrow[1:]
   131  }
   132  
   133  // MonthWide returns the locales wide month given the 'month' provided
   134  func (zh *zh_Hant_MO) MonthWide(month time.Month) string {
   135  	return zh.monthsWide[month]
   136  }
   137  
   138  // MonthsWide returns the locales wide months
   139  func (zh *zh_Hant_MO) MonthsWide() []string {
   140  	return zh.monthsWide[1:]
   141  }
   142  
   143  // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
   144  func (zh *zh_Hant_MO) WeekdayAbbreviated(weekday time.Weekday) string {
   145  	return zh.daysAbbreviated[weekday]
   146  }
   147  
   148  // WeekdaysAbbreviated returns the locales abbreviated weekdays
   149  func (zh *zh_Hant_MO) WeekdaysAbbreviated() []string {
   150  	return zh.daysAbbreviated
   151  }
   152  
   153  // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
   154  func (zh *zh_Hant_MO) WeekdayNarrow(weekday time.Weekday) string {
   155  	return zh.daysNarrow[weekday]
   156  }
   157  
   158  // WeekdaysNarrow returns the locales narrow weekdays
   159  func (zh *zh_Hant_MO) WeekdaysNarrow() []string {
   160  	return zh.daysNarrow
   161  }
   162  
   163  // WeekdayShort returns the locales short weekday given the 'weekday' provided
   164  func (zh *zh_Hant_MO) WeekdayShort(weekday time.Weekday) string {
   165  	return zh.daysShort[weekday]
   166  }
   167  
   168  // WeekdaysShort returns the locales short weekdays
   169  func (zh *zh_Hant_MO) WeekdaysShort() []string {
   170  	return zh.daysShort
   171  }
   172  
   173  // WeekdayWide returns the locales wide weekday given the 'weekday' provided
   174  func (zh *zh_Hant_MO) WeekdayWide(weekday time.Weekday) string {
   175  	return zh.daysWide[weekday]
   176  }
   177  
   178  // WeekdaysWide returns the locales wide weekdays
   179  func (zh *zh_Hant_MO) WeekdaysWide() []string {
   180  	return zh.daysWide
   181  }
   182  
   183  // Decimal returns the decimal point of number
   184  func (zh *zh_Hant_MO) Decimal() string {
   185  	return zh.decimal
   186  }
   187  
   188  // Group returns the group of number
   189  func (zh *zh_Hant_MO) Group() string {
   190  	return zh.group
   191  }
   192  
   193  // Group returns the minus sign of number
   194  func (zh *zh_Hant_MO) Minus() string {
   195  	return zh.minus
   196  }
   197  
   198  // FmtNumber returns 'num' with digits/precision of 'v' for 'zh_Hant_MO' and handles both Whole and Real numbers based on 'v'
   199  func (zh *zh_Hant_MO) FmtNumber(num float64, v uint64) string {
   200  
   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
   203  	count := 0
   204  	inWhole := v == 0
   205  	b := make([]byte, 0, l)
   206  
   207  	for i := len(s) - 1; i >= 0; i-- {
   208  
   209  		if s[i] == '.' {
   210  			b = append(b, zh.decimal[0])
   211  			inWhole = true
   212  			continue
   213  		}
   214  
   215  		if inWhole {
   216  			if count == 3 {
   217  				b = append(b, zh.group[0])
   218  				count = 1
   219  			} else {
   220  				count++
   221  			}
   222  		}
   223  
   224  		b = append(b, s[i])
   225  	}
   226  
   227  	if num < 0 {
   228  		b = append(b, zh.minus[0])
   229  	}
   230  
   231  	// reverse
   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]
   234  	}
   235  
   236  	return string(b)
   237  }
   238  
   239  // FmtPercent returns 'num' with digits/precision of 'v' for 'zh_Hant_MO' 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_MO) FmtPercent(num float64, v uint64) string {
   242  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   243  	l := len(s) + 3
   244  	b := make([]byte, 0, l)
   245  
   246  	for i := len(s) - 1; i >= 0; i-- {
   247  
   248  		if s[i] == '.' {
   249  			b = append(b, zh.decimal[0])
   250  			continue
   251  		}
   252  
   253  		b = append(b, s[i])
   254  	}
   255  
   256  	if num < 0 {
   257  		b = append(b, zh.minus[0])
   258  	}
   259  
   260  	// reverse
   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]
   263  	}
   264  
   265  	b = append(b, zh.percent...)
   266  
   267  	return string(b)
   268  }
   269  
   270  // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'zh_Hant_MO'
   271  func (zh *zh_Hant_MO) FmtCurrency(num float64, v uint64, currency currency.Type) string {
   272  
   273  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   274  	symbol := zh.currencies[currency]
   275  	l := len(s) + len(symbol) + 3
   276  
   277  	b := make([]byte, 0, l)
   278  
   279  	for i := len(s) - 1; i >= 0; i-- {
   280  
   281  		if s[i] == '.' {
   282  			b = append(b, zh.decimal[0])
   283  			continue
   284  		}
   285  
   286  		b = append(b, s[i])
   287  	}
   288  
   289  	for j := len(symbol) - 1; j >= 0; j-- {
   290  		b = append(b, symbol[j])
   291  	}
   292  
   293  	if num < 0 {
   294  		b = append(b, zh.minus[0])
   295  	}
   296  
   297  	// reverse
   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]
   300  	}
   301  
   302  	b = append(b, zh.currencyPositiveSuffix...)
   303  
   304  	return string(b)
   305  }
   306  
   307  // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'zh_Hant_MO'
   308  // in accounting notation.
   309  func (zh *zh_Hant_MO) FmtAccounting(num float64, v uint64, currency currency.Type) string {
   310  
   311  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   312  	symbol := zh.currencies[currency]
   313  	l := len(s) + len(symbol) + 3
   314  
   315  	b := make([]byte, 0, l)
   316  
   317  	for i := len(s) - 1; i >= 0; i-- {
   318  
   319  		if s[i] == '.' {
   320  			b = append(b, zh.decimal[0])
   321  			continue
   322  		}
   323  
   324  		b = append(b, s[i])
   325  	}
   326  
   327  	if num < 0 {
   328  
   329  		for j := len(symbol) - 1; j >= 0; j-- {
   330  			b = append(b, symbol[j])
   331  		}
   332  
   333  		b = append(b, zh.minus[0])
   334  
   335  	} else {
   336  
   337  		for j := len(symbol) - 1; j >= 0; j-- {
   338  			b = append(b, symbol[j])
   339  		}
   340  
   341  	}
   342  
   343  	// reverse
   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]
   346  	}
   347  
   348  	if num < 0 {
   349  		b = append(b, zh.currencyNegativeSuffix...)
   350  	} else {
   351  
   352  		b = append(b, zh.currencyPositiveSuffix...)
   353  	}
   354  
   355  	return string(b)
   356  }
   357  
   358  // FmtDateShort returns the short date representation of 't' for 'zh_Hant_MO'
   359  func (zh *zh_Hant_MO) FmtDateShort(t time.Time) string {
   360  
   361  	b := make([]byte, 0, 32)
   362  
   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}...)
   367  
   368  	if t.Year() > 0 {
   369  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   370  	} else {
   371  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   372  	}
   373  
   374  	return string(b)
   375  }
   376  
   377  // FmtDateMedium returns the medium date representation of 't' for 'zh_Hant_MO'
   378  func (zh *zh_Hant_MO) FmtDateMedium(t time.Time) string {
   379  
   380  	b := make([]byte, 0, 32)
   381  
   382  	if t.Year() > 0 {
   383  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   384  	} else {
   385  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   386  	}
   387  
   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}...)
   393  
   394  	return string(b)
   395  }
   396  
   397  // FmtDateLong returns the long date representation of 't' for 'zh_Hant_MO'
   398  func (zh *zh_Hant_MO) FmtDateLong(t time.Time) string {
   399  
   400  	b := make([]byte, 0, 32)
   401  
   402  	if t.Year() > 0 {
   403  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   404  	} else {
   405  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   406  	}
   407  
   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}...)
   413  
   414  	return string(b)
   415  }
   416  
   417  // FmtDateFull returns the full date representation of 't' for 'zh_Hant_MO'
   418  func (zh *zh_Hant_MO) FmtDateFull(t time.Time) string {
   419  
   420  	b := make([]byte, 0, 32)
   421  
   422  	if t.Year() > 0 {
   423  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   424  	} else {
   425  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   426  	}
   427  
   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()]...)
   434  
   435  	return string(b)
   436  }
   437  
   438  // FmtTimeShort returns the short time representation of 't' for 'zh_Hant_MO'
   439  func (zh *zh_Hant_MO) FmtTimeShort(t time.Time) string {
   440  
   441  	b := make([]byte, 0, 32)
   442  
   443  	if t.Hour() < 12 {
   444  		b = append(b, zh.periodsAbbreviated[0]...)
   445  	} else {
   446  		b = append(b, zh.periodsAbbreviated[1]...)
   447  	}
   448  
   449  	h := t.Hour()
   450  
   451  	if h > 12 {
   452  		h -= 12
   453  	}
   454  
   455  	b = strconv.AppendInt(b, int64(h), 10)
   456  	b = append(b, zh.timeSeparator...)
   457  
   458  	if t.Minute() < 10 {
   459  		b = append(b, '0')
   460  	}
   461  
   462  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   463  
   464  	return string(b)
   465  }
   466  
   467  // FmtTimeMedium returns the medium time representation of 't' for 'zh_Hant_MO'
   468  func (zh *zh_Hant_MO) FmtTimeMedium(t time.Time) string {
   469  
   470  	b := make([]byte, 0, 32)
   471  
   472  	if t.Hour() < 12 {
   473  		b = append(b, zh.periodsAbbreviated[0]...)
   474  	} else {
   475  		b = append(b, zh.periodsAbbreviated[1]...)
   476  	}
   477  
   478  	h := t.Hour()
   479  
   480  	if h > 12 {
   481  		h -= 12
   482  	}
   483  
   484  	b = strconv.AppendInt(b, int64(h), 10)
   485  	b = append(b, zh.timeSeparator...)
   486  
   487  	if t.Minute() < 10 {
   488  		b = append(b, '0')
   489  	}
   490  
   491  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   492  	b = append(b, zh.timeSeparator...)
   493  
   494  	if t.Second() < 10 {
   495  		b = append(b, '0')
   496  	}
   497  
   498  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   499  
   500  	return string(b)
   501  }
   502  
   503  // FmtTimeLong returns the long time representation of 't' for 'zh_Hant_MO'
   504  func (zh *zh_Hant_MO) FmtTimeLong(t time.Time) string {
   505  
   506  	b := make([]byte, 0, 32)
   507  
   508  	if t.Hour() < 12 {
   509  		b = append(b, zh.periodsAbbreviated[0]...)
   510  	} else {
   511  		b = append(b, zh.periodsAbbreviated[1]...)
   512  	}
   513  
   514  	h := t.Hour()
   515  
   516  	if h > 12 {
   517  		h -= 12
   518  	}
   519  
   520  	b = strconv.AppendInt(b, int64(h), 10)
   521  	b = append(b, zh.timeSeparator...)
   522  
   523  	if t.Minute() < 10 {
   524  		b = append(b, '0')
   525  	}
   526  
   527  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   528  	b = append(b, zh.timeSeparator...)
   529  
   530  	if t.Second() < 10 {
   531  		b = append(b, '0')
   532  	}
   533  
   534  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   535  	b = append(b, []byte{0x20, 0x5b}...)
   536  
   537  	tz, _ := t.Zone()
   538  	b = append(b, tz...)
   539  
   540  	b = append(b, []byte{0x5d}...)
   541  
   542  	return string(b)
   543  }
   544  
   545  // FmtTimeFull returns the full time representation of 't' for 'zh_Hant_MO'
   546  func (zh *zh_Hant_MO) FmtTimeFull(t time.Time) string {
   547  
   548  	b := make([]byte, 0, 32)
   549  
   550  	if t.Hour() < 12 {
   551  		b = append(b, zh.periodsAbbreviated[0]...)
   552  	} else {
   553  		b = append(b, zh.periodsAbbreviated[1]...)
   554  	}
   555  
   556  	h := t.Hour()
   557  
   558  	if h > 12 {
   559  		h -= 12
   560  	}
   561  
   562  	b = strconv.AppendInt(b, int64(h), 10)
   563  	b = append(b, zh.timeSeparator...)
   564  
   565  	if t.Minute() < 10 {
   566  		b = append(b, '0')
   567  	}
   568  
   569  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   570  	b = append(b, zh.timeSeparator...)
   571  
   572  	if t.Second() < 10 {
   573  		b = append(b, '0')
   574  	}
   575  
   576  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   577  	b = append(b, []byte{0x20, 0x5b}...)
   578  
   579  	tz, _ := t.Zone()
   580  
   581  	if btz, ok := zh.timezones[tz]; ok {
   582  		b = append(b, btz...)
   583  	} else {
   584  		b = append(b, tz...)
   585  	}
   586  
   587  	b = append(b, []byte{0x5d}...)
   588  
   589  	return string(b)
   590  }
   591  

View as plain text