bas_CM.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590
  1. package bas_CM
  2. import (
  3. "math"
  4. "strconv"
  5. "time"
  6. "github.com/go-playground/locales"
  7. "github.com/go-playground/locales/currency"
  8. )
  9. type bas_CM 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. percentSuffix string
  19. perMille string
  20. timeSeparator string
  21. inifinity string
  22. currencies []string // idx = enum of currency code
  23. currencyPositiveSuffix 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 'bas_CM' locale
  42. func New() locales.Translator {
  43. return &bas_CM{
  44. locale: "bas_CM",
  45. pluralsCardinal: nil,
  46. pluralsOrdinal: nil,
  47. pluralsRange: nil,
  48. decimal: ",",
  49. group: " ",
  50. timeSeparator: ":",
  51. 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"},
  52. percentSuffix: " ",
  53. currencyPositiveSuffix: " ",
  54. currencyNegativeSuffix: " ",
  55. monthsAbbreviated: []string{"", "kɔn", "mac", "mat", "mto", "mpu", "hil", "nje", "hik", "dip", "bio", "may", "liɓ"},
  56. monthsNarrow: []string{"", "k", "m", "m", "m", "m", "h", "n", "h", "d", "b", "m", "l"},
  57. monthsWide: []string{"", "Kɔndɔŋ", "Màcɛ̂l", "Màtùmb", "Màtop", "M̀puyɛ", "Hìlòndɛ̀", "Njèbà", "Hìkaŋ", "Dìpɔ̀s", "Bìòôm", "Màyɛsèp", "Lìbuy li ńyèe"},
  58. daysAbbreviated: []string{"nɔy", "nja", "uum", "ŋge", "mbɔ", "kɔɔ", "jon"},
  59. daysNarrow: []string{"n", "n", "u", "ŋ", "m", "k", "j"},
  60. daysWide: []string{"ŋgwà nɔ̂y", "ŋgwà njaŋgumba", "ŋgwà ûm", "ŋgwà ŋgê", "ŋgwà mbɔk", "ŋgwà kɔɔ", "ŋgwà jôn"},
  61. periodsAbbreviated: []string{"I bikɛ̂glà", "I ɓugajɔp"},
  62. periodsWide: []string{"I bikɛ̂glà", "I ɓugajɔp"},
  63. erasAbbreviated: []string{"b.Y.K", "m.Y.K"},
  64. erasNarrow: []string{"", ""},
  65. erasWide: []string{"bisū bi Yesù Krǐstò", "i mbūs Yesù Krǐstò"},
  66. timezones: map[string]string{"WITA": "WITA", "HAT": "HAT", "TMT": "TMT", "EAT": "EAT", "UYST": "UYST", "HECU": "HECU", "MYT": "MYT", "AKDT": "AKDT", "EST": "EST", "HNNOMX": "HNNOMX", "CLST": "CLST", "CST": "CST", "AEST": "AEST", "HNCU": "HNCU", "WESZ": "WESZ", "ACWST": "ACWST", "ACWDT": "ACWDT", "HEOG": "HEOG", "HKT": "HKT", "TMST": "TMST", "CHADT": "CHADT", "JST": "JST", "OEZ": "OEZ", "SGT": "SGT", "HNEG": "HNEG", "LHDT": "LHDT", "VET": "VET", "MDT": "MDT", "ARST": "ARST", "BOT": "BOT", "HENOMX": "HENOMX", "COT": "COT", "UYT": "UYT", "PDT": "PDT", "WEZ": "WEZ", "SAST": "SAST", "IST": "IST", "PST": "PST", "AKST": "AKST", "COST": "COST", "AWDT": "AWDT", "GFT": "GFT", "CDT": "CDT", "AST": "AST", "NZST": "NZST", "ACDT": "ACDT", "ART": "ART", "HAST": "HAST", "AEDT": "AEDT", "HNPMX": "HNPMX", "NZDT": "NZDT", "ECT": "ECT", "ACST": "ACST", "MEZ": "MEZ", "WART": "WART", "OESZ": "OESZ", "ChST": "ChST", "HNOG": "HNOG", "HKST": "HKST", "MST": "MST", "CHAST": "CHAST", "WAST": "WAST", "WAT": "WAT", "WARST": "WARST", "HEPM": "HEPM", "CLT": "CLT", "HADT": "HADT", "GYT": "GYT", "WIB": "WIB", "MESZ": "MESZ", "HNT": "HNT", "SRT": "SRT", "HEPMX": "HEPMX", "HNPM": "HNPM", "CAT": "CAT", "ADT": "ADT", "JDT": "JDT", "BT": "BT", "AWST": "AWST", "HEEG": "HEEG", "EDT": "EDT", "∅∅∅": "∅∅∅", "LHST": "LHST", "WIT": "WIT", "GMT": "GMT"},
  67. }
  68. }
  69. // Locale returns the current translators string locale
  70. func (bas *bas_CM) Locale() string {
  71. return bas.locale
  72. }
  73. // PluralsCardinal returns the list of cardinal plural rules associated with 'bas_CM'
  74. func (bas *bas_CM) PluralsCardinal() []locales.PluralRule {
  75. return bas.pluralsCardinal
  76. }
  77. // PluralsOrdinal returns the list of ordinal plural rules associated with 'bas_CM'
  78. func (bas *bas_CM) PluralsOrdinal() []locales.PluralRule {
  79. return bas.pluralsOrdinal
  80. }
  81. // PluralsRange returns the list of range plural rules associated with 'bas_CM'
  82. func (bas *bas_CM) PluralsRange() []locales.PluralRule {
  83. return bas.pluralsRange
  84. }
  85. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'bas_CM'
  86. func (bas *bas_CM) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
  87. return locales.PluralRuleUnknown
  88. }
  89. // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'bas_CM'
  90. func (bas *bas_CM) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
  91. return locales.PluralRuleUnknown
  92. }
  93. // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'bas_CM'
  94. func (bas *bas_CM) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
  95. return locales.PluralRuleUnknown
  96. }
  97. // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
  98. func (bas *bas_CM) MonthAbbreviated(month time.Month) string {
  99. return bas.monthsAbbreviated[month]
  100. }
  101. // MonthsAbbreviated returns the locales abbreviated months
  102. func (bas *bas_CM) MonthsAbbreviated() []string {
  103. return bas.monthsAbbreviated[1:]
  104. }
  105. // MonthNarrow returns the locales narrow month given the 'month' provided
  106. func (bas *bas_CM) MonthNarrow(month time.Month) string {
  107. return bas.monthsNarrow[month]
  108. }
  109. // MonthsNarrow returns the locales narrow months
  110. func (bas *bas_CM) MonthsNarrow() []string {
  111. return bas.monthsNarrow[1:]
  112. }
  113. // MonthWide returns the locales wide month given the 'month' provided
  114. func (bas *bas_CM) MonthWide(month time.Month) string {
  115. return bas.monthsWide[month]
  116. }
  117. // MonthsWide returns the locales wide months
  118. func (bas *bas_CM) MonthsWide() []string {
  119. return bas.monthsWide[1:]
  120. }
  121. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  122. func (bas *bas_CM) WeekdayAbbreviated(weekday time.Weekday) string {
  123. return bas.daysAbbreviated[weekday]
  124. }
  125. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  126. func (bas *bas_CM) WeekdaysAbbreviated() []string {
  127. return bas.daysAbbreviated
  128. }
  129. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  130. func (bas *bas_CM) WeekdayNarrow(weekday time.Weekday) string {
  131. return bas.daysNarrow[weekday]
  132. }
  133. // WeekdaysNarrow returns the locales narrow weekdays
  134. func (bas *bas_CM) WeekdaysNarrow() []string {
  135. return bas.daysNarrow
  136. }
  137. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  138. func (bas *bas_CM) WeekdayShort(weekday time.Weekday) string {
  139. return bas.daysShort[weekday]
  140. }
  141. // WeekdaysShort returns the locales short weekdays
  142. func (bas *bas_CM) WeekdaysShort() []string {
  143. return bas.daysShort
  144. }
  145. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  146. func (bas *bas_CM) WeekdayWide(weekday time.Weekday) string {
  147. return bas.daysWide[weekday]
  148. }
  149. // WeekdaysWide returns the locales wide weekdays
  150. func (bas *bas_CM) WeekdaysWide() []string {
  151. return bas.daysWide
  152. }
  153. // Decimal returns the decimal point of number
  154. func (bas *bas_CM) Decimal() string {
  155. return bas.decimal
  156. }
  157. // Group returns the group of number
  158. func (bas *bas_CM) Group() string {
  159. return bas.group
  160. }
  161. // Group returns the minus sign of number
  162. func (bas *bas_CM) Minus() string {
  163. return bas.minus
  164. }
  165. // FmtNumber returns 'num' with digits/precision of 'v' for 'bas_CM' and handles both Whole and Real numbers based on 'v'
  166. func (bas *bas_CM) FmtNumber(num float64, v uint64) string {
  167. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  168. l := len(s) + 1 + 2*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, bas.decimal[0])
  175. inWhole = true
  176. continue
  177. }
  178. if inWhole {
  179. if count == 3 {
  180. for j := len(bas.group) - 1; j >= 0; j-- {
  181. b = append(b, bas.group[j])
  182. }
  183. count = 1
  184. } else {
  185. count++
  186. }
  187. }
  188. b = append(b, s[i])
  189. }
  190. if num < 0 {
  191. b = append(b, bas.minus[0])
  192. }
  193. // reverse
  194. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  195. b[i], b[j] = b[j], b[i]
  196. }
  197. return string(b)
  198. }
  199. // FmtPercent returns 'num' with digits/precision of 'v' for 'bas_CM' and handles both Whole and Real numbers based on 'v'
  200. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
  201. func (bas *bas_CM) FmtPercent(num float64, v uint64) string {
  202. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  203. l := len(s) + 3
  204. b := make([]byte, 0, l)
  205. for i := len(s) - 1; i >= 0; i-- {
  206. if s[i] == '.' {
  207. b = append(b, bas.decimal[0])
  208. continue
  209. }
  210. b = append(b, s[i])
  211. }
  212. if num < 0 {
  213. b = append(b, bas.minus[0])
  214. }
  215. // reverse
  216. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  217. b[i], b[j] = b[j], b[i]
  218. }
  219. b = append(b, bas.percentSuffix...)
  220. b = append(b, bas.percent...)
  221. return string(b)
  222. }
  223. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'bas_CM'
  224. func (bas *bas_CM) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  225. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  226. symbol := bas.currencies[currency]
  227. l := len(s) + len(symbol) + 3 + 2*len(s[:len(s)-int(v)-1])/3
  228. count := 0
  229. inWhole := v == 0
  230. b := make([]byte, 0, l)
  231. for i := len(s) - 1; i >= 0; i-- {
  232. if s[i] == '.' {
  233. b = append(b, bas.decimal[0])
  234. inWhole = true
  235. continue
  236. }
  237. if inWhole {
  238. if count == 3 {
  239. for j := len(bas.group) - 1; j >= 0; j-- {
  240. b = append(b, bas.group[j])
  241. }
  242. count = 1
  243. } else {
  244. count++
  245. }
  246. }
  247. b = append(b, s[i])
  248. }
  249. if num < 0 {
  250. b = append(b, bas.minus[0])
  251. }
  252. // reverse
  253. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  254. b[i], b[j] = b[j], b[i]
  255. }
  256. if int(v) < 2 {
  257. if v == 0 {
  258. b = append(b, bas.decimal...)
  259. }
  260. for i := 0; i < 2-int(v); i++ {
  261. b = append(b, '0')
  262. }
  263. }
  264. b = append(b, bas.currencyPositiveSuffix...)
  265. b = append(b, symbol...)
  266. return string(b)
  267. }
  268. // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'bas_CM'
  269. // in accounting notation.
  270. func (bas *bas_CM) FmtAccounting(num float64, v uint64, currency currency.Type) string {
  271. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  272. symbol := bas.currencies[currency]
  273. l := len(s) + len(symbol) + 3 + 2*len(s[:len(s)-int(v)-1])/3
  274. count := 0
  275. inWhole := v == 0
  276. b := make([]byte, 0, l)
  277. for i := len(s) - 1; i >= 0; i-- {
  278. if s[i] == '.' {
  279. b = append(b, bas.decimal[0])
  280. inWhole = true
  281. continue
  282. }
  283. if inWhole {
  284. if count == 3 {
  285. for j := len(bas.group) - 1; j >= 0; j-- {
  286. b = append(b, bas.group[j])
  287. }
  288. count = 1
  289. } else {
  290. count++
  291. }
  292. }
  293. b = append(b, s[i])
  294. }
  295. if num < 0 {
  296. b = append(b, bas.minus[0])
  297. }
  298. // reverse
  299. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  300. b[i], b[j] = b[j], b[i]
  301. }
  302. if int(v) < 2 {
  303. if v == 0 {
  304. b = append(b, bas.decimal...)
  305. }
  306. for i := 0; i < 2-int(v); i++ {
  307. b = append(b, '0')
  308. }
  309. }
  310. if num < 0 {
  311. b = append(b, bas.currencyNegativeSuffix...)
  312. b = append(b, symbol...)
  313. } else {
  314. b = append(b, bas.currencyPositiveSuffix...)
  315. b = append(b, symbol...)
  316. }
  317. return string(b)
  318. }
  319. // FmtDateShort returns the short date representation of 't' for 'bas_CM'
  320. func (bas *bas_CM) FmtDateShort(t time.Time) string {
  321. b := make([]byte, 0, 32)
  322. b = strconv.AppendInt(b, int64(t.Day()), 10)
  323. b = append(b, []byte{0x2f}...)
  324. b = strconv.AppendInt(b, int64(t.Month()), 10)
  325. b = append(b, []byte{0x2f}...)
  326. if t.Year() > 0 {
  327. b = strconv.AppendInt(b, int64(t.Year()), 10)
  328. } else {
  329. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  330. }
  331. return string(b)
  332. }
  333. // FmtDateMedium returns the medium date representation of 't' for 'bas_CM'
  334. func (bas *bas_CM) FmtDateMedium(t time.Time) string {
  335. b := make([]byte, 0, 32)
  336. b = strconv.AppendInt(b, int64(t.Day()), 10)
  337. b = append(b, []byte{0x20}...)
  338. b = append(b, bas.monthsAbbreviated[t.Month()]...)
  339. b = append(b, []byte{0x2c, 0x20}...)
  340. if t.Year() > 0 {
  341. b = strconv.AppendInt(b, int64(t.Year()), 10)
  342. } else {
  343. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  344. }
  345. return string(b)
  346. }
  347. // FmtDateLong returns the long date representation of 't' for 'bas_CM'
  348. func (bas *bas_CM) FmtDateLong(t time.Time) string {
  349. b := make([]byte, 0, 32)
  350. b = strconv.AppendInt(b, int64(t.Day()), 10)
  351. b = append(b, []byte{0x20}...)
  352. b = append(b, bas.monthsWide[t.Month()]...)
  353. b = append(b, []byte{0x20}...)
  354. if t.Year() > 0 {
  355. b = strconv.AppendInt(b, int64(t.Year()), 10)
  356. } else {
  357. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  358. }
  359. return string(b)
  360. }
  361. // FmtDateFull returns the full date representation of 't' for 'bas_CM'
  362. func (bas *bas_CM) FmtDateFull(t time.Time) string {
  363. b := make([]byte, 0, 32)
  364. b = append(b, bas.daysWide[t.Weekday()]...)
  365. b = append(b, []byte{0x20}...)
  366. b = strconv.AppendInt(b, int64(t.Day()), 10)
  367. b = append(b, []byte{0x20}...)
  368. b = append(b, bas.monthsWide[t.Month()]...)
  369. b = append(b, []byte{0x20}...)
  370. if t.Year() > 0 {
  371. b = strconv.AppendInt(b, int64(t.Year()), 10)
  372. } else {
  373. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  374. }
  375. return string(b)
  376. }
  377. // FmtTimeShort returns the short time representation of 't' for 'bas_CM'
  378. func (bas *bas_CM) FmtTimeShort(t time.Time) string {
  379. b := make([]byte, 0, 32)
  380. if t.Hour() < 10 {
  381. b = append(b, '0')
  382. }
  383. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  384. b = append(b, bas.timeSeparator...)
  385. if t.Minute() < 10 {
  386. b = append(b, '0')
  387. }
  388. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  389. return string(b)
  390. }
  391. // FmtTimeMedium returns the medium time representation of 't' for 'bas_CM'
  392. func (bas *bas_CM) FmtTimeMedium(t time.Time) string {
  393. b := make([]byte, 0, 32)
  394. if t.Hour() < 10 {
  395. b = append(b, '0')
  396. }
  397. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  398. b = append(b, bas.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, bas.timeSeparator...)
  404. if t.Second() < 10 {
  405. b = append(b, '0')
  406. }
  407. b = strconv.AppendInt(b, int64(t.Second()), 10)
  408. return string(b)
  409. }
  410. // FmtTimeLong returns the long time representation of 't' for 'bas_CM'
  411. func (bas *bas_CM) FmtTimeLong(t time.Time) string {
  412. b := make([]byte, 0, 32)
  413. if t.Hour() < 10 {
  414. b = append(b, '0')
  415. }
  416. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  417. b = append(b, bas.timeSeparator...)
  418. if t.Minute() < 10 {
  419. b = append(b, '0')
  420. }
  421. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  422. b = append(b, bas.timeSeparator...)
  423. if t.Second() < 10 {
  424. b = append(b, '0')
  425. }
  426. b = strconv.AppendInt(b, int64(t.Second()), 10)
  427. b = append(b, []byte{0x20}...)
  428. tz, _ := t.Zone()
  429. b = append(b, tz...)
  430. return string(b)
  431. }
  432. // FmtTimeFull returns the full time representation of 't' for 'bas_CM'
  433. func (bas *bas_CM) FmtTimeFull(t time.Time) string {
  434. b := make([]byte, 0, 32)
  435. if t.Hour() < 10 {
  436. b = append(b, '0')
  437. }
  438. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  439. b = append(b, bas.timeSeparator...)
  440. if t.Minute() < 10 {
  441. b = append(b, '0')
  442. }
  443. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  444. b = append(b, bas.timeSeparator...)
  445. if t.Second() < 10 {
  446. b = append(b, '0')
  447. }
  448. b = strconv.AppendInt(b, int64(t.Second()), 10)
  449. b = append(b, []byte{0x20}...)
  450. tz, _ := t.Zone()
  451. if btz, ok := bas.timezones[tz]; ok {
  452. b = append(b, btz...)
  453. } else {
  454. b = append(b, tz...)
  455. }
  456. return string(b)
  457. }