sk_SK.go 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627
  1. package sk_SK
  2. import (
  3. "math"
  4. "strconv"
  5. "time"
  6. "github.com/go-playground/locales"
  7. "github.com/go-playground/locales/currency"
  8. )
  9. type sk_SK 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. currencyNegativePrefix string
  25. currencyNegativeSuffix string
  26. monthsAbbreviated []string
  27. monthsNarrow []string
  28. monthsWide []string
  29. daysAbbreviated []string
  30. daysNarrow []string
  31. daysShort []string
  32. daysWide []string
  33. periodsAbbreviated []string
  34. periodsNarrow []string
  35. periodsShort []string
  36. periodsWide []string
  37. erasAbbreviated []string
  38. erasNarrow []string
  39. erasWide []string
  40. timezones map[string]string
  41. }
  42. // New returns a new instance of translator for the 'sk_SK' locale
  43. func New() locales.Translator {
  44. return &sk_SK{
  45. locale: "sk_SK",
  46. pluralsCardinal: []locales.PluralRule{2, 4, 5, 6},
  47. pluralsOrdinal: []locales.PluralRule{6},
  48. pluralsRange: []locales.PluralRule{2, 4, 5, 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", "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"},
  57. percentSuffix: " ",
  58. currencyPositiveSuffix: " ",
  59. currencyNegativePrefix: "(",
  60. currencyNegativeSuffix: " )",
  61. monthsAbbreviated: []string{"", "jan", "feb", "mar", "apr", "máj", "jún", "júl", "aug", "sep", "okt", "nov", "dec"},
  62. monthsNarrow: []string{"", "j", "f", "m", "a", "m", "j", "j", "a", "s", "o", "n", "d"},
  63. monthsWide: []string{"", "januára", "februára", "marca", "apríla", "mája", "júna", "júla", "augusta", "septembra", "októbra", "novembra", "decembra"},
  64. daysAbbreviated: []string{"ne", "po", "ut", "st", "št", "pi", "so"},
  65. daysNarrow: []string{"n", "p", "u", "s", "š", "p", "s"},
  66. daysShort: []string{"ne", "po", "ut", "st", "št", "pi", "so"},
  67. daysWide: []string{"nedeľa", "pondelok", "utorok", "streda", "štvrtok", "piatok", "sobota"},
  68. periodsAbbreviated: []string{"AM", "PM"},
  69. periodsNarrow: []string{"AM", "PM"},
  70. periodsWide: []string{"AM", "PM"},
  71. erasAbbreviated: []string{"pred Kr.", "po Kr."},
  72. erasNarrow: []string{"", ""},
  73. erasWide: []string{"pred Kristom", "po Kristovi"},
  74. timezones: map[string]string{"BT": "bhutánsky čas", "AKDT": "aljašský letný čas", "MEZ": "stredoeurópsky štandardný čas", "CLST": "čilský letný čas", "WIT": "východoindonézsky čas", "IST": "indický čas", "COST": "kolumbijský letný čas", "CHADT": "chathamský letný čas", "MYT": "malajzijský čas", "WART": "západoargentínsky štandardný čas", "HAT": "newfoundlandský letný čas", "SRT": "surinamský čas", "ACST": "stredoaustrálsky štandardný čas", "LHST": "štandardný čas ostrova lorda Howa", "CDT": "severoamerický centrálny letný čas", "AWST": "západoaustrálsky štandardný čas", "MST": "severoamerický horský štandardný čas", "WAST": "západoafrický letný čas", "NZDT": "novozélandský letný čas", "EDT": "severoamerický východný letný čas", "TMT": "turkménsky štandardný čas", "UYST": "uruguajský letný čas", "ChST": "chamorrský čas", "HNPMX": "mexický tichomorský štandardný čas", "AST": "atlantický štandardný čas", "JST": "japonský štandardný čas", "HKST": "hongkonský letný čas", "HNPM": "pierre-miquelonský štandardný čas", "CST": "severoamerický centrálny štandardný čas", "HNEG": "východogrónsky štandardný čas", "OESZ": "východoeurópsky letný čas", "ARST": "argentínsky letný čas", "PDT": "severoamerický tichomorský letný čas", "WIB": "západoindonézsky čas", "SGT": "singapurský štandardný čas", "HEEG": "východogrónsky letný čas", "HKT": "hongkonský štandardný čas", "COT": "kolumbijský štandardný čas", "GYT": "guyanský čas", "ACDT": "stredoaustrálsky letný čas", "HNOG": "západogrónsky štandardný čas", "WITA": "stredoindonézsky čas", "TMST": "turkménsky letný čas", "HAST": "havajsko-aleutský štandardný čas", "HECU": "kubánsky letný čas", "WAT": "západoafrický štandardný čas", "WARST": "západoargentínsky letný čas", "GMT": "greenwichský čas", "HNNOMX": "severozápadný mexický štandardný čas", "CAT": "stredoafrický čas", "OEZ": "východoeurópsky štandardný čas", "HADT": "havajsko-aleutský letný čas", "ART": "argentínsky štandardný čas", "ACWDT": "stredozápadný austrálsky letný čas", "GFT": "francúzskoguyanský čas", "JDT": "japonský letný čas", "UYT": "uruguajský štandardný čas", "CHAST": "chathamský štandardný čas", "AWDT": "západoaustrálsky letný čas", "HEPMX": "mexický tichomorský letný čas", "SAST": "juhoafrický čas", "WESZ": "západoeurópsky letný čas", "AKST": "aljašský štandardný čas", "EST": "severoamerický východný štandardný čas", "HEOG": "západogrónsky letný čas", "EAT": "východoafrický čas", "HENOMX": "severozápadný mexický letný čas", "CLT": "čilský štandardný čas", "HNCU": "kubánsky štandardný čas", "ADT": "atlantický letný čas", "MDT": "severoamerický horský letný čas", "NZST": "novozélandský štandardný čas", "ECT": "ekvádorský čas", "HNT": "newfoundlandský štandardný čas", "∅∅∅": "brazílsky letný čas", "PST": "severoamerický tichomorský štandardný čas", "MESZ": "stredoeurópsky letný čas", "LHDT": "letný čas ostrova lorda Howa", "VET": "venezuelský čas", "HEPM": "pierre-miquelonský letný čas", "AEST": "východoaustrálsky štandardný čas", "AEDT": "východoaustrálsky letný čas", "WEZ": "západoeurópsky štandardný čas", "BOT": "bolívijský čas", "ACWST": "stredozápadný austrálsky štandardný čas"},
  75. }
  76. }
  77. // Locale returns the current translators string locale
  78. func (sk *sk_SK) Locale() string {
  79. return sk.locale
  80. }
  81. // PluralsCardinal returns the list of cardinal plural rules associated with 'sk_SK'
  82. func (sk *sk_SK) PluralsCardinal() []locales.PluralRule {
  83. return sk.pluralsCardinal
  84. }
  85. // PluralsOrdinal returns the list of ordinal plural rules associated with 'sk_SK'
  86. func (sk *sk_SK) PluralsOrdinal() []locales.PluralRule {
  87. return sk.pluralsOrdinal
  88. }
  89. // PluralsRange returns the list of range plural rules associated with 'sk_SK'
  90. func (sk *sk_SK) PluralsRange() []locales.PluralRule {
  91. return sk.pluralsRange
  92. }
  93. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'sk_SK'
  94. func (sk *sk_SK) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
  95. n := math.Abs(num)
  96. i := int64(n)
  97. if i == 1 && v == 0 {
  98. return locales.PluralRuleOne
  99. } else if i >= 2 && i <= 4 && v == 0 {
  100. return locales.PluralRuleFew
  101. } else if v != 0 {
  102. return locales.PluralRuleMany
  103. }
  104. return locales.PluralRuleOther
  105. }
  106. // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'sk_SK'
  107. func (sk *sk_SK) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
  108. return locales.PluralRuleOther
  109. }
  110. // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'sk_SK'
  111. func (sk *sk_SK) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
  112. start := sk.CardinalPluralRule(num1, v1)
  113. end := sk.CardinalPluralRule(num2, v2)
  114. if start == locales.PluralRuleOne && end == locales.PluralRuleFew {
  115. return locales.PluralRuleFew
  116. } else if start == locales.PluralRuleOne && end == locales.PluralRuleMany {
  117. return locales.PluralRuleMany
  118. } else if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
  119. return locales.PluralRuleOther
  120. } else if start == locales.PluralRuleFew && end == locales.PluralRuleFew {
  121. return locales.PluralRuleFew
  122. } else if start == locales.PluralRuleFew && end == locales.PluralRuleMany {
  123. return locales.PluralRuleMany
  124. } else if start == locales.PluralRuleFew && end == locales.PluralRuleOther {
  125. return locales.PluralRuleOther
  126. } else if start == locales.PluralRuleMany && end == locales.PluralRuleOne {
  127. return locales.PluralRuleOne
  128. } else if start == locales.PluralRuleMany && end == locales.PluralRuleFew {
  129. return locales.PluralRuleFew
  130. } else if start == locales.PluralRuleMany && end == locales.PluralRuleMany {
  131. return locales.PluralRuleMany
  132. } else if start == locales.PluralRuleMany && end == locales.PluralRuleOther {
  133. return locales.PluralRuleOther
  134. } else if start == locales.PluralRuleOther && end == locales.PluralRuleOne {
  135. return locales.PluralRuleOne
  136. } else if start == locales.PluralRuleOther && end == locales.PluralRuleFew {
  137. return locales.PluralRuleFew
  138. } else if start == locales.PluralRuleOther && end == locales.PluralRuleMany {
  139. return locales.PluralRuleMany
  140. }
  141. return locales.PluralRuleOther
  142. }
  143. // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
  144. func (sk *sk_SK) MonthAbbreviated(month time.Month) string {
  145. return sk.monthsAbbreviated[month]
  146. }
  147. // MonthsAbbreviated returns the locales abbreviated months
  148. func (sk *sk_SK) MonthsAbbreviated() []string {
  149. return sk.monthsAbbreviated[1:]
  150. }
  151. // MonthNarrow returns the locales narrow month given the 'month' provided
  152. func (sk *sk_SK) MonthNarrow(month time.Month) string {
  153. return sk.monthsNarrow[month]
  154. }
  155. // MonthsNarrow returns the locales narrow months
  156. func (sk *sk_SK) MonthsNarrow() []string {
  157. return sk.monthsNarrow[1:]
  158. }
  159. // MonthWide returns the locales wide month given the 'month' provided
  160. func (sk *sk_SK) MonthWide(month time.Month) string {
  161. return sk.monthsWide[month]
  162. }
  163. // MonthsWide returns the locales wide months
  164. func (sk *sk_SK) MonthsWide() []string {
  165. return sk.monthsWide[1:]
  166. }
  167. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  168. func (sk *sk_SK) WeekdayAbbreviated(weekday time.Weekday) string {
  169. return sk.daysAbbreviated[weekday]
  170. }
  171. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  172. func (sk *sk_SK) WeekdaysAbbreviated() []string {
  173. return sk.daysAbbreviated
  174. }
  175. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  176. func (sk *sk_SK) WeekdayNarrow(weekday time.Weekday) string {
  177. return sk.daysNarrow[weekday]
  178. }
  179. // WeekdaysNarrow returns the locales narrow weekdays
  180. func (sk *sk_SK) WeekdaysNarrow() []string {
  181. return sk.daysNarrow
  182. }
  183. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  184. func (sk *sk_SK) WeekdayShort(weekday time.Weekday) string {
  185. return sk.daysShort[weekday]
  186. }
  187. // WeekdaysShort returns the locales short weekdays
  188. func (sk *sk_SK) WeekdaysShort() []string {
  189. return sk.daysShort
  190. }
  191. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  192. func (sk *sk_SK) WeekdayWide(weekday time.Weekday) string {
  193. return sk.daysWide[weekday]
  194. }
  195. // WeekdaysWide returns the locales wide weekdays
  196. func (sk *sk_SK) WeekdaysWide() []string {
  197. return sk.daysWide
  198. }
  199. // Decimal returns the decimal point of number
  200. func (sk *sk_SK) Decimal() string {
  201. return sk.decimal
  202. }
  203. // Group returns the group of number
  204. func (sk *sk_SK) Group() string {
  205. return sk.group
  206. }
  207. // Group returns the minus sign of number
  208. func (sk *sk_SK) Minus() string {
  209. return sk.minus
  210. }
  211. // FmtNumber returns 'num' with digits/precision of 'v' for 'sk_SK' and handles both Whole and Real numbers based on 'v'
  212. func (sk *sk_SK) FmtNumber(num float64, v uint64) string {
  213. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  214. l := len(s) + 2 + 2*len(s[:len(s)-int(v)-1])/3
  215. count := 0
  216. inWhole := v == 0
  217. b := make([]byte, 0, l)
  218. for i := len(s) - 1; i >= 0; i-- {
  219. if s[i] == '.' {
  220. b = append(b, sk.decimal[0])
  221. inWhole = true
  222. continue
  223. }
  224. if inWhole {
  225. if count == 3 {
  226. for j := len(sk.group) - 1; j >= 0; j-- {
  227. b = append(b, sk.group[j])
  228. }
  229. count = 1
  230. } else {
  231. count++
  232. }
  233. }
  234. b = append(b, s[i])
  235. }
  236. if num < 0 {
  237. b = append(b, sk.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. return string(b)
  244. }
  245. // FmtPercent returns 'num' with digits/precision of 'v' for 'sk_SK' and handles both Whole and Real numbers based on 'v'
  246. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
  247. func (sk *sk_SK) FmtPercent(num float64, v uint64) string {
  248. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  249. l := len(s) + 5
  250. b := make([]byte, 0, l)
  251. for i := len(s) - 1; i >= 0; i-- {
  252. if s[i] == '.' {
  253. b = append(b, sk.decimal[0])
  254. continue
  255. }
  256. b = append(b, s[i])
  257. }
  258. if num < 0 {
  259. b = append(b, sk.minus[0])
  260. }
  261. // reverse
  262. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  263. b[i], b[j] = b[j], b[i]
  264. }
  265. b = append(b, sk.percentSuffix...)
  266. b = append(b, sk.percent...)
  267. return string(b)
  268. }
  269. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'sk_SK'
  270. func (sk *sk_SK) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  271. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  272. symbol := sk.currencies[currency]
  273. l := len(s) + len(symbol) + 4 + 2*len(s[:len(s)-int(v)-1])/3
  274. count := 0
  275. inWhole := v == 0
  276. b := make([]byte, 0, l)
  277. for i := len(s) - 1; i >= 0; i-- {
  278. if s[i] == '.' {
  279. b = append(b, sk.decimal[0])
  280. inWhole = true
  281. continue
  282. }
  283. if inWhole {
  284. if count == 3 {
  285. for j := len(sk.group) - 1; j >= 0; j-- {
  286. b = append(b, sk.group[j])
  287. }
  288. count = 1
  289. } else {
  290. count++
  291. }
  292. }
  293. b = append(b, s[i])
  294. }
  295. if num < 0 {
  296. b = append(b, sk.minus[0])
  297. }
  298. // reverse
  299. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  300. b[i], b[j] = b[j], b[i]
  301. }
  302. if int(v) < 2 {
  303. if v == 0 {
  304. b = append(b, sk.decimal...)
  305. }
  306. for i := 0; i < 2-int(v); i++ {
  307. b = append(b, '0')
  308. }
  309. }
  310. b = append(b, sk.currencyPositiveSuffix...)
  311. b = append(b, symbol...)
  312. return string(b)
  313. }
  314. // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sk_SK'
  315. // in accounting notation.
  316. func (sk *sk_SK) FmtAccounting(num float64, v uint64, currency currency.Type) string {
  317. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  318. symbol := sk.currencies[currency]
  319. l := len(s) + len(symbol) + 6 + 2*len(s[:len(s)-int(v)-1])/3
  320. count := 0
  321. inWhole := v == 0
  322. b := make([]byte, 0, l)
  323. for i := len(s) - 1; i >= 0; i-- {
  324. if s[i] == '.' {
  325. b = append(b, sk.decimal[0])
  326. inWhole = true
  327. continue
  328. }
  329. if inWhole {
  330. if count == 3 {
  331. for j := len(sk.group) - 1; j >= 0; j-- {
  332. b = append(b, sk.group[j])
  333. }
  334. count = 1
  335. } else {
  336. count++
  337. }
  338. }
  339. b = append(b, s[i])
  340. }
  341. if num < 0 {
  342. b = append(b, sk.currencyNegativePrefix[0])
  343. }
  344. // reverse
  345. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  346. b[i], b[j] = b[j], b[i]
  347. }
  348. if int(v) < 2 {
  349. if v == 0 {
  350. b = append(b, sk.decimal...)
  351. }
  352. for i := 0; i < 2-int(v); i++ {
  353. b = append(b, '0')
  354. }
  355. }
  356. if num < 0 {
  357. b = append(b, sk.currencyNegativeSuffix...)
  358. b = append(b, symbol...)
  359. } else {
  360. b = append(b, sk.currencyPositiveSuffix...)
  361. b = append(b, symbol...)
  362. }
  363. return string(b)
  364. }
  365. // FmtDateShort returns the short date representation of 't' for 'sk_SK'
  366. func (sk *sk_SK) FmtDateShort(t time.Time) string {
  367. b := make([]byte, 0, 32)
  368. b = strconv.AppendInt(b, int64(t.Day()), 10)
  369. b = append(b, []byte{0x2e, 0x20}...)
  370. b = strconv.AppendInt(b, int64(t.Month()), 10)
  371. b = append(b, []byte{0x2e, 0x20}...)
  372. if t.Year() > 0 {
  373. b = strconv.AppendInt(b, int64(t.Year()), 10)
  374. } else {
  375. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  376. }
  377. return string(b)
  378. }
  379. // FmtDateMedium returns the medium date representation of 't' for 'sk_SK'
  380. func (sk *sk_SK) FmtDateMedium(t time.Time) string {
  381. b := make([]byte, 0, 32)
  382. b = strconv.AppendInt(b, int64(t.Day()), 10)
  383. b = append(b, []byte{0x2e, 0x20}...)
  384. b = strconv.AppendInt(b, int64(t.Month()), 10)
  385. b = append(b, []byte{0x2e, 0x20}...)
  386. if t.Year() > 0 {
  387. b = strconv.AppendInt(b, int64(t.Year()), 10)
  388. } else {
  389. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  390. }
  391. return string(b)
  392. }
  393. // FmtDateLong returns the long date representation of 't' for 'sk_SK'
  394. func (sk *sk_SK) FmtDateLong(t time.Time) string {
  395. b := make([]byte, 0, 32)
  396. b = strconv.AppendInt(b, int64(t.Day()), 10)
  397. b = append(b, []byte{0x2e, 0x20}...)
  398. b = append(b, sk.monthsWide[t.Month()]...)
  399. b = append(b, []byte{0x20}...)
  400. if t.Year() > 0 {
  401. b = strconv.AppendInt(b, int64(t.Year()), 10)
  402. } else {
  403. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  404. }
  405. return string(b)
  406. }
  407. // FmtDateFull returns the full date representation of 't' for 'sk_SK'
  408. func (sk *sk_SK) FmtDateFull(t time.Time) string {
  409. b := make([]byte, 0, 32)
  410. b = append(b, sk.daysWide[t.Weekday()]...)
  411. b = append(b, []byte{0x20}...)
  412. b = strconv.AppendInt(b, int64(t.Day()), 10)
  413. b = append(b, []byte{0x2e, 0x20}...)
  414. b = append(b, sk.monthsWide[t.Month()]...)
  415. b = append(b, []byte{0x20}...)
  416. if t.Year() > 0 {
  417. b = strconv.AppendInt(b, int64(t.Year()), 10)
  418. } else {
  419. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  420. }
  421. return string(b)
  422. }
  423. // FmtTimeShort returns the short time representation of 't' for 'sk_SK'
  424. func (sk *sk_SK) FmtTimeShort(t time.Time) string {
  425. b := make([]byte, 0, 32)
  426. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  427. b = append(b, sk.timeSeparator...)
  428. if t.Minute() < 10 {
  429. b = append(b, '0')
  430. }
  431. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  432. return string(b)
  433. }
  434. // FmtTimeMedium returns the medium time representation of 't' for 'sk_SK'
  435. func (sk *sk_SK) FmtTimeMedium(t time.Time) string {
  436. b := make([]byte, 0, 32)
  437. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  438. b = append(b, sk.timeSeparator...)
  439. if t.Minute() < 10 {
  440. b = append(b, '0')
  441. }
  442. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  443. b = append(b, sk.timeSeparator...)
  444. if t.Second() < 10 {
  445. b = append(b, '0')
  446. }
  447. b = strconv.AppendInt(b, int64(t.Second()), 10)
  448. return string(b)
  449. }
  450. // FmtTimeLong returns the long time representation of 't' for 'sk_SK'
  451. func (sk *sk_SK) FmtTimeLong(t time.Time) string {
  452. b := make([]byte, 0, 32)
  453. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  454. b = append(b, sk.timeSeparator...)
  455. if t.Minute() < 10 {
  456. b = append(b, '0')
  457. }
  458. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  459. b = append(b, sk.timeSeparator...)
  460. if t.Second() < 10 {
  461. b = append(b, '0')
  462. }
  463. b = strconv.AppendInt(b, int64(t.Second()), 10)
  464. b = append(b, []byte{0x20}...)
  465. tz, _ := t.Zone()
  466. b = append(b, tz...)
  467. return string(b)
  468. }
  469. // FmtTimeFull returns the full time representation of 't' for 'sk_SK'
  470. func (sk *sk_SK) FmtTimeFull(t time.Time) string {
  471. b := make([]byte, 0, 32)
  472. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  473. b = append(b, sk.timeSeparator...)
  474. if t.Minute() < 10 {
  475. b = append(b, '0')
  476. }
  477. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  478. b = append(b, sk.timeSeparator...)
  479. if t.Second() < 10 {
  480. b = append(b, '0')
  481. }
  482. b = strconv.AppendInt(b, int64(t.Second()), 10)
  483. b = append(b, []byte{0x20}...)
  484. tz, _ := t.Zone()
  485. if btz, ok := sk.timezones[tz]; ok {
  486. b = append(b, btz...)
  487. } else {
  488. b = append(b, tz...)
  489. }
  490. return string(b)
  491. }