sl_SI.go 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663
  1. package sl_SI
  2. import (
  3. "math"
  4. "strconv"
  5. "time"
  6. "github.com/go-playground/locales"
  7. "github.com/go-playground/locales/currency"
  8. )
  9. type sl_SI 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 'sl_SI' locale
  43. func New() locales.Translator {
  44. return &sl_SI{
  45. locale: "sl_SI",
  46. pluralsCardinal: []locales.PluralRule{2, 3, 4, 6},
  47. pluralsOrdinal: []locales.PluralRule{6},
  48. pluralsRange: []locales.PluralRule{3, 4, 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.", "maj", "jun.", "jul.", "avg.", "sep.", "okt.", "nov.", "dec."},
  62. monthsNarrow: []string{"", "j", "f", "m", "a", "m", "j", "j", "a", "s", "o", "n", "d"},
  63. monthsWide: []string{"", "januar", "februar", "marec", "april", "maj", "junij", "julij", "avgust", "september", "oktober", "november", "december"},
  64. daysAbbreviated: []string{"ned.", "pon.", "tor.", "sre.", "čet.", "pet.", "sob."},
  65. daysNarrow: []string{"n", "p", "t", "s", "č", "p", "s"},
  66. daysShort: []string{"ned.", "pon.", "tor.", "sre.", "čet.", "pet.", "sob."},
  67. daysWide: []string{"nedelja", "ponedeljek", "torek", "sreda", "četrtek", "petek", "sobota"},
  68. periodsAbbreviated: []string{"dop.", "pop."},
  69. periodsNarrow: []string{"d", "p"},
  70. periodsWide: []string{"dop.", "pop."},
  71. erasAbbreviated: []string{"pr. Kr.", "po Kr."},
  72. erasNarrow: []string{"", ""},
  73. erasWide: []string{"pred Kristusom", "po Kristusu"},
  74. timezones: map[string]string{"GFT": "Čas: Francoska Gvajana", "LHST": "Standardni čas otoka Lord Howe", "MDT": "MDT", "ADT": "Atlantski poletni čas", "WEZ": "Zahodnoevropski standardni čas", "MYT": "Malezijski čas", "MESZ": "Srednjeevropski poletni čas", "HEPM": "Poletni čas: Saint Pierre in Miquelon", "WIT": "Indonezijski vzhodni čas", "CHAST": "Čatamski standardni čas", "WIB": "Indonezijski zahodni čas", "NZST": "Novozelandski standardni čas", "HEEG": "Vzhodnogrenlandski poletni čas", "IST": "Indijski standardni čas", "PDT": "Pacifiški poletni čas", "AEDT": "Avstralski vzhodni poletni čas", "WAT": "Zahodnoafriški standardni čas", "AST": "Atlantski standardni čas", "JST": "Japonski standardni čas", "NZDT": "Novozelandski poletni čas", "EST": "Vzhodni standardni čas", "ACDT": "Avstralski centralni poletni čas", "HNPM": "Standardni čas: Saint Pierre in Miquelon", "HNNOMX": "Mehiški severozahodni standardni čas", "HEPMX": "Mehiški pacifiški poletni čas", "HKT": "Hongkonški standardni čas", "WART": "Argentinski zahodni standardni čas", "HEOG": "Zahodnogrenlandski poletni čas", "CAT": "Centralnoafriški čas", "CHADT": "Čatamski poletni čas", "SAST": "Južnoafriški čas", "EDT": "Vzhodni poletni čas", "MEZ": "Srednjeevropski standardni čas", "GMT": "Greenwiški srednji čas", "CST": "Centralni standardni čas", "WAST": "Zahodnoafriški poletni čas", "JDT": "Japonski poletni čas", "ACWST": "Avstralski centralni zahodni standardni čas", "HKST": "Hongkonški poletni čas", "VET": "Venezuelski čas", "∅∅∅": "Amazonski poletni čas", "GYT": "Gvajanski čas", "AWST": "Avstralski zahodni standardni čas", "BT": "Butanski čas", "SRT": "Surinamski čas", "HECU": "Kubanski poletni čas", "CDT": "Centralni poletni čas", "MST": "MST", "OEZ": "Vzhodnoevropski standardni čas", "HNEG": "Vzhodnogrenlandski standardni čas", "AWDT": "Avstralski zahodni poletni čas", "SGT": "Singapurski standardni čas", "LHDT": "Poletni čas otoka Lord Howe", "WITA": "Indonezijski osrednji čas", "ART": "Argentinski standardni čas", "COST": "Kolumbijski poletni čas", "HADT": "Havajski aleutski poletni čas", "PST": "Pacifiški standardni čas", "ECT": "Ekvadorski čas", "WESZ": "Zahodnoevropski poletni čas", "AKST": "Aljaški standardni čas", "WARST": "Argentinski zahodni poletni čas", "HNT": "Novofundlandski standardni čas", "UYT": "Urugvajski standardni čas", "HNPMX": "Mehiški pacifiški standardni čas", "HNCU": "Kubanski standardni čas", "ACWDT": "Avstralski centralni zahodni poletni čas", "HNOG": "Zahodnogrenlandski standardni čas", "HAST": "Havajski aleutski standardni čas", "UYST": "Urugvajski poletni čas", "ChST": "Čamorski standardni čas", "CLT": "Čilski standardni čas", "COT": "Kolumbijski standardni čas", "AEST": "Avstralski vzhodni standardni čas", "AKDT": "Aljaški poletni čas", "HENOMX": "Mehiški severozahodni poletni čas", "CLST": "Čilski poletni čas", "OESZ": "Vzhodnoevropski poletni čas", "TMST": "Turkmenistanski poletni čas", "ARST": "Argentinski poletni čas", "BOT": "Bolivijski čas", "ACST": "Avstralski centralni standardni čas", "HAT": "Novofundlandski poletni čas", "EAT": "Vzhodnoafriški čas", "TMT": "Turkmenistanski standardni čas"},
  75. }
  76. }
  77. // Locale returns the current translators string locale
  78. func (sl *sl_SI) Locale() string {
  79. return sl.locale
  80. }
  81. // PluralsCardinal returns the list of cardinal plural rules associated with 'sl_SI'
  82. func (sl *sl_SI) PluralsCardinal() []locales.PluralRule {
  83. return sl.pluralsCardinal
  84. }
  85. // PluralsOrdinal returns the list of ordinal plural rules associated with 'sl_SI'
  86. func (sl *sl_SI) PluralsOrdinal() []locales.PluralRule {
  87. return sl.pluralsOrdinal
  88. }
  89. // PluralsRange returns the list of range plural rules associated with 'sl_SI'
  90. func (sl *sl_SI) PluralsRange() []locales.PluralRule {
  91. return sl.pluralsRange
  92. }
  93. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'sl_SI'
  94. func (sl *sl_SI) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
  95. n := math.Abs(num)
  96. i := int64(n)
  97. iMod100 := i % 100
  98. if v == 0 && iMod100 == 1 {
  99. return locales.PluralRuleOne
  100. } else if v == 0 && iMod100 == 2 {
  101. return locales.PluralRuleTwo
  102. } else if (v == 0 && iMod100 >= 3 && iMod100 <= 4) || (v != 0) {
  103. return locales.PluralRuleFew
  104. }
  105. return locales.PluralRuleOther
  106. }
  107. // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'sl_SI'
  108. func (sl *sl_SI) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
  109. return locales.PluralRuleOther
  110. }
  111. // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'sl_SI'
  112. func (sl *sl_SI) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
  113. start := sl.CardinalPluralRule(num1, v1)
  114. end := sl.CardinalPluralRule(num2, v2)
  115. if start == locales.PluralRuleOne && end == locales.PluralRuleOne {
  116. return locales.PluralRuleFew
  117. } else if start == locales.PluralRuleOne && end == locales.PluralRuleTwo {
  118. return locales.PluralRuleTwo
  119. } else if start == locales.PluralRuleOne && end == locales.PluralRuleFew {
  120. return locales.PluralRuleFew
  121. } else if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
  122. return locales.PluralRuleOther
  123. } else if start == locales.PluralRuleTwo && end == locales.PluralRuleOne {
  124. return locales.PluralRuleFew
  125. } else if start == locales.PluralRuleTwo && end == locales.PluralRuleTwo {
  126. return locales.PluralRuleTwo
  127. } else if start == locales.PluralRuleTwo && end == locales.PluralRuleFew {
  128. return locales.PluralRuleFew
  129. } else if start == locales.PluralRuleTwo && end == locales.PluralRuleOther {
  130. return locales.PluralRuleOther
  131. } else if start == locales.PluralRuleFew && end == locales.PluralRuleOne {
  132. return locales.PluralRuleFew
  133. } else if start == locales.PluralRuleFew && end == locales.PluralRuleTwo {
  134. return locales.PluralRuleTwo
  135. } else if start == locales.PluralRuleFew && end == locales.PluralRuleFew {
  136. return locales.PluralRuleFew
  137. } else if start == locales.PluralRuleFew && end == locales.PluralRuleOther {
  138. return locales.PluralRuleOther
  139. } else if start == locales.PluralRuleOther && end == locales.PluralRuleOne {
  140. return locales.PluralRuleFew
  141. } else if start == locales.PluralRuleOther && end == locales.PluralRuleTwo {
  142. return locales.PluralRuleTwo
  143. } else if start == locales.PluralRuleOther && end == locales.PluralRuleFew {
  144. return locales.PluralRuleFew
  145. }
  146. return locales.PluralRuleOther
  147. }
  148. // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
  149. func (sl *sl_SI) MonthAbbreviated(month time.Month) string {
  150. return sl.monthsAbbreviated[month]
  151. }
  152. // MonthsAbbreviated returns the locales abbreviated months
  153. func (sl *sl_SI) MonthsAbbreviated() []string {
  154. return sl.monthsAbbreviated[1:]
  155. }
  156. // MonthNarrow returns the locales narrow month given the 'month' provided
  157. func (sl *sl_SI) MonthNarrow(month time.Month) string {
  158. return sl.monthsNarrow[month]
  159. }
  160. // MonthsNarrow returns the locales narrow months
  161. func (sl *sl_SI) MonthsNarrow() []string {
  162. return sl.monthsNarrow[1:]
  163. }
  164. // MonthWide returns the locales wide month given the 'month' provided
  165. func (sl *sl_SI) MonthWide(month time.Month) string {
  166. return sl.monthsWide[month]
  167. }
  168. // MonthsWide returns the locales wide months
  169. func (sl *sl_SI) MonthsWide() []string {
  170. return sl.monthsWide[1:]
  171. }
  172. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  173. func (sl *sl_SI) WeekdayAbbreviated(weekday time.Weekday) string {
  174. return sl.daysAbbreviated[weekday]
  175. }
  176. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  177. func (sl *sl_SI) WeekdaysAbbreviated() []string {
  178. return sl.daysAbbreviated
  179. }
  180. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  181. func (sl *sl_SI) WeekdayNarrow(weekday time.Weekday) string {
  182. return sl.daysNarrow[weekday]
  183. }
  184. // WeekdaysNarrow returns the locales narrow weekdays
  185. func (sl *sl_SI) WeekdaysNarrow() []string {
  186. return sl.daysNarrow
  187. }
  188. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  189. func (sl *sl_SI) WeekdayShort(weekday time.Weekday) string {
  190. return sl.daysShort[weekday]
  191. }
  192. // WeekdaysShort returns the locales short weekdays
  193. func (sl *sl_SI) WeekdaysShort() []string {
  194. return sl.daysShort
  195. }
  196. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  197. func (sl *sl_SI) WeekdayWide(weekday time.Weekday) string {
  198. return sl.daysWide[weekday]
  199. }
  200. // WeekdaysWide returns the locales wide weekdays
  201. func (sl *sl_SI) WeekdaysWide() []string {
  202. return sl.daysWide
  203. }
  204. // Decimal returns the decimal point of number
  205. func (sl *sl_SI) Decimal() string {
  206. return sl.decimal
  207. }
  208. // Group returns the group of number
  209. func (sl *sl_SI) Group() string {
  210. return sl.group
  211. }
  212. // Group returns the minus sign of number
  213. func (sl *sl_SI) Minus() string {
  214. return sl.minus
  215. }
  216. // FmtNumber returns 'num' with digits/precision of 'v' for 'sl_SI' and handles both Whole and Real numbers based on 'v'
  217. func (sl *sl_SI) FmtNumber(num float64, v uint64) string {
  218. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  219. l := len(s) + 4 + 1*len(s[:len(s)-int(v)-1])/3
  220. count := 0
  221. inWhole := v == 0
  222. b := make([]byte, 0, l)
  223. for i := len(s) - 1; i >= 0; i-- {
  224. if s[i] == '.' {
  225. b = append(b, sl.decimal[0])
  226. inWhole = true
  227. continue
  228. }
  229. if inWhole {
  230. if count == 3 {
  231. b = append(b, sl.group[0])
  232. count = 1
  233. } else {
  234. count++
  235. }
  236. }
  237. b = append(b, s[i])
  238. }
  239. if num < 0 {
  240. for j := len(sl.minus) - 1; j >= 0; j-- {
  241. b = append(b, sl.minus[j])
  242. }
  243. }
  244. // reverse
  245. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  246. b[i], b[j] = b[j], b[i]
  247. }
  248. return string(b)
  249. }
  250. // FmtPercent returns 'num' with digits/precision of 'v' for 'sl_SI' and handles both Whole and Real numbers based on 'v'
  251. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
  252. func (sl *sl_SI) FmtPercent(num float64, v uint64) string {
  253. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  254. l := len(s) + 7
  255. b := make([]byte, 0, l)
  256. for i := len(s) - 1; i >= 0; i-- {
  257. if s[i] == '.' {
  258. b = append(b, sl.decimal[0])
  259. continue
  260. }
  261. b = append(b, s[i])
  262. }
  263. if num < 0 {
  264. for j := len(sl.minus) - 1; j >= 0; j-- {
  265. b = append(b, sl.minus[j])
  266. }
  267. }
  268. // reverse
  269. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  270. b[i], b[j] = b[j], b[i]
  271. }
  272. b = append(b, sl.percentSuffix...)
  273. b = append(b, sl.percent...)
  274. return string(b)
  275. }
  276. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'sl_SI'
  277. func (sl *sl_SI) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  278. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  279. symbol := sl.currencies[currency]
  280. l := len(s) + len(symbol) + 6 + 1*len(s[:len(s)-int(v)-1])/3
  281. count := 0
  282. inWhole := v == 0
  283. b := make([]byte, 0, l)
  284. for i := len(s) - 1; i >= 0; i-- {
  285. if s[i] == '.' {
  286. b = append(b, sl.decimal[0])
  287. inWhole = true
  288. continue
  289. }
  290. if inWhole {
  291. if count == 3 {
  292. b = append(b, sl.group[0])
  293. count = 1
  294. } else {
  295. count++
  296. }
  297. }
  298. b = append(b, s[i])
  299. }
  300. if num < 0 {
  301. for j := len(sl.minus) - 1; j >= 0; j-- {
  302. b = append(b, sl.minus[j])
  303. }
  304. }
  305. // reverse
  306. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  307. b[i], b[j] = b[j], b[i]
  308. }
  309. if int(v) < 2 {
  310. if v == 0 {
  311. b = append(b, sl.decimal...)
  312. }
  313. for i := 0; i < 2-int(v); i++ {
  314. b = append(b, '0')
  315. }
  316. }
  317. b = append(b, sl.currencyPositiveSuffix...)
  318. b = append(b, symbol...)
  319. return string(b)
  320. }
  321. // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sl_SI'
  322. // in accounting notation.
  323. func (sl *sl_SI) FmtAccounting(num float64, v uint64, currency currency.Type) string {
  324. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  325. symbol := sl.currencies[currency]
  326. l := len(s) + len(symbol) + 8 + 1*len(s[:len(s)-int(v)-1])/3
  327. count := 0
  328. inWhole := v == 0
  329. b := make([]byte, 0, l)
  330. for i := len(s) - 1; i >= 0; i-- {
  331. if s[i] == '.' {
  332. b = append(b, sl.decimal[0])
  333. inWhole = true
  334. continue
  335. }
  336. if inWhole {
  337. if count == 3 {
  338. b = append(b, sl.group[0])
  339. count = 1
  340. } else {
  341. count++
  342. }
  343. }
  344. b = append(b, s[i])
  345. }
  346. if num < 0 {
  347. b = append(b, sl.currencyNegativePrefix[0])
  348. }
  349. // reverse
  350. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  351. b[i], b[j] = b[j], b[i]
  352. }
  353. if int(v) < 2 {
  354. if v == 0 {
  355. b = append(b, sl.decimal...)
  356. }
  357. for i := 0; i < 2-int(v); i++ {
  358. b = append(b, '0')
  359. }
  360. }
  361. if num < 0 {
  362. b = append(b, sl.currencyNegativeSuffix...)
  363. b = append(b, symbol...)
  364. } else {
  365. b = append(b, sl.currencyPositiveSuffix...)
  366. b = append(b, symbol...)
  367. }
  368. return string(b)
  369. }
  370. // FmtDateShort returns the short date representation of 't' for 'sl_SI'
  371. func (sl *sl_SI) FmtDateShort(t time.Time) string {
  372. b := make([]byte, 0, 32)
  373. b = strconv.AppendInt(b, int64(t.Day()), 10)
  374. b = append(b, []byte{0x2e, 0x20}...)
  375. if t.Month() < 10 {
  376. b = append(b, '0')
  377. }
  378. b = strconv.AppendInt(b, int64(t.Month()), 10)
  379. b = append(b, []byte{0x2e, 0x20}...)
  380. if t.Year() > 9 {
  381. b = append(b, strconv.Itoa(t.Year())[2:]...)
  382. } else {
  383. b = append(b, strconv.Itoa(t.Year())[1:]...)
  384. }
  385. return string(b)
  386. }
  387. // FmtDateMedium returns the medium date representation of 't' for 'sl_SI'
  388. func (sl *sl_SI) FmtDateMedium(t time.Time) string {
  389. b := make([]byte, 0, 32)
  390. b = strconv.AppendInt(b, int64(t.Day()), 10)
  391. b = append(b, []byte{0x2e, 0x20}...)
  392. b = append(b, sl.monthsAbbreviated[t.Month()]...)
  393. b = append(b, []byte{0x20}...)
  394. if t.Year() > 0 {
  395. b = strconv.AppendInt(b, int64(t.Year()), 10)
  396. } else {
  397. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  398. }
  399. return string(b)
  400. }
  401. // FmtDateLong returns the long date representation of 't' for 'sl_SI'
  402. func (sl *sl_SI) FmtDateLong(t time.Time) string {
  403. b := make([]byte, 0, 32)
  404. if t.Day() < 10 {
  405. b = append(b, '0')
  406. }
  407. b = strconv.AppendInt(b, int64(t.Day()), 10)
  408. b = append(b, []byte{0x2e, 0x20}...)
  409. b = append(b, sl.monthsWide[t.Month()]...)
  410. b = append(b, []byte{0x20}...)
  411. if t.Year() > 0 {
  412. b = strconv.AppendInt(b, int64(t.Year()), 10)
  413. } else {
  414. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  415. }
  416. return string(b)
  417. }
  418. // FmtDateFull returns the full date representation of 't' for 'sl_SI'
  419. func (sl *sl_SI) FmtDateFull(t time.Time) string {
  420. b := make([]byte, 0, 32)
  421. b = append(b, sl.daysWide[t.Weekday()]...)
  422. b = append(b, []byte{0x2c, 0x20}...)
  423. if t.Day() < 10 {
  424. b = append(b, '0')
  425. }
  426. b = strconv.AppendInt(b, int64(t.Day()), 10)
  427. b = append(b, []byte{0x2e, 0x20}...)
  428. b = append(b, sl.monthsWide[t.Month()]...)
  429. b = append(b, []byte{0x20}...)
  430. if t.Year() > 0 {
  431. b = strconv.AppendInt(b, int64(t.Year()), 10)
  432. } else {
  433. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  434. }
  435. return string(b)
  436. }
  437. // FmtTimeShort returns the short time representation of 't' for 'sl_SI'
  438. func (sl *sl_SI) FmtTimeShort(t time.Time) string {
  439. b := make([]byte, 0, 32)
  440. if t.Hour() < 10 {
  441. b = append(b, '0')
  442. }
  443. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  444. b = append(b, sl.timeSeparator...)
  445. if t.Minute() < 10 {
  446. b = append(b, '0')
  447. }
  448. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  449. return string(b)
  450. }
  451. // FmtTimeMedium returns the medium time representation of 't' for 'sl_SI'
  452. func (sl *sl_SI) FmtTimeMedium(t time.Time) string {
  453. b := make([]byte, 0, 32)
  454. if t.Hour() < 10 {
  455. b = append(b, '0')
  456. }
  457. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  458. b = append(b, sl.timeSeparator...)
  459. if t.Minute() < 10 {
  460. b = append(b, '0')
  461. }
  462. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  463. b = append(b, sl.timeSeparator...)
  464. if t.Second() < 10 {
  465. b = append(b, '0')
  466. }
  467. b = strconv.AppendInt(b, int64(t.Second()), 10)
  468. return string(b)
  469. }
  470. // FmtTimeLong returns the long time representation of 't' for 'sl_SI'
  471. func (sl *sl_SI) FmtTimeLong(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, sl.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, sl.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}...)
  488. tz, _ := t.Zone()
  489. b = append(b, tz...)
  490. return string(b)
  491. }
  492. // FmtTimeFull returns the full time representation of 't' for 'sl_SI'
  493. func (sl *sl_SI) FmtTimeFull(t time.Time) string {
  494. b := make([]byte, 0, 32)
  495. if t.Hour() < 10 {
  496. b = append(b, '0')
  497. }
  498. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  499. b = append(b, sl.timeSeparator...)
  500. if t.Minute() < 10 {
  501. b = append(b, '0')
  502. }
  503. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  504. b = append(b, sl.timeSeparator...)
  505. if t.Second() < 10 {
  506. b = append(b, '0')
  507. }
  508. b = strconv.AppendInt(b, int64(t.Second()), 10)
  509. b = append(b, []byte{0x20}...)
  510. tz, _ := t.Zone()
  511. if btz, ok := sl.timezones[tz]; ok {
  512. b = append(b, btz...)
  513. } else {
  514. b = append(b, tz...)
  515. }
  516. return string(b)
  517. }