et_EE.go 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572
  1. package et_EE
  2. import (
  3. "math"
  4. "strconv"
  5. "time"
  6. "github.com/go-playground/locales"
  7. "github.com/go-playground/locales/currency"
  8. )
  9. type et_EE 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. currencyNegativePrefix string
  24. currencyNegativeSuffix string
  25. monthsAbbreviated []string
  26. monthsNarrow []string
  27. monthsWide []string
  28. daysAbbreviated []string
  29. daysNarrow []string
  30. daysShort []string
  31. daysWide []string
  32. periodsAbbreviated []string
  33. periodsNarrow []string
  34. periodsShort []string
  35. periodsWide []string
  36. erasAbbreviated []string
  37. erasNarrow []string
  38. erasWide []string
  39. timezones map[string]string
  40. }
  41. // New returns a new instance of translator for the 'et_EE' locale
  42. func New() locales.Translator {
  43. return &et_EE{
  44. locale: "et_EE",
  45. pluralsCardinal: []locales.PluralRule{2, 6},
  46. pluralsOrdinal: []locales.PluralRule{6},
  47. pluralsRange: []locales.PluralRule{6},
  48. decimal: ",",
  49. group: " ",
  50. minus: "−",
  51. percent: "%",
  52. perMille: "‰",
  53. timeSeparator: ":",
  54. inifinity: "∞",
  55. 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 "},
  56. currencyPositiveSuffix: " ",
  57. currencyNegativePrefix: "(",
  58. currencyNegativeSuffix: " )",
  59. monthsAbbreviated: []string{"", "jaan", "veebr", "märts", "apr", "mai", "juuni", "juuli", "aug", "sept", "okt", "nov", "dets"},
  60. monthsNarrow: []string{"", "J", "V", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"},
  61. monthsWide: []string{"", "jaanuar", "veebruar", "märts", "aprill", "mai", "juuni", "juuli", "august", "september", "oktoober", "november", "detsember"},
  62. daysAbbreviated: []string{"P", "E", "T", "K", "N", "R", "L"},
  63. daysNarrow: []string{"P", "E", "T", "K", "N", "R", "L"},
  64. daysShort: []string{"P", "E", "T", "K", "N", "R", "L"},
  65. daysWide: []string{"pühapäev", "esmaspäev", "teisipäev", "kolmapäev", "neljapäev", "reede", "laupäev"},
  66. periodsAbbreviated: []string{"AM", "PM"},
  67. periodsNarrow: []string{"a", "p"},
  68. periodsWide: []string{"AM", "PM"},
  69. erasAbbreviated: []string{"eKr", "pKr"},
  70. erasNarrow: []string{"eKr", "pKr"},
  71. erasWide: []string{"enne Kristust", "pärast Kristust"},
  72. timezones: map[string]string{"ACWDT": "Kesk-Lääne Austraalia suveaeg", "AEDT": "Ida-Austraalia suveaeg", "WARST": "Lääne-Argentina suveaeg", "GFT": "Prantsuse Guajaana aeg", "EAT": "Ida-Aafrika aeg", "TMST": "Türkmenistani suveaeg", "NZST": "Uus-Meremaa standardaeg", "SAST": "Lõuna-Aafrika standardaeg", "HNT": "Newfoundlandi standardaeg", "WIT": "Ida-Indoneesia aeg", "MST": "Mäestikuvööndi standardaeg", "ACWST": "Kesk-Lääne Austraalia standardaeg", "MDT": "Mäestikuvööndi suveaeg", "OEZ": "Ida-Euroopa standardaeg", "AKST": "Alaska standardaeg", "ARST": "Argentina suveaeg", "PDT": "Vaikse ookeani suveaeg", "SGT": "Singapuri standardaeg", "WAST": "Lääne-Aafrika suveaeg", "HKT": "Hongkongi standardaeg", "LHDT": "Lord Howe suveaeg", "∅∅∅": "Assooride suveaeg", "UYT": "Uruguay standardaeg", "ChST": "Tšamorro standardaeg", "HKST": "Hongkongi suveaeg", "GMT": "Greenwichi aeg", "TMT": "Türkmenistani standardaeg", "AWST": "Lääne-Austraalia standardaeg", "ART": "Argentina standardaeg", "SRT": "Suriname aeg", "JST": "Jaapani standardaeg", "MESZ": "Kesk-Euroopa suveaeg", "AEST": "Ida-Austraalia standardaeg", "CLT": "Tšiili standardaeg", "AST": "Atlandi standardaeg", "HAST": "Hawaii-Aleuudi standardaeg", "GYT": "Guyana aeg", "JDT": "Jaapani suveaeg", "CDT": "Kesk-Ameerika suveaeg", "MEZ": "Kesk-Euroopa standardaeg", "CHAST": "Chathami standardaeg", "CLST": "Tšiili suveaeg", "BT": "Bhutani aeg", "WART": "Lääne-Argentina standardaeg", "AWDT": "Lääne-Austraalia suveaeg", "VET": "Venezuela aeg", "COT": "Colombia standardaeg", "IST": "India aeg", "LHST": "Lord Howe standardaeg", "NZDT": "Uus-Meremaa suveaeg", "CAT": "Kesk-Aafrika aeg", "EDT": "Idaranniku suveaeg", "HAT": "Newfoundlandi suveaeg", "MYT": "Malaisia \u200b\u200baeg", "ECT": "Ecuadori aeg", "BOT": "Boliivia aeg", "WEZ": "Lääne-Euroopa standardaeg", "WAT": "Lääne-Aafrika standardaeg", "OESZ": "Ida-Euroopa suveaeg", "WITA": "Kesk-Indoneesia aeg", "UYST": "Uruguay suveaeg", "EST": "Idaranniku standardaeg", "COST": "Colombia suveaeg", "PST": "Vaikse ookeani standardaeg", "WESZ": "Lääne-Euroopa suveaeg", "CHADT": "Chathami suveaeg", "ADT": "Atlandi suveaeg", "WIB": "Lääne-Indoneesia aeg", "AKDT": "Alaska suveaeg", "HADT": "Hawaii-Aleuudi suveaeg", "ACST": "Kesk-Austraalia standardaeg", "ACDT": "Kesk-Austraalia suveaeg", "CST": "Kesk-Ameerika standardaeg"},
  73. }
  74. }
  75. // Locale returns the current translators string locale
  76. func (et *et_EE) Locale() string {
  77. return et.locale
  78. }
  79. // PluralsCardinal returns the list of cardinal plural rules associated with 'et_EE'
  80. func (et *et_EE) PluralsCardinal() []locales.PluralRule {
  81. return et.pluralsCardinal
  82. }
  83. // PluralsOrdinal returns the list of ordinal plural rules associated with 'et_EE'
  84. func (et *et_EE) PluralsOrdinal() []locales.PluralRule {
  85. return et.pluralsOrdinal
  86. }
  87. // PluralsRange returns the list of range plural rules associated with 'et_EE'
  88. func (et *et_EE) PluralsRange() []locales.PluralRule {
  89. return et.pluralsRange
  90. }
  91. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'et_EE'
  92. func (et *et_EE) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
  93. n := math.Abs(num)
  94. i := int64(n)
  95. if i == 1 && v == 0 {
  96. return locales.PluralRuleOne
  97. }
  98. return locales.PluralRuleOther
  99. }
  100. // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'et_EE'
  101. func (et *et_EE) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
  102. return locales.PluralRuleOther
  103. }
  104. // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'et_EE'
  105. func (et *et_EE) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
  106. return locales.PluralRuleOther
  107. }
  108. // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
  109. func (et *et_EE) MonthAbbreviated(month time.Month) string {
  110. return et.monthsAbbreviated[month]
  111. }
  112. // MonthsAbbreviated returns the locales abbreviated months
  113. func (et *et_EE) MonthsAbbreviated() []string {
  114. return et.monthsAbbreviated[1:]
  115. }
  116. // MonthNarrow returns the locales narrow month given the 'month' provided
  117. func (et *et_EE) MonthNarrow(month time.Month) string {
  118. return et.monthsNarrow[month]
  119. }
  120. // MonthsNarrow returns the locales narrow months
  121. func (et *et_EE) MonthsNarrow() []string {
  122. return et.monthsNarrow[1:]
  123. }
  124. // MonthWide returns the locales wide month given the 'month' provided
  125. func (et *et_EE) MonthWide(month time.Month) string {
  126. return et.monthsWide[month]
  127. }
  128. // MonthsWide returns the locales wide months
  129. func (et *et_EE) MonthsWide() []string {
  130. return et.monthsWide[1:]
  131. }
  132. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  133. func (et *et_EE) WeekdayAbbreviated(weekday time.Weekday) string {
  134. return et.daysAbbreviated[weekday]
  135. }
  136. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  137. func (et *et_EE) WeekdaysAbbreviated() []string {
  138. return et.daysAbbreviated
  139. }
  140. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  141. func (et *et_EE) WeekdayNarrow(weekday time.Weekday) string {
  142. return et.daysNarrow[weekday]
  143. }
  144. // WeekdaysNarrow returns the locales narrow weekdays
  145. func (et *et_EE) WeekdaysNarrow() []string {
  146. return et.daysNarrow
  147. }
  148. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  149. func (et *et_EE) WeekdayShort(weekday time.Weekday) string {
  150. return et.daysShort[weekday]
  151. }
  152. // WeekdaysShort returns the locales short weekdays
  153. func (et *et_EE) WeekdaysShort() []string {
  154. return et.daysShort
  155. }
  156. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  157. func (et *et_EE) WeekdayWide(weekday time.Weekday) string {
  158. return et.daysWide[weekday]
  159. }
  160. // WeekdaysWide returns the locales wide weekdays
  161. func (et *et_EE) WeekdaysWide() []string {
  162. return et.daysWide
  163. }
  164. // FmtNumber returns 'num' with digits/precision of 'v' for 'et_EE' and handles both Whole and Real numbers based on 'v'
  165. func (et *et_EE) FmtNumber(num float64, v uint64) string {
  166. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  167. l := len(s) + 4 + 2*len(s[:len(s)-int(v)-1])/3
  168. count := 0
  169. inWhole := v == 0
  170. b := make([]byte, 0, l)
  171. for i := len(s) - 1; i >= 0; i-- {
  172. if s[i] == '.' {
  173. b = append(b, et.decimal[0])
  174. inWhole = true
  175. continue
  176. }
  177. if inWhole {
  178. if count == 3 {
  179. for j := len(et.group) - 1; j >= 0; j-- {
  180. b = append(b, et.group[j])
  181. }
  182. count = 1
  183. } else {
  184. count++
  185. }
  186. }
  187. b = append(b, s[i])
  188. }
  189. if num < 0 {
  190. for j := len(et.minus) - 1; j >= 0; j-- {
  191. b = append(b, et.minus[j])
  192. }
  193. }
  194. // reverse
  195. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  196. b[i], b[j] = b[j], b[i]
  197. }
  198. return string(b)
  199. }
  200. // FmtPercent returns 'num' with digits/precision of 'v' for 'et_EE' and handles both Whole and Real numbers based on 'v'
  201. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
  202. func (et *et_EE) FmtPercent(num float64, v uint64) string {
  203. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  204. l := len(s) + 5
  205. b := make([]byte, 0, l)
  206. for i := len(s) - 1; i >= 0; i-- {
  207. if s[i] == '.' {
  208. b = append(b, et.decimal[0])
  209. continue
  210. }
  211. b = append(b, s[i])
  212. }
  213. if num < 0 {
  214. for j := len(et.minus) - 1; j >= 0; j-- {
  215. b = append(b, et.minus[j])
  216. }
  217. }
  218. // reverse
  219. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  220. b[i], b[j] = b[j], b[i]
  221. }
  222. b = append(b, et.percent...)
  223. return string(b)
  224. }
  225. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'et_EE'
  226. func (et *et_EE) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  227. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  228. symbol := et.currencies[currency]
  229. l := len(s) + len(symbol) + 6 + 2*len(s[:len(s)-int(v)-1])/3
  230. count := 0
  231. inWhole := v == 0
  232. b := make([]byte, 0, l)
  233. for i := len(s) - 1; i >= 0; i-- {
  234. if s[i] == '.' {
  235. b = append(b, et.decimal[0])
  236. inWhole = true
  237. continue
  238. }
  239. if inWhole {
  240. if count == 3 {
  241. for j := len(et.group) - 1; j >= 0; j-- {
  242. b = append(b, et.group[j])
  243. }
  244. count = 1
  245. } else {
  246. count++
  247. }
  248. }
  249. b = append(b, s[i])
  250. }
  251. if num < 0 {
  252. for j := len(et.minus) - 1; j >= 0; j-- {
  253. b = append(b, et.minus[j])
  254. }
  255. }
  256. // reverse
  257. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  258. b[i], b[j] = b[j], b[i]
  259. }
  260. if int(v) < 2 {
  261. if v == 0 {
  262. b = append(b, et.decimal...)
  263. }
  264. for i := 0; i < 2-int(v); i++ {
  265. b = append(b, '0')
  266. }
  267. }
  268. b = append(b, et.currencyPositiveSuffix...)
  269. b = append(b, symbol...)
  270. return string(b)
  271. }
  272. // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'et_EE'
  273. // in accounting notation.
  274. func (et *et_EE) FmtAccounting(num float64, v uint64, currency currency.Type) string {
  275. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  276. symbol := et.currencies[currency]
  277. l := len(s) + len(symbol) + 8 + 2*len(s[:len(s)-int(v)-1])/3
  278. count := 0
  279. inWhole := v == 0
  280. b := make([]byte, 0, l)
  281. for i := len(s) - 1; i >= 0; i-- {
  282. if s[i] == '.' {
  283. b = append(b, et.decimal[0])
  284. inWhole = true
  285. continue
  286. }
  287. if inWhole {
  288. if count == 3 {
  289. for j := len(et.group) - 1; j >= 0; j-- {
  290. b = append(b, et.group[j])
  291. }
  292. count = 1
  293. } else {
  294. count++
  295. }
  296. }
  297. b = append(b, s[i])
  298. }
  299. if num < 0 {
  300. b = append(b, et.currencyNegativePrefix[0])
  301. }
  302. // reverse
  303. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  304. b[i], b[j] = b[j], b[i]
  305. }
  306. if int(v) < 2 {
  307. if v == 0 {
  308. b = append(b, et.decimal...)
  309. }
  310. for i := 0; i < 2-int(v); i++ {
  311. b = append(b, '0')
  312. }
  313. }
  314. if num < 0 {
  315. b = append(b, et.currencyNegativeSuffix...)
  316. b = append(b, symbol...)
  317. } else {
  318. b = append(b, et.currencyPositiveSuffix...)
  319. b = append(b, symbol...)
  320. }
  321. return string(b)
  322. }
  323. // FmtDateShort returns the short date representation of 't' for 'et_EE'
  324. func (et *et_EE) FmtDateShort(t time.Time) string {
  325. b := make([]byte, 0, 32)
  326. if t.Day() < 10 {
  327. b = append(b, '0')
  328. }
  329. b = strconv.AppendInt(b, int64(t.Day()), 10)
  330. b = append(b, []byte{0x2e}...)
  331. if t.Month() < 10 {
  332. b = append(b, '0')
  333. }
  334. b = strconv.AppendInt(b, int64(t.Month()), 10)
  335. b = append(b, []byte{0x2e}...)
  336. if t.Year() > 9 {
  337. b = append(b, strconv.Itoa(t.Year())[2:]...)
  338. } else {
  339. b = append(b, strconv.Itoa(t.Year())[1:]...)
  340. }
  341. return string(b)
  342. }
  343. // FmtDateMedium returns the medium date representation of 't' for 'et_EE'
  344. func (et *et_EE) FmtDateMedium(t time.Time) string {
  345. b := make([]byte, 0, 32)
  346. b = strconv.AppendInt(b, int64(t.Day()), 10)
  347. b = append(b, []byte{0x2e, 0x20}...)
  348. b = append(b, et.monthsAbbreviated[t.Month()]...)
  349. b = append(b, []byte{0x20}...)
  350. b = strconv.AppendInt(b, int64(t.Year()), 10)
  351. return string(b)
  352. }
  353. // FmtDateLong returns the long date representation of 't' for 'et_EE'
  354. func (et *et_EE) FmtDateLong(t time.Time) string {
  355. b := make([]byte, 0, 32)
  356. b = strconv.AppendInt(b, int64(t.Day()), 10)
  357. b = append(b, []byte{0x2e, 0x20}...)
  358. b = append(b, et.monthsWide[t.Month()]...)
  359. b = append(b, []byte{0x20}...)
  360. b = strconv.AppendInt(b, int64(t.Year()), 10)
  361. return string(b)
  362. }
  363. // FmtDateFull returns the full date representation of 't' for 'et_EE'
  364. func (et *et_EE) FmtDateFull(t time.Time) string {
  365. b := make([]byte, 0, 32)
  366. b = append(b, et.daysWide[t.Weekday()]...)
  367. b = append(b, []byte{0x2c, 0x20}...)
  368. b = strconv.AppendInt(b, int64(t.Day()), 10)
  369. b = append(b, []byte{0x2e, 0x20}...)
  370. b = append(b, et.monthsWide[t.Month()]...)
  371. b = append(b, []byte{0x20}...)
  372. b = strconv.AppendInt(b, int64(t.Year()), 10)
  373. return string(b)
  374. }
  375. // FmtTimeShort returns the short time representation of 't' for 'et_EE'
  376. func (et *et_EE) FmtTimeShort(t time.Time) string {
  377. b := make([]byte, 0, 32)
  378. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  379. b = append(b, et.timeSeparator...)
  380. if t.Minute() < 10 {
  381. b = append(b, '0')
  382. }
  383. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  384. return string(b)
  385. }
  386. // FmtTimeMedium returns the medium time representation of 't' for 'et_EE'
  387. func (et *et_EE) FmtTimeMedium(t time.Time) string {
  388. b := make([]byte, 0, 32)
  389. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  390. b = append(b, et.timeSeparator...)
  391. if t.Minute() < 10 {
  392. b = append(b, '0')
  393. }
  394. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  395. b = append(b, []byte{0x2e}...)
  396. if t.Second() < 10 {
  397. b = append(b, '0')
  398. }
  399. b = strconv.AppendInt(b, int64(t.Second()), 10)
  400. return string(b)
  401. }
  402. // FmtTimeLong returns the long time representation of 't' for 'et_EE'
  403. func (et *et_EE) FmtTimeLong(t time.Time) string {
  404. b := make([]byte, 0, 32)
  405. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  406. b = append(b, et.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, []byte{0x2e}...)
  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. b = append(b, tz...)
  419. return string(b)
  420. }
  421. // FmtTimeFull returns the full time representation of 't' for 'et_EE'
  422. func (et *et_EE) FmtTimeFull(t time.Time) string {
  423. b := make([]byte, 0, 32)
  424. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  425. b = append(b, et.timeSeparator...)
  426. if t.Minute() < 10 {
  427. b = append(b, '0')
  428. }
  429. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  430. b = append(b, []byte{0x2e}...)
  431. if t.Second() < 10 {
  432. b = append(b, '0')
  433. }
  434. b = strconv.AppendInt(b, int64(t.Second()), 10)
  435. b = append(b, []byte{0x20}...)
  436. tz, _ := t.Zone()
  437. if btz, ok := et.timezones[tz]; ok {
  438. b = append(b, btz...)
  439. } else {
  440. b = append(b, tz...)
  441. }
  442. return string(b)
  443. }