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