en_IN.go 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699
  1. package en_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 en_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 'en_IN' locale
  41. func New() locales.Translator {
  42. return &en_IN{
  43. locale: "en_IN",
  44. pluralsCardinal: []locales.PluralRule{2, 6},
  45. pluralsOrdinal: []locales.PluralRule{2, 3, 4, 6},
  46. pluralsRange: []locales.PluralRule{6},
  47. decimal: ".",
  48. group: ",",
  49. minus: "-",
  50. percent: "%",
  51. perMille: "‰",
  52. timeSeparator: ":",
  53. inifinity: "∞",
  54. 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"},
  55. currencyPositivePrefix: " ",
  56. currencyNegativePrefix: " ",
  57. monthsAbbreviated: []string{"", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"},
  58. monthsNarrow: []string{"", "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"},
  59. monthsWide: []string{"", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"},
  60. daysAbbreviated: []string{"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"},
  61. daysNarrow: []string{"S", "M", "T", "W", "T", "F", "S"},
  62. daysShort: []string{"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"},
  63. daysWide: []string{"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"},
  64. periodsAbbreviated: []string{"am", "pm"},
  65. periodsNarrow: []string{"a", "p"},
  66. periodsWide: []string{"am", "pm"},
  67. erasAbbreviated: []string{"BC", "AD"},
  68. erasNarrow: []string{"B", "A"},
  69. erasWide: []string{"Before Christ", "Anno Domini"},
  70. timezones: map[string]string{"LHDT": "Lord Howe Daylight Time", "HNPM": "St. Pierre & Miquelon Standard Time", "PDT": "Pacific Daylight Time", "AKST": "Alaska Standard Time", "HEOG": "West Greenland Summer Time", "VET": "Venezuela Time", "HEPM": "St. Pierre & Miquelon Daylight Time", "WIT": "Eastern Indonesia Time", "COST": "Colombia Summer Time", "CHADT": "Chatham Daylight Time", "BOT": "Bolivia Time", "ACWDT": "Australian Central Western Daylight Time", "HAST": "Hawaii-Aleutian Standard Time", "HEPMX": "Mexican Pacific Daylight Time", "AEST": "Australian Eastern Standard Time", "ACWST": "Australian Central Western Standard Time", "HKST": "Hong Kong Summer Time", "GYT": "Guyana Time", "CST": "Central Standard Time", "AEDT": "Australian Eastern Daylight Time", "BT": "Bhutan Time", "SRT": "Suriname Time", "CHAST": "Chatham Standard Time", "JST": "Japan Standard Time", "HEEG": "East Greenland Summer Time", "MDT": "Macau Summer Time", "EAT": "East Africa Time", "CLST": "Chile Summer Time", "HECU": "Cuba Daylight Time", "PST": "Pacific Standard Time", "AST": "Atlantic Standard Time", "IST": "India Standard Time", "HNNOMX": "Northwest Mexico Standard Time", "TMST": "Turkmenistan Summer Time", "ARST": "Argentina Summer Time", "WAT": "West Africa Standard Time", "NZST": "New Zealand Standard Time", "NZDT": "New Zealand Daylight Time", "HNOG": "West Greenland Standard Time", "WEZ": "Western European Standard Time", "WITA": "Central Indonesia Time", "OEZ": "Eastern European Standard Time", "HADT": "Hawaii-Aleutian Daylight Time", "COT": "Colombia Standard Time", "UYT": "Uruguay Standard Time", "UYST": "Uruguay Summer Time", "ADT": "Atlantic Daylight Time", "WIB": "Western Indonesia Time", "MEZ": "Central European Standard Time", "CLT": "Chile Standard Time", "HNPMX": "Mexican Pacific Standard Time", "SAST": "South Africa Standard Time", "HAT": "Newfoundland Daylight Time", "AWDT": "Australian Western Daylight Time", "EDT": "Eastern Daylight Time", "MYT": "Malaysia Time", "LHST": "Lord Howe Standard Time", "WART": "Western Argentina Standard Time", "WARST": "Western Argentina Summer Time", "GMT": "Greenwich Mean Time", "ChST": "Chamorro Standard Time", "HNCU": "Cuba Standard Time", "CDT": "Central Daylight Time", "ACST": "Australian Central Standard Time", "∅∅∅": "Peru Summer Time", "WAST": "West Africa Summer Time", "GFT": "French Guiana Time", "HNEG": "East Greenland Standard Time", "MESZ": "Central European Summer Time", "TMT": "Turkmenistan Standard Time", "ART": "Argentina Standard Time", "AWST": "Australian Western Standard Time", "JDT": "Japan Daylight Time", "AKDT": "Alaska Daylight Time", "ACDT": "Australian Central Daylight Time", "HNT": "Newfoundland Standard Time", "MST": "Macau Standard Time", "CAT": "Central Africa Time", "OESZ": "Eastern European Summer Time", "WESZ": "Western European Summer Time", "EST": "Eastern Standard Time", "HENOMX": "Northwest Mexico Daylight Time", "SGT": "Singapore Standard Time", "ECT": "Ecuador Time", "HKT": "Hong Kong Standard Time"},
  71. }
  72. }
  73. // Locale returns the current translators string locale
  74. func (en *en_IN) Locale() string {
  75. return en.locale
  76. }
  77. // PluralsCardinal returns the list of cardinal plural rules associated with 'en_IN'
  78. func (en *en_IN) PluralsCardinal() []locales.PluralRule {
  79. return en.pluralsCardinal
  80. }
  81. // PluralsOrdinal returns the list of ordinal plural rules associated with 'en_IN'
  82. func (en *en_IN) PluralsOrdinal() []locales.PluralRule {
  83. return en.pluralsOrdinal
  84. }
  85. // PluralsRange returns the list of range plural rules associated with 'en_IN'
  86. func (en *en_IN) PluralsRange() []locales.PluralRule {
  87. return en.pluralsRange
  88. }
  89. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'en_IN'
  90. func (en *en_IN) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
  91. n := math.Abs(num)
  92. i := int64(n)
  93. if i == 1 && v == 0 {
  94. return locales.PluralRuleOne
  95. }
  96. return locales.PluralRuleOther
  97. }
  98. // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'en_IN'
  99. func (en *en_IN) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
  100. n := math.Abs(num)
  101. nMod10 := math.Mod(n, 10)
  102. nMod100 := math.Mod(n, 100)
  103. if nMod10 == 1 && nMod100 != 11 {
  104. return locales.PluralRuleOne
  105. } else if nMod10 == 2 && nMod100 != 12 {
  106. return locales.PluralRuleTwo
  107. } else if nMod10 == 3 && nMod100 != 13 {
  108. return locales.PluralRuleFew
  109. }
  110. return locales.PluralRuleOther
  111. }
  112. // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'en_IN'
  113. func (en *en_IN) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
  114. return locales.PluralRuleOther
  115. }
  116. // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
  117. func (en *en_IN) MonthAbbreviated(month time.Month) string {
  118. return en.monthsAbbreviated[month]
  119. }
  120. // MonthsAbbreviated returns the locales abbreviated months
  121. func (en *en_IN) MonthsAbbreviated() []string {
  122. return en.monthsAbbreviated[1:]
  123. }
  124. // MonthNarrow returns the locales narrow month given the 'month' provided
  125. func (en *en_IN) MonthNarrow(month time.Month) string {
  126. return en.monthsNarrow[month]
  127. }
  128. // MonthsNarrow returns the locales narrow months
  129. func (en *en_IN) MonthsNarrow() []string {
  130. return en.monthsNarrow[1:]
  131. }
  132. // MonthWide returns the locales wide month given the 'month' provided
  133. func (en *en_IN) MonthWide(month time.Month) string {
  134. return en.monthsWide[month]
  135. }
  136. // MonthsWide returns the locales wide months
  137. func (en *en_IN) MonthsWide() []string {
  138. return en.monthsWide[1:]
  139. }
  140. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  141. func (en *en_IN) WeekdayAbbreviated(weekday time.Weekday) string {
  142. return en.daysAbbreviated[weekday]
  143. }
  144. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  145. func (en *en_IN) WeekdaysAbbreviated() []string {
  146. return en.daysAbbreviated
  147. }
  148. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  149. func (en *en_IN) WeekdayNarrow(weekday time.Weekday) string {
  150. return en.daysNarrow[weekday]
  151. }
  152. // WeekdaysNarrow returns the locales narrow weekdays
  153. func (en *en_IN) WeekdaysNarrow() []string {
  154. return en.daysNarrow
  155. }
  156. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  157. func (en *en_IN) WeekdayShort(weekday time.Weekday) string {
  158. return en.daysShort[weekday]
  159. }
  160. // WeekdaysShort returns the locales short weekdays
  161. func (en *en_IN) WeekdaysShort() []string {
  162. return en.daysShort
  163. }
  164. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  165. func (en *en_IN) WeekdayWide(weekday time.Weekday) string {
  166. return en.daysWide[weekday]
  167. }
  168. // WeekdaysWide returns the locales wide weekdays
  169. func (en *en_IN) WeekdaysWide() []string {
  170. return en.daysWide
  171. }
  172. // Decimal returns the decimal point of number
  173. func (en *en_IN) Decimal() string {
  174. return en.decimal
  175. }
  176. // Group returns the group of number
  177. func (en *en_IN) Group() string {
  178. return en.group
  179. }
  180. // Group returns the minus sign of number
  181. func (en *en_IN) Minus() string {
  182. return en.minus
  183. }
  184. // FmtNumber returns 'num' with digits/precision of 'v' for 'en_IN' and handles both Whole and Real numbers based on 'v'
  185. func (en *en_IN) FmtNumber(num float64, v uint64) string {
  186. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  187. l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
  188. count := 0
  189. inWhole := v == 0
  190. inSecondary := false
  191. groupThreshold := 3
  192. b := make([]byte, 0, l)
  193. for i := len(s) - 1; i >= 0; i-- {
  194. if s[i] == '.' {
  195. b = append(b, en.decimal[0])
  196. inWhole = true
  197. continue
  198. }
  199. if inWhole {
  200. if count == groupThreshold {
  201. b = append(b, en.group[0])
  202. count = 1
  203. if !inSecondary {
  204. inSecondary = true
  205. groupThreshold = 2
  206. }
  207. } else {
  208. count++
  209. }
  210. }
  211. b = append(b, s[i])
  212. }
  213. if num < 0 {
  214. b = append(b, en.minus[0])
  215. }
  216. // reverse
  217. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  218. b[i], b[j] = b[j], b[i]
  219. }
  220. return string(b)
  221. }
  222. // FmtPercent returns 'num' with digits/precision of 'v' for 'en_IN' and handles both Whole and Real numbers based on 'v'
  223. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
  224. func (en *en_IN) FmtPercent(num float64, v uint64) string {
  225. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  226. l := len(s) + 3
  227. b := make([]byte, 0, l)
  228. for i := len(s) - 1; i >= 0; i-- {
  229. if s[i] == '.' {
  230. b = append(b, en.decimal[0])
  231. continue
  232. }
  233. b = append(b, s[i])
  234. }
  235. if num < 0 {
  236. b = append(b, en.minus[0])
  237. }
  238. // reverse
  239. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  240. b[i], b[j] = b[j], b[i]
  241. }
  242. b = append(b, en.percent...)
  243. return string(b)
  244. }
  245. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'en_IN'
  246. func (en *en_IN) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  247. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  248. symbol := en.currencies[currency]
  249. l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
  250. count := 0
  251. inWhole := v == 0
  252. inSecondary := false
  253. groupThreshold := 3
  254. b := make([]byte, 0, l)
  255. for i := len(s) - 1; i >= 0; i-- {
  256. if s[i] == '.' {
  257. b = append(b, en.decimal[0])
  258. inWhole = true
  259. continue
  260. }
  261. if inWhole {
  262. if count == groupThreshold {
  263. b = append(b, en.group[0])
  264. count = 1
  265. if !inSecondary {
  266. inSecondary = true
  267. groupThreshold = 2
  268. }
  269. } else {
  270. count++
  271. }
  272. }
  273. b = append(b, s[i])
  274. }
  275. for j := len(symbol) - 1; j >= 0; j-- {
  276. b = append(b, symbol[j])
  277. }
  278. for j := len(en.currencyPositivePrefix) - 1; j >= 0; j-- {
  279. b = append(b, en.currencyPositivePrefix[j])
  280. }
  281. if num < 0 {
  282. b = append(b, en.minus[0])
  283. }
  284. // reverse
  285. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  286. b[i], b[j] = b[j], b[i]
  287. }
  288. if int(v) < 2 {
  289. if v == 0 {
  290. b = append(b, en.decimal...)
  291. }
  292. for i := 0; i < 2-int(v); i++ {
  293. b = append(b, '0')
  294. }
  295. }
  296. return string(b)
  297. }
  298. // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_IN'
  299. // in accounting notation.
  300. func (en *en_IN) FmtAccounting(num float64, v uint64, currency currency.Type) string {
  301. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  302. symbol := en.currencies[currency]
  303. l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
  304. count := 0
  305. inWhole := v == 0
  306. inSecondary := false
  307. groupThreshold := 3
  308. b := make([]byte, 0, l)
  309. for i := len(s) - 1; i >= 0; i-- {
  310. if s[i] == '.' {
  311. b = append(b, en.decimal[0])
  312. inWhole = true
  313. continue
  314. }
  315. if inWhole {
  316. if count == groupThreshold {
  317. b = append(b, en.group[0])
  318. count = 1
  319. if !inSecondary {
  320. inSecondary = true
  321. groupThreshold = 2
  322. }
  323. } else {
  324. count++
  325. }
  326. }
  327. b = append(b, s[i])
  328. }
  329. if num < 0 {
  330. for j := len(symbol) - 1; j >= 0; j-- {
  331. b = append(b, symbol[j])
  332. }
  333. for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
  334. b = append(b, en.currencyNegativePrefix[j])
  335. }
  336. b = append(b, en.minus[0])
  337. } else {
  338. for j := len(symbol) - 1; j >= 0; j-- {
  339. b = append(b, symbol[j])
  340. }
  341. for j := len(en.currencyPositivePrefix) - 1; j >= 0; j-- {
  342. b = append(b, en.currencyPositivePrefix[j])
  343. }
  344. }
  345. // reverse
  346. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  347. b[i], b[j] = b[j], b[i]
  348. }
  349. if int(v) < 2 {
  350. if v == 0 {
  351. b = append(b, en.decimal...)
  352. }
  353. for i := 0; i < 2-int(v); i++ {
  354. b = append(b, '0')
  355. }
  356. }
  357. return string(b)
  358. }
  359. // FmtDateShort returns the short date representation of 't' for 'en_IN'
  360. func (en *en_IN) FmtDateShort(t time.Time) string {
  361. b := make([]byte, 0, 32)
  362. if t.Day() < 10 {
  363. b = append(b, '0')
  364. }
  365. b = strconv.AppendInt(b, int64(t.Day()), 10)
  366. b = append(b, []byte{0x2f}...)
  367. if t.Month() < 10 {
  368. b = append(b, '0')
  369. }
  370. b = strconv.AppendInt(b, int64(t.Month()), 10)
  371. b = append(b, []byte{0x2f}...)
  372. if t.Year() > 9 {
  373. b = append(b, strconv.Itoa(t.Year())[2:]...)
  374. } else {
  375. b = append(b, strconv.Itoa(t.Year())[1:]...)
  376. }
  377. return string(b)
  378. }
  379. // FmtDateMedium returns the medium date representation of 't' for 'en_IN'
  380. func (en *en_IN) FmtDateMedium(t time.Time) string {
  381. b := make([]byte, 0, 32)
  382. if t.Day() < 10 {
  383. b = append(b, '0')
  384. }
  385. b = strconv.AppendInt(b, int64(t.Day()), 10)
  386. b = append(b, []byte{0x2d}...)
  387. b = append(b, en.monthsAbbreviated[t.Month()]...)
  388. b = append(b, []byte{0x2d}...)
  389. if t.Year() > 0 {
  390. b = strconv.AppendInt(b, int64(t.Year()), 10)
  391. } else {
  392. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  393. }
  394. return string(b)
  395. }
  396. // FmtDateLong returns the long date representation of 't' for 'en_IN'
  397. func (en *en_IN) FmtDateLong(t time.Time) string {
  398. b := make([]byte, 0, 32)
  399. b = strconv.AppendInt(b, int64(t.Day()), 10)
  400. b = append(b, []byte{0x20}...)
  401. b = append(b, en.monthsWide[t.Month()]...)
  402. b = append(b, []byte{0x20}...)
  403. if t.Year() > 0 {
  404. b = strconv.AppendInt(b, int64(t.Year()), 10)
  405. } else {
  406. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  407. }
  408. return string(b)
  409. }
  410. // FmtDateFull returns the full date representation of 't' for 'en_IN'
  411. func (en *en_IN) FmtDateFull(t time.Time) string {
  412. b := make([]byte, 0, 32)
  413. b = append(b, en.daysWide[t.Weekday()]...)
  414. b = append(b, []byte{0x2c, 0x20}...)
  415. b = strconv.AppendInt(b, int64(t.Day()), 10)
  416. b = append(b, []byte{0x20}...)
  417. b = append(b, en.monthsWide[t.Month()]...)
  418. b = append(b, []byte{0x2c, 0x20}...)
  419. if t.Year() > 0 {
  420. b = strconv.AppendInt(b, int64(t.Year()), 10)
  421. } else {
  422. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  423. }
  424. return string(b)
  425. }
  426. // FmtTimeShort returns the short time representation of 't' for 'en_IN'
  427. func (en *en_IN) FmtTimeShort(t time.Time) string {
  428. b := make([]byte, 0, 32)
  429. h := t.Hour()
  430. if h > 12 {
  431. h -= 12
  432. }
  433. b = strconv.AppendInt(b, int64(h), 10)
  434. b = append(b, en.timeSeparator...)
  435. if t.Minute() < 10 {
  436. b = append(b, '0')
  437. }
  438. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  439. b = append(b, []byte{0x20}...)
  440. if t.Hour() < 12 {
  441. b = append(b, en.periodsAbbreviated[0]...)
  442. } else {
  443. b = append(b, en.periodsAbbreviated[1]...)
  444. }
  445. return string(b)
  446. }
  447. // FmtTimeMedium returns the medium time representation of 't' for 'en_IN'
  448. func (en *en_IN) FmtTimeMedium(t time.Time) string {
  449. b := make([]byte, 0, 32)
  450. h := t.Hour()
  451. if h > 12 {
  452. h -= 12
  453. }
  454. b = strconv.AppendInt(b, int64(h), 10)
  455. b = append(b, en.timeSeparator...)
  456. if t.Minute() < 10 {
  457. b = append(b, '0')
  458. }
  459. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  460. b = append(b, en.timeSeparator...)
  461. if t.Second() < 10 {
  462. b = append(b, '0')
  463. }
  464. b = strconv.AppendInt(b, int64(t.Second()), 10)
  465. b = append(b, []byte{0x20}...)
  466. if t.Hour() < 12 {
  467. b = append(b, en.periodsAbbreviated[0]...)
  468. } else {
  469. b = append(b, en.periodsAbbreviated[1]...)
  470. }
  471. return string(b)
  472. }
  473. // FmtTimeLong returns the long time representation of 't' for 'en_IN'
  474. func (en *en_IN) FmtTimeLong(t time.Time) string {
  475. b := make([]byte, 0, 32)
  476. h := t.Hour()
  477. if h > 12 {
  478. h -= 12
  479. }
  480. b = strconv.AppendInt(b, int64(h), 10)
  481. b = append(b, en.timeSeparator...)
  482. if t.Minute() < 10 {
  483. b = append(b, '0')
  484. }
  485. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  486. b = append(b, en.timeSeparator...)
  487. if t.Second() < 10 {
  488. b = append(b, '0')
  489. }
  490. b = strconv.AppendInt(b, int64(t.Second()), 10)
  491. b = append(b, []byte{0x20}...)
  492. if t.Hour() < 12 {
  493. b = append(b, en.periodsAbbreviated[0]...)
  494. } else {
  495. b = append(b, en.periodsAbbreviated[1]...)
  496. }
  497. b = append(b, []byte{0x20}...)
  498. tz, _ := t.Zone()
  499. b = append(b, tz...)
  500. return string(b)
  501. }
  502. // FmtTimeFull returns the full time representation of 't' for 'en_IN'
  503. func (en *en_IN) FmtTimeFull(t time.Time) string {
  504. b := make([]byte, 0, 32)
  505. h := t.Hour()
  506. if h > 12 {
  507. h -= 12
  508. }
  509. b = strconv.AppendInt(b, int64(h), 10)
  510. b = append(b, en.timeSeparator...)
  511. if t.Minute() < 10 {
  512. b = append(b, '0')
  513. }
  514. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  515. b = append(b, en.timeSeparator...)
  516. if t.Second() < 10 {
  517. b = append(b, '0')
  518. }
  519. b = strconv.AppendInt(b, int64(t.Second()), 10)
  520. b = append(b, []byte{0x20}...)
  521. if t.Hour() < 12 {
  522. b = append(b, en.periodsAbbreviated[0]...)
  523. } else {
  524. b = append(b, en.periodsAbbreviated[1]...)
  525. }
  526. b = append(b, []byte{0x20}...)
  527. tz, _ := t.Zone()
  528. if btz, ok := en.timezones[tz]; ok {
  529. b = append(b, btz...)
  530. } else {
  531. b = append(b, tz...)
  532. }
  533. return string(b)
  534. }