eo_001.go 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  1. package eo_001
  2. import (
  3. "math"
  4. "strconv"
  5. "time"
  6. "github.com/go-playground/locales"
  7. "github.com/go-playground/locales/currency"
  8. )
  9. type eo_001 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. currencyPositivePrefix string
  23. currencyPositiveSuffix string
  24. currencyNegativePrefix string
  25. currencyNegativeSuffix string
  26. monthsAbbreviated []string
  27. monthsNarrow []string
  28. monthsWide []string
  29. daysAbbreviated []string
  30. daysNarrow []string
  31. daysShort []string
  32. daysWide []string
  33. periodsAbbreviated []string
  34. periodsNarrow []string
  35. periodsShort []string
  36. periodsWide []string
  37. erasAbbreviated []string
  38. erasNarrow []string
  39. erasWide []string
  40. timezones map[string]string
  41. }
  42. // New returns a new instance of translator for the 'eo_001' locale
  43. func New() locales.Translator {
  44. return &eo_001{
  45. locale: "eo_001",
  46. pluralsCardinal: []locales.PluralRule{2, 6},
  47. pluralsOrdinal: nil,
  48. pluralsRange: nil,
  49. decimal: ",",
  50. group: " ",
  51. minus: "−",
  52. percent: "%",
  53. perMille: "‰",
  54. timeSeparator: ":",
  55. inifinity: "∞",
  56. 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", "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", "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"},
  57. currencyPositivePrefix: " ",
  58. currencyPositiveSuffix: "K",
  59. currencyNegativePrefix: " ",
  60. currencyNegativeSuffix: "K",
  61. monthsAbbreviated: []string{"", "jan", "feb", "mar", "apr", "maj", "jun", "jul", "aŭg", "sep", "okt", "nov", "dec"},
  62. monthsNarrow: []string{"", "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"},
  63. monthsWide: []string{"", "januaro", "februaro", "marto", "aprilo", "majo", "junio", "julio", "aŭgusto", "septembro", "oktobro", "novembro", "decembro"},
  64. daysAbbreviated: []string{"di", "lu", "ma", "me", "ĵa", "ve", "sa"},
  65. daysNarrow: []string{"D", "L", "M", "M", "Ĵ", "V", "S"},
  66. daysWide: []string{"dimanĉo", "lundo", "mardo", "merkredo", "ĵaŭdo", "vendredo", "sabato"},
  67. periodsAbbreviated: []string{"atm", "ptm"},
  68. periodsNarrow: []string{"a", "p"},
  69. periodsWide: []string{"atm", "ptm"},
  70. erasAbbreviated: []string{"aK", "pK"},
  71. erasNarrow: []string{"aK", "pK"},
  72. erasWide: []string{"aK", "pK"},
  73. timezones: map[string]string{"MST": "MST", "SRT": "SRT", "PST": "pacifika nord-amerika norma tempo", "AST": "atlantika nord-amerika norma tempo", "ACWDT": "centrokcidenta aŭstralia somera tempo", "HEOG": "HEOG", "WART": "WART", "WARST": "WARST", "AEST": "orienta aŭstralia norma tempo", "AEDT": "orienta aŭstralia somera tempo", "ChST": "ChST", "HNPMX": "HNPMX", "HAT": "HAT", "HNNOMX": "HNNOMX", "TMT": "TMT", "HADT": "HADT", "AWDT": "okcidenta aŭstralia somera tempo", "HEPMX": "HEPMX", "AKST": "AKST", "ACDT": "centra aŭstralia somera tempo", "LHST": "LHST", "HNPM": "HNPM", "GFT": "GFT", "BOT": "BOT", "BT": "BT", "ECT": "ECT", "∅∅∅": "∅∅∅", "CLT": "CLT", "HECU": "HECU", "PDT": "pacifika nord-amerika somera tempo", "WAT": "okcidenta afrika norma tempo", "JDT": "japana somera tempo", "OEZ": "orienta eŭropa norma tempo", "GYT": "GYT", "CHADT": "CHADT", "CST": "centra nord-amerika norma tempo", "JST": "japana norma tempo", "SGT": "SGT", "ACST": "centra aŭstralia norma tempo", "HENOMX": "HENOMX", "CAT": "centra afrika tempo", "WIB": "okcidenta indonezia tempo", "HNOG": "HNOG", "HKT": "HKT", "WIT": "orienta indonezia tempo", "WESZ": "okcidenta eŭropa somera tempo", "HNCU": "HNCU", "MYT": "MYT", "MEZ": "centra eŭropa norma tempo", "IST": "barata tempo", "WITA": "centra indonezia tempo", "EAT": "orienta afrika tempo", "ART": "ART", "HAST": "HAST", "SAST": "suda afrika tempo", "EST": "orienta nord-amerika norma tempo", "LHDT": "LHDT", "VET": "VET", "MDT": "MDT", "COT": "COT", "COST": "COST", "CDT": "centra nord-amerika somera tempo", "NZST": "NZST", "WAST": "okcidenta afrika somera tempo", "NZDT": "NZDT", "MESZ": "centra eŭropa somera tempo", "HEPM": "HEPM", "ARST": "ARST", "AWST": "okcidenta aŭstralia norma tempo", "ACWST": "centrokcidenta aŭstralia norma tempo", "TMST": "TMST", "GMT": "universala tempo kunordigita", "ADT": "atlantika nord-amerika somera tempo", "HKST": "HKST", "HNT": "HNT", "CLST": "CLST", "UYST": "UYST", "CHAST": "CHAST", "AKDT": "AKDT", "HNEG": "HNEG", "HEEG": "HEEG", "OESZ": "orienta eŭropa somera tempo", "EDT": "orienta nord-amerika somera tempo", "UYT": "UYT", "WEZ": "okcidenta eŭropa norma tempo"},
  74. }
  75. }
  76. // Locale returns the current translators string locale
  77. func (eo *eo_001) Locale() string {
  78. return eo.locale
  79. }
  80. // PluralsCardinal returns the list of cardinal plural rules associated with 'eo_001'
  81. func (eo *eo_001) PluralsCardinal() []locales.PluralRule {
  82. return eo.pluralsCardinal
  83. }
  84. // PluralsOrdinal returns the list of ordinal plural rules associated with 'eo_001'
  85. func (eo *eo_001) PluralsOrdinal() []locales.PluralRule {
  86. return eo.pluralsOrdinal
  87. }
  88. // PluralsRange returns the list of range plural rules associated with 'eo_001'
  89. func (eo *eo_001) PluralsRange() []locales.PluralRule {
  90. return eo.pluralsRange
  91. }
  92. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'eo_001'
  93. func (eo *eo_001) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
  94. n := math.Abs(num)
  95. if n == 1 {
  96. return locales.PluralRuleOne
  97. }
  98. return locales.PluralRuleOther
  99. }
  100. // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'eo_001'
  101. func (eo *eo_001) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
  102. return locales.PluralRuleUnknown
  103. }
  104. // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'eo_001'
  105. func (eo *eo_001) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
  106. return locales.PluralRuleUnknown
  107. }
  108. // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
  109. func (eo *eo_001) MonthAbbreviated(month time.Month) string {
  110. return eo.monthsAbbreviated[month]
  111. }
  112. // MonthsAbbreviated returns the locales abbreviated months
  113. func (eo *eo_001) MonthsAbbreviated() []string {
  114. return eo.monthsAbbreviated[1:]
  115. }
  116. // MonthNarrow returns the locales narrow month given the 'month' provided
  117. func (eo *eo_001) MonthNarrow(month time.Month) string {
  118. return eo.monthsNarrow[month]
  119. }
  120. // MonthsNarrow returns the locales narrow months
  121. func (eo *eo_001) MonthsNarrow() []string {
  122. return eo.monthsNarrow[1:]
  123. }
  124. // MonthWide returns the locales wide month given the 'month' provided
  125. func (eo *eo_001) MonthWide(month time.Month) string {
  126. return eo.monthsWide[month]
  127. }
  128. // MonthsWide returns the locales wide months
  129. func (eo *eo_001) MonthsWide() []string {
  130. return eo.monthsWide[1:]
  131. }
  132. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  133. func (eo *eo_001) WeekdayAbbreviated(weekday time.Weekday) string {
  134. return eo.daysAbbreviated[weekday]
  135. }
  136. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  137. func (eo *eo_001) WeekdaysAbbreviated() []string {
  138. return eo.daysAbbreviated
  139. }
  140. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  141. func (eo *eo_001) WeekdayNarrow(weekday time.Weekday) string {
  142. return eo.daysNarrow[weekday]
  143. }
  144. // WeekdaysNarrow returns the locales narrow weekdays
  145. func (eo *eo_001) WeekdaysNarrow() []string {
  146. return eo.daysNarrow
  147. }
  148. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  149. func (eo *eo_001) WeekdayShort(weekday time.Weekday) string {
  150. return eo.daysShort[weekday]
  151. }
  152. // WeekdaysShort returns the locales short weekdays
  153. func (eo *eo_001) WeekdaysShort() []string {
  154. return eo.daysShort
  155. }
  156. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  157. func (eo *eo_001) WeekdayWide(weekday time.Weekday) string {
  158. return eo.daysWide[weekday]
  159. }
  160. // WeekdaysWide returns the locales wide weekdays
  161. func (eo *eo_001) WeekdaysWide() []string {
  162. return eo.daysWide
  163. }
  164. // Decimal returns the decimal point of number
  165. func (eo *eo_001) Decimal() string {
  166. return eo.decimal
  167. }
  168. // Group returns the group of number
  169. func (eo *eo_001) Group() string {
  170. return eo.group
  171. }
  172. // Group returns the minus sign of number
  173. func (eo *eo_001) Minus() string {
  174. return eo.minus
  175. }
  176. // FmtNumber returns 'num' with digits/precision of 'v' for 'eo_001' and handles both Whole and Real numbers based on 'v'
  177. func (eo *eo_001) FmtNumber(num float64, v uint64) string {
  178. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  179. l := len(s) + 4 + 2*len(s[:len(s)-int(v)-1])/3
  180. count := 0
  181. inWhole := v == 0
  182. b := make([]byte, 0, l)
  183. for i := len(s) - 1; i >= 0; i-- {
  184. if s[i] == '.' {
  185. b = append(b, eo.decimal[0])
  186. inWhole = true
  187. continue
  188. }
  189. if inWhole {
  190. if count == 3 {
  191. for j := len(eo.group) - 1; j >= 0; j-- {
  192. b = append(b, eo.group[j])
  193. }
  194. count = 1
  195. } else {
  196. count++
  197. }
  198. }
  199. b = append(b, s[i])
  200. }
  201. if num < 0 {
  202. for j := len(eo.minus) - 1; j >= 0; j-- {
  203. b = append(b, eo.minus[j])
  204. }
  205. }
  206. // reverse
  207. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  208. b[i], b[j] = b[j], b[i]
  209. }
  210. return string(b)
  211. }
  212. // FmtPercent returns 'num' with digits/precision of 'v' for 'eo_001' and handles both Whole and Real numbers based on 'v'
  213. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
  214. func (eo *eo_001) FmtPercent(num float64, v uint64) string {
  215. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  216. l := len(s) + 5
  217. b := make([]byte, 0, l)
  218. for i := len(s) - 1; i >= 0; i-- {
  219. if s[i] == '.' {
  220. b = append(b, eo.decimal[0])
  221. continue
  222. }
  223. b = append(b, s[i])
  224. }
  225. if num < 0 {
  226. for j := len(eo.minus) - 1; j >= 0; j-- {
  227. b = append(b, eo.minus[j])
  228. }
  229. }
  230. // reverse
  231. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  232. b[i], b[j] = b[j], b[i]
  233. }
  234. b = append(b, eo.percent...)
  235. return string(b)
  236. }
  237. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'eo_001'
  238. func (eo *eo_001) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  239. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  240. symbol := eo.currencies[currency]
  241. l := len(s) + len(symbol) + 7
  242. b := make([]byte, 0, l)
  243. for i := len(s) - 1; i >= 0; i-- {
  244. if s[i] == '.' {
  245. b = append(b, eo.decimal[0])
  246. continue
  247. }
  248. b = append(b, s[i])
  249. }
  250. for j := len(symbol) - 1; j >= 0; j-- {
  251. b = append(b, symbol[j])
  252. }
  253. for j := len(eo.currencyPositivePrefix) - 1; j >= 0; j-- {
  254. b = append(b, eo.currencyPositivePrefix[j])
  255. }
  256. if num < 0 {
  257. for j := len(eo.minus) - 1; j >= 0; j-- {
  258. b = append(b, eo.minus[j])
  259. }
  260. }
  261. // reverse
  262. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  263. b[i], b[j] = b[j], b[i]
  264. }
  265. b = append(b, eo.currencyPositiveSuffix...)
  266. return string(b)
  267. }
  268. // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'eo_001'
  269. // in accounting notation.
  270. func (eo *eo_001) FmtAccounting(num float64, v uint64, currency currency.Type) string {
  271. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  272. symbol := eo.currencies[currency]
  273. l := len(s) + len(symbol) + 7
  274. b := make([]byte, 0, l)
  275. for i := len(s) - 1; i >= 0; i-- {
  276. if s[i] == '.' {
  277. b = append(b, eo.decimal[0])
  278. continue
  279. }
  280. b = append(b, s[i])
  281. }
  282. if num < 0 {
  283. for j := len(symbol) - 1; j >= 0; j-- {
  284. b = append(b, symbol[j])
  285. }
  286. for j := len(eo.currencyNegativePrefix) - 1; j >= 0; j-- {
  287. b = append(b, eo.currencyNegativePrefix[j])
  288. }
  289. for j := len(eo.minus) - 1; j >= 0; j-- {
  290. b = append(b, eo.minus[j])
  291. }
  292. } else {
  293. for j := len(symbol) - 1; j >= 0; j-- {
  294. b = append(b, symbol[j])
  295. }
  296. for j := len(eo.currencyPositivePrefix) - 1; j >= 0; j-- {
  297. b = append(b, eo.currencyPositivePrefix[j])
  298. }
  299. }
  300. // reverse
  301. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  302. b[i], b[j] = b[j], b[i]
  303. }
  304. if num < 0 {
  305. b = append(b, eo.currencyNegativeSuffix...)
  306. } else {
  307. b = append(b, eo.currencyPositiveSuffix...)
  308. }
  309. return string(b)
  310. }
  311. // FmtDateShort returns the short date representation of 't' for 'eo_001'
  312. func (eo *eo_001) FmtDateShort(t time.Time) string {
  313. b := make([]byte, 0, 32)
  314. if t.Year() > 9 {
  315. b = append(b, strconv.Itoa(t.Year())[2:]...)
  316. } else {
  317. b = append(b, strconv.Itoa(t.Year())[1:]...)
  318. }
  319. b = append(b, []byte{0x2d}...)
  320. if t.Month() < 10 {
  321. b = append(b, '0')
  322. }
  323. b = strconv.AppendInt(b, int64(t.Month()), 10)
  324. b = append(b, []byte{0x2d}...)
  325. if t.Day() < 10 {
  326. b = append(b, '0')
  327. }
  328. b = strconv.AppendInt(b, int64(t.Day()), 10)
  329. return string(b)
  330. }
  331. // FmtDateMedium returns the medium date representation of 't' for 'eo_001'
  332. func (eo *eo_001) FmtDateMedium(t time.Time) string {
  333. b := make([]byte, 0, 32)
  334. if t.Year() > 0 {
  335. b = strconv.AppendInt(b, int64(t.Year()), 10)
  336. } else {
  337. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  338. }
  339. b = append(b, []byte{0x2d}...)
  340. b = append(b, eo.monthsAbbreviated[t.Month()]...)
  341. b = append(b, []byte{0x2d}...)
  342. if t.Day() < 10 {
  343. b = append(b, '0')
  344. }
  345. b = strconv.AppendInt(b, int64(t.Day()), 10)
  346. return string(b)
  347. }
  348. // FmtDateLong returns the long date representation of 't' for 'eo_001'
  349. func (eo *eo_001) FmtDateLong(t time.Time) string {
  350. b := make([]byte, 0, 32)
  351. if t.Year() > 0 {
  352. b = strconv.AppendInt(b, int64(t.Year()), 10)
  353. } else {
  354. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  355. }
  356. b = append(b, []byte{0x2d}...)
  357. b = append(b, eo.monthsWide[t.Month()]...)
  358. b = append(b, []byte{0x2d}...)
  359. if t.Day() < 10 {
  360. b = append(b, '0')
  361. }
  362. b = strconv.AppendInt(b, int64(t.Day()), 10)
  363. return string(b)
  364. }
  365. // FmtDateFull returns the full date representation of 't' for 'eo_001'
  366. func (eo *eo_001) FmtDateFull(t time.Time) string {
  367. b := make([]byte, 0, 32)
  368. b = append(b, eo.daysWide[t.Weekday()]...)
  369. b = append(b, []byte{0x2c, 0x20}...)
  370. b = strconv.AppendInt(b, int64(t.Day()), 10)
  371. b = append(b, []byte{0x2d, 0x61}...)
  372. b = append(b, []byte{0x20, 0x64, 0x65}...)
  373. b = append(b, []byte{0x20}...)
  374. b = append(b, eo.monthsWide[t.Month()]...)
  375. b = append(b, []byte{0x20}...)
  376. if t.Year() > 0 {
  377. b = strconv.AppendInt(b, int64(t.Year()), 10)
  378. } else {
  379. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  380. }
  381. return string(b)
  382. }
  383. // FmtTimeShort returns the short time representation of 't' for 'eo_001'
  384. func (eo *eo_001) FmtTimeShort(t time.Time) string {
  385. b := make([]byte, 0, 32)
  386. if t.Hour() < 10 {
  387. b = append(b, '0')
  388. }
  389. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  390. b = append(b, eo.timeSeparator...)
  391. if t.Minute() < 10 {
  392. b = append(b, '0')
  393. }
  394. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  395. return string(b)
  396. }
  397. // FmtTimeMedium returns the medium time representation of 't' for 'eo_001'
  398. func (eo *eo_001) FmtTimeMedium(t time.Time) string {
  399. b := make([]byte, 0, 32)
  400. if t.Hour() < 10 {
  401. b = append(b, '0')
  402. }
  403. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  404. b = append(b, eo.timeSeparator...)
  405. if t.Minute() < 10 {
  406. b = append(b, '0')
  407. }
  408. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  409. b = append(b, eo.timeSeparator...)
  410. if t.Second() < 10 {
  411. b = append(b, '0')
  412. }
  413. b = strconv.AppendInt(b, int64(t.Second()), 10)
  414. return string(b)
  415. }
  416. // FmtTimeLong returns the long time representation of 't' for 'eo_001'
  417. func (eo *eo_001) FmtTimeLong(t time.Time) string {
  418. b := make([]byte, 0, 32)
  419. if t.Hour() < 10 {
  420. b = append(b, '0')
  421. }
  422. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  423. b = append(b, eo.timeSeparator...)
  424. if t.Minute() < 10 {
  425. b = append(b, '0')
  426. }
  427. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  428. b = append(b, eo.timeSeparator...)
  429. if t.Second() < 10 {
  430. b = append(b, '0')
  431. }
  432. b = strconv.AppendInt(b, int64(t.Second()), 10)
  433. b = append(b, []byte{0x20}...)
  434. tz, _ := t.Zone()
  435. b = append(b, tz...)
  436. return string(b)
  437. }
  438. // FmtTimeFull returns the full time representation of 't' for 'eo_001'
  439. func (eo *eo_001) FmtTimeFull(t time.Time) string {
  440. b := make([]byte, 0, 32)
  441. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  442. b = append(b, []byte{0x2d, 0x61}...)
  443. b = append(b, []byte{0x20, 0x68, 0x6f, 0x72, 0x6f}...)
  444. b = append(b, []byte{0x20, 0x6b, 0x61, 0x6a}...)
  445. b = append(b, []byte{0x20}...)
  446. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  447. b = append(b, eo.timeSeparator...)
  448. if t.Second() < 10 {
  449. b = append(b, '0')
  450. }
  451. b = strconv.AppendInt(b, int64(t.Second()), 10)
  452. b = append(b, []byte{0x20}...)
  453. tz, _ := t.Zone()
  454. if btz, ok := eo.timezones[tz]; ok {
  455. b = append(b, btz...)
  456. } else {
  457. b = append(b, tz...)
  458. }
  459. return string(b)
  460. }