1package ks_IN 2 3import ( 4 "math" 5 "strconv" 6 "time" 7 8 "github.com/gohugoio/locales" 9 "github.com/gohugoio/locales/currency" 10) 11 12type ks_IN struct { 13 locale string 14 pluralsCardinal []locales.PluralRule 15 pluralsOrdinal []locales.PluralRule 16 pluralsRange []locales.PluralRule 17 decimal string 18 group string 19 minus string 20 percent string 21 perMille string 22 timeSeparator string 23 inifinity string 24 currencies []string // idx = enum of currency code 25 currencyPositivePrefix string 26 currencyNegativePrefix string 27 monthsAbbreviated []string 28 monthsNarrow []string 29 monthsWide []string 30 daysAbbreviated []string 31 daysNarrow []string 32 daysShort []string 33 daysWide []string 34 periodsAbbreviated []string 35 periodsNarrow []string 36 periodsShort []string 37 periodsWide []string 38 erasAbbreviated []string 39 erasNarrow []string 40 erasWide []string 41 timezones map[string]string 42} 43 44// New returns a new instance of translator for the 'ks_IN' locale 45func New() locales.Translator { 46 return &ks_IN{ 47 locale: "ks_IN", 48 pluralsCardinal: []locales.PluralRule{2, 6}, 49 pluralsOrdinal: nil, 50 pluralsRange: nil, 51 timeSeparator: ":", 52 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", "MRU", "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", "UYW", "UZS", "VEB", "VEF", "VES", "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"}, 53 currencyPositivePrefix: " ", 54 currencyNegativePrefix: " ", 55 monthsNarrow: []string{"", "ج", "ف", "م", "ا", "م", "ج", "ج", "ا", "س", "س", "ا", "ن"}, 56 monthsWide: []string{"", "جنؤری", "فرؤری", "مارٕچ", "اپریل", "میٔ", "جوٗن", "جوٗلایی", "اگست", "ستمبر", "اکتوٗبر", "نومبر", "دسمبر"}, 57 daysAbbreviated: []string{"آتھوار", "ژٔندٕروار", "بۆموار", "بودوار", "برؠسوار", "جُمہ", "بٹوار"}, 58 daysNarrow: []string{"ا", "ژ", "ب", "ب", "ب", "ج", "ب"}, 59 daysWide: []string{"اَتھوار", "ژٔندرٕروار", "بۆموار", "بودوار", "برؠسوار", "جُمہ", "بٹوار"}, 60 erasAbbreviated: []string{"بی سی", "اے ڈی"}, 61 erasNarrow: []string{"", ""}, 62 erasWide: []string{"قبٕل مسیٖح", "عیٖسوی سنہٕ"}, 63 timezones: map[string]string{"ACDT": "آسٹریلِیَن مرکزی ڈےلایِٔٹ ٹایِم", "ACST": "آسٹریلِیَن مرکزی سٹینڑاڑ ٹایِم", "ACWDT": "آسٹریلِیَن مرکزی مغربی ڈےلایِٔٹ ٹایِم", "ACWST": "آسٹریلِیَن مرکزی مغربی سٹینڑاڑ ٹایِم", "ADT": "اؠٹلانٹِک ڈےلایِٔٹ ٹایِم", "AEDT": "آسٹریلِیَن مشرقی ڈےلایِٔٹ ٹایِم", "AEST": "آسٹریلِیَن مشرقی سٹینڑاڑ ٹایِم", "AKDT": "اؠلاسکا ڈےلایِٔٹ ٹایِم", "AKST": "اؠلاسکا سٹینڑاڑ ٹایِم", "ARST": "ارجؠنٹیٖنا سَمَر ٹایِم", "ART": "ارجؠنٹیٖنا سٹینڑاڑ ٹایِم", "AST": "اؠٹلانٹِک سٹینڑاڑ ٹایِم", "AWDT": "آسٹریلِیَن مغرِبیٖ ڈےلایٔٹ ٹایِم", "AWST": "آسٹریلِیَن مغرِبی سٹینڑاڑ ٹایِم", "BOT": "بولِوِیا ٹایِم", "BT": "بوٗٹان ٹایِم", "CAT": "مرکزی افریٖقا ٹایِم", "CDT": "مرکزی ڈےلایِٔٹ ٹایِم", "CHADT": "چؠتھَم سَمَر ٹایِم", "CHAST": "کؠتھَم سٹینڑاڑ ٹایِم", "CLST": "چِلی سَمَر ٹایِم", "CLT": "چِلی سٹینڑاڑ ٹایِم", "COST": "کولومبِیا سَمَر ٹایِم", "COT": "کولومبِیا سٹینڑاڑ ٹایِم", "CST": "مرکزی سٹینڑاڑ ٹایِم", "ChST": "کؠمورو سٹینڑاڑ ٹایِم", "EAT": "مشرقی افریٖقا ٹایِم", "ECT": "اِکویڑَر ٹایِم", "EDT": "مشرقی ڈےلایِٔٹ ٹایِم", "EST": "مشرقی سٹینڑاڑ ٹایِم", "GFT": "فرؠنچ گیوٗؠنا ٹایِم", "GMT": "گریٖن وِچ میٖن ٹایِم", "GST": "گَلف سٹینڑاڑ ٹایِم", "GYT": "گُیَنا ٹایِم", "HADT": "حَواے اؠلیوٗٹِیَن سَمَر ٹایِم", "HAST": "حَواے اؠلیوٗٹِیَن سٹینڑاڑ ٹایِم", "HAT": "نیوٗ فاونڑ لینڑ ڑےلایِٔٹ ٹایِم", "HECU": "کیوٗبا ڈےلایِٔٹ ٹایِم", "HEEG": "مشرِقی گریٖن لینڑُک سَمَر ٹایِم", "HENOMX": "HENOMX", "HEOG": "مغرِبی گریٖن لینڑُک سَمَر ٹایِم", "HEPM": "سینٹ پَیری مِقیوٗلَن ڑےلایِٔٹ ٹایِم", "HEPMX": "HEPMX", "HKST": "حانگ کانگ سَمَر ٹایِم", "HKT": "حانگ کانگ سٹینڑاڑ ٹایِم", "HNCU": "کیوٗبا سٹینڑاڑ ٹایِم", "HNEG": "مشرِقی گریٖن لینڑُک سٹینڑاڑ ٹایِم", "HNNOMX": "HNNOMX", "HNOG": "مغرِبی گریٖن لینڑُک سٹینڑاڑ ٹایِم", "HNPM": "سینٹ پَیری مِقیوٗلَن سٹینڑاڑ ٹایِم", "HNPMX": "HNPMX", "HNT": "نیوٗ فاونڑلینڑ سٹینڑاڑ ٹایِم", "IST": "ہِندوستان", "JDT": "جاپٲنۍ ڑےلایِٔٹ ٹایِم", "JST": "جاپٲنۍ سٹینڑاڑ ٹایِم", "LHDT": "لعاڑ ڑےلایٔٹ ٹایِم", "LHST": "لعاڑ حووے سٹینڑاڑ ٹایِم", "MDT": "ماونٹین ڈےلایِٔٹ ٹایِم", "MESZ": "مرکزی یوٗرپی سَمَر ٹایِم", "MEZ": "مرکزی یوٗرپی سٹینڑاڑ ٹایِم", "MST": "ماونٹین سٹینڑاڑ ٹایِم", "MYT": "مَلیشِیا ٹایِم", "NZDT": "نِوزِلینڑ ڑےلایٔٹ ٹایِم", "NZST": "نِوزِلینڑ سٹینڑاڑ ٹایِم", "OESZ": "مشرقی یوٗرپی سَمَر ٹایِم", "OEZ": "مشرقی یوٗرپی سٹینڑاڑ ٹایِم", "PDT": "پیسِفِک ڈےلایِٔٹ ٹایِم", "PST": "پیسِفِک سٹینڑاڑ ٹایِم", "SAST": "جنوٗبی افریقا ٹایِم", "SGT": "سِنگاپوٗر ٹایِم", "SRT": "سُرِنام ٹایِم", "TMST": "تُرکمؠنِستان سَمَر ٹایِم", "TMT": "تُرکمؠنِستان سٹینڑاڑ ٹایِم", "UYST": "یوٗرؠگوَے سَمَر ٹایِم", "UYT": "یوٗرؠگوَے سٹینڑاڑ ٹایِم", "VET": "وؠنؠزیوٗلا ٹایِم", "WARST": "مغربی ارجؠنٹیٖنا سَمَر ٹایِم", "WART": "مغربی ارجؠنٹیٖنا سٹینڑاڑ ٹایِم", "WAST": "مغربی افریٖقا سَمَر ٹایِم", "WAT": "مغربی افریٖقا سٹینڑاڑ ٹایِم", "WESZ": "مغرِبی یوٗرِپی سَمَر ٹایِم", "WEZ": "مغرِبی یوٗرپی سٹینڑاڑ ٹایِم", "WIB": "مغرِبی اِنڑونیشِیا ٹایِم", "WIT": "مشرِقی اِنڑونیشِیا ٹایِم", "WITA": "مرکزی اِنڑونیشِیا ٹایِم", "∅∅∅": "اؠزورٕس سَمَر ٹ"}, 64 } 65} 66 67// Locale returns the current translators string locale 68func (ks *ks_IN) Locale() string { 69 return ks.locale 70} 71 72// PluralsCardinal returns the list of cardinal plural rules associated with 'ks_IN' 73func (ks *ks_IN) PluralsCardinal() []locales.PluralRule { 74 return ks.pluralsCardinal 75} 76 77// PluralsOrdinal returns the list of ordinal plural rules associated with 'ks_IN' 78func (ks *ks_IN) PluralsOrdinal() []locales.PluralRule { 79 return ks.pluralsOrdinal 80} 81 82// PluralsRange returns the list of range plural rules associated with 'ks_IN' 83func (ks *ks_IN) PluralsRange() []locales.PluralRule { 84 return ks.pluralsRange 85} 86 87// CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'ks_IN' 88func (ks *ks_IN) CardinalPluralRule(num float64, v uint64) locales.PluralRule { 89 90 n := math.Abs(num) 91 92 if n == 1 { 93 return locales.PluralRuleOne 94 } 95 96 return locales.PluralRuleOther 97} 98 99// OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'ks_IN' 100func (ks *ks_IN) OrdinalPluralRule(num float64, v uint64) locales.PluralRule { 101 return locales.PluralRuleUnknown 102} 103 104// RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'ks_IN' 105func (ks *ks_IN) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule { 106 return locales.PluralRuleUnknown 107} 108 109// MonthAbbreviated returns the locales abbreviated month given the 'month' provided 110func (ks *ks_IN) MonthAbbreviated(month time.Month) string { 111 return ks.monthsAbbreviated[month] 112} 113 114// MonthsAbbreviated returns the locales abbreviated months 115func (ks *ks_IN) MonthsAbbreviated() []string { 116 return nil 117} 118 119// MonthNarrow returns the locales narrow month given the 'month' provided 120func (ks *ks_IN) MonthNarrow(month time.Month) string { 121 return ks.monthsNarrow[month] 122} 123 124// MonthsNarrow returns the locales narrow months 125func (ks *ks_IN) MonthsNarrow() []string { 126 return ks.monthsNarrow[1:] 127} 128 129// MonthWide returns the locales wide month given the 'month' provided 130func (ks *ks_IN) MonthWide(month time.Month) string { 131 return ks.monthsWide[month] 132} 133 134// MonthsWide returns the locales wide months 135func (ks *ks_IN) MonthsWide() []string { 136 return ks.monthsWide[1:] 137} 138 139// WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided 140func (ks *ks_IN) WeekdayAbbreviated(weekday time.Weekday) string { 141 return ks.daysAbbreviated[weekday] 142} 143 144// WeekdaysAbbreviated returns the locales abbreviated weekdays 145func (ks *ks_IN) WeekdaysAbbreviated() []string { 146 return ks.daysAbbreviated 147} 148 149// WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided 150func (ks *ks_IN) WeekdayNarrow(weekday time.Weekday) string { 151 return ks.daysNarrow[weekday] 152} 153 154// WeekdaysNarrow returns the locales narrow weekdays 155func (ks *ks_IN) WeekdaysNarrow() []string { 156 return ks.daysNarrow 157} 158 159// WeekdayShort returns the locales short weekday given the 'weekday' provided 160func (ks *ks_IN) WeekdayShort(weekday time.Weekday) string { 161 return ks.daysShort[weekday] 162} 163 164// WeekdaysShort returns the locales short weekdays 165func (ks *ks_IN) WeekdaysShort() []string { 166 return ks.daysShort 167} 168 169// WeekdayWide returns the locales wide weekday given the 'weekday' provided 170func (ks *ks_IN) WeekdayWide(weekday time.Weekday) string { 171 return ks.daysWide[weekday] 172} 173 174// WeekdaysWide returns the locales wide weekdays 175func (ks *ks_IN) WeekdaysWide() []string { 176 return ks.daysWide 177} 178 179// Decimal returns the decimal point of number 180func (ks *ks_IN) Decimal() string { 181 return ks.decimal 182} 183 184// Group returns the group of number 185func (ks *ks_IN) Group() string { 186 return ks.group 187} 188 189// Group returns the minus sign of number 190func (ks *ks_IN) Minus() string { 191 return ks.minus 192} 193 194// FmtNumber returns 'num' with digits/precision of 'v' for 'ks_IN' and handles both Whole and Real numbers based on 'v' 195func (ks *ks_IN) FmtNumber(num float64, v uint64) string { 196 197 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64) 198 l := len(s) + 0 199 count := 0 200 inWhole := v == 0 201 inSecondary := false 202 groupThreshold := 3 203 204 b := make([]byte, 0, l) 205 206 for i := len(s) - 1; i >= 0; i-- { 207 208 if s[i] == '.' { 209 b = append(b, ks.decimal[0]) 210 inWhole = true 211 continue 212 } 213 214 if inWhole { 215 216 if count == groupThreshold { 217 b = append(b, ks.group[0]) 218 count = 1 219 220 if !inSecondary { 221 inSecondary = true 222 groupThreshold = 2 223 } 224 } else { 225 count++ 226 } 227 } 228 229 b = append(b, s[i]) 230 } 231 232 if num < 0 { 233 b = append(b, ks.minus[0]) 234 } 235 236 // reverse 237 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 { 238 b[i], b[j] = b[j], b[i] 239 } 240 241 return string(b) 242} 243 244// FmtPercent returns 'num' with digits/precision of 'v' for 'ks_IN' and handles both Whole and Real numbers based on 'v' 245// NOTE: 'num' passed into FmtPercent is assumed to be in percent already 246func (ks *ks_IN) FmtPercent(num float64, v uint64) string { 247 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64) 248 l := len(s) + 0 249 b := make([]byte, 0, l) 250 251 for i := len(s) - 1; i >= 0; i-- { 252 253 if s[i] == '.' { 254 b = append(b, ks.decimal[0]) 255 continue 256 } 257 258 b = append(b, s[i]) 259 } 260 261 if num < 0 { 262 b = append(b, ks.minus[0]) 263 } 264 265 // reverse 266 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 { 267 b[i], b[j] = b[j], b[i] 268 } 269 270 b = append(b, ks.percent...) 271 272 return string(b) 273} 274 275// FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'ks_IN' 276func (ks *ks_IN) FmtCurrency(num float64, v uint64, currency currency.Type) string { 277 278 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64) 279 symbol := ks.currencies[currency] 280 l := len(s) + len(symbol) + 2 281 count := 0 282 inWhole := v == 0 283 inSecondary := false 284 groupThreshold := 3 285 286 b := make([]byte, 0, l) 287 288 for i := len(s) - 1; i >= 0; i-- { 289 290 if s[i] == '.' { 291 b = append(b, ks.decimal[0]) 292 inWhole = true 293 continue 294 } 295 296 if inWhole { 297 298 if count == groupThreshold { 299 b = append(b, ks.group[0]) 300 count = 1 301 302 if !inSecondary { 303 inSecondary = true 304 groupThreshold = 2 305 } 306 } else { 307 count++ 308 } 309 } 310 311 b = append(b, s[i]) 312 } 313 314 for j := len(symbol) - 1; j >= 0; j-- { 315 b = append(b, symbol[j]) 316 } 317 318 for j := len(ks.currencyPositivePrefix) - 1; j >= 0; j-- { 319 b = append(b, ks.currencyPositivePrefix[j]) 320 } 321 322 if num < 0 { 323 b = append(b, ks.minus[0]) 324 } 325 326 // reverse 327 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 { 328 b[i], b[j] = b[j], b[i] 329 } 330 331 if int(v) < 2 { 332 333 if v == 0 { 334 b = append(b, ks.decimal...) 335 } 336 337 for i := 0; i < 2-int(v); i++ { 338 b = append(b, '0') 339 } 340 } 341 342 return string(b) 343} 344 345// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ks_IN' 346// in accounting notation. 347func (ks *ks_IN) FmtAccounting(num float64, v uint64, currency currency.Type) string { 348 349 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64) 350 symbol := ks.currencies[currency] 351 l := len(s) + len(symbol) + 2 352 count := 0 353 inWhole := v == 0 354 inSecondary := false 355 groupThreshold := 3 356 357 b := make([]byte, 0, l) 358 359 for i := len(s) - 1; i >= 0; i-- { 360 361 if s[i] == '.' { 362 b = append(b, ks.decimal[0]) 363 inWhole = true 364 continue 365 } 366 367 if inWhole { 368 369 if count == groupThreshold { 370 b = append(b, ks.group[0]) 371 count = 1 372 373 if !inSecondary { 374 inSecondary = true 375 groupThreshold = 2 376 } 377 } else { 378 count++ 379 } 380 } 381 382 b = append(b, s[i]) 383 } 384 385 if num < 0 { 386 387 for j := len(symbol) - 1; j >= 0; j-- { 388 b = append(b, symbol[j]) 389 } 390 391 for j := len(ks.currencyNegativePrefix) - 1; j >= 0; j-- { 392 b = append(b, ks.currencyNegativePrefix[j]) 393 } 394 395 b = append(b, ks.minus[0]) 396 397 } else { 398 399 for j := len(symbol) - 1; j >= 0; j-- { 400 b = append(b, symbol[j]) 401 } 402 403 for j := len(ks.currencyPositivePrefix) - 1; j >= 0; j-- { 404 b = append(b, ks.currencyPositivePrefix[j]) 405 } 406 407 } 408 409 // reverse 410 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 { 411 b[i], b[j] = b[j], b[i] 412 } 413 414 if int(v) < 2 { 415 416 if v == 0 { 417 b = append(b, ks.decimal...) 418 } 419 420 for i := 0; i < 2-int(v); i++ { 421 b = append(b, '0') 422 } 423 } 424 425 return string(b) 426} 427 428// FmtDateShort returns the short date representation of 't' for 'ks_IN' 429func (ks *ks_IN) FmtDateShort(t time.Time) string { 430 431 b := make([]byte, 0, 32) 432 433 b = strconv.AppendInt(b, int64(t.Month()), 10) 434 b = append(b, []byte{0x2f}...) 435 b = strconv.AppendInt(b, int64(t.Day()), 10) 436 b = append(b, []byte{0x2f}...) 437 438 if t.Year() > 9 { 439 b = append(b, strconv.Itoa(t.Year())[2:]...) 440 } else { 441 b = append(b, strconv.Itoa(t.Year())[1:]...) 442 } 443 444 return string(b) 445} 446 447// FmtDateMedium returns the medium date representation of 't' for 'ks_IN' 448func (ks *ks_IN) FmtDateMedium(t time.Time) string { 449 450 b := make([]byte, 0, 32) 451 452 b = append(b, ks.monthsAbbreviated[t.Month()]...) 453 b = append(b, []byte{0x20}...) 454 b = strconv.AppendInt(b, int64(t.Day()), 10) 455 b = append(b, []byte{0x2c, 0x20}...) 456 457 if t.Year() > 0 { 458 b = strconv.AppendInt(b, int64(t.Year()), 10) 459 } else { 460 b = strconv.AppendInt(b, int64(-t.Year()), 10) 461 } 462 463 return string(b) 464} 465 466// FmtDateLong returns the long date representation of 't' for 'ks_IN' 467func (ks *ks_IN) FmtDateLong(t time.Time) string { 468 469 b := make([]byte, 0, 32) 470 471 b = append(b, ks.monthsWide[t.Month()]...) 472 b = append(b, []byte{0x20}...) 473 b = strconv.AppendInt(b, int64(t.Day()), 10) 474 b = append(b, []byte{0x2c, 0x20}...) 475 476 if t.Year() > 0 { 477 b = strconv.AppendInt(b, int64(t.Year()), 10) 478 } else { 479 b = strconv.AppendInt(b, int64(-t.Year()), 10) 480 } 481 482 return string(b) 483} 484 485// FmtDateFull returns the full date representation of 't' for 'ks_IN' 486func (ks *ks_IN) FmtDateFull(t time.Time) string { 487 488 b := make([]byte, 0, 32) 489 490 b = append(b, ks.daysWide[t.Weekday()]...) 491 b = append(b, []byte{0x2c, 0x20}...) 492 b = append(b, ks.monthsWide[t.Month()]...) 493 b = append(b, []byte{0x20}...) 494 b = strconv.AppendInt(b, int64(t.Day()), 10) 495 b = append(b, []byte{0x2c, 0x20}...) 496 497 if t.Year() > 0 { 498 b = strconv.AppendInt(b, int64(t.Year()), 10) 499 } else { 500 b = strconv.AppendInt(b, int64(-t.Year()), 10) 501 } 502 503 return string(b) 504} 505 506// FmtTimeShort returns the short time representation of 't' for 'ks_IN' 507func (ks *ks_IN) FmtTimeShort(t time.Time) string { 508 509 b := make([]byte, 0, 32) 510 511 h := t.Hour() 512 513 if h > 12 { 514 h -= 12 515 } 516 517 b = strconv.AppendInt(b, int64(h), 10) 518 b = append(b, ks.timeSeparator...) 519 520 if t.Minute() < 10 { 521 b = append(b, '0') 522 } 523 524 b = strconv.AppendInt(b, int64(t.Minute()), 10) 525 b = append(b, []byte{0x20}...) 526 527 if t.Hour() < 12 { 528 b = append(b, ks.periodsAbbreviated[0]...) 529 } else { 530 b = append(b, ks.periodsAbbreviated[1]...) 531 } 532 533 return string(b) 534} 535 536// FmtTimeMedium returns the medium time representation of 't' for 'ks_IN' 537func (ks *ks_IN) FmtTimeMedium(t time.Time) string { 538 539 b := make([]byte, 0, 32) 540 541 h := t.Hour() 542 543 if h > 12 { 544 h -= 12 545 } 546 547 b = strconv.AppendInt(b, int64(h), 10) 548 b = append(b, ks.timeSeparator...) 549 550 if t.Minute() < 10 { 551 b = append(b, '0') 552 } 553 554 b = strconv.AppendInt(b, int64(t.Minute()), 10) 555 b = append(b, ks.timeSeparator...) 556 557 if t.Second() < 10 { 558 b = append(b, '0') 559 } 560 561 b = strconv.AppendInt(b, int64(t.Second()), 10) 562 b = append(b, []byte{0x20}...) 563 564 if t.Hour() < 12 { 565 b = append(b, ks.periodsAbbreviated[0]...) 566 } else { 567 b = append(b, ks.periodsAbbreviated[1]...) 568 } 569 570 return string(b) 571} 572 573// FmtTimeLong returns the long time representation of 't' for 'ks_IN' 574func (ks *ks_IN) FmtTimeLong(t time.Time) string { 575 576 b := make([]byte, 0, 32) 577 578 h := t.Hour() 579 580 if h > 12 { 581 h -= 12 582 } 583 584 b = strconv.AppendInt(b, int64(h), 10) 585 b = append(b, ks.timeSeparator...) 586 587 if t.Minute() < 10 { 588 b = append(b, '0') 589 } 590 591 b = strconv.AppendInt(b, int64(t.Minute()), 10) 592 b = append(b, ks.timeSeparator...) 593 594 if t.Second() < 10 { 595 b = append(b, '0') 596 } 597 598 b = strconv.AppendInt(b, int64(t.Second()), 10) 599 b = append(b, []byte{0x20}...) 600 601 if t.Hour() < 12 { 602 b = append(b, ks.periodsAbbreviated[0]...) 603 } else { 604 b = append(b, ks.periodsAbbreviated[1]...) 605 } 606 607 b = append(b, []byte{0x20}...) 608 609 tz, _ := t.Zone() 610 b = append(b, tz...) 611 612 return string(b) 613} 614 615// FmtTimeFull returns the full time representation of 't' for 'ks_IN' 616func (ks *ks_IN) FmtTimeFull(t time.Time) string { 617 618 b := make([]byte, 0, 32) 619 620 h := t.Hour() 621 622 if h > 12 { 623 h -= 12 624 } 625 626 b = strconv.AppendInt(b, int64(h), 10) 627 b = append(b, ks.timeSeparator...) 628 629 if t.Minute() < 10 { 630 b = append(b, '0') 631 } 632 633 b = strconv.AppendInt(b, int64(t.Minute()), 10) 634 b = append(b, ks.timeSeparator...) 635 636 if t.Second() < 10 { 637 b = append(b, '0') 638 } 639 640 b = strconv.AppendInt(b, int64(t.Second()), 10) 641 b = append(b, []byte{0x20}...) 642 643 if t.Hour() < 12 { 644 b = append(b, ks.periodsAbbreviated[0]...) 645 } else { 646 b = append(b, ks.periodsAbbreviated[1]...) 647 } 648 649 b = append(b, []byte{0x20}...) 650 651 tz, _ := t.Zone() 652 653 if btz, ok := ks.timezones[tz]; ok { 654 b = append(b, btz...) 655 } else { 656 b = append(b, tz...) 657 } 658 659 return string(b) 660} 661