ee_TG.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505
  1. package ee_TG
  2. import (
  3. "math"
  4. "strconv"
  5. "time"
  6. "github.com/go-playground/locales"
  7. "github.com/go-playground/locales/currency"
  8. )
  9. type ee_TG 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. currencyNegativePrefix 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 'ee_TG' locale
  41. func New() locales.Translator {
  42. return &ee_TG{
  43. locale: "ee_TG",
  44. pluralsCardinal: []locales.PluralRule{2, 6},
  45. pluralsOrdinal: nil,
  46. pluralsRange: nil,
  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. currencyNegativePrefix: "(",
  50. currencyNegativeSuffix: ")",
  51. monthsAbbreviated: []string{"", "dzv", "dzd", "ted", "afɔ", "dam", "mas", "sia", "dea", "any", "kel", "ade", "dzm"},
  52. monthsNarrow: []string{"", "d", "d", "t", "a", "d", "m", "s", "d", "a", "k", "a", "d"},
  53. monthsWide: []string{"", "dzove", "dzodze", "tedoxe", "afɔfĩe", "dama", "masa", "siamlɔm", "deasiamime", "anyɔnyɔ", "kele", "adeɛmekpɔxe", "dzome"},
  54. daysAbbreviated: []string{"kɔs", "dzo", "bla", "kuɖ", "yaw", "fiɖ", "mem"},
  55. daysNarrow: []string{"k", "d", "b", "k", "y", "f", "m"},
  56. daysShort: []string{"kɔs", "dzo", "bla", "kuɖ", "yaw", "fiɖ", "mem"},
  57. daysWide: []string{"kɔsiɖa", "dzoɖa", "blaɖa", "kuɖa", "yawoɖa", "fiɖa", "memleɖa"},
  58. periodsAbbreviated: []string{"ŋdi", "ɣetrɔ"},
  59. periodsNarrow: []string{"ŋ", "ɣ"},
  60. periodsWide: []string{"ŋdi", "ɣetrɔ"},
  61. erasAbbreviated: []string{"hY", "Yŋ"},
  62. erasNarrow: []string{"hY", "Yŋ"},
  63. erasWide: []string{"Hafi Yesu Va Do ŋgɔ", "Yesu Ŋɔli"},
  64. timezones: map[string]string{"ACDT": "Titina Australia ŋkekeme gaƒoƒome", "MYT": "MYT", "CDT": "Titina America ŋkekeme gaƒoƒome", "ACWST": "Australia ɣetoɖofe gaƒoƒoɖoanyime", "SGT": "SGT", "WITA": "WITA", "WIT": "WIT", "HNT": "Niufaunɖlanɖ gaƒoƒoɖoanyime", "LHST": "LHST", "CHADT": "CHADT", "CLT": "Tsile gaƒoƒoɖoanyime", "WAT": "Ɣetoɖoƒe Afrika gaƒoƒoɖoanyime", "BT": "BT", "WEZ": "Ɣetoɖoƒe Europe gaƒoƒoɖoanyime", "ACST": "Titina Australia gaƒoƒoɖoanyime", "AWDT": "Ɣetoɖoƒe Australia ŋkekeme gaƒoƒome", "COT": "Kolombia gaƒoƒoɖoanyime", "OEZ": "Ɣedzeƒe Europe gaƒoƒoɖoanyime", "EAT": "Ɣedzeƒe Africa gaƒoƒome", "JST": "Japan gaƒoƒoɖanyime", "NZST": "NZST", "NZDT": "NZDT", "HAST": "Hawaii-Aleutia gaƒoƒoɖoanyime", "GMT": "Greenwich gaƒoƒome", "SRT": "Suriname gaƒoƒome", "WESZ": "Ɣetoɖoƒe Europe ŋkekeme gaƒoƒome", "AEDT": "Ɣedzeƒe Australia ŋkekeme gaƒoƒome", "HKT": "Hɔng Kɔng gaƒoƒoɖoanyi me", "WIB": "WIB", "MST": "Makau gaƒoƒoɖoanyime", "PST": "Pacific gaƒoƒoɖoanyime", "MEZ": "Titina Europe gaƒoƒoɖoanyime", "UYT": "Uruguai gaƒoƒoɖoanyime", "CHAST": "CHAST", "OESZ": "Ɣedzeƒe Europe ŋkekeme gaƒoƒome", "ART": "Argentina gaƒoƒoɖoanyime", "∅∅∅": "Amazon dzomeŋɔli gaƒoƒome", "JDT": "Japan ŋkekeme gaƒoƒome", "AWST": "Ɣetoɖoƒe Australia gaƒoƒoɖoanyime", "ECT": "Ikuedɔ dzomeŋɔli gaƒoƒome", "ARST": "Argentina dzomeŋɔli gaƒoƒome", "PDT": "Pacific ŋkekme gaƒoƒome", "ACWDT": "Australia ɣetoɖofe ŋkekeme gaƒoƒome", "HAT": "Niufaunɖlanɖ ŋkekeme gaƒoƒome", "LHDT": "LHDT", "MESZ": "Titina Europe ŋkekeme gaƒoƒome", "VET": "Venezuela gaƒoƒome", "WART": "Ɣetoɖoƒe Argentina gaƒoƒoɖoanyime", "TMT": "Tɛkmenistan gaƒoƒoɖoanyime", "AKST": "Alaska gaƒoƒoɖoanyime", "ChST": "ChST", "WAST": "Ɣetoɖoƒe Africa ŋkekeme gaƒoƒome", "TMST": "Tɛkmenistan dzomeŋɔli gaƒoƒome", "HADT": "Hawaii-Aleutia ŋkekeme gaƒoƒome", "HKST": "Hɔng Kɔng dzomeŋɔli gaƒoƒome", "COST": "Kolombia dzomeŋɔli gaƒoƒome", "AKDT": "Alaska ŋkekeme gaƒoƒome", "GYT": "Gayana gaƒoƒome", "BOT": "Bolivia gaƒoƒome", "CAT": "Titina Afrika gaƒoƒome", "EST": "Ɣedzeƒe America gaƒoƒoɖoanyime", "CLST": "Tsile dzomeŋɔli gaƒoƒome", "AEST": "Ɣedzeƒe Australia gaƒoƒoɖoanyime", "EDT": "Ɣedzeƒe America ŋkekeme gaƒoƒome", "ADT": "Atlantic ŋkekeme gaƒoƒome", "GFT": "Frentsi Guiana gaƒoƒome", "CST": "Titina America gaƒoƒoɖoanyime", "SAST": "Anyiehe Africa gaƒoƒome", "WARST": "Ɣetoɖoƒe Argentina dzomeŋɔli gaƒoƒome", "IST": "IST", "MDT": "Makau ŋkekeme gaƒoƒome", "UYST": "Uruguai dzomeŋɔli gaƒoƒome", "AST": "Atlantic gaƒoƒoɖoanyime"},
  65. }
  66. }
  67. // Locale returns the current translators string locale
  68. func (ee *ee_TG) Locale() string {
  69. return ee.locale
  70. }
  71. // PluralsCardinal returns the list of cardinal plural rules associated with 'ee_TG'
  72. func (ee *ee_TG) PluralsCardinal() []locales.PluralRule {
  73. return ee.pluralsCardinal
  74. }
  75. // PluralsOrdinal returns the list of ordinal plural rules associated with 'ee_TG'
  76. func (ee *ee_TG) PluralsOrdinal() []locales.PluralRule {
  77. return ee.pluralsOrdinal
  78. }
  79. // PluralsRange returns the list of range plural rules associated with 'ee_TG'
  80. func (ee *ee_TG) PluralsRange() []locales.PluralRule {
  81. return ee.pluralsRange
  82. }
  83. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'ee_TG'
  84. func (ee *ee_TG) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
  85. n := math.Abs(num)
  86. if n == 1 {
  87. return locales.PluralRuleOne
  88. }
  89. return locales.PluralRuleOther
  90. }
  91. // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'ee_TG'
  92. func (ee *ee_TG) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
  93. return locales.PluralRuleUnknown
  94. }
  95. // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'ee_TG'
  96. func (ee *ee_TG) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
  97. return locales.PluralRuleUnknown
  98. }
  99. // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
  100. func (ee *ee_TG) MonthAbbreviated(month time.Month) string {
  101. return ee.monthsAbbreviated[month]
  102. }
  103. // MonthsAbbreviated returns the locales abbreviated months
  104. func (ee *ee_TG) MonthsAbbreviated() []string {
  105. return ee.monthsAbbreviated[1:]
  106. }
  107. // MonthNarrow returns the locales narrow month given the 'month' provided
  108. func (ee *ee_TG) MonthNarrow(month time.Month) string {
  109. return ee.monthsNarrow[month]
  110. }
  111. // MonthsNarrow returns the locales narrow months
  112. func (ee *ee_TG) MonthsNarrow() []string {
  113. return ee.monthsNarrow[1:]
  114. }
  115. // MonthWide returns the locales wide month given the 'month' provided
  116. func (ee *ee_TG) MonthWide(month time.Month) string {
  117. return ee.monthsWide[month]
  118. }
  119. // MonthsWide returns the locales wide months
  120. func (ee *ee_TG) MonthsWide() []string {
  121. return ee.monthsWide[1:]
  122. }
  123. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  124. func (ee *ee_TG) WeekdayAbbreviated(weekday time.Weekday) string {
  125. return ee.daysAbbreviated[weekday]
  126. }
  127. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  128. func (ee *ee_TG) WeekdaysAbbreviated() []string {
  129. return ee.daysAbbreviated
  130. }
  131. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  132. func (ee *ee_TG) WeekdayNarrow(weekday time.Weekday) string {
  133. return ee.daysNarrow[weekday]
  134. }
  135. // WeekdaysNarrow returns the locales narrow weekdays
  136. func (ee *ee_TG) WeekdaysNarrow() []string {
  137. return ee.daysNarrow
  138. }
  139. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  140. func (ee *ee_TG) WeekdayShort(weekday time.Weekday) string {
  141. return ee.daysShort[weekday]
  142. }
  143. // WeekdaysShort returns the locales short weekdays
  144. func (ee *ee_TG) WeekdaysShort() []string {
  145. return ee.daysShort
  146. }
  147. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  148. func (ee *ee_TG) WeekdayWide(weekday time.Weekday) string {
  149. return ee.daysWide[weekday]
  150. }
  151. // WeekdaysWide returns the locales wide weekdays
  152. func (ee *ee_TG) WeekdaysWide() []string {
  153. return ee.daysWide
  154. }
  155. // FmtNumber returns 'num' with digits/precision of 'v' for 'ee_TG' and handles both Whole and Real numbers based on 'v'
  156. func (ee *ee_TG) FmtNumber(num float64, v uint64) string {
  157. return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  158. }
  159. // FmtPercent returns 'num' with digits/precision of 'v' for 'ee_TG' and handles both Whole and Real numbers based on 'v'
  160. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
  161. func (ee *ee_TG) FmtPercent(num float64, v uint64) string {
  162. return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  163. }
  164. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'ee_TG'
  165. func (ee *ee_TG) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  166. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  167. symbol := ee.currencies[currency]
  168. l := len(s) + len(symbol) + 0 + 0*len(s[:len(s)-int(v)-1])/3
  169. count := 0
  170. inWhole := v == 0
  171. b := make([]byte, 0, l)
  172. for i := len(s) - 1; i >= 0; i-- {
  173. if s[i] == '.' {
  174. b = append(b, ee.decimal[0])
  175. inWhole = true
  176. continue
  177. }
  178. if inWhole {
  179. if count == 3 {
  180. b = append(b, ee.group[0])
  181. count = 1
  182. } else {
  183. count++
  184. }
  185. }
  186. b = append(b, s[i])
  187. }
  188. for j := len(symbol) - 1; j >= 0; j-- {
  189. b = append(b, symbol[j])
  190. }
  191. if num < 0 {
  192. b = append(b, ee.minus[0])
  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. if int(v) < 2 {
  199. if v == 0 {
  200. b = append(b, ee.decimal...)
  201. }
  202. for i := 0; i < 2-int(v); i++ {
  203. b = append(b, '0')
  204. }
  205. }
  206. return string(b)
  207. }
  208. // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ee_TG'
  209. // in accounting notation.
  210. func (ee *ee_TG) FmtAccounting(num float64, v uint64, currency currency.Type) string {
  211. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  212. symbol := ee.currencies[currency]
  213. l := len(s) + len(symbol) + 2 + 0*len(s[:len(s)-int(v)-1])/3
  214. count := 0
  215. inWhole := v == 0
  216. b := make([]byte, 0, l)
  217. for i := len(s) - 1; i >= 0; i-- {
  218. if s[i] == '.' {
  219. b = append(b, ee.decimal[0])
  220. inWhole = true
  221. continue
  222. }
  223. if inWhole {
  224. if count == 3 {
  225. b = append(b, ee.group[0])
  226. count = 1
  227. } else {
  228. count++
  229. }
  230. }
  231. b = append(b, s[i])
  232. }
  233. if num < 0 {
  234. for j := len(symbol) - 1; j >= 0; j-- {
  235. b = append(b, symbol[j])
  236. }
  237. b = append(b, ee.currencyNegativePrefix[0])
  238. } else {
  239. for j := len(symbol) - 1; j >= 0; j-- {
  240. b = append(b, symbol[j])
  241. }
  242. }
  243. // reverse
  244. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  245. b[i], b[j] = b[j], b[i]
  246. }
  247. if int(v) < 2 {
  248. if v == 0 {
  249. b = append(b, ee.decimal...)
  250. }
  251. for i := 0; i < 2-int(v); i++ {
  252. b = append(b, '0')
  253. }
  254. }
  255. if num < 0 {
  256. b = append(b, ee.currencyNegativeSuffix...)
  257. }
  258. return string(b)
  259. }
  260. // FmtDateShort returns the short date representation of 't' for 'ee_TG'
  261. func (ee *ee_TG) FmtDateShort(t time.Time) string {
  262. b := make([]byte, 0, 32)
  263. b = strconv.AppendInt(b, int64(t.Month()), 10)
  264. b = append(b, []byte{0x2f}...)
  265. b = strconv.AppendInt(b, int64(t.Day()), 10)
  266. b = append(b, []byte{0x2f}...)
  267. if t.Year() > 9 {
  268. b = append(b, strconv.Itoa(t.Year())[2:]...)
  269. } else {
  270. b = append(b, strconv.Itoa(t.Year())[1:]...)
  271. }
  272. return string(b)
  273. }
  274. // FmtDateMedium returns the medium date representation of 't' for 'ee_TG'
  275. func (ee *ee_TG) FmtDateMedium(t time.Time) string {
  276. b := make([]byte, 0, 32)
  277. b = append(b, ee.monthsAbbreviated[t.Month()]...)
  278. b = append(b, []byte{0x20}...)
  279. b = strconv.AppendInt(b, int64(t.Day()), 10)
  280. b = append(b, []byte{}...)
  281. b = append(b, []byte{0x27, 0x6c, 0x69, 0x61, 0x27, 0x2c, 0x20}...)
  282. b = strconv.AppendInt(b, int64(t.Year()), 10)
  283. return string(b)
  284. }
  285. // FmtDateLong returns the long date representation of 't' for 'ee_TG'
  286. func (ee *ee_TG) FmtDateLong(t time.Time) string {
  287. b := make([]byte, 0, 32)
  288. b = append(b, ee.monthsWide[t.Month()]...)
  289. b = append(b, []byte{0x20}...)
  290. b = strconv.AppendInt(b, int64(t.Day()), 10)
  291. b = append(b, []byte{}...)
  292. b = append(b, []byte{0x27, 0x6c, 0x69, 0x61, 0x27, 0x20}...)
  293. b = strconv.AppendInt(b, int64(t.Year()), 10)
  294. return string(b)
  295. }
  296. // FmtDateFull returns the full date representation of 't' for 'ee_TG'
  297. func (ee *ee_TG) FmtDateFull(t time.Time) string {
  298. b := make([]byte, 0, 32)
  299. b = append(b, ee.daysWide[t.Weekday()]...)
  300. b = append(b, []byte{0x2c, 0x20}...)
  301. b = append(b, ee.monthsWide[t.Month()]...)
  302. b = append(b, []byte{0x20}...)
  303. b = strconv.AppendInt(b, int64(t.Day()), 10)
  304. b = append(b, []byte{}...)
  305. b = append(b, []byte{0x27, 0x6c, 0x69, 0x61, 0x27, 0x20}...)
  306. b = strconv.AppendInt(b, int64(t.Year()), 10)
  307. return string(b)
  308. }
  309. // FmtTimeShort returns the short time representation of 't' for 'ee_TG'
  310. func (ee *ee_TG) FmtTimeShort(t time.Time) string {
  311. b := make([]byte, 0, 32)
  312. if t.Hour() < 10 {
  313. b = append(b, '0')
  314. }
  315. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  316. b = append(b, ee.timeSeparator...)
  317. if t.Minute() < 10 {
  318. b = append(b, '0')
  319. }
  320. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  321. return string(b)
  322. }
  323. // FmtTimeMedium returns the medium time representation of 't' for 'ee_TG'
  324. func (ee *ee_TG) FmtTimeMedium(t time.Time) string {
  325. b := make([]byte, 0, 32)
  326. if t.Hour() < 10 {
  327. b = append(b, '0')
  328. }
  329. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  330. b = append(b, ee.timeSeparator...)
  331. if t.Minute() < 10 {
  332. b = append(b, '0')
  333. }
  334. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  335. b = append(b, ee.timeSeparator...)
  336. if t.Second() < 10 {
  337. b = append(b, '0')
  338. }
  339. b = strconv.AppendInt(b, int64(t.Second()), 10)
  340. return string(b)
  341. }
  342. // FmtTimeLong returns the long time representation of 't' for 'ee_TG'
  343. func (ee *ee_TG) FmtTimeLong(t time.Time) string {
  344. b := make([]byte, 0, 32)
  345. if t.Hour() < 10 {
  346. b = append(b, '0')
  347. }
  348. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  349. b = append(b, ee.timeSeparator...)
  350. if t.Minute() < 10 {
  351. b = append(b, '0')
  352. }
  353. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  354. b = append(b, ee.timeSeparator...)
  355. if t.Second() < 10 {
  356. b = append(b, '0')
  357. }
  358. b = strconv.AppendInt(b, int64(t.Second()), 10)
  359. b = append(b, []byte{0x20}...)
  360. tz, _ := t.Zone()
  361. b = append(b, tz...)
  362. return string(b)
  363. }
  364. // FmtTimeFull returns the full time representation of 't' for 'ee_TG'
  365. func (ee *ee_TG) FmtTimeFull(t time.Time) string {
  366. b := make([]byte, 0, 32)
  367. if t.Hour() < 10 {
  368. b = append(b, '0')
  369. }
  370. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  371. b = append(b, ee.timeSeparator...)
  372. if t.Minute() < 10 {
  373. b = append(b, '0')
  374. }
  375. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  376. b = append(b, ee.timeSeparator...)
  377. if t.Second() < 10 {
  378. b = append(b, '0')
  379. }
  380. b = strconv.AppendInt(b, int64(t.Second()), 10)
  381. b = append(b, []byte{0x20}...)
  382. tz, _ := t.Zone()
  383. if btz, ok := ee.timezones[tz]; ok {
  384. b = append(b, btz...)
  385. } else {
  386. b = append(b, tz...)
  387. }
  388. return string(b)
  389. }