ewo.go 17 KB

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