1package gu_IN 2 3import ( 4 "math" 5 "strconv" 6 "time" 7 8 "github.com/gohugoio/locales" 9 "github.com/gohugoio/locales/currency" 10) 11 12type gu_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 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 42// New returns a new instance of translator for the 'gu_IN' locale 43func New() locales.Translator { 44 return &gu_IN{ 45 locale: "gu_IN", 46 pluralsCardinal: []locales.PluralRule{2, 6}, 47 pluralsOrdinal: []locales.PluralRule{2, 3, 4, 5, 6}, 48 pluralsRange: []locales.PluralRule{2, 6}, 49 decimal: ".", 50 group: ",", 51 minus: "-", 52 percent: "%", 53 perMille: "‰", 54 timeSeparator: ":", 55 inifinity: "∞", 56 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"}, 57 monthsAbbreviated: []string{"", "જાન્યુ", "ફેબ્રુ", "માર્ચ", "એપ્રિલ", "મે", "જૂન", "જુલાઈ", "ઑગસ્ટ", "સપ્ટે", "ઑક્ટો", "નવે", "ડિસે"}, 58 monthsNarrow: []string{"", "જા", "ફે", "મા", "એ", "મે", "જૂ", "જુ", "ઑ", "સ", "ઑ", "ન", "ડિ"}, 59 monthsWide: []string{"", "જાન્યુઆરી", "ફેબ્રુઆરી", "માર્ચ", "એપ્રિલ", "મે", "જૂન", "જુલાઈ", "ઑગસ્ટ", "સપ્ટેમ્બર", "ઑક્ટોબર", "નવેમ્બર", "ડિસેમ્બર"}, 60 daysAbbreviated: []string{"રવિ", "સોમ", "મંગળ", "બુધ", "ગુરુ", "શુક્ર", "શનિ"}, 61 daysNarrow: []string{"ર", "સો", "મં", "બુ", "ગુ", "શુ", "શ"}, 62 daysShort: []string{"ર", "સો", "મં", "બુ", "ગુ", "શુ", "શ"}, 63 daysWide: []string{"રવિવાર", "સોમવાર", "મંગળવાર", "બુધવાર", "ગુરુવાર", "શુક્રવાર", "શનિવાર"}, 64 periodsAbbreviated: []string{"AM", "PM"}, 65 periodsNarrow: []string{"AM", "PM"}, 66 periodsWide: []string{"AM", "PM"}, 67 erasAbbreviated: []string{"ઈ.સ.પૂર્વે", "ઈ.સ."}, 68 erasNarrow: []string{"ઇ સ પુ", "ઇસ"}, 69 erasWide: []string{"ઈસવીસન પૂર્વે", "ઇસવીસન"}, 70 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": "ઉત્તરપશ્ચિમ મેક્સિકો દિવસ સમય", "HEOG": "પશ્ચિમ ગ્રીનલેન્ડ ગ્રીષ્મ સમય", "HEPM": "સેંટ પીએરી અને મિક્યુલોન દિવસ સમય", "HEPMX": "મેક્સિકન પેસિફિક દિવસ સમય", "HKST": "હોંગ કોંગ ગ્રીષ્મ સમય", "HKT": "હોંગ કોંગ માનક સમય", "HNCU": "ક્યુબા માનક સમય", "HNEG": "પૂર્વ ગ્રીનલેન્ડ માનક સમય", "HNNOMX": "ઉત્તરપશ્ચિમ મેક્સિકો માનક સમય", "HNOG": "પશ્ચિમ ગ્રીનલેન્ડ માનક સમય", "HNPM": "સેંટ પીએરી અને મિક્યુલોન માનક સમય", "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": "મધ્ય ઇન્ડોનેશિયા સમય", "∅∅∅": "એઝોર્સ ગ્રીષ્મ સમય"}, 71 } 72} 73 74// Locale returns the current translators string locale 75func (gu *gu_IN) Locale() string { 76 return gu.locale 77} 78 79// PluralsCardinal returns the list of cardinal plural rules associated with 'gu_IN' 80func (gu *gu_IN) PluralsCardinal() []locales.PluralRule { 81 return gu.pluralsCardinal 82} 83 84// PluralsOrdinal returns the list of ordinal plural rules associated with 'gu_IN' 85func (gu *gu_IN) PluralsOrdinal() []locales.PluralRule { 86 return gu.pluralsOrdinal 87} 88 89// PluralsRange returns the list of range plural rules associated with 'gu_IN' 90func (gu *gu_IN) PluralsRange() []locales.PluralRule { 91 return gu.pluralsRange 92} 93 94// CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'gu_IN' 95func (gu *gu_IN) CardinalPluralRule(num float64, v uint64) locales.PluralRule { 96 97 n := math.Abs(num) 98 i := int64(n) 99 100 if (i == 0) || (n == 1) { 101 return locales.PluralRuleOne 102 } 103 104 return locales.PluralRuleOther 105} 106 107// OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'gu_IN' 108func (gu *gu_IN) OrdinalPluralRule(num float64, v uint64) locales.PluralRule { 109 110 n := math.Abs(num) 111 112 if n == 1 { 113 return locales.PluralRuleOne 114 } else if n == 2 || n == 3 { 115 return locales.PluralRuleTwo 116 } else if n == 4 { 117 return locales.PluralRuleFew 118 } else if n == 6 { 119 return locales.PluralRuleMany 120 } 121 122 return locales.PluralRuleOther 123} 124 125// RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'gu_IN' 126func (gu *gu_IN) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule { 127 128 start := gu.CardinalPluralRule(num1, v1) 129 end := gu.CardinalPluralRule(num2, v2) 130 131 if start == locales.PluralRuleOne && end == locales.PluralRuleOne { 132 return locales.PluralRuleOne 133 } else if start == locales.PluralRuleOne && end == locales.PluralRuleOther { 134 return locales.PluralRuleOther 135 } 136 137 return locales.PluralRuleOther 138 139} 140 141// MonthAbbreviated returns the locales abbreviated month given the 'month' provided 142func (gu *gu_IN) MonthAbbreviated(month time.Month) string { 143 return gu.monthsAbbreviated[month] 144} 145 146// MonthsAbbreviated returns the locales abbreviated months 147func (gu *gu_IN) MonthsAbbreviated() []string { 148 return gu.monthsAbbreviated[1:] 149} 150 151// MonthNarrow returns the locales narrow month given the 'month' provided 152func (gu *gu_IN) MonthNarrow(month time.Month) string { 153 return gu.monthsNarrow[month] 154} 155 156// MonthsNarrow returns the locales narrow months 157func (gu *gu_IN) MonthsNarrow() []string { 158 return gu.monthsNarrow[1:] 159} 160 161// MonthWide returns the locales wide month given the 'month' provided 162func (gu *gu_IN) MonthWide(month time.Month) string { 163 return gu.monthsWide[month] 164} 165 166// MonthsWide returns the locales wide months 167func (gu *gu_IN) MonthsWide() []string { 168 return gu.monthsWide[1:] 169} 170 171// WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided 172func (gu *gu_IN) WeekdayAbbreviated(weekday time.Weekday) string { 173 return gu.daysAbbreviated[weekday] 174} 175 176// WeekdaysAbbreviated returns the locales abbreviated weekdays 177func (gu *gu_IN) WeekdaysAbbreviated() []string { 178 return gu.daysAbbreviated 179} 180 181// WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided 182func (gu *gu_IN) WeekdayNarrow(weekday time.Weekday) string { 183 return gu.daysNarrow[weekday] 184} 185 186// WeekdaysNarrow returns the locales narrow weekdays 187func (gu *gu_IN) WeekdaysNarrow() []string { 188 return gu.daysNarrow 189} 190 191// WeekdayShort returns the locales short weekday given the 'weekday' provided 192func (gu *gu_IN) WeekdayShort(weekday time.Weekday) string { 193 return gu.daysShort[weekday] 194} 195 196// WeekdaysShort returns the locales short weekdays 197func (gu *gu_IN) WeekdaysShort() []string { 198 return gu.daysShort 199} 200 201// WeekdayWide returns the locales wide weekday given the 'weekday' provided 202func (gu *gu_IN) WeekdayWide(weekday time.Weekday) string { 203 return gu.daysWide[weekday] 204} 205 206// WeekdaysWide returns the locales wide weekdays 207func (gu *gu_IN) WeekdaysWide() []string { 208 return gu.daysWide 209} 210 211// Decimal returns the decimal point of number 212func (gu *gu_IN) Decimal() string { 213 return gu.decimal 214} 215 216// Group returns the group of number 217func (gu *gu_IN) Group() string { 218 return gu.group 219} 220 221// Group returns the minus sign of number 222func (gu *gu_IN) Minus() string { 223 return gu.minus 224} 225 226// FmtNumber returns 'num' with digits/precision of 'v' for 'gu_IN' and handles both Whole and Real numbers based on 'v' 227func (gu *gu_IN) FmtNumber(num float64, v uint64) string { 228 229 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64) 230 l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3 231 count := 0 232 inWhole := v == 0 233 inSecondary := false 234 groupThreshold := 3 235 236 b := make([]byte, 0, l) 237 238 for i := len(s) - 1; i >= 0; i-- { 239 240 if s[i] == '.' { 241 b = append(b, gu.decimal[0]) 242 inWhole = true 243 continue 244 } 245 246 if inWhole { 247 248 if count == groupThreshold { 249 b = append(b, gu.group[0]) 250 count = 1 251 252 if !inSecondary { 253 inSecondary = true 254 groupThreshold = 2 255 } 256 } else { 257 count++ 258 } 259 } 260 261 b = append(b, s[i]) 262 } 263 264 if num < 0 { 265 b = append(b, gu.minus[0]) 266 } 267 268 // reverse 269 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 { 270 b[i], b[j] = b[j], b[i] 271 } 272 273 return string(b) 274} 275 276// FmtPercent returns 'num' with digits/precision of 'v' for 'gu_IN' and handles both Whole and Real numbers based on 'v' 277// NOTE: 'num' passed into FmtPercent is assumed to be in percent already 278func (gu *gu_IN) FmtPercent(num float64, v uint64) string { 279 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64) 280 l := len(s) + 3 281 b := make([]byte, 0, l) 282 283 for i := len(s) - 1; i >= 0; i-- { 284 285 if s[i] == '.' { 286 b = append(b, gu.decimal[0]) 287 continue 288 } 289 290 b = append(b, s[i]) 291 } 292 293 if num < 0 { 294 b = append(b, gu.minus[0]) 295 } 296 297 // reverse 298 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 { 299 b[i], b[j] = b[j], b[i] 300 } 301 302 b = append(b, gu.percent...) 303 304 return string(b) 305} 306 307// FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'gu_IN' 308func (gu *gu_IN) FmtCurrency(num float64, v uint64, currency currency.Type) string { 309 310 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64) 311 symbol := gu.currencies[currency] 312 l := len(s) + len(symbol) + 2 + 1*len(s[:len(s)-int(v)-1])/3 313 count := 0 314 inWhole := v == 0 315 b := make([]byte, 0, l) 316 317 for i := len(s) - 1; i >= 0; i-- { 318 319 if s[i] == '.' { 320 b = append(b, gu.decimal[0]) 321 inWhole = true 322 continue 323 } 324 325 if inWhole { 326 if count == 3 { 327 b = append(b, gu.group[0]) 328 count = 1 329 } else { 330 count++ 331 } 332 } 333 334 b = append(b, s[i]) 335 } 336 337 for j := len(symbol) - 1; j >= 0; j-- { 338 b = append(b, symbol[j]) 339 } 340 341 if num < 0 { 342 b = append(b, gu.minus[0]) 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 350 if int(v) < 2 { 351 352 if v == 0 { 353 b = append(b, gu.decimal...) 354 } 355 356 for i := 0; i < 2-int(v); i++ { 357 b = append(b, '0') 358 } 359 } 360 361 return string(b) 362} 363 364// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'gu_IN' 365// in accounting notation. 366func (gu *gu_IN) FmtAccounting(num float64, v uint64, currency currency.Type) string { 367 368 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64) 369 symbol := gu.currencies[currency] 370 l := len(s) + len(symbol) + 2 + 1*len(s[:len(s)-int(v)-1])/3 371 count := 0 372 inWhole := v == 0 373 b := make([]byte, 0, l) 374 375 for i := len(s) - 1; i >= 0; i-- { 376 377 if s[i] == '.' { 378 b = append(b, gu.decimal[0]) 379 inWhole = true 380 continue 381 } 382 383 if inWhole { 384 if count == 3 { 385 b = append(b, gu.group[0]) 386 count = 1 387 } else { 388 count++ 389 } 390 } 391 392 b = append(b, s[i]) 393 } 394 395 if num < 0 { 396 397 for j := len(symbol) - 1; j >= 0; j-- { 398 b = append(b, symbol[j]) 399 } 400 401 b = append(b, gu.minus[0]) 402 403 } else { 404 405 for j := len(symbol) - 1; j >= 0; j-- { 406 b = append(b, symbol[j]) 407 } 408 409 } 410 411 // reverse 412 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 { 413 b[i], b[j] = b[j], b[i] 414 } 415 416 if int(v) < 2 { 417 418 if v == 0 { 419 b = append(b, gu.decimal...) 420 } 421 422 for i := 0; i < 2-int(v); i++ { 423 b = append(b, '0') 424 } 425 } 426 427 return string(b) 428} 429 430// FmtDateShort returns the short date representation of 't' for 'gu_IN' 431func (gu *gu_IN) FmtDateShort(t time.Time) string { 432 433 b := make([]byte, 0, 32) 434 435 b = strconv.AppendInt(b, int64(t.Day()), 10) 436 b = append(b, []byte{0x2f}...) 437 b = strconv.AppendInt(b, int64(t.Month()), 10) 438 b = append(b, []byte{0x2f}...) 439 440 if t.Year() > 9 { 441 b = append(b, strconv.Itoa(t.Year())[2:]...) 442 } else { 443 b = append(b, strconv.Itoa(t.Year())[1:]...) 444 } 445 446 return string(b) 447} 448 449// FmtDateMedium returns the medium date representation of 't' for 'gu_IN' 450func (gu *gu_IN) FmtDateMedium(t time.Time) string { 451 452 b := make([]byte, 0, 32) 453 454 b = strconv.AppendInt(b, int64(t.Day()), 10) 455 b = append(b, []byte{0x20}...) 456 b = append(b, gu.monthsAbbreviated[t.Month()]...) 457 b = append(b, []byte{0x2c, 0x20}...) 458 459 if t.Year() > 0 { 460 b = strconv.AppendInt(b, int64(t.Year()), 10) 461 } else { 462 b = strconv.AppendInt(b, int64(-t.Year()), 10) 463 } 464 465 return string(b) 466} 467 468// FmtDateLong returns the long date representation of 't' for 'gu_IN' 469func (gu *gu_IN) FmtDateLong(t time.Time) string { 470 471 b := make([]byte, 0, 32) 472 473 b = strconv.AppendInt(b, int64(t.Day()), 10) 474 b = append(b, []byte{0x20}...) 475 b = append(b, gu.monthsWide[t.Month()]...) 476 b = append(b, []byte{0x2c, 0x20}...) 477 478 if t.Year() > 0 { 479 b = strconv.AppendInt(b, int64(t.Year()), 10) 480 } else { 481 b = strconv.AppendInt(b, int64(-t.Year()), 10) 482 } 483 484 return string(b) 485} 486 487// FmtDateFull returns the full date representation of 't' for 'gu_IN' 488func (gu *gu_IN) FmtDateFull(t time.Time) string { 489 490 b := make([]byte, 0, 32) 491 492 b = append(b, gu.daysWide[t.Weekday()]...) 493 b = append(b, []byte{0x2c, 0x20}...) 494 b = strconv.AppendInt(b, int64(t.Day()), 10) 495 b = append(b, []byte{0x20}...) 496 b = append(b, gu.monthsWide[t.Month()]...) 497 b = append(b, []byte{0x2c, 0x20}...) 498 499 if t.Year() > 0 { 500 b = strconv.AppendInt(b, int64(t.Year()), 10) 501 } else { 502 b = strconv.AppendInt(b, int64(-t.Year()), 10) 503 } 504 505 return string(b) 506} 507 508// FmtTimeShort returns the short time representation of 't' for 'gu_IN' 509func (gu *gu_IN) FmtTimeShort(t time.Time) string { 510 511 b := make([]byte, 0, 32) 512 513 h := t.Hour() 514 515 if h > 12 { 516 h -= 12 517 } 518 519 if h < 10 { 520 b = append(b, '0') 521 } 522 523 b = strconv.AppendInt(b, int64(h), 10) 524 b = append(b, gu.timeSeparator...) 525 526 if t.Minute() < 10 { 527 b = append(b, '0') 528 } 529 530 b = strconv.AppendInt(b, int64(t.Minute()), 10) 531 b = append(b, []byte{0x20}...) 532 533 if t.Hour() < 12 { 534 b = append(b, gu.periodsAbbreviated[0]...) 535 } else { 536 b = append(b, gu.periodsAbbreviated[1]...) 537 } 538 539 return string(b) 540} 541 542// FmtTimeMedium returns the medium time representation of 't' for 'gu_IN' 543func (gu *gu_IN) FmtTimeMedium(t time.Time) string { 544 545 b := make([]byte, 0, 32) 546 547 h := t.Hour() 548 549 if h > 12 { 550 h -= 12 551 } 552 553 if h < 10 { 554 b = append(b, '0') 555 } 556 557 b = strconv.AppendInt(b, int64(h), 10) 558 b = append(b, gu.timeSeparator...) 559 560 if t.Minute() < 10 { 561 b = append(b, '0') 562 } 563 564 b = strconv.AppendInt(b, int64(t.Minute()), 10) 565 b = append(b, gu.timeSeparator...) 566 567 if t.Second() < 10 { 568 b = append(b, '0') 569 } 570 571 b = strconv.AppendInt(b, int64(t.Second()), 10) 572 b = append(b, []byte{0x20}...) 573 574 if t.Hour() < 12 { 575 b = append(b, gu.periodsAbbreviated[0]...) 576 } else { 577 b = append(b, gu.periodsAbbreviated[1]...) 578 } 579 580 return string(b) 581} 582 583// FmtTimeLong returns the long time representation of 't' for 'gu_IN' 584func (gu *gu_IN) FmtTimeLong(t time.Time) string { 585 586 b := make([]byte, 0, 32) 587 588 h := t.Hour() 589 590 if h > 12 { 591 h -= 12 592 } 593 594 if h < 10 { 595 b = append(b, '0') 596 } 597 598 b = strconv.AppendInt(b, int64(h), 10) 599 b = append(b, gu.timeSeparator...) 600 601 if t.Minute() < 10 { 602 b = append(b, '0') 603 } 604 605 b = strconv.AppendInt(b, int64(t.Minute()), 10) 606 b = append(b, gu.timeSeparator...) 607 608 if t.Second() < 10 { 609 b = append(b, '0') 610 } 611 612 b = strconv.AppendInt(b, int64(t.Second()), 10) 613 b = append(b, []byte{0x20}...) 614 615 if t.Hour() < 12 { 616 b = append(b, gu.periodsAbbreviated[0]...) 617 } else { 618 b = append(b, gu.periodsAbbreviated[1]...) 619 } 620 621 b = append(b, []byte{0x20}...) 622 623 tz, _ := t.Zone() 624 b = append(b, tz...) 625 626 return string(b) 627} 628 629// FmtTimeFull returns the full time representation of 't' for 'gu_IN' 630func (gu *gu_IN) FmtTimeFull(t time.Time) string { 631 632 b := make([]byte, 0, 32) 633 634 h := t.Hour() 635 636 if h > 12 { 637 h -= 12 638 } 639 640 if h < 10 { 641 b = append(b, '0') 642 } 643 644 b = strconv.AppendInt(b, int64(h), 10) 645 b = append(b, gu.timeSeparator...) 646 647 if t.Minute() < 10 { 648 b = append(b, '0') 649 } 650 651 b = strconv.AppendInt(b, int64(t.Minute()), 10) 652 b = append(b, gu.timeSeparator...) 653 654 if t.Second() < 10 { 655 b = append(b, '0') 656 } 657 658 b = strconv.AppendInt(b, int64(t.Second()), 10) 659 b = append(b, []byte{0x20}...) 660 661 if t.Hour() < 12 { 662 b = append(b, gu.periodsAbbreviated[0]...) 663 } else { 664 b = append(b, gu.periodsAbbreviated[1]...) 665 } 666 667 b = append(b, []byte{0x20}...) 668 669 tz, _ := t.Zone() 670 671 if btz, ok := gu.timezones[tz]; ok { 672 b = append(b, btz...) 673 } else { 674 b = append(b, tz...) 675 } 676 677 return string(b) 678} 679