mgh.go 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512
  1. package mgh
  2. import (
  3. "math"
  4. "strconv"
  5. "time"
  6. "github.com/go-playground/locales"
  7. "github.com/go-playground/locales/currency"
  8. )
  9. type mgh struct {
  10. locale string
  11. pluralsCardinal []locales.PluralRule
  12. pluralsOrdinal []locales.PluralRule
  13. pluralsRange []locales.PluralRule
  14. decimal string
  15. group string
  16. minus string
  17. percent string
  18. perMille string
  19. timeSeparator string
  20. inifinity string
  21. currencies []string // idx = enum of currency code
  22. currencyPositivePrefix string
  23. currencyPositiveSuffix string
  24. currencyNegativePrefix string
  25. currencyNegativeSuffix string
  26. monthsAbbreviated []string
  27. monthsNarrow []string
  28. monthsWide []string
  29. daysAbbreviated []string
  30. daysNarrow []string
  31. daysShort []string
  32. daysWide []string
  33. periodsAbbreviated []string
  34. periodsNarrow []string
  35. periodsShort []string
  36. periodsWide []string
  37. erasAbbreviated []string
  38. erasNarrow []string
  39. erasWide []string
  40. timezones map[string]string
  41. }
  42. // New returns a new instance of translator for the 'mgh' locale
  43. func New() locales.Translator {
  44. return &mgh{
  45. locale: "mgh",
  46. pluralsCardinal: nil,
  47. pluralsOrdinal: nil,
  48. pluralsRange: nil,
  49. decimal: ",",
  50. group: ".",
  51. timeSeparator: ":",
  52. 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", "MTL", "MTP", "MUR", "MVP", "MVR", "MWK", "MXN", "MXP", "MXV", "MYR", "MZE", "MZM", "MTn", "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", "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"},
  53. currencyPositivePrefix: " ",
  54. currencyPositiveSuffix: "K",
  55. currencyNegativePrefix: " ",
  56. currencyNegativeSuffix: "K",
  57. monthsAbbreviated: []string{"", "Kwa", "Una", "Rar", "Che", "Tha", "Moc", "Sab", "Nan", "Tis", "Kum", "Moj", "Yel"},
  58. monthsNarrow: []string{"", "K", "U", "R", "C", "T", "M", "S", "N", "T", "K", "M", "Y"},
  59. monthsWide: []string{"", "Mweri wo kwanza", "Mweri wo unayeli", "Mweri wo uneraru", "Mweri wo unecheshe", "Mweri wo unethanu", "Mweri wo thanu na mocha", "Mweri wo saba", "Mweri wo nane", "Mweri wo tisa", "Mweri wo kumi", "Mweri wo kumi na moja", "Mweri wo kumi na yel’li"},
  60. daysAbbreviated: []string{"Sab", "Jtt", "Jnn", "Jtn", "Ara", "Iju", "Jmo"},
  61. daysNarrow: []string{"S", "J", "J", "J", "A", "I", "J"},
  62. daysWide: []string{"Sabato", "Jumatatu", "Jumanne", "Jumatano", "Arahamisi", "Ijumaa", "Jumamosi"},
  63. periodsAbbreviated: []string{"wichishu", "mchochil’l"},
  64. periodsWide: []string{"wichishu", "mchochil’l"},
  65. erasAbbreviated: []string{"HY", "YY"},
  66. erasNarrow: []string{"", ""},
  67. erasWide: []string{"Hinapiya yesu", "Yopia yesu"},
  68. timezones: map[string]string{"HEPM": "HEPM", "CLST": "CLST", "SAST": "SAST", "WIB": "WIB", "BOT": "BOT", "AKDT": "AKDT", "ChST": "ChST", "PDT": "PDT", "WEZ": "WEZ", "MST": "MST", "CAT": "CAT", "WIT": "WIT", "OESZ": "OESZ", "GYT": "GYT", "HKT": "HKT", "HNT": "HNT", "TMT": "TMT", "MYT": "MYT", "VET": "VET", "TMST": "TMST", "COT": "COT", "GFT": "GFT", "MESZ": "MESZ", "WAST": "WAST", "HNOG": "HNOG", "HENOMX": "HENOMX", "HADT": "HADT", "CHAST": "CHAST", "AWDT": "AWDT", "AEDT": "AEDT", "HEPMX": "HEPMX", "NZDT": "NZDT", "ECT": "ECT", "MDT": "MDT", "OEZ": "OEZ", "ARST": "ARST", "GMT": "GMT", "HECU": "HECU", "ACDT": "ACDT", "HKST": "HKST", "IST": "IST", "LHDT": "LHDT", "COST": "COST", "AWST": "AWST", "EDT": "EDT", "NZST": "NZST", "HEOG": "HEOG", "ACWDT": "ACWDT", "HAST": "HAST", "AST": "AST", "WAT": "WAT", "JDT": "JDT", "BT": "BT", "LHST": "LHST", "HAT": "HAT", "UYST": "UYST", "HNCU": "HNCU", "SGT": "SGT", "WARST": "WARST", "HNNOMX": "HNNOMX", "EAT": "EAT", "HNPMX": "HNPMX", "AKST": "AKST", "WART": "WART", "CLT": "CLT", "CST": "CST", "WESZ": "WESZ", "ACST": "ACST", "MEZ": "MEZ", "∅∅∅": "∅∅∅", "ART": "ART", "UYT": "UYT", "AEST": "AEST", "JST": "JST", "ADT": "ADT", "ACWST": "ACWST", "HNPM": "HNPM", "CHADT": "CHADT", "WITA": "WITA", "HEEG": "HEEG", "SRT": "SRT", "CDT": "CDT", "PST": "PST", "EST": "EST", "HNEG": "HNEG"},
  69. }
  70. }
  71. // Locale returns the current translators string locale
  72. func (mgh *mgh) Locale() string {
  73. return mgh.locale
  74. }
  75. // PluralsCardinal returns the list of cardinal plural rules associated with 'mgh'
  76. func (mgh *mgh) PluralsCardinal() []locales.PluralRule {
  77. return mgh.pluralsCardinal
  78. }
  79. // PluralsOrdinal returns the list of ordinal plural rules associated with 'mgh'
  80. func (mgh *mgh) PluralsOrdinal() []locales.PluralRule {
  81. return mgh.pluralsOrdinal
  82. }
  83. // PluralsRange returns the list of range plural rules associated with 'mgh'
  84. func (mgh *mgh) PluralsRange() []locales.PluralRule {
  85. return mgh.pluralsRange
  86. }
  87. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'mgh'
  88. func (mgh *mgh) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
  89. return locales.PluralRuleUnknown
  90. }
  91. // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'mgh'
  92. func (mgh *mgh) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
  93. return locales.PluralRuleUnknown
  94. }
  95. // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'mgh'
  96. func (mgh *mgh) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
  97. return locales.PluralRuleUnknown
  98. }
  99. // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
  100. func (mgh *mgh) MonthAbbreviated(month time.Month) string {
  101. return mgh.monthsAbbreviated[month]
  102. }
  103. // MonthsAbbreviated returns the locales abbreviated months
  104. func (mgh *mgh) MonthsAbbreviated() []string {
  105. return mgh.monthsAbbreviated[1:]
  106. }
  107. // MonthNarrow returns the locales narrow month given the 'month' provided
  108. func (mgh *mgh) MonthNarrow(month time.Month) string {
  109. return mgh.monthsNarrow[month]
  110. }
  111. // MonthsNarrow returns the locales narrow months
  112. func (mgh *mgh) MonthsNarrow() []string {
  113. return mgh.monthsNarrow[1:]
  114. }
  115. // MonthWide returns the locales wide month given the 'month' provided
  116. func (mgh *mgh) MonthWide(month time.Month) string {
  117. return mgh.monthsWide[month]
  118. }
  119. // MonthsWide returns the locales wide months
  120. func (mgh *mgh) MonthsWide() []string {
  121. return mgh.monthsWide[1:]
  122. }
  123. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  124. func (mgh *mgh) WeekdayAbbreviated(weekday time.Weekday) string {
  125. return mgh.daysAbbreviated[weekday]
  126. }
  127. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  128. func (mgh *mgh) WeekdaysAbbreviated() []string {
  129. return mgh.daysAbbreviated
  130. }
  131. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  132. func (mgh *mgh) WeekdayNarrow(weekday time.Weekday) string {
  133. return mgh.daysNarrow[weekday]
  134. }
  135. // WeekdaysNarrow returns the locales narrow weekdays
  136. func (mgh *mgh) WeekdaysNarrow() []string {
  137. return mgh.daysNarrow
  138. }
  139. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  140. func (mgh *mgh) WeekdayShort(weekday time.Weekday) string {
  141. return mgh.daysShort[weekday]
  142. }
  143. // WeekdaysShort returns the locales short weekdays
  144. func (mgh *mgh) WeekdaysShort() []string {
  145. return mgh.daysShort
  146. }
  147. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  148. func (mgh *mgh) WeekdayWide(weekday time.Weekday) string {
  149. return mgh.daysWide[weekday]
  150. }
  151. // WeekdaysWide returns the locales wide weekdays
  152. func (mgh *mgh) WeekdaysWide() []string {
  153. return mgh.daysWide
  154. }
  155. // Decimal returns the decimal point of number
  156. func (mgh *mgh) Decimal() string {
  157. return mgh.decimal
  158. }
  159. // Group returns the group of number
  160. func (mgh *mgh) Group() string {
  161. return mgh.group
  162. }
  163. // Group returns the minus sign of number
  164. func (mgh *mgh) Minus() string {
  165. return mgh.minus
  166. }
  167. // FmtNumber returns 'num' with digits/precision of 'v' for 'mgh' and handles both Whole and Real numbers based on 'v'
  168. func (mgh *mgh) FmtNumber(num float64, v uint64) string {
  169. return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  170. }
  171. // FmtPercent returns 'num' with digits/precision of 'v' for 'mgh' and handles both Whole and Real numbers based on 'v'
  172. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
  173. func (mgh *mgh) FmtPercent(num float64, v uint64) string {
  174. return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  175. }
  176. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'mgh'
  177. func (mgh *mgh) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  178. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  179. symbol := mgh.currencies[currency]
  180. l := len(s) + len(symbol) + 4
  181. b := make([]byte, 0, l)
  182. for i := len(s) - 1; i >= 0; i-- {
  183. if s[i] == '.' {
  184. b = append(b, mgh.decimal[0])
  185. continue
  186. }
  187. b = append(b, s[i])
  188. }
  189. for j := len(symbol) - 1; j >= 0; j-- {
  190. b = append(b, symbol[j])
  191. }
  192. for j := len(mgh.currencyPositivePrefix) - 1; j >= 0; j-- {
  193. b = append(b, mgh.currencyPositivePrefix[j])
  194. }
  195. if num < 0 {
  196. b = append(b, mgh.minus[0])
  197. }
  198. // reverse
  199. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  200. b[i], b[j] = b[j], b[i]
  201. }
  202. b = append(b, mgh.currencyPositiveSuffix...)
  203. return string(b)
  204. }
  205. // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'mgh'
  206. // in accounting notation.
  207. func (mgh *mgh) FmtAccounting(num float64, v uint64, currency currency.Type) string {
  208. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  209. symbol := mgh.currencies[currency]
  210. l := len(s) + len(symbol) + 4
  211. b := make([]byte, 0, l)
  212. for i := len(s) - 1; i >= 0; i-- {
  213. if s[i] == '.' {
  214. b = append(b, mgh.decimal[0])
  215. continue
  216. }
  217. b = append(b, s[i])
  218. }
  219. if num < 0 {
  220. for j := len(symbol) - 1; j >= 0; j-- {
  221. b = append(b, symbol[j])
  222. }
  223. for j := len(mgh.currencyNegativePrefix) - 1; j >= 0; j-- {
  224. b = append(b, mgh.currencyNegativePrefix[j])
  225. }
  226. b = append(b, mgh.minus[0])
  227. } else {
  228. for j := len(symbol) - 1; j >= 0; j-- {
  229. b = append(b, symbol[j])
  230. }
  231. for j := len(mgh.currencyPositivePrefix) - 1; j >= 0; j-- {
  232. b = append(b, mgh.currencyPositivePrefix[j])
  233. }
  234. }
  235. // reverse
  236. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  237. b[i], b[j] = b[j], b[i]
  238. }
  239. if num < 0 {
  240. b = append(b, mgh.currencyNegativeSuffix...)
  241. } else {
  242. b = append(b, mgh.currencyPositiveSuffix...)
  243. }
  244. return string(b)
  245. }
  246. // FmtDateShort returns the short date representation of 't' for 'mgh'
  247. func (mgh *mgh) FmtDateShort(t time.Time) string {
  248. b := make([]byte, 0, 32)
  249. if t.Day() < 10 {
  250. b = append(b, '0')
  251. }
  252. b = strconv.AppendInt(b, int64(t.Day()), 10)
  253. b = append(b, []byte{0x2f}...)
  254. if t.Month() < 10 {
  255. b = append(b, '0')
  256. }
  257. b = strconv.AppendInt(b, int64(t.Month()), 10)
  258. b = append(b, []byte{0x2f}...)
  259. if t.Year() > 0 {
  260. b = strconv.AppendInt(b, int64(t.Year()), 10)
  261. } else {
  262. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  263. }
  264. return string(b)
  265. }
  266. // FmtDateMedium returns the medium date representation of 't' for 'mgh'
  267. func (mgh *mgh) FmtDateMedium(t time.Time) string {
  268. b := make([]byte, 0, 32)
  269. b = strconv.AppendInt(b, int64(t.Day()), 10)
  270. b = append(b, []byte{0x20}...)
  271. b = append(b, mgh.monthsAbbreviated[t.Month()]...)
  272. b = append(b, []byte{0x20}...)
  273. if t.Year() > 0 {
  274. b = strconv.AppendInt(b, int64(t.Year()), 10)
  275. } else {
  276. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  277. }
  278. return string(b)
  279. }
  280. // FmtDateLong returns the long date representation of 't' for 'mgh'
  281. func (mgh *mgh) FmtDateLong(t time.Time) string {
  282. b := make([]byte, 0, 32)
  283. b = strconv.AppendInt(b, int64(t.Day()), 10)
  284. b = append(b, []byte{0x20}...)
  285. b = append(b, mgh.monthsWide[t.Month()]...)
  286. b = append(b, []byte{0x20}...)
  287. if t.Year() > 0 {
  288. b = strconv.AppendInt(b, int64(t.Year()), 10)
  289. } else {
  290. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  291. }
  292. return string(b)
  293. }
  294. // FmtDateFull returns the full date representation of 't' for 'mgh'
  295. func (mgh *mgh) FmtDateFull(t time.Time) string {
  296. b := make([]byte, 0, 32)
  297. b = append(b, mgh.daysWide[t.Weekday()]...)
  298. b = append(b, []byte{0x2c, 0x20}...)
  299. b = strconv.AppendInt(b, int64(t.Day()), 10)
  300. b = append(b, []byte{0x20}...)
  301. b = append(b, mgh.monthsWide[t.Month()]...)
  302. b = append(b, []byte{0x20}...)
  303. if t.Year() > 0 {
  304. b = strconv.AppendInt(b, int64(t.Year()), 10)
  305. } else {
  306. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  307. }
  308. return string(b)
  309. }
  310. // FmtTimeShort returns the short time representation of 't' for 'mgh'
  311. func (mgh *mgh) FmtTimeShort(t time.Time) string {
  312. b := make([]byte, 0, 32)
  313. if t.Hour() < 10 {
  314. b = append(b, '0')
  315. }
  316. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  317. b = append(b, mgh.timeSeparator...)
  318. if t.Minute() < 10 {
  319. b = append(b, '0')
  320. }
  321. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  322. return string(b)
  323. }
  324. // FmtTimeMedium returns the medium time representation of 't' for 'mgh'
  325. func (mgh *mgh) FmtTimeMedium(t time.Time) string {
  326. b := make([]byte, 0, 32)
  327. if t.Hour() < 10 {
  328. b = append(b, '0')
  329. }
  330. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  331. b = append(b, mgh.timeSeparator...)
  332. if t.Minute() < 10 {
  333. b = append(b, '0')
  334. }
  335. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  336. b = append(b, mgh.timeSeparator...)
  337. if t.Second() < 10 {
  338. b = append(b, '0')
  339. }
  340. b = strconv.AppendInt(b, int64(t.Second()), 10)
  341. return string(b)
  342. }
  343. // FmtTimeLong returns the long time representation of 't' for 'mgh'
  344. func (mgh *mgh) FmtTimeLong(t time.Time) string {
  345. b := make([]byte, 0, 32)
  346. if t.Hour() < 10 {
  347. b = append(b, '0')
  348. }
  349. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  350. b = append(b, mgh.timeSeparator...)
  351. if t.Minute() < 10 {
  352. b = append(b, '0')
  353. }
  354. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  355. b = append(b, mgh.timeSeparator...)
  356. if t.Second() < 10 {
  357. b = append(b, '0')
  358. }
  359. b = strconv.AppendInt(b, int64(t.Second()), 10)
  360. b = append(b, []byte{0x20}...)
  361. tz, _ := t.Zone()
  362. b = append(b, tz...)
  363. return string(b)
  364. }
  365. // FmtTimeFull returns the full time representation of 't' for 'mgh'
  366. func (mgh *mgh) FmtTimeFull(t time.Time) string {
  367. b := make([]byte, 0, 32)
  368. if t.Hour() < 10 {
  369. b = append(b, '0')
  370. }
  371. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  372. b = append(b, mgh.timeSeparator...)
  373. if t.Minute() < 10 {
  374. b = append(b, '0')
  375. }
  376. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  377. b = append(b, mgh.timeSeparator...)
  378. if t.Second() < 10 {
  379. b = append(b, '0')
  380. }
  381. b = strconv.AppendInt(b, int64(t.Second()), 10)
  382. b = append(b, []byte{0x20}...)
  383. tz, _ := t.Zone()
  384. if btz, ok := mgh.timezones[tz]; ok {
  385. b = append(b, btz...)
  386. } else {
  387. b = append(b, tz...)
  388. }
  389. return string(b)
  390. }