bo_IN.go 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643
  1. package bo_IN
  2. import (
  3. "math"
  4. "strconv"
  5. "time"
  6. "github.com/go-playground/locales"
  7. "github.com/go-playground/locales/currency"
  8. )
  9. type bo_IN 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. currencyNegativePrefix 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 'bo_IN' locale
  41. func New() locales.Translator {
  42. return &bo_IN{
  43. locale: "bo_IN",
  44. pluralsCardinal: []locales.PluralRule{6},
  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", "BYN", "BYR", "BZD", "CAD", "CDF", "CHE", "CHF", "CHW", "CLE", "CLF", "CLP", "CNH", "CNX", "CN¥", "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"},
  51. currencyPositivePrefix: " ",
  52. currencyNegativePrefix: " ",
  53. monthsAbbreviated: []string{"", "ཟླ་༡", "ཟླ་༢", "ཟླ་༣", "ཟླ་༤", "ཟླ་༥", "ཟླ་༦", "ཟླ་༧", "ཟླ་༨", "ཟླ་༩", "ཟླ་༡༠", "ཟླ་༡༡", "ཟླ་༡༢"},
  54. monthsWide: []string{"", "ཟླ་བ་དང་པོ", "ཟླ་བ་གཉིས་པ", "ཟླ་བ་གསུམ་པ", "ཟླ་བ་བཞི་པ", "ཟླ་བ་ལྔ་པ", "ཟླ་བ་དྲུག་པ", "ཟླ་བ་བདུན་པ", "ཟླ་བ་བརྒྱད་པ", "ཟླ་བ་དགུ་པ", "ཟླ་བ་བཅུ་པ", "ཟླ་བ་བཅུ་གཅིག་པ", "ཟླ་བ་བཅུ་གཉིས་པ"},
  55. daysAbbreviated: []string{"ཉི་མ་", "ཟླ་བ་", "མིག་དམར་", "ལྷག་པ་", "ཕུར་བུ་", "པ་སངས་", "སྤེན་པ་"},
  56. daysNarrow: []string{"ཉི", "ཟླ", "མིག", "ལྷག", "ཕུར", "སངས", "སྤེན"},
  57. daysWide: []string{"གཟའ་ཉི་མ་", "གཟའ་ཟླ་བ་", "གཟའ་མིག་དམར་", "གཟའ་ལྷག་པ་", "གཟའ་ཕུར་བུ་", "གཟའ་པ་སངས་", "གཟའ་སྤེན་པ་"},
  58. periodsAbbreviated: []string{"སྔ་དྲོ་", "ཕྱི་དྲོ་"},
  59. periodsWide: []string{"སྔ་དྲོ་", "ཕྱི་དྲོ་"},
  60. erasAbbreviated: []string{"སྤྱི་ལོ་སྔོན་", "སྤྱི་ལོ་"},
  61. erasNarrow: []string{"", ""},
  62. erasWide: []string{"", ""},
  63. timezones: map[string]string{"AST": "AST", "EST": "EST", "OESZ": "OESZ", "HNPMX": "HNPMX", "MDT": "MDT", "HNOG": "HNOG", "UYT": "UYT", "SGT": "SGT", "ARST": "ARST", "ChST": "ChST", "CHADT": "CHADT", "NZDT": "NZDT", "MYT": "MYT", "EAT": "EAT", "CLT": "CLT", "TMST": "TMST", "HECU": "HECU", "SAST": "SAST", "HKST": "HKST", "HNT": "HNT", "LHDT": "LHDT", "CLST": "CLST", "COT": "COT", "GYT": "GYT", "CST": "CST", "ACST": "ACST", "ACWST": "ACWST", "HKT": "HKT", "GMT": "GMT", "CDT": "CDT", "WAT": "WAT", "EDT": "EDT", "CAT": "CAT", "HEEG": "HEEG", "HENOMX": "HENOMX", "WIT": "WIT", "AEST": "AEST", "WIB": "WIB", "SRT": "SRT", "HADT": "HADT", "ART": "ART", "WEZ": "WEZ", "WESZ": "WESZ", "WARST": "WARST", "HEPM": "HEPM", "WITA": "WITA", "UYST": "UYST", "AEDT": "AEDT", "JST": "JST", "IST": "IST", "WART": "WART", "ACWDT": "ACWDT", "OEZ": "OEZ", "COST": "COST", "HNCU": "HNCU", "∅∅∅": "∅∅∅", "JDT": "JDT", "ECT": "ECT", "ACDT": "ACDT", "HNEG": "HNEG", "MESZ": "MESZ", "HNPM": "HNPM", "AWDT": "AWDT", "MST": "MST", "BT": "BT", "AKST": "AKST", "PST": "PST", "NZST": "NZST", "HAST": "HAST", "HAT": "HAT", "VET": "VET", "TMT": "TMT", "PDT": "PDT", "AWST": "AWST", "AKDT": "AKDT", "MEZ": "MEZ", "BOT": "BOT", "GFT": "GFT", "HEOG": "HEOG", "LHST": "LHST", "CHAST": "CHAST", "HEPMX": "HEPMX", "ADT": "ADT", "WAST": "WAST", "HNNOMX": "HNNOMX"},
  64. }
  65. }
  66. // Locale returns the current translators string locale
  67. func (bo *bo_IN) Locale() string {
  68. return bo.locale
  69. }
  70. // PluralsCardinal returns the list of cardinal plural rules associated with 'bo_IN'
  71. func (bo *bo_IN) PluralsCardinal() []locales.PluralRule {
  72. return bo.pluralsCardinal
  73. }
  74. // PluralsOrdinal returns the list of ordinal plural rules associated with 'bo_IN'
  75. func (bo *bo_IN) PluralsOrdinal() []locales.PluralRule {
  76. return bo.pluralsOrdinal
  77. }
  78. // PluralsRange returns the list of range plural rules associated with 'bo_IN'
  79. func (bo *bo_IN) PluralsRange() []locales.PluralRule {
  80. return bo.pluralsRange
  81. }
  82. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'bo_IN'
  83. func (bo *bo_IN) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
  84. return locales.PluralRuleOther
  85. }
  86. // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'bo_IN'
  87. func (bo *bo_IN) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
  88. return locales.PluralRuleUnknown
  89. }
  90. // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'bo_IN'
  91. func (bo *bo_IN) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
  92. return locales.PluralRuleUnknown
  93. }
  94. // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
  95. func (bo *bo_IN) MonthAbbreviated(month time.Month) string {
  96. return bo.monthsAbbreviated[month]
  97. }
  98. // MonthsAbbreviated returns the locales abbreviated months
  99. func (bo *bo_IN) MonthsAbbreviated() []string {
  100. return bo.monthsAbbreviated[1:]
  101. }
  102. // MonthNarrow returns the locales narrow month given the 'month' provided
  103. func (bo *bo_IN) MonthNarrow(month time.Month) string {
  104. return bo.monthsNarrow[month]
  105. }
  106. // MonthsNarrow returns the locales narrow months
  107. func (bo *bo_IN) MonthsNarrow() []string {
  108. return nil
  109. }
  110. // MonthWide returns the locales wide month given the 'month' provided
  111. func (bo *bo_IN) MonthWide(month time.Month) string {
  112. return bo.monthsWide[month]
  113. }
  114. // MonthsWide returns the locales wide months
  115. func (bo *bo_IN) MonthsWide() []string {
  116. return bo.monthsWide[1:]
  117. }
  118. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  119. func (bo *bo_IN) WeekdayAbbreviated(weekday time.Weekday) string {
  120. return bo.daysAbbreviated[weekday]
  121. }
  122. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  123. func (bo *bo_IN) WeekdaysAbbreviated() []string {
  124. return bo.daysAbbreviated
  125. }
  126. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  127. func (bo *bo_IN) WeekdayNarrow(weekday time.Weekday) string {
  128. return bo.daysNarrow[weekday]
  129. }
  130. // WeekdaysNarrow returns the locales narrow weekdays
  131. func (bo *bo_IN) WeekdaysNarrow() []string {
  132. return bo.daysNarrow
  133. }
  134. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  135. func (bo *bo_IN) WeekdayShort(weekday time.Weekday) string {
  136. return bo.daysShort[weekday]
  137. }
  138. // WeekdaysShort returns the locales short weekdays
  139. func (bo *bo_IN) WeekdaysShort() []string {
  140. return bo.daysShort
  141. }
  142. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  143. func (bo *bo_IN) WeekdayWide(weekday time.Weekday) string {
  144. return bo.daysWide[weekday]
  145. }
  146. // WeekdaysWide returns the locales wide weekdays
  147. func (bo *bo_IN) WeekdaysWide() []string {
  148. return bo.daysWide
  149. }
  150. // Decimal returns the decimal point of number
  151. func (bo *bo_IN) Decimal() string {
  152. return bo.decimal
  153. }
  154. // Group returns the group of number
  155. func (bo *bo_IN) Group() string {
  156. return bo.group
  157. }
  158. // Group returns the minus sign of number
  159. func (bo *bo_IN) Minus() string {
  160. return bo.minus
  161. }
  162. // FmtNumber returns 'num' with digits/precision of 'v' for 'bo_IN' and handles both Whole and Real numbers based on 'v'
  163. func (bo *bo_IN) FmtNumber(num float64, v uint64) string {
  164. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  165. l := len(s) + 1 + 1*len(s[:len(s)-int(v)-1])/3
  166. count := 0
  167. inWhole := v == 0
  168. b := make([]byte, 0, l)
  169. for i := len(s) - 1; i >= 0; i-- {
  170. if s[i] == '.' {
  171. b = append(b, bo.decimal[0])
  172. inWhole = true
  173. continue
  174. }
  175. if inWhole {
  176. if count == 3 {
  177. b = append(b, bo.group[0])
  178. count = 1
  179. } else {
  180. count++
  181. }
  182. }
  183. b = append(b, s[i])
  184. }
  185. if num < 0 {
  186. b = append(b, bo.minus[0])
  187. }
  188. // reverse
  189. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  190. b[i], b[j] = b[j], b[i]
  191. }
  192. return string(b)
  193. }
  194. // FmtPercent returns 'num' with digits/precision of 'v' for 'bo_IN' and handles both Whole and Real numbers based on 'v'
  195. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
  196. func (bo *bo_IN) FmtPercent(num float64, v uint64) string {
  197. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  198. l := len(s) + 1
  199. b := make([]byte, 0, l)
  200. for i := len(s) - 1; i >= 0; i-- {
  201. if s[i] == '.' {
  202. b = append(b, bo.decimal[0])
  203. continue
  204. }
  205. b = append(b, s[i])
  206. }
  207. if num < 0 {
  208. b = append(b, bo.minus[0])
  209. }
  210. // reverse
  211. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  212. b[i], b[j] = b[j], b[i]
  213. }
  214. b = append(b, bo.percent...)
  215. return string(b)
  216. }
  217. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'bo_IN'
  218. func (bo *bo_IN) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  219. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  220. symbol := bo.currencies[currency]
  221. l := len(s) + len(symbol) + 3 + 1*len(s[:len(s)-int(v)-1])/3
  222. count := 0
  223. inWhole := v == 0
  224. b := make([]byte, 0, l)
  225. for i := len(s) - 1; i >= 0; i-- {
  226. if s[i] == '.' {
  227. b = append(b, bo.decimal[0])
  228. inWhole = true
  229. continue
  230. }
  231. if inWhole {
  232. if count == 3 {
  233. b = append(b, bo.group[0])
  234. count = 1
  235. } else {
  236. count++
  237. }
  238. }
  239. b = append(b, s[i])
  240. }
  241. for j := len(symbol) - 1; j >= 0; j-- {
  242. b = append(b, symbol[j])
  243. }
  244. for j := len(bo.currencyPositivePrefix) - 1; j >= 0; j-- {
  245. b = append(b, bo.currencyPositivePrefix[j])
  246. }
  247. if num < 0 {
  248. b = append(b, bo.minus[0])
  249. }
  250. // reverse
  251. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  252. b[i], b[j] = b[j], b[i]
  253. }
  254. if int(v) < 2 {
  255. if v == 0 {
  256. b = append(b, bo.decimal...)
  257. }
  258. for i := 0; i < 2-int(v); i++ {
  259. b = append(b, '0')
  260. }
  261. }
  262. return string(b)
  263. }
  264. // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'bo_IN'
  265. // in accounting notation.
  266. func (bo *bo_IN) FmtAccounting(num float64, v uint64, currency currency.Type) string {
  267. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  268. symbol := bo.currencies[currency]
  269. l := len(s) + len(symbol) + 3 + 1*len(s[:len(s)-int(v)-1])/3
  270. count := 0
  271. inWhole := v == 0
  272. b := make([]byte, 0, l)
  273. for i := len(s) - 1; i >= 0; i-- {
  274. if s[i] == '.' {
  275. b = append(b, bo.decimal[0])
  276. inWhole = true
  277. continue
  278. }
  279. if inWhole {
  280. if count == 3 {
  281. b = append(b, bo.group[0])
  282. count = 1
  283. } else {
  284. count++
  285. }
  286. }
  287. b = append(b, s[i])
  288. }
  289. if num < 0 {
  290. for j := len(symbol) - 1; j >= 0; j-- {
  291. b = append(b, symbol[j])
  292. }
  293. for j := len(bo.currencyNegativePrefix) - 1; j >= 0; j-- {
  294. b = append(b, bo.currencyNegativePrefix[j])
  295. }
  296. b = append(b, bo.minus[0])
  297. } else {
  298. for j := len(symbol) - 1; j >= 0; j-- {
  299. b = append(b, symbol[j])
  300. }
  301. for j := len(bo.currencyPositivePrefix) - 1; j >= 0; j-- {
  302. b = append(b, bo.currencyPositivePrefix[j])
  303. }
  304. }
  305. // reverse
  306. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  307. b[i], b[j] = b[j], b[i]
  308. }
  309. if int(v) < 2 {
  310. if v == 0 {
  311. b = append(b, bo.decimal...)
  312. }
  313. for i := 0; i < 2-int(v); i++ {
  314. b = append(b, '0')
  315. }
  316. }
  317. return string(b)
  318. }
  319. // FmtDateShort returns the short date representation of 't' for 'bo_IN'
  320. func (bo *bo_IN) FmtDateShort(t time.Time) string {
  321. b := make([]byte, 0, 32)
  322. if t.Year() > 0 {
  323. b = strconv.AppendInt(b, int64(t.Year()), 10)
  324. } else {
  325. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  326. }
  327. b = append(b, []byte{0x2d}...)
  328. if t.Month() < 10 {
  329. b = append(b, '0')
  330. }
  331. b = strconv.AppendInt(b, int64(t.Month()), 10)
  332. b = append(b, []byte{0x2d}...)
  333. if t.Day() < 10 {
  334. b = append(b, '0')
  335. }
  336. b = strconv.AppendInt(b, int64(t.Day()), 10)
  337. return string(b)
  338. }
  339. // FmtDateMedium returns the medium date representation of 't' for 'bo_IN'
  340. func (bo *bo_IN) FmtDateMedium(t time.Time) string {
  341. b := make([]byte, 0, 32)
  342. if t.Year() > 0 {
  343. b = strconv.AppendInt(b, int64(t.Year()), 10)
  344. } else {
  345. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  346. }
  347. b = append(b, []byte{0x20, 0xe0, 0xbd, 0xa3, 0xe0, 0xbd, 0xbc, 0xe0, 0xbd, 0xa0, 0xe0, 0xbd, 0xb2, 0xe0, 0xbc, 0x8b}...)
  348. b = append(b, bo.monthsAbbreviated[t.Month()]...)
  349. b = append(b, []byte{0xe0, 0xbd, 0x9a, 0xe0, 0xbd, 0xba, 0xe0, 0xbd, 0xa6, 0xe0, 0xbc, 0x8b}...)
  350. b = strconv.AppendInt(b, int64(t.Day()), 10)
  351. return string(b)
  352. }
  353. // FmtDateLong returns the long date representation of 't' for 'bo_IN'
  354. func (bo *bo_IN) FmtDateLong(t time.Time) string {
  355. b := make([]byte, 0, 32)
  356. b = append(b, []byte{0xe0, 0xbd, 0xa6, 0xe0, 0xbe, 0xa4, 0xe0, 0xbe, 0xb1, 0xe0, 0xbd, 0xb2, 0xe0, 0xbc, 0x8b, 0xe0, 0xbd, 0xa3, 0xe0, 0xbd, 0xbc, 0xe0, 0xbc, 0x8b}...)
  357. if t.Year() > 0 {
  358. b = strconv.AppendInt(b, int64(t.Year()), 10)
  359. } else {
  360. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  361. }
  362. b = append(b, []byte{0x20}...)
  363. b = append(b, bo.monthsWide[t.Month()]...)
  364. b = append(b, []byte{0xe0, 0xbd, 0xa0, 0xe0, 0xbd, 0xb2, 0xe0, 0xbc, 0x8b, 0xe0, 0xbd, 0x9a, 0xe0, 0xbd, 0xba, 0xe0, 0xbd, 0xa6, 0xe0, 0xbc, 0x8b}...)
  365. b = strconv.AppendInt(b, int64(t.Day()), 10)
  366. return string(b)
  367. }
  368. // FmtDateFull returns the full date representation of 't' for 'bo_IN'
  369. func (bo *bo_IN) FmtDateFull(t time.Time) string {
  370. b := make([]byte, 0, 32)
  371. if t.Year() > 0 {
  372. b = strconv.AppendInt(b, int64(t.Year()), 10)
  373. } else {
  374. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  375. }
  376. b = append(b, []byte{0x20}...)
  377. b = append(b, bo.monthsWide[t.Month()]...)
  378. b = append(b, []byte{0xe0, 0xbd, 0xa0, 0xe0, 0xbd, 0xb2, 0xe0, 0xbc, 0x8b, 0xe0, 0xbd, 0x9a, 0xe0, 0xbd, 0xba, 0xe0, 0xbd, 0xa6, 0xe0, 0xbc, 0x8b}...)
  379. b = strconv.AppendInt(b, int64(t.Day()), 10)
  380. b = append(b, []byte{0x2c, 0x20}...)
  381. b = append(b, bo.daysWide[t.Weekday()]...)
  382. return string(b)
  383. }
  384. // FmtTimeShort returns the short time representation of 't' for 'bo_IN'
  385. func (bo *bo_IN) FmtTimeShort(t time.Time) string {
  386. b := make([]byte, 0, 32)
  387. h := t.Hour()
  388. if h > 12 {
  389. h -= 12
  390. }
  391. b = strconv.AppendInt(b, int64(h), 10)
  392. b = append(b, bo.timeSeparator...)
  393. if t.Minute() < 10 {
  394. b = append(b, '0')
  395. }
  396. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  397. b = append(b, []byte{0x20}...)
  398. if t.Hour() < 12 {
  399. b = append(b, bo.periodsAbbreviated[0]...)
  400. } else {
  401. b = append(b, bo.periodsAbbreviated[1]...)
  402. }
  403. return string(b)
  404. }
  405. // FmtTimeMedium returns the medium time representation of 't' for 'bo_IN'
  406. func (bo *bo_IN) FmtTimeMedium(t time.Time) string {
  407. b := make([]byte, 0, 32)
  408. h := t.Hour()
  409. if h > 12 {
  410. h -= 12
  411. }
  412. b = strconv.AppendInt(b, int64(h), 10)
  413. b = append(b, bo.timeSeparator...)
  414. if t.Minute() < 10 {
  415. b = append(b, '0')
  416. }
  417. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  418. b = append(b, bo.timeSeparator...)
  419. if t.Second() < 10 {
  420. b = append(b, '0')
  421. }
  422. b = strconv.AppendInt(b, int64(t.Second()), 10)
  423. b = append(b, []byte{0x20}...)
  424. if t.Hour() < 12 {
  425. b = append(b, bo.periodsAbbreviated[0]...)
  426. } else {
  427. b = append(b, bo.periodsAbbreviated[1]...)
  428. }
  429. return string(b)
  430. }
  431. // FmtTimeLong returns the long time representation of 't' for 'bo_IN'
  432. func (bo *bo_IN) FmtTimeLong(t time.Time) string {
  433. b := make([]byte, 0, 32)
  434. h := t.Hour()
  435. if h > 12 {
  436. h -= 12
  437. }
  438. b = strconv.AppendInt(b, int64(h), 10)
  439. b = append(b, bo.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, bo.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. if t.Hour() < 12 {
  451. b = append(b, bo.periodsAbbreviated[0]...)
  452. } else {
  453. b = append(b, bo.periodsAbbreviated[1]...)
  454. }
  455. b = append(b, []byte{0x20}...)
  456. tz, _ := t.Zone()
  457. b = append(b, tz...)
  458. return string(b)
  459. }
  460. // FmtTimeFull returns the full time representation of 't' for 'bo_IN'
  461. func (bo *bo_IN) FmtTimeFull(t time.Time) string {
  462. b := make([]byte, 0, 32)
  463. h := t.Hour()
  464. if h > 12 {
  465. h -= 12
  466. }
  467. b = strconv.AppendInt(b, int64(h), 10)
  468. b = append(b, bo.timeSeparator...)
  469. if t.Minute() < 10 {
  470. b = append(b, '0')
  471. }
  472. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  473. b = append(b, bo.timeSeparator...)
  474. if t.Second() < 10 {
  475. b = append(b, '0')
  476. }
  477. b = strconv.AppendInt(b, int64(t.Second()), 10)
  478. b = append(b, []byte{0x20}...)
  479. if t.Hour() < 12 {
  480. b = append(b, bo.periodsAbbreviated[0]...)
  481. } else {
  482. b = append(b, bo.periodsAbbreviated[1]...)
  483. }
  484. b = append(b, []byte{0x20}...)
  485. tz, _ := t.Zone()
  486. if btz, ok := bo.timezones[tz]; ok {
  487. b = append(b, btz...)
  488. } else {
  489. b = append(b, tz...)
  490. }
  491. return string(b)
  492. }