om.go 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  1. package om
  2. import (
  3. "math"
  4. "strconv"
  5. "time"
  6. "github.com/go-playground/locales"
  7. "github.com/go-playground/locales/currency"
  8. )
  9. type om 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. monthsAbbreviated []string
  23. monthsNarrow []string
  24. monthsWide []string
  25. daysAbbreviated []string
  26. daysNarrow []string
  27. daysShort []string
  28. daysWide []string
  29. periodsAbbreviated []string
  30. periodsNarrow []string
  31. periodsShort []string
  32. periodsWide []string
  33. erasAbbreviated []string
  34. erasNarrow []string
  35. erasWide []string
  36. timezones map[string]string
  37. }
  38. // New returns a new instance of translator for the 'om' locale
  39. func New() locales.Translator {
  40. return &om{
  41. locale: "om",
  42. pluralsCardinal: []locales.PluralRule{2, 6},
  43. pluralsOrdinal: nil,
  44. pluralsRange: nil,
  45. timeSeparator: ":",
  46. 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 ", "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 ", "Br", "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 "},
  47. monthsAbbreviated: []string{"", "Ama", "Gur", "Bit", "Elb", "Cam", "Wax", "Ado", "Hag", "Ful", "Onk", "Sad", "Mud"},
  48. monthsNarrow: []string{"", "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"},
  49. monthsWide: []string{"", "Amajjii", "Guraandhala", "Bitooteessa", "Elba", "Caamsa", "Waxabajjii", "Adooleessa", "Hagayya", "Fuulbana", "Onkololeessa", "Sadaasa", "Muddee"},
  50. daysAbbreviated: []string{"Dil", "Wix", "Qib", "Rob", "Kam", "Jim", "San"},
  51. daysNarrow: []string{"S", "M", "T", "W", "T", "F", "S"},
  52. daysWide: []string{"Dilbata", "Wiixata", "Qibxata", "Roobii", "Kamiisa", "Jimaata", "Sanbata"},
  53. periodsAbbreviated: []string{"WD", "WB"},
  54. periodsWide: []string{"WD", "WB"},
  55. erasAbbreviated: []string{"KD", "KB"},
  56. erasNarrow: []string{"", ""},
  57. erasWide: []string{"", ""},
  58. timezones: map[string]string{"ACWDT": "ACWDT", "EAT": "EAT", "JST": "JST", "WAT": "WAT", "BT": "BT", "HKST": "HKST", "TMST": "TMST", "COST": "COST", "SAST": "SAST", "SRT": "SRT", "UYT": "UYT", "AEST": "AEST", "CHADT": "CHADT", "HKT": "HKT", "WIT": "WIT", "IST": "IST", "GFT": "GFT", "ACDT": "ACDT", "ARST": "ARST", "AKDT": "AKDT", "VET": "VET", "WEZ": "WEZ", "ChST": "ChST", "MST": "MST", "CAT": "CAT", "EDT": "EDT", "AEDT": "AEDT", "PDT": "PDT", "MEZ": "MEZ", "NZDT": "NZDT", "CHAST": "CHAST", "EST": "EST", "WIB": "WIB", "AWDT": "AWDT", "WAST": "WAST", "ART": "ART", "PST": "PST", "CST": "CST", "CDT": "CDT", "MESZ": "MESZ", "GMT": "GMT", "MYT": "MYT", "NZST": "NZST", "ECT": "ECT", "OESZ": "OESZ", "HNT": "HNT", "ACST": "ACST", "UYST": "UYST", "CLT": "CLT", "ACWST": "ACWST", "JDT": "JDT", "BOT": "BOT", "COT": "COT", "ADT": "ADT", "LHDT": "LHDT", "WITA": "WITA", "CLST": "CLST", "AST": "AST", "HADT": "HADT", "WART": "WART", "WARST": "WARST", "TMT": "TMT", "AWST": "AWST", "LHST": "LHST", "WESZ": "WESZ", "HAST": "HAST", "SGT": "SGT", "MDT": "MDT", "∅∅∅": "∅∅∅", "OEZ": "OEZ", "HAT": "HAT", "AKST": "AKST", "GYT": "GYT"},
  59. }
  60. }
  61. // Locale returns the current translators string locale
  62. func (om *om) Locale() string {
  63. return om.locale
  64. }
  65. // PluralsCardinal returns the list of cardinal plural rules associated with 'om'
  66. func (om *om) PluralsCardinal() []locales.PluralRule {
  67. return om.pluralsCardinal
  68. }
  69. // PluralsOrdinal returns the list of ordinal plural rules associated with 'om'
  70. func (om *om) PluralsOrdinal() []locales.PluralRule {
  71. return om.pluralsOrdinal
  72. }
  73. // PluralsRange returns the list of range plural rules associated with 'om'
  74. func (om *om) PluralsRange() []locales.PluralRule {
  75. return om.pluralsRange
  76. }
  77. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'om'
  78. func (om *om) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
  79. n := math.Abs(num)
  80. if n == 1 {
  81. return locales.PluralRuleOne
  82. }
  83. return locales.PluralRuleOther
  84. }
  85. // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'om'
  86. func (om *om) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
  87. return locales.PluralRuleUnknown
  88. }
  89. // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'om'
  90. func (om *om) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
  91. return locales.PluralRuleUnknown
  92. }
  93. // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
  94. func (om *om) MonthAbbreviated(month time.Month) string {
  95. return om.monthsAbbreviated[month]
  96. }
  97. // MonthsAbbreviated returns the locales abbreviated months
  98. func (om *om) MonthsAbbreviated() []string {
  99. return om.monthsAbbreviated[1:]
  100. }
  101. // MonthNarrow returns the locales narrow month given the 'month' provided
  102. func (om *om) MonthNarrow(month time.Month) string {
  103. return om.monthsNarrow[month]
  104. }
  105. // MonthsNarrow returns the locales narrow months
  106. func (om *om) MonthsNarrow() []string {
  107. return om.monthsNarrow[1:]
  108. }
  109. // MonthWide returns the locales wide month given the 'month' provided
  110. func (om *om) MonthWide(month time.Month) string {
  111. return om.monthsWide[month]
  112. }
  113. // MonthsWide returns the locales wide months
  114. func (om *om) MonthsWide() []string {
  115. return om.monthsWide[1:]
  116. }
  117. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  118. func (om *om) WeekdayAbbreviated(weekday time.Weekday) string {
  119. return om.daysAbbreviated[weekday]
  120. }
  121. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  122. func (om *om) WeekdaysAbbreviated() []string {
  123. return om.daysAbbreviated
  124. }
  125. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  126. func (om *om) WeekdayNarrow(weekday time.Weekday) string {
  127. return om.daysNarrow[weekday]
  128. }
  129. // WeekdaysNarrow returns the locales narrow weekdays
  130. func (om *om) WeekdaysNarrow() []string {
  131. return om.daysNarrow
  132. }
  133. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  134. func (om *om) WeekdayShort(weekday time.Weekday) string {
  135. return om.daysShort[weekday]
  136. }
  137. // WeekdaysShort returns the locales short weekdays
  138. func (om *om) WeekdaysShort() []string {
  139. return om.daysShort
  140. }
  141. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  142. func (om *om) WeekdayWide(weekday time.Weekday) string {
  143. return om.daysWide[weekday]
  144. }
  145. // WeekdaysWide returns the locales wide weekdays
  146. func (om *om) WeekdaysWide() []string {
  147. return om.daysWide
  148. }
  149. // FmtNumber returns 'num' with digits/precision of 'v' for 'om' and handles both Whole and Real numbers based on 'v'
  150. func (om *om) FmtNumber(num float64, v uint64) string {
  151. return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  152. }
  153. // FmtPercent returns 'num' with digits/precision of 'v' for 'om' and handles both Whole and Real numbers based on 'v'
  154. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
  155. func (om *om) FmtPercent(num float64, v uint64) string {
  156. return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  157. }
  158. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'om'
  159. func (om *om) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  160. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  161. symbol := om.currencies[currency]
  162. l := len(s) + len(symbol) + 0 + 0*len(s[:len(s)-int(v)-1])/3
  163. count := 0
  164. inWhole := v == 0
  165. b := make([]byte, 0, l)
  166. for i := len(s) - 1; i >= 0; i-- {
  167. if s[i] == '.' {
  168. b = append(b, om.decimal[0])
  169. inWhole = true
  170. continue
  171. }
  172. if inWhole {
  173. if count == 3 {
  174. b = append(b, om.group[0])
  175. count = 1
  176. } else {
  177. count++
  178. }
  179. }
  180. b = append(b, s[i])
  181. }
  182. for j := len(symbol) - 1; j >= 0; j-- {
  183. b = append(b, symbol[j])
  184. }
  185. if num < 0 {
  186. b = append(b, om.minus[0])
  187. }
  188. // reverse
  189. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  190. b[i], b[j] = b[j], b[i]
  191. }
  192. if int(v) < 2 {
  193. if v == 0 {
  194. b = append(b, om.decimal...)
  195. }
  196. for i := 0; i < 2-int(v); i++ {
  197. b = append(b, '0')
  198. }
  199. }
  200. return string(b)
  201. }
  202. // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'om'
  203. // in accounting notation.
  204. func (om *om) FmtAccounting(num float64, v uint64, currency currency.Type) string {
  205. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  206. symbol := om.currencies[currency]
  207. l := len(s) + len(symbol) + 0 + 0*len(s[:len(s)-int(v)-1])/3
  208. count := 0
  209. inWhole := v == 0
  210. b := make([]byte, 0, l)
  211. for i := len(s) - 1; i >= 0; i-- {
  212. if s[i] == '.' {
  213. b = append(b, om.decimal[0])
  214. inWhole = true
  215. continue
  216. }
  217. if inWhole {
  218. if count == 3 {
  219. b = append(b, om.group[0])
  220. count = 1
  221. } else {
  222. count++
  223. }
  224. }
  225. b = append(b, s[i])
  226. }
  227. if num < 0 {
  228. for j := len(symbol) - 1; j >= 0; j-- {
  229. b = append(b, symbol[j])
  230. }
  231. b = append(b, om.minus[0])
  232. } else {
  233. for j := len(symbol) - 1; j >= 0; j-- {
  234. b = append(b, symbol[j])
  235. }
  236. }
  237. // reverse
  238. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  239. b[i], b[j] = b[j], b[i]
  240. }
  241. if int(v) < 2 {
  242. if v == 0 {
  243. b = append(b, om.decimal...)
  244. }
  245. for i := 0; i < 2-int(v); i++ {
  246. b = append(b, '0')
  247. }
  248. }
  249. return string(b)
  250. }
  251. // FmtDateShort returns the short date representation of 't' for 'om'
  252. func (om *om) FmtDateShort(t time.Time) string {
  253. b := make([]byte, 0, 32)
  254. if t.Day() < 10 {
  255. b = append(b, '0')
  256. }
  257. b = strconv.AppendInt(b, int64(t.Day()), 10)
  258. b = append(b, []byte{0x2f}...)
  259. if t.Month() < 10 {
  260. b = append(b, '0')
  261. }
  262. b = strconv.AppendInt(b, int64(t.Month()), 10)
  263. b = append(b, []byte{0x2f}...)
  264. if t.Year() > 9 {
  265. b = append(b, strconv.Itoa(t.Year())[2:]...)
  266. } else {
  267. b = append(b, strconv.Itoa(t.Year())[1:]...)
  268. }
  269. return string(b)
  270. }
  271. // FmtDateMedium returns the medium date representation of 't' for 'om'
  272. func (om *om) FmtDateMedium(t time.Time) string {
  273. b := make([]byte, 0, 32)
  274. if t.Day() < 10 {
  275. b = append(b, '0')
  276. }
  277. b = strconv.AppendInt(b, int64(t.Day()), 10)
  278. b = append(b, []byte{0x2d}...)
  279. b = append(b, om.monthsAbbreviated[t.Month()]...)
  280. b = append(b, []byte{0x2d}...)
  281. b = strconv.AppendInt(b, int64(t.Year()), 10)
  282. return string(b)
  283. }
  284. // FmtDateLong returns the long date representation of 't' for 'om'
  285. func (om *om) FmtDateLong(t time.Time) string {
  286. b := make([]byte, 0, 32)
  287. if t.Day() < 10 {
  288. b = append(b, '0')
  289. }
  290. b = strconv.AppendInt(b, int64(t.Day()), 10)
  291. b = append(b, []byte{0x20}...)
  292. b = append(b, om.monthsWide[t.Month()]...)
  293. b = append(b, []byte{0x20}...)
  294. b = strconv.AppendInt(b, int64(t.Year()), 10)
  295. return string(b)
  296. }
  297. // FmtDateFull returns the full date representation of 't' for 'om'
  298. func (om *om) FmtDateFull(t time.Time) string {
  299. b := make([]byte, 0, 32)
  300. b = append(b, om.daysWide[t.Weekday()]...)
  301. b = append(b, []byte{0x2c, 0x20}...)
  302. b = append(b, om.monthsWide[t.Month()]...)
  303. b = append(b, []byte{0x20}...)
  304. b = strconv.AppendInt(b, int64(t.Day()), 10)
  305. b = append(b, []byte{0x2c, 0x20}...)
  306. b = strconv.AppendInt(b, int64(t.Year()), 10)
  307. return string(b)
  308. }
  309. // FmtTimeShort returns the short time representation of 't' for 'om'
  310. func (om *om) FmtTimeShort(t time.Time) string {
  311. b := make([]byte, 0, 32)
  312. h := t.Hour()
  313. if h > 12 {
  314. h -= 12
  315. }
  316. b = strconv.AppendInt(b, int64(h), 10)
  317. b = append(b, om.timeSeparator...)
  318. if t.Minute() < 10 {
  319. b = append(b, '0')
  320. }
  321. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  322. b = append(b, []byte{0x20}...)
  323. if t.Hour() < 12 {
  324. b = append(b, om.periodsAbbreviated[0]...)
  325. } else {
  326. b = append(b, om.periodsAbbreviated[1]...)
  327. }
  328. return string(b)
  329. }
  330. // FmtTimeMedium returns the medium time representation of 't' for 'om'
  331. func (om *om) FmtTimeMedium(t time.Time) string {
  332. b := make([]byte, 0, 32)
  333. h := t.Hour()
  334. if h > 12 {
  335. h -= 12
  336. }
  337. b = strconv.AppendInt(b, int64(h), 10)
  338. b = append(b, om.timeSeparator...)
  339. if t.Minute() < 10 {
  340. b = append(b, '0')
  341. }
  342. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  343. b = append(b, om.timeSeparator...)
  344. if t.Second() < 10 {
  345. b = append(b, '0')
  346. }
  347. b = strconv.AppendInt(b, int64(t.Second()), 10)
  348. b = append(b, []byte{0x20}...)
  349. if t.Hour() < 12 {
  350. b = append(b, om.periodsAbbreviated[0]...)
  351. } else {
  352. b = append(b, om.periodsAbbreviated[1]...)
  353. }
  354. return string(b)
  355. }
  356. // FmtTimeLong returns the long time representation of 't' for 'om'
  357. func (om *om) FmtTimeLong(t time.Time) string {
  358. b := make([]byte, 0, 32)
  359. h := t.Hour()
  360. if h > 12 {
  361. h -= 12
  362. }
  363. b = strconv.AppendInt(b, int64(h), 10)
  364. b = append(b, om.timeSeparator...)
  365. if t.Minute() < 10 {
  366. b = append(b, '0')
  367. }
  368. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  369. b = append(b, om.timeSeparator...)
  370. if t.Second() < 10 {
  371. b = append(b, '0')
  372. }
  373. b = strconv.AppendInt(b, int64(t.Second()), 10)
  374. b = append(b, []byte{0x20}...)
  375. if t.Hour() < 12 {
  376. b = append(b, om.periodsAbbreviated[0]...)
  377. } else {
  378. b = append(b, om.periodsAbbreviated[1]...)
  379. }
  380. b = append(b, []byte{0x20}...)
  381. tz, _ := t.Zone()
  382. b = append(b, tz...)
  383. return string(b)
  384. }
  385. // FmtTimeFull returns the full time representation of 't' for 'om'
  386. func (om *om) FmtTimeFull(t time.Time) string {
  387. b := make([]byte, 0, 32)
  388. h := t.Hour()
  389. if h > 12 {
  390. h -= 12
  391. }
  392. b = strconv.AppendInt(b, int64(h), 10)
  393. b = append(b, om.timeSeparator...)
  394. if t.Minute() < 10 {
  395. b = append(b, '0')
  396. }
  397. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  398. b = append(b, om.timeSeparator...)
  399. if t.Second() < 10 {
  400. b = append(b, '0')
  401. }
  402. b = strconv.AppendInt(b, int64(t.Second()), 10)
  403. b = append(b, []byte{0x20}...)
  404. if t.Hour() < 12 {
  405. b = append(b, om.periodsAbbreviated[0]...)
  406. } else {
  407. b = append(b, om.periodsAbbreviated[1]...)
  408. }
  409. b = append(b, []byte{0x20}...)
  410. tz, _ := t.Zone()
  411. if btz, ok := om.timezones[tz]; ok {
  412. b = append(b, btz...)
  413. } else {
  414. b = append(b, tz...)
  415. }
  416. return string(b)
  417. }