saq.go 16 KB

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