dyo.go 16 KB

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