cs_CZ.go 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593
  1. package cs_CZ
  2. import (
  3. "math"
  4. "strconv"
  5. "time"
  6. "github.com/go-playground/locales"
  7. "github.com/go-playground/locales/currency"
  8. )
  9. type cs_CZ 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. percentSuffix string
  19. perMille string
  20. timeSeparator string
  21. inifinity string
  22. currencies []string // idx = enum of currency code
  23. currencyPositiveSuffix string
  24. currencyNegativeSuffix string
  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. // New returns a new instance of translator for the 'cs_CZ' locale
  42. func New() locales.Translator {
  43. return &cs_CZ{
  44. locale: "cs_CZ",
  45. pluralsCardinal: []locales.PluralRule{2, 4, 5, 6},
  46. pluralsOrdinal: []locales.PluralRule{6},
  47. pluralsRange: []locales.PluralRule{6, 2, 4, 5},
  48. timeSeparator: ":",
  49. 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 ", "BYR ", "BZD ", "CAD ", "CDF ", "CHE ", "CHF ", "CHW ", "CLE ", "CLF ", "CLP ", "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 ", "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 "},
  50. percentSuffix: " ",
  51. currencyPositiveSuffix: " ",
  52. currencyNegativeSuffix: " ",
  53. monthsAbbreviated: []string{"", "led", "úno", "bře", "dub", "kvě", "čvn", "čvc", "srp", "zář", "říj", "lis", "pro"},
  54. monthsNarrow: []string{"", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"},
  55. monthsWide: []string{"", "ledna", "února", "března", "dubna", "května", "června", "července", "srpna", "září", "října", "listopadu", "prosince"},
  56. daysAbbreviated: []string{"ne", "po", "út", "st", "čt", "pá", "so"},
  57. daysNarrow: []string{"N", "P", "Ú", "S", "Č", "P", "S"},
  58. daysShort: []string{"ne", "po", "út", "st", "čt", "pá", "so"},
  59. daysWide: []string{"neděle", "pondělí", "úterý", "středa", "čtvrtek", "pátek", "sobota"},
  60. periodsAbbreviated: []string{"dop.", "odp."},
  61. periodsNarrow: []string{"dop.", "odp."},
  62. periodsWide: []string{"dop.", "odp."},
  63. erasAbbreviated: []string{"př. n. l.", "n. l."},
  64. erasNarrow: []string{"př.n.l.", "n.l."},
  65. erasWide: []string{"př. n. l.", "n. l."},
  66. timezones: map[string]string{"AST": "Atlantický standardní čas", "WITA": "Středoindonéský čas", "UYT": "Uruguayský standardní čas", "COT": "Kolumbijský standardní čas", "CHADT": "Chathamský letní čas", "AEST": "Východoaustralský standardní čas", "ChST": "Chamorrský čas", "ARST": "Argentinský letní čas", "JDT": "Japonský letní čas", "HKST": "Hongkongský letní čas", "PDT": "Severoamerický pacifický letní čas", "ACWST": "Středozápadní australský standardní čas", "AKST": "Aljašský standardní čas", "CLST": "Chilský letní čas", "COST": "Kolumbijský letní čas", "WAT": "Západoafrický standardní čas", "WIB": "Západoindonéský čas", "TMST": "Turkmenský letní čas", "ART": "Argentinský standardní čas", "EDT": "Severoamerický východní letní čas", "TMT": "Turkmenský standardní čas", "UYST": "Uruguayský letní čas", "CDT": "Severoamerický centrální letní čas", "VET": "Venezuelský čas", "EST": "Severoamerický východní standardní čas", "GFT": "Francouzskoguyanský čas", "MDT": "Macajský letní čas", "AWDT": "Západoaustralský letní čas", "WAST": "Západoafrický letní čas", "HKT": "Hongkongský standardní čas", "IST": "Indický čas", "HNT": "Newfoundlandský standardní čas", "CST": "Severoamerický centrální standardní čas", "HADT": "Havajsko-aleutský letní čas", "BOT": "Bolivijský čas", "ACST": "Středoaustralský standardní čas", "LHST": "Standardní čas ostrova lorda Howa", "BT": "Bhútánský čas", "WIT": "Východoindonéský čas", "MESZ": "Středoevropský letní čas", "ECT": "Ekvádorský čas", "GYT": "Guyanský čas", "LHDT": "Letní čas ostrova lorda Howa", "EAT": "Východoafrický čas", "ACDT": "Středoaustralský letní čas", "WARST": "Západoargentinský letní čas", "OEZ": "Východoevropský standardní čas", "AEDT": "Východoaustralský letní čas", "CAT": "Středoafrický čas", "ADT": "Atlantický letní čas", "HAT": "Newfoundlandský letní čas", "AWST": "Západoaustralský standardní čas", "MEZ": "Středoevropský standardní čas", "OESZ": "Východoevropský letní čas", "GMT": "Greenwichský střední čas", "WEZ": "Západoevropský standardní čas", "SAST": "Jihoafrický čas", "MST": "Macajský standardní čas", "CHAST": "Chathamský standardní čas", "HAST": "Havajsko-aleutský standardní čas", "SRT": "Surinamský čas", "AKDT": "Aljašský letní čas", "JST": "Japonský standardní čas", "PST": "Severoamerický pacifický standardní čas", "NZST": "Novozélandský standardní čas", "NZDT": "Novozélandský letní čas", "CLT": "Chilský standardní čas", "WESZ": "Západoevropský letní čas", "∅∅∅": "Amazonský letní čas", "MYT": "Malajský čas", "WART": "Západoargentinský standardní čas", "ACWDT": "Středozápadní australský letní čas", "SGT": "Singapurský čas"},
  67. }
  68. }
  69. // Locale returns the current translators string locale
  70. func (cs *cs_CZ) Locale() string {
  71. return cs.locale
  72. }
  73. // PluralsCardinal returns the list of cardinal plural rules associated with 'cs_CZ'
  74. func (cs *cs_CZ) PluralsCardinal() []locales.PluralRule {
  75. return cs.pluralsCardinal
  76. }
  77. // PluralsOrdinal returns the list of ordinal plural rules associated with 'cs_CZ'
  78. func (cs *cs_CZ) PluralsOrdinal() []locales.PluralRule {
  79. return cs.pluralsOrdinal
  80. }
  81. // PluralsRange returns the list of range plural rules associated with 'cs_CZ'
  82. func (cs *cs_CZ) PluralsRange() []locales.PluralRule {
  83. return cs.pluralsRange
  84. }
  85. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'cs_CZ'
  86. func (cs *cs_CZ) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
  87. n := math.Abs(num)
  88. i := int64(n)
  89. if i == 1 && v == 0 {
  90. return locales.PluralRuleOne
  91. } else if i >= 2 && i <= 4 && v == 0 {
  92. return locales.PluralRuleFew
  93. } else if v != 0 {
  94. return locales.PluralRuleMany
  95. }
  96. return locales.PluralRuleOther
  97. }
  98. // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'cs_CZ'
  99. func (cs *cs_CZ) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
  100. return locales.PluralRuleOther
  101. }
  102. // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'cs_CZ'
  103. func (cs *cs_CZ) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
  104. start := cs.CardinalPluralRule(num1, v1)
  105. end := cs.CardinalPluralRule(num2, v2)
  106. if start == locales.PluralRuleOne && end == locales.PluralRuleFew {
  107. return locales.PluralRuleFew
  108. } else if start == locales.PluralRuleOne && end == locales.PluralRuleMany {
  109. return locales.PluralRuleMany
  110. } else if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
  111. return locales.PluralRuleOther
  112. } else if start == locales.PluralRuleFew && end == locales.PluralRuleFew {
  113. return locales.PluralRuleFew
  114. } else if start == locales.PluralRuleFew && end == locales.PluralRuleMany {
  115. return locales.PluralRuleMany
  116. } else if start == locales.PluralRuleFew && end == locales.PluralRuleOther {
  117. return locales.PluralRuleOther
  118. } else if start == locales.PluralRuleMany && end == locales.PluralRuleOne {
  119. return locales.PluralRuleOne
  120. } else if start == locales.PluralRuleMany && end == locales.PluralRuleFew {
  121. return locales.PluralRuleFew
  122. } else if start == locales.PluralRuleMany && end == locales.PluralRuleMany {
  123. return locales.PluralRuleMany
  124. } else if start == locales.PluralRuleMany && end == locales.PluralRuleOther {
  125. return locales.PluralRuleOther
  126. } else if start == locales.PluralRuleOther && end == locales.PluralRuleOne {
  127. return locales.PluralRuleOne
  128. } else if start == locales.PluralRuleOther && end == locales.PluralRuleFew {
  129. return locales.PluralRuleFew
  130. } else if start == locales.PluralRuleOther && end == locales.PluralRuleMany {
  131. return locales.PluralRuleMany
  132. }
  133. return locales.PluralRuleOther
  134. }
  135. // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
  136. func (cs *cs_CZ) MonthAbbreviated(month time.Month) string {
  137. return cs.monthsAbbreviated[month]
  138. }
  139. // MonthsAbbreviated returns the locales abbreviated months
  140. func (cs *cs_CZ) MonthsAbbreviated() []string {
  141. return cs.monthsAbbreviated[1:]
  142. }
  143. // MonthNarrow returns the locales narrow month given the 'month' provided
  144. func (cs *cs_CZ) MonthNarrow(month time.Month) string {
  145. return cs.monthsNarrow[month]
  146. }
  147. // MonthsNarrow returns the locales narrow months
  148. func (cs *cs_CZ) MonthsNarrow() []string {
  149. return cs.monthsNarrow[1:]
  150. }
  151. // MonthWide returns the locales wide month given the 'month' provided
  152. func (cs *cs_CZ) MonthWide(month time.Month) string {
  153. return cs.monthsWide[month]
  154. }
  155. // MonthsWide returns the locales wide months
  156. func (cs *cs_CZ) MonthsWide() []string {
  157. return cs.monthsWide[1:]
  158. }
  159. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  160. func (cs *cs_CZ) WeekdayAbbreviated(weekday time.Weekday) string {
  161. return cs.daysAbbreviated[weekday]
  162. }
  163. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  164. func (cs *cs_CZ) WeekdaysAbbreviated() []string {
  165. return cs.daysAbbreviated
  166. }
  167. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  168. func (cs *cs_CZ) WeekdayNarrow(weekday time.Weekday) string {
  169. return cs.daysNarrow[weekday]
  170. }
  171. // WeekdaysNarrow returns the locales narrow weekdays
  172. func (cs *cs_CZ) WeekdaysNarrow() []string {
  173. return cs.daysNarrow
  174. }
  175. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  176. func (cs *cs_CZ) WeekdayShort(weekday time.Weekday) string {
  177. return cs.daysShort[weekday]
  178. }
  179. // WeekdaysShort returns the locales short weekdays
  180. func (cs *cs_CZ) WeekdaysShort() []string {
  181. return cs.daysShort
  182. }
  183. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  184. func (cs *cs_CZ) WeekdayWide(weekday time.Weekday) string {
  185. return cs.daysWide[weekday]
  186. }
  187. // WeekdaysWide returns the locales wide weekdays
  188. func (cs *cs_CZ) WeekdaysWide() []string {
  189. return cs.daysWide
  190. }
  191. // FmtNumber returns 'num' with digits/precision of 'v' for 'cs_CZ' and handles both Whole and Real numbers based on 'v'
  192. func (cs *cs_CZ) FmtNumber(num float64, v uint64) string {
  193. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  194. l := len(s) + 0 + 0*len(s[:len(s)-int(v)-1])/3
  195. count := 0
  196. inWhole := v == 0
  197. b := make([]byte, 0, l)
  198. for i := len(s) - 1; i >= 0; i-- {
  199. if s[i] == '.' {
  200. b = append(b, cs.decimal[0])
  201. inWhole = true
  202. continue
  203. }
  204. if inWhole {
  205. if count == 3 {
  206. b = append(b, cs.group[0])
  207. count = 1
  208. } else {
  209. count++
  210. }
  211. }
  212. b = append(b, s[i])
  213. }
  214. if num < 0 {
  215. b = append(b, cs.minus[0])
  216. }
  217. // reverse
  218. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  219. b[i], b[j] = b[j], b[i]
  220. }
  221. return string(b)
  222. }
  223. // FmtPercent returns 'num' with digits/precision of 'v' for 'cs_CZ' and handles both Whole and Real numbers based on 'v'
  224. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
  225. func (cs *cs_CZ) FmtPercent(num float64, v uint64) string {
  226. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  227. l := len(s) + 2
  228. b := make([]byte, 0, l)
  229. for i := len(s) - 1; i >= 0; i-- {
  230. if s[i] == '.' {
  231. b = append(b, cs.decimal[0])
  232. continue
  233. }
  234. b = append(b, s[i])
  235. }
  236. if num < 0 {
  237. b = append(b, cs.minus[0])
  238. }
  239. // reverse
  240. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  241. b[i], b[j] = b[j], b[i]
  242. }
  243. b = append(b, cs.percentSuffix...)
  244. b = append(b, cs.percent...)
  245. return string(b)
  246. }
  247. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'cs_CZ'
  248. func (cs *cs_CZ) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  249. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  250. symbol := cs.currencies[currency]
  251. l := len(s) + len(symbol) + 2 + 0*len(s[:len(s)-int(v)-1])/3
  252. count := 0
  253. inWhole := v == 0
  254. b := make([]byte, 0, l)
  255. for i := len(s) - 1; i >= 0; i-- {
  256. if s[i] == '.' {
  257. b = append(b, cs.decimal[0])
  258. inWhole = true
  259. continue
  260. }
  261. if inWhole {
  262. if count == 3 {
  263. b = append(b, cs.group[0])
  264. count = 1
  265. } else {
  266. count++
  267. }
  268. }
  269. b = append(b, s[i])
  270. }
  271. if num < 0 {
  272. b = append(b, cs.minus[0])
  273. }
  274. // reverse
  275. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  276. b[i], b[j] = b[j], b[i]
  277. }
  278. if int(v) < 2 {
  279. if v == 0 {
  280. b = append(b, cs.decimal...)
  281. }
  282. for i := 0; i < 2-int(v); i++ {
  283. b = append(b, '0')
  284. }
  285. }
  286. b = append(b, cs.currencyPositiveSuffix...)
  287. b = append(b, symbol...)
  288. return string(b)
  289. }
  290. // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'cs_CZ'
  291. // in accounting notation.
  292. func (cs *cs_CZ) FmtAccounting(num float64, v uint64, currency currency.Type) string {
  293. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  294. symbol := cs.currencies[currency]
  295. l := len(s) + len(symbol) + 2 + 0*len(s[:len(s)-int(v)-1])/3
  296. count := 0
  297. inWhole := v == 0
  298. b := make([]byte, 0, l)
  299. for i := len(s) - 1; i >= 0; i-- {
  300. if s[i] == '.' {
  301. b = append(b, cs.decimal[0])
  302. inWhole = true
  303. continue
  304. }
  305. if inWhole {
  306. if count == 3 {
  307. b = append(b, cs.group[0])
  308. count = 1
  309. } else {
  310. count++
  311. }
  312. }
  313. b = append(b, s[i])
  314. }
  315. if num < 0 {
  316. b = append(b, cs.minus[0])
  317. }
  318. // reverse
  319. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  320. b[i], b[j] = b[j], b[i]
  321. }
  322. if int(v) < 2 {
  323. if v == 0 {
  324. b = append(b, cs.decimal...)
  325. }
  326. for i := 0; i < 2-int(v); i++ {
  327. b = append(b, '0')
  328. }
  329. }
  330. if num < 0 {
  331. b = append(b, cs.currencyNegativeSuffix...)
  332. b = append(b, symbol...)
  333. } else {
  334. b = append(b, cs.currencyPositiveSuffix...)
  335. b = append(b, symbol...)
  336. }
  337. return string(b)
  338. }
  339. // FmtDateShort returns the short date representation of 't' for 'cs_CZ'
  340. func (cs *cs_CZ) FmtDateShort(t time.Time) string {
  341. b := make([]byte, 0, 32)
  342. if t.Day() < 10 {
  343. b = append(b, '0')
  344. }
  345. b = strconv.AppendInt(b, int64(t.Day()), 10)
  346. b = append(b, []byte{0x2e}...)
  347. if t.Month() < 10 {
  348. b = append(b, '0')
  349. }
  350. b = strconv.AppendInt(b, int64(t.Month()), 10)
  351. b = append(b, []byte{0x2e}...)
  352. if t.Year() > 9 {
  353. b = append(b, strconv.Itoa(t.Year())[2:]...)
  354. } else {
  355. b = append(b, strconv.Itoa(t.Year())[1:]...)
  356. }
  357. return string(b)
  358. }
  359. // FmtDateMedium returns the medium date representation of 't' for 'cs_CZ'
  360. func (cs *cs_CZ) FmtDateMedium(t time.Time) string {
  361. b := make([]byte, 0, 32)
  362. b = strconv.AppendInt(b, int64(t.Day()), 10)
  363. b = append(b, []byte{0x2e, 0x20}...)
  364. b = strconv.AppendInt(b, int64(t.Month()), 10)
  365. b = append(b, []byte{0x2e, 0x20}...)
  366. b = strconv.AppendInt(b, int64(t.Year()), 10)
  367. return string(b)
  368. }
  369. // FmtDateLong returns the long date representation of 't' for 'cs_CZ'
  370. func (cs *cs_CZ) FmtDateLong(t time.Time) string {
  371. b := make([]byte, 0, 32)
  372. b = strconv.AppendInt(b, int64(t.Day()), 10)
  373. b = append(b, []byte{0x2e, 0x20}...)
  374. b = append(b, cs.monthsWide[t.Month()]...)
  375. b = append(b, []byte{0x20}...)
  376. b = strconv.AppendInt(b, int64(t.Year()), 10)
  377. return string(b)
  378. }
  379. // FmtDateFull returns the full date representation of 't' for 'cs_CZ'
  380. func (cs *cs_CZ) FmtDateFull(t time.Time) string {
  381. b := make([]byte, 0, 32)
  382. b = append(b, cs.daysWide[t.Weekday()]...)
  383. b = append(b, []byte{0x20}...)
  384. b = strconv.AppendInt(b, int64(t.Day()), 10)
  385. b = append(b, []byte{0x2e, 0x20}...)
  386. b = append(b, cs.monthsWide[t.Month()]...)
  387. b = append(b, []byte{0x20}...)
  388. b = strconv.AppendInt(b, int64(t.Year()), 10)
  389. return string(b)
  390. }
  391. // FmtTimeShort returns the short time representation of 't' for 'cs_CZ'
  392. func (cs *cs_CZ) FmtTimeShort(t time.Time) string {
  393. b := make([]byte, 0, 32)
  394. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  395. b = append(b, cs.timeSeparator...)
  396. if t.Minute() < 10 {
  397. b = append(b, '0')
  398. }
  399. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  400. return string(b)
  401. }
  402. // FmtTimeMedium returns the medium time representation of 't' for 'cs_CZ'
  403. func (cs *cs_CZ) FmtTimeMedium(t time.Time) string {
  404. b := make([]byte, 0, 32)
  405. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  406. b = append(b, cs.timeSeparator...)
  407. if t.Minute() < 10 {
  408. b = append(b, '0')
  409. }
  410. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  411. b = append(b, cs.timeSeparator...)
  412. if t.Second() < 10 {
  413. b = append(b, '0')
  414. }
  415. b = strconv.AppendInt(b, int64(t.Second()), 10)
  416. return string(b)
  417. }
  418. // FmtTimeLong returns the long time representation of 't' for 'cs_CZ'
  419. func (cs *cs_CZ) FmtTimeLong(t time.Time) string {
  420. b := make([]byte, 0, 32)
  421. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  422. b = append(b, cs.timeSeparator...)
  423. if t.Minute() < 10 {
  424. b = append(b, '0')
  425. }
  426. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  427. b = append(b, cs.timeSeparator...)
  428. if t.Second() < 10 {
  429. b = append(b, '0')
  430. }
  431. b = strconv.AppendInt(b, int64(t.Second()), 10)
  432. b = append(b, []byte{0x20}...)
  433. tz, _ := t.Zone()
  434. b = append(b, tz...)
  435. return string(b)
  436. }
  437. // FmtTimeFull returns the full time representation of 't' for 'cs_CZ'
  438. func (cs *cs_CZ) FmtTimeFull(t time.Time) string {
  439. b := make([]byte, 0, 32)
  440. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  441. b = append(b, cs.timeSeparator...)
  442. if t.Minute() < 10 {
  443. b = append(b, '0')
  444. }
  445. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  446. b = append(b, cs.timeSeparator...)
  447. if t.Second() < 10 {
  448. b = append(b, '0')
  449. }
  450. b = strconv.AppendInt(b, int64(t.Second()), 10)
  451. b = append(b, []byte{0x20}...)
  452. tz, _ := t.Zone()
  453. if btz, ok := cs.timezones[tz]; ok {
  454. b = append(b, btz...)
  455. } else {
  456. b = append(b, tz...)
  457. }
  458. return string(b)
  459. }