hr_HR.go 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  1. package hr_HR
  2. import (
  3. "math"
  4. "strconv"
  5. "time"
  6. "github.com/go-playground/locales"
  7. "github.com/go-playground/locales/currency"
  8. )
  9. type hr_HR 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. currencyPositiveSuffix string
  23. currencyNegativeSuffix 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 'hr_HR' locale
  41. func New() locales.Translator {
  42. return &hr_HR{
  43. locale: "hr_HR",
  44. pluralsCardinal: []locales.PluralRule{2, 4, 6},
  45. pluralsOrdinal: []locales.PluralRule{6},
  46. pluralsRange: []locales.PluralRule{2, 4, 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. currencyPositiveSuffix: " ",
  56. currencyNegativeSuffix: " ",
  57. monthsAbbreviated: []string{"", "sij", "velj", "ožu", "tra", "svi", "lip", "srp", "kol", "ruj", "lis", "stu", "pro"},
  58. monthsNarrow: []string{"", "1.", "2.", "3.", "4.", "5.", "6.", "7.", "8.", "9.", "10.", "11.", "12."},
  59. monthsWide: []string{"", "siječnja", "veljače", "ožujka", "travnja", "svibnja", "lipnja", "srpnja", "kolovoza", "rujna", "listopada", "studenoga", "prosinca"},
  60. daysAbbreviated: []string{"ned", "pon", "uto", "sri", "čet", "pet", "sub"},
  61. daysNarrow: []string{"N", "P", "U", "S", "Č", "P", "S"},
  62. daysShort: []string{"ned", "pon", "uto", "sri", "čet", "pet", "sub"},
  63. daysWide: []string{"nedjelja", "ponedjeljak", "utorak", "srijeda", "četvrtak", "petak", "subota"},
  64. periodsAbbreviated: []string{"AM", "PM"},
  65. periodsNarrow: []string{"AM", "PM"},
  66. periodsWide: []string{"AM", "PM"},
  67. erasAbbreviated: []string{"pr. Kr.", "po. Kr."},
  68. erasNarrow: []string{"pr.n.e.", "AD"},
  69. erasWide: []string{"prije Krista", "poslije Krista"},
  70. timezones: map[string]string{"AKST": "aljaško standardno vrijeme", "SGT": "singapursko vrijeme", "HEEG": "istočnogrenlandsko ljetno vrijeme", "HEOG": "zapadnogrenlandsko ljetno vrijeme", "EDT": "istočno ljetno vrijeme", "OESZ": "istočnoeuropsko ljetno vrijeme", "PST": "pacifičko standardno vrijeme", "WEZ": "zapadnoeuropsko standardno vrijeme", "GYT": "gvajansko vrijeme", "SAST": "južnoafričko vrijeme", "WAT": "zapadnoafričko standardno vrijeme", "TMST": "turkmenistansko ljetno vrijeme", "CAT": "srednjoafričko vrijeme", "ART": "argentinsko standardno vrijeme", "HEPMX": "meksičko pacifičko ljetno vrijeme", "PDT": "pacifičko ljetno vrijeme", "MDT": "planinsko ljetno vrijeme", "CDT": "središnje ljetno vrijeme", "ACST": "srednjoaustralsko standardno vrijeme", "ECT": "ekvadorsko vrijeme", "OEZ": "istočnoeuropsko standardno vrijeme", "AWDT": "zapadnoaustralsko ljetno vrijeme", "WESZ": "zapadnoeuropsko ljetno vrijeme", "LHDT": "ljetno vrijeme otoka Lord Howe", "HENOMX": "sjeverozapadno meksičko ljetno vrijeme", "SRT": "surinamsko vrijeme", "JDT": "japansko ljetno vrijeme", "HKT": "hongkonško standardno vrijeme", "ARST": "argentinsko ljetno vrijeme", "ACWDT": "australsko središnje zapadno ljetno vrijeme", "LHST": "standardno vrijeme otoka Lord Howe", "ACWST": "australsko središnje zapadno standardno vrijeme", "MESZ": "srednjoeuropsko ljetno vrijeme", "WART": "zapadnoargentinsko standardno vrijeme", "IST": "indijsko vrijeme", "HAST": "havajsko-aleutsko standardno vrijeme", "GMT": "univerzalno vrijeme", "MST": "planinsko standardno vrijeme", "NZDT": "novozelandsko ljetno vrijeme", "WARST": "zapadnoargentinsko ljetno vrijeme", "HEPM": "ljetno vrijeme za Sveti Petar i Mikelon", "WIT": "istočnoindonezijsko vrijeme", "UYT": "urugvajsko standardno vrijeme", "HNCU": "kubansko standardno vrijeme", "EST": "istočno standardno vrijeme", "MEZ": "srednjoeuropsko standardno vrijeme", "HNT": "newfoundlandsko standardno vrijeme", "HAT": "newfoundlandsko ljetno vrijeme", "AEDT": "istočnoaustralsko ljetno vrijeme", "JST": "japansko standardno vrijeme", "WIB": "zapadnoindonezijsko vrijeme", "HKST": "hongkonško ljetno vrijeme", "VET": "venezuelsko vrijeme", "HECU": "kubansko ljetno vrijeme", "AST": "atlantsko standardno vrijeme", "AEST": "istočnoaustralsko standardno vrijeme", "WITA": "srednjoindonezijsko vrijeme", "HNNOMX": "sjeverozapadno meksičko standardno vrijeme", "ChST": "standardno vrijeme Chamorra", "CST": "središnje standardno vrijeme", "ACDT": "srednjoaustralsko ljetno vrijeme", "BOT": "bolivijsko vrijeme", "NZST": "novozelandsko standardno vrijeme", "CLT": "čileansko standardno vrijeme", "CLST": "čileansko ljetno vrijeme", "HNPMX": "meksičko pacifičko standardno vrijeme", "MYT": "malezijsko vrijeme", "HNOG": "zapadnogrenlandsko standardno vrijeme", "HNPM": "standardno vrijeme za Sveti Petar i Mikelon", "TMT": "turkmenistansko standardno vrijeme", "EAT": "istočnoafričko vrijeme", "COT": "kolumbijsko standardno vrijeme", "AKDT": "aljaško ljetno vrijeme", "HNEG": "istočnogrenlandsko standardno vrijeme", "WAST": "zapadnoafričko ljetno vrijeme", "BT": "butansko vrijeme", "AWST": "zapadnoaustralsko standardno vrijeme", "∅∅∅": "Acre ljetno vrijeme", "COST": "kolumbijsko ljetno vrijeme", "HADT": "havajsko-aleutsko ljetno vrijeme", "UYST": "urugvajsko ljetno vrijeme", "CHAST": "standardno vrijeme Chathama", "CHADT": "ljetno vrijeme Chathama", "ADT": "atlantsko ljetno vrijeme", "GFT": "vrijeme Francuske Gvajane"},
  71. }
  72. }
  73. // Locale returns the current translators string locale
  74. func (hr *hr_HR) Locale() string {
  75. return hr.locale
  76. }
  77. // PluralsCardinal returns the list of cardinal plural rules associated with 'hr_HR'
  78. func (hr *hr_HR) PluralsCardinal() []locales.PluralRule {
  79. return hr.pluralsCardinal
  80. }
  81. // PluralsOrdinal returns the list of ordinal plural rules associated with 'hr_HR'
  82. func (hr *hr_HR) PluralsOrdinal() []locales.PluralRule {
  83. return hr.pluralsOrdinal
  84. }
  85. // PluralsRange returns the list of range plural rules associated with 'hr_HR'
  86. func (hr *hr_HR) PluralsRange() []locales.PluralRule {
  87. return hr.pluralsRange
  88. }
  89. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'hr_HR'
  90. func (hr *hr_HR) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
  91. n := math.Abs(num)
  92. i := int64(n)
  93. f := locales.F(n, v)
  94. iMod10 := i % 10
  95. iMod100 := i % 100
  96. fMod10 := f % 10
  97. fMod100 := f % 100
  98. if (v == 0 && iMod10 == 1 && iMod100 != 11) || (fMod10 == 1 && fMod100 != 11) {
  99. return locales.PluralRuleOne
  100. } else if (v == 0 && iMod10 >= 2 && iMod10 <= 4 && (iMod100 < 12 || iMod100 > 14)) || (fMod10 >= 2 && fMod10 <= 4 && (fMod100 < 12 || fMod100 > 14)) {
  101. return locales.PluralRuleFew
  102. }
  103. return locales.PluralRuleOther
  104. }
  105. // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'hr_HR'
  106. func (hr *hr_HR) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
  107. return locales.PluralRuleOther
  108. }
  109. // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'hr_HR'
  110. func (hr *hr_HR) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
  111. start := hr.CardinalPluralRule(num1, v1)
  112. end := hr.CardinalPluralRule(num2, v2)
  113. if start == locales.PluralRuleOne && end == locales.PluralRuleOne {
  114. return locales.PluralRuleOne
  115. } else if start == locales.PluralRuleOne && end == locales.PluralRuleFew {
  116. return locales.PluralRuleFew
  117. } else if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
  118. return locales.PluralRuleOther
  119. } else if start == locales.PluralRuleFew && end == locales.PluralRuleOne {
  120. return locales.PluralRuleOne
  121. } else if start == locales.PluralRuleFew && end == locales.PluralRuleFew {
  122. return locales.PluralRuleFew
  123. } else if start == locales.PluralRuleFew && end == locales.PluralRuleOther {
  124. return locales.PluralRuleOther
  125. } else if start == locales.PluralRuleOther && end == locales.PluralRuleOne {
  126. return locales.PluralRuleOne
  127. } else if start == locales.PluralRuleOther && end == locales.PluralRuleFew {
  128. return locales.PluralRuleFew
  129. }
  130. return locales.PluralRuleOther
  131. }
  132. // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
  133. func (hr *hr_HR) MonthAbbreviated(month time.Month) string {
  134. return hr.monthsAbbreviated[month]
  135. }
  136. // MonthsAbbreviated returns the locales abbreviated months
  137. func (hr *hr_HR) MonthsAbbreviated() []string {
  138. return hr.monthsAbbreviated[1:]
  139. }
  140. // MonthNarrow returns the locales narrow month given the 'month' provided
  141. func (hr *hr_HR) MonthNarrow(month time.Month) string {
  142. return hr.monthsNarrow[month]
  143. }
  144. // MonthsNarrow returns the locales narrow months
  145. func (hr *hr_HR) MonthsNarrow() []string {
  146. return hr.monthsNarrow[1:]
  147. }
  148. // MonthWide returns the locales wide month given the 'month' provided
  149. func (hr *hr_HR) MonthWide(month time.Month) string {
  150. return hr.monthsWide[month]
  151. }
  152. // MonthsWide returns the locales wide months
  153. func (hr *hr_HR) MonthsWide() []string {
  154. return hr.monthsWide[1:]
  155. }
  156. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  157. func (hr *hr_HR) WeekdayAbbreviated(weekday time.Weekday) string {
  158. return hr.daysAbbreviated[weekday]
  159. }
  160. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  161. func (hr *hr_HR) WeekdaysAbbreviated() []string {
  162. return hr.daysAbbreviated
  163. }
  164. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  165. func (hr *hr_HR) WeekdayNarrow(weekday time.Weekday) string {
  166. return hr.daysNarrow[weekday]
  167. }
  168. // WeekdaysNarrow returns the locales narrow weekdays
  169. func (hr *hr_HR) WeekdaysNarrow() []string {
  170. return hr.daysNarrow
  171. }
  172. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  173. func (hr *hr_HR) WeekdayShort(weekday time.Weekday) string {
  174. return hr.daysShort[weekday]
  175. }
  176. // WeekdaysShort returns the locales short weekdays
  177. func (hr *hr_HR) WeekdaysShort() []string {
  178. return hr.daysShort
  179. }
  180. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  181. func (hr *hr_HR) WeekdayWide(weekday time.Weekday) string {
  182. return hr.daysWide[weekday]
  183. }
  184. // WeekdaysWide returns the locales wide weekdays
  185. func (hr *hr_HR) WeekdaysWide() []string {
  186. return hr.daysWide
  187. }
  188. // Decimal returns the decimal point of number
  189. func (hr *hr_HR) Decimal() string {
  190. return hr.decimal
  191. }
  192. // Group returns the group of number
  193. func (hr *hr_HR) Group() string {
  194. return hr.group
  195. }
  196. // Group returns the minus sign of number
  197. func (hr *hr_HR) Minus() string {
  198. return hr.minus
  199. }
  200. // FmtNumber returns 'num' with digits/precision of 'v' for 'hr_HR' and handles both Whole and Real numbers based on 'v'
  201. func (hr *hr_HR) FmtNumber(num float64, v uint64) string {
  202. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  203. l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
  204. count := 0
  205. inWhole := v == 0
  206. b := make([]byte, 0, l)
  207. for i := len(s) - 1; i >= 0; i-- {
  208. if s[i] == '.' {
  209. b = append(b, hr.decimal[0])
  210. inWhole = true
  211. continue
  212. }
  213. if inWhole {
  214. if count == 3 {
  215. b = append(b, hr.group[0])
  216. count = 1
  217. } else {
  218. count++
  219. }
  220. }
  221. b = append(b, s[i])
  222. }
  223. if num < 0 {
  224. b = append(b, hr.minus[0])
  225. }
  226. // reverse
  227. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  228. b[i], b[j] = b[j], b[i]
  229. }
  230. return string(b)
  231. }
  232. // FmtPercent returns 'num' with digits/precision of 'v' for 'hr_HR' and handles both Whole and Real numbers based on 'v'
  233. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
  234. func (hr *hr_HR) FmtPercent(num float64, v uint64) string {
  235. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  236. l := len(s) + 3
  237. b := make([]byte, 0, l)
  238. for i := len(s) - 1; i >= 0; i-- {
  239. if s[i] == '.' {
  240. b = append(b, hr.decimal[0])
  241. continue
  242. }
  243. b = append(b, s[i])
  244. }
  245. if num < 0 {
  246. b = append(b, hr.minus[0])
  247. }
  248. // reverse
  249. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  250. b[i], b[j] = b[j], b[i]
  251. }
  252. b = append(b, hr.percent...)
  253. return string(b)
  254. }
  255. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'hr_HR'
  256. func (hr *hr_HR) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  257. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  258. symbol := hr.currencies[currency]
  259. l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
  260. count := 0
  261. inWhole := v == 0
  262. b := make([]byte, 0, l)
  263. for i := len(s) - 1; i >= 0; i-- {
  264. if s[i] == '.' {
  265. b = append(b, hr.decimal[0])
  266. inWhole = true
  267. continue
  268. }
  269. if inWhole {
  270. if count == 3 {
  271. b = append(b, hr.group[0])
  272. count = 1
  273. } else {
  274. count++
  275. }
  276. }
  277. b = append(b, s[i])
  278. }
  279. if num < 0 {
  280. b = append(b, hr.minus[0])
  281. }
  282. // reverse
  283. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  284. b[i], b[j] = b[j], b[i]
  285. }
  286. if int(v) < 2 {
  287. if v == 0 {
  288. b = append(b, hr.decimal...)
  289. }
  290. for i := 0; i < 2-int(v); i++ {
  291. b = append(b, '0')
  292. }
  293. }
  294. b = append(b, hr.currencyPositiveSuffix...)
  295. b = append(b, symbol...)
  296. return string(b)
  297. }
  298. // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'hr_HR'
  299. // in accounting notation.
  300. func (hr *hr_HR) FmtAccounting(num float64, v uint64, currency currency.Type) string {
  301. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  302. symbol := hr.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. b := make([]byte, 0, l)
  307. for i := len(s) - 1; i >= 0; i-- {
  308. if s[i] == '.' {
  309. b = append(b, hr.decimal[0])
  310. inWhole = true
  311. continue
  312. }
  313. if inWhole {
  314. if count == 3 {
  315. b = append(b, hr.group[0])
  316. count = 1
  317. } else {
  318. count++
  319. }
  320. }
  321. b = append(b, s[i])
  322. }
  323. if num < 0 {
  324. b = append(b, hr.minus[0])
  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. if int(v) < 2 {
  331. if v == 0 {
  332. b = append(b, hr.decimal...)
  333. }
  334. for i := 0; i < 2-int(v); i++ {
  335. b = append(b, '0')
  336. }
  337. }
  338. if num < 0 {
  339. b = append(b, hr.currencyNegativeSuffix...)
  340. b = append(b, symbol...)
  341. } else {
  342. b = append(b, hr.currencyPositiveSuffix...)
  343. b = append(b, symbol...)
  344. }
  345. return string(b)
  346. }
  347. // FmtDateShort returns the short date representation of 't' for 'hr_HR'
  348. func (hr *hr_HR) FmtDateShort(t time.Time) string {
  349. b := make([]byte, 0, 32)
  350. if t.Day() < 10 {
  351. b = append(b, '0')
  352. }
  353. b = strconv.AppendInt(b, int64(t.Day()), 10)
  354. b = append(b, []byte{0x2e, 0x20}...)
  355. if t.Month() < 10 {
  356. b = append(b, '0')
  357. }
  358. b = strconv.AppendInt(b, int64(t.Month()), 10)
  359. b = append(b, []byte{0x2e, 0x20}...)
  360. if t.Year() > 0 {
  361. b = strconv.AppendInt(b, int64(t.Year()), 10)
  362. } else {
  363. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  364. }
  365. b = append(b, []byte{0x2e}...)
  366. return string(b)
  367. }
  368. // FmtDateMedium returns the medium date representation of 't' for 'hr_HR'
  369. func (hr *hr_HR) FmtDateMedium(t time.Time) string {
  370. b := make([]byte, 0, 32)
  371. b = strconv.AppendInt(b, int64(t.Day()), 10)
  372. b = append(b, []byte{0x2e, 0x20}...)
  373. b = append(b, hr.monthsAbbreviated[t.Month()]...)
  374. b = append(b, []byte{0x20}...)
  375. if t.Year() > 0 {
  376. b = strconv.AppendInt(b, int64(t.Year()), 10)
  377. } else {
  378. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  379. }
  380. b = append(b, []byte{0x2e}...)
  381. return string(b)
  382. }
  383. // FmtDateLong returns the long date representation of 't' for 'hr_HR'
  384. func (hr *hr_HR) FmtDateLong(t time.Time) string {
  385. b := make([]byte, 0, 32)
  386. b = strconv.AppendInt(b, int64(t.Day()), 10)
  387. b = append(b, []byte{0x2e, 0x20}...)
  388. b = append(b, hr.monthsWide[t.Month()]...)
  389. b = append(b, []byte{0x20}...)
  390. if t.Year() > 0 {
  391. b = strconv.AppendInt(b, int64(t.Year()), 10)
  392. } else {
  393. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  394. }
  395. b = append(b, []byte{0x2e}...)
  396. return string(b)
  397. }
  398. // FmtDateFull returns the full date representation of 't' for 'hr_HR'
  399. func (hr *hr_HR) FmtDateFull(t time.Time) string {
  400. b := make([]byte, 0, 32)
  401. b = append(b, hr.daysWide[t.Weekday()]...)
  402. b = append(b, []byte{0x2c, 0x20}...)
  403. b = strconv.AppendInt(b, int64(t.Day()), 10)
  404. b = append(b, []byte{0x2e, 0x20}...)
  405. b = append(b, hr.monthsWide[t.Month()]...)
  406. b = append(b, []byte{0x20}...)
  407. if t.Year() > 0 {
  408. b = strconv.AppendInt(b, int64(t.Year()), 10)
  409. } else {
  410. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  411. }
  412. b = append(b, []byte{0x2e}...)
  413. return string(b)
  414. }
  415. // FmtTimeShort returns the short time representation of 't' for 'hr_HR'
  416. func (hr *hr_HR) FmtTimeShort(t time.Time) string {
  417. b := make([]byte, 0, 32)
  418. if t.Hour() < 10 {
  419. b = append(b, '0')
  420. }
  421. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  422. b = append(b, hr.timeSeparator...)
  423. if t.Minute() < 10 {
  424. b = append(b, '0')
  425. }
  426. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  427. return string(b)
  428. }
  429. // FmtTimeMedium returns the medium time representation of 't' for 'hr_HR'
  430. func (hr *hr_HR) FmtTimeMedium(t time.Time) string {
  431. b := make([]byte, 0, 32)
  432. if t.Hour() < 10 {
  433. b = append(b, '0')
  434. }
  435. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  436. b = append(b, hr.timeSeparator...)
  437. if t.Minute() < 10 {
  438. b = append(b, '0')
  439. }
  440. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  441. b = append(b, hr.timeSeparator...)
  442. if t.Second() < 10 {
  443. b = append(b, '0')
  444. }
  445. b = strconv.AppendInt(b, int64(t.Second()), 10)
  446. return string(b)
  447. }
  448. // FmtTimeLong returns the long time representation of 't' for 'hr_HR'
  449. func (hr *hr_HR) FmtTimeLong(t time.Time) string {
  450. b := make([]byte, 0, 32)
  451. if t.Hour() < 10 {
  452. b = append(b, '0')
  453. }
  454. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  455. b = append(b, hr.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, hr.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. tz, _ := t.Zone()
  467. b = append(b, tz...)
  468. return string(b)
  469. }
  470. // FmtTimeFull returns the full time representation of 't' for 'hr_HR'
  471. func (hr *hr_HR) FmtTimeFull(t time.Time) string {
  472. b := make([]byte, 0, 32)
  473. if t.Hour() < 10 {
  474. b = append(b, '0')
  475. }
  476. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  477. b = append(b, hr.timeSeparator...)
  478. if t.Minute() < 10 {
  479. b = append(b, '0')
  480. }
  481. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  482. b = append(b, hr.timeSeparator...)
  483. if t.Second() < 10 {
  484. b = append(b, '0')
  485. }
  486. b = strconv.AppendInt(b, int64(t.Second()), 10)
  487. b = append(b, []byte{0x20, 0x28}...)
  488. tz, _ := t.Zone()
  489. if btz, ok := hr.timezones[tz]; ok {
  490. b = append(b, btz...)
  491. } else {
  492. b = append(b, tz...)
  493. }
  494. b = append(b, []byte{0x29}...)
  495. return string(b)
  496. }