ak.go 16 KB

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