so_SO.go 16 KB

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