en_SE.go 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. package en_SE
  2. import (
  3. "math"
  4. "strconv"
  5. "time"
  6. "github.com/go-playground/locales"
  7. "github.com/go-playground/locales/currency"
  8. )
  9. type en_SE 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 'en_SE' locale
  42. func New() locales.Translator {
  43. return &en_SE{
  44. locale: "en_SE",
  45. pluralsCardinal: []locales.PluralRule{2, 6},
  46. pluralsOrdinal: []locales.PluralRule{2, 3, 4, 6},
  47. pluralsRange: []locales.PluralRule{6},
  48. decimal: ",",
  49. group: " ",
  50. minus: "-",
  51. percent: "%",
  52. perMille: "‰",
  53. timeSeparator: ":",
  54. inifinity: "∞",
  55. 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", "kr", "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"},
  56. percentSuffix: " ",
  57. currencyPositiveSuffix: " ",
  58. currencyNegativeSuffix: " ",
  59. monthsAbbreviated: []string{"", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"},
  60. monthsNarrow: []string{"", "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"},
  61. monthsWide: []string{"", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"},
  62. daysAbbreviated: []string{"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"},
  63. daysNarrow: []string{"S", "M", "T", "W", "T", "F", "S"},
  64. daysShort: []string{"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"},
  65. daysWide: []string{"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"},
  66. periodsAbbreviated: []string{"am", "pm"},
  67. periodsNarrow: []string{"a", "p"},
  68. periodsWide: []string{"am", "pm"},
  69. erasAbbreviated: []string{"BC", "AD"},
  70. erasNarrow: []string{"B", "A"},
  71. erasWide: []string{"Before Christ", "Anno Domini"},
  72. timezones: map[string]string{"GFT": "French Guiana Time", "HNEG": "East Greenland Standard Time", "HADT": "Hawaii-Aleutian Daylight Time", "ChST": "Chamorro Standard Time", "NZST": "New Zealand Standard Time", "JST": "Japan Standard Time", "SGT": "Singapore Standard Time", "HKST": "Hong Kong Summer Time", "IST": "India Standard Time", "VET": "Venezuela Time", "OESZ": "Eastern European Summer Time", "BT": "Bhutan Time", "HEOG": "West Greenland Summer Time", "HNT": "Newfoundland Standard Time", "WITA": "Central Indonesia Time", "OEZ": "Eastern European Standard Time", "AWDT": "Australian Western Daylight Time", "LHDT": "Lord Howe Daylight Time", "HEPM": "St. Pierre & Miquelon Daylight Time", "EAT": "East Africa Time", "PST": "Pacific Standard Time", "AKDT": "Alaska Daylight Time", "HAST": "Hawaii-Aleutian Standard Time", "ADT": "Atlantic Daylight Time", "HNPM": "St. Pierre & Miquelon Standard Time", "CAT": "Central Africa Time", "UYT": "Uruguay Standard Time", "WAST": "West Africa Summer Time", "WEZ": "Western European Standard Time", "ACDT": "Australian Central Daylight Time", "CST": "Central Standard Time", "WIB": "Western Indonesia Time", "JDT": "Japan Daylight Time", "EST": "Eastern Standard Time", "ACST": "Australian Central Standard Time", "AEDT": "Australian Eastern Daylight Time", "AWST": "Australian Western Standard Time", "AST": "Atlantic Standard Time", "EDT": "Eastern Daylight Time", "LHST": "Lord Howe Standard Time", "TMT": "Turkmenistan Standard Time", "ARST": "Argentina Summer Time", "UYST": "Uruguay Summer Time", "WART": "Western Argentina Standard Time", "HNNOMX": "Northwest Mexico Standard Time", "CLT": "Chile Standard Time", "ART": "Argentina Standard Time", "CDT": "Central Daylight Time", "HNCU": "Cuba Standard Time", "MDT": "Mountain Daylight Time", "SAST": "South Africa Standard Time", "MYT": "Malaysia Time", "HENOMX": "Northwest Mexico Daylight Time", "SRT": "Suriname Time", "CHAST": "Chatham Standard Time", "HEPMX": "Mexican Pacific Daylight Time", "AEST": "Australian Eastern Standard Time", "MST": "Mountain Standard Time", "HEEG": "East Greenland Summer Time", "MEZ": "Central European Standard Time", "CLST": "Chile Summer Time", "WIT": "Eastern Indonesia Time", "CHADT": "Chatham Daylight Time", "ACWST": "Australian Central Western Standard Time", "WARST": "Western Argentina Summer Time", "COT": "Colombia Standard Time", "BOT": "Bolivia Time", "ACWDT": "Australian Central Western Daylight Time", "HKT": "Hong Kong Standard Time", "PDT": "Pacific Daylight Time", "HECU": "Cuba Daylight Time", "HNPMX": "Mexican Pacific Standard Time", "WAT": "West Africa Standard Time", "HNOG": "West Greenland Standard Time", "HAT": "Newfoundland Daylight Time", "TMST": "Turkmenistan Summer Time", "COST": "Colombia Summer Time", "GMT": "Greenwich Mean Time", "∅∅∅": "Brasilia Summer Time", "WESZ": "Western European Summer Time", "NZDT": "New Zealand Daylight Time", "AKST": "Alaska Standard Time", "ECT": "Ecuador Time", "MESZ": "Central European Summer Time", "GYT": "Guyana Time"},
  73. }
  74. }
  75. // Locale returns the current translators string locale
  76. func (en *en_SE) Locale() string {
  77. return en.locale
  78. }
  79. // PluralsCardinal returns the list of cardinal plural rules associated with 'en_SE'
  80. func (en *en_SE) PluralsCardinal() []locales.PluralRule {
  81. return en.pluralsCardinal
  82. }
  83. // PluralsOrdinal returns the list of ordinal plural rules associated with 'en_SE'
  84. func (en *en_SE) PluralsOrdinal() []locales.PluralRule {
  85. return en.pluralsOrdinal
  86. }
  87. // PluralsRange returns the list of range plural rules associated with 'en_SE'
  88. func (en *en_SE) PluralsRange() []locales.PluralRule {
  89. return en.pluralsRange
  90. }
  91. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'en_SE'
  92. func (en *en_SE) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
  93. n := math.Abs(num)
  94. i := int64(n)
  95. if i == 1 && v == 0 {
  96. return locales.PluralRuleOne
  97. }
  98. return locales.PluralRuleOther
  99. }
  100. // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'en_SE'
  101. func (en *en_SE) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
  102. n := math.Abs(num)
  103. nMod10 := math.Mod(n, 10)
  104. nMod100 := math.Mod(n, 100)
  105. if nMod10 == 1 && nMod100 != 11 {
  106. return locales.PluralRuleOne
  107. } else if nMod10 == 2 && nMod100 != 12 {
  108. return locales.PluralRuleTwo
  109. } else if nMod10 == 3 && nMod100 != 13 {
  110. return locales.PluralRuleFew
  111. }
  112. return locales.PluralRuleOther
  113. }
  114. // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'en_SE'
  115. func (en *en_SE) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
  116. return locales.PluralRuleOther
  117. }
  118. // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
  119. func (en *en_SE) MonthAbbreviated(month time.Month) string {
  120. return en.monthsAbbreviated[month]
  121. }
  122. // MonthsAbbreviated returns the locales abbreviated months
  123. func (en *en_SE) MonthsAbbreviated() []string {
  124. return en.monthsAbbreviated[1:]
  125. }
  126. // MonthNarrow returns the locales narrow month given the 'month' provided
  127. func (en *en_SE) MonthNarrow(month time.Month) string {
  128. return en.monthsNarrow[month]
  129. }
  130. // MonthsNarrow returns the locales narrow months
  131. func (en *en_SE) MonthsNarrow() []string {
  132. return en.monthsNarrow[1:]
  133. }
  134. // MonthWide returns the locales wide month given the 'month' provided
  135. func (en *en_SE) MonthWide(month time.Month) string {
  136. return en.monthsWide[month]
  137. }
  138. // MonthsWide returns the locales wide months
  139. func (en *en_SE) MonthsWide() []string {
  140. return en.monthsWide[1:]
  141. }
  142. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  143. func (en *en_SE) WeekdayAbbreviated(weekday time.Weekday) string {
  144. return en.daysAbbreviated[weekday]
  145. }
  146. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  147. func (en *en_SE) WeekdaysAbbreviated() []string {
  148. return en.daysAbbreviated
  149. }
  150. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  151. func (en *en_SE) WeekdayNarrow(weekday time.Weekday) string {
  152. return en.daysNarrow[weekday]
  153. }
  154. // WeekdaysNarrow returns the locales narrow weekdays
  155. func (en *en_SE) WeekdaysNarrow() []string {
  156. return en.daysNarrow
  157. }
  158. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  159. func (en *en_SE) WeekdayShort(weekday time.Weekday) string {
  160. return en.daysShort[weekday]
  161. }
  162. // WeekdaysShort returns the locales short weekdays
  163. func (en *en_SE) WeekdaysShort() []string {
  164. return en.daysShort
  165. }
  166. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  167. func (en *en_SE) WeekdayWide(weekday time.Weekday) string {
  168. return en.daysWide[weekday]
  169. }
  170. // WeekdaysWide returns the locales wide weekdays
  171. func (en *en_SE) WeekdaysWide() []string {
  172. return en.daysWide
  173. }
  174. // Decimal returns the decimal point of number
  175. func (en *en_SE) Decimal() string {
  176. return en.decimal
  177. }
  178. // Group returns the group of number
  179. func (en *en_SE) Group() string {
  180. return en.group
  181. }
  182. // Group returns the minus sign of number
  183. func (en *en_SE) Minus() string {
  184. return en.minus
  185. }
  186. // FmtNumber returns 'num' with digits/precision of 'v' for 'en_SE' and handles both Whole and Real numbers based on 'v'
  187. func (en *en_SE) FmtNumber(num float64, v uint64) string {
  188. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  189. l := len(s) + 2 + 2*len(s[:len(s)-int(v)-1])/3
  190. count := 0
  191. inWhole := v == 0
  192. b := make([]byte, 0, l)
  193. for i := len(s) - 1; i >= 0; i-- {
  194. if s[i] == '.' {
  195. b = append(b, en.decimal[0])
  196. inWhole = true
  197. continue
  198. }
  199. if inWhole {
  200. if count == 3 {
  201. for j := len(en.group) - 1; j >= 0; j-- {
  202. b = append(b, en.group[j])
  203. }
  204. count = 1
  205. } else {
  206. count++
  207. }
  208. }
  209. b = append(b, s[i])
  210. }
  211. if num < 0 {
  212. b = append(b, en.minus[0])
  213. }
  214. // reverse
  215. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  216. b[i], b[j] = b[j], b[i]
  217. }
  218. return string(b)
  219. }
  220. // FmtPercent returns 'num' with digits/precision of 'v' for 'en_SE' and handles both Whole and Real numbers based on 'v'
  221. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
  222. func (en *en_SE) FmtPercent(num float64, v uint64) string {
  223. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  224. l := len(s) + 5
  225. b := make([]byte, 0, l)
  226. for i := len(s) - 1; i >= 0; i-- {
  227. if s[i] == '.' {
  228. b = append(b, en.decimal[0])
  229. continue
  230. }
  231. b = append(b, s[i])
  232. }
  233. if num < 0 {
  234. b = append(b, en.minus[0])
  235. }
  236. // reverse
  237. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  238. b[i], b[j] = b[j], b[i]
  239. }
  240. b = append(b, en.percentSuffix...)
  241. b = append(b, en.percent...)
  242. return string(b)
  243. }
  244. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'en_SE'
  245. func (en *en_SE) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  246. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  247. symbol := en.currencies[currency]
  248. l := len(s) + len(symbol) + 4 + 2*len(s[:len(s)-int(v)-1])/3
  249. count := 0
  250. inWhole := v == 0
  251. b := make([]byte, 0, l)
  252. for i := len(s) - 1; i >= 0; i-- {
  253. if s[i] == '.' {
  254. b = append(b, en.decimal[0])
  255. inWhole = true
  256. continue
  257. }
  258. if inWhole {
  259. if count == 3 {
  260. for j := len(en.group) - 1; j >= 0; j-- {
  261. b = append(b, en.group[j])
  262. }
  263. count = 1
  264. } else {
  265. count++
  266. }
  267. }
  268. b = append(b, s[i])
  269. }
  270. if num < 0 {
  271. b = append(b, en.minus[0])
  272. }
  273. // reverse
  274. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  275. b[i], b[j] = b[j], b[i]
  276. }
  277. if int(v) < 2 {
  278. if v == 0 {
  279. b = append(b, en.decimal...)
  280. }
  281. for i := 0; i < 2-int(v); i++ {
  282. b = append(b, '0')
  283. }
  284. }
  285. b = append(b, en.currencyPositiveSuffix...)
  286. b = append(b, symbol...)
  287. return string(b)
  288. }
  289. // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_SE'
  290. // in accounting notation.
  291. func (en *en_SE) FmtAccounting(num float64, v uint64, currency currency.Type) string {
  292. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  293. symbol := en.currencies[currency]
  294. l := len(s) + len(symbol) + 4 + 2*len(s[:len(s)-int(v)-1])/3
  295. count := 0
  296. inWhole := v == 0
  297. b := make([]byte, 0, l)
  298. for i := len(s) - 1; i >= 0; i-- {
  299. if s[i] == '.' {
  300. b = append(b, en.decimal[0])
  301. inWhole = true
  302. continue
  303. }
  304. if inWhole {
  305. if count == 3 {
  306. for j := len(en.group) - 1; j >= 0; j-- {
  307. b = append(b, en.group[j])
  308. }
  309. count = 1
  310. } else {
  311. count++
  312. }
  313. }
  314. b = append(b, s[i])
  315. }
  316. if num < 0 {
  317. b = append(b, en.minus[0])
  318. }
  319. // reverse
  320. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  321. b[i], b[j] = b[j], b[i]
  322. }
  323. if int(v) < 2 {
  324. if v == 0 {
  325. b = append(b, en.decimal...)
  326. }
  327. for i := 0; i < 2-int(v); i++ {
  328. b = append(b, '0')
  329. }
  330. }
  331. if num < 0 {
  332. b = append(b, en.currencyNegativeSuffix...)
  333. b = append(b, symbol...)
  334. } else {
  335. b = append(b, en.currencyPositiveSuffix...)
  336. b = append(b, symbol...)
  337. }
  338. return string(b)
  339. }
  340. // FmtDateShort returns the short date representation of 't' for 'en_SE'
  341. func (en *en_SE) FmtDateShort(t time.Time) string {
  342. b := make([]byte, 0, 32)
  343. if t.Year() > 0 {
  344. b = strconv.AppendInt(b, int64(t.Year()), 10)
  345. } else {
  346. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  347. }
  348. b = append(b, []byte{0x2d}...)
  349. if t.Month() < 10 {
  350. b = append(b, '0')
  351. }
  352. b = strconv.AppendInt(b, int64(t.Month()), 10)
  353. b = append(b, []byte{0x2d}...)
  354. if t.Day() < 10 {
  355. b = append(b, '0')
  356. }
  357. b = strconv.AppendInt(b, int64(t.Day()), 10)
  358. return string(b)
  359. }
  360. // FmtDateMedium returns the medium date representation of 't' for 'en_SE'
  361. func (en *en_SE) FmtDateMedium(t time.Time) string {
  362. b := make([]byte, 0, 32)
  363. b = strconv.AppendInt(b, int64(t.Day()), 10)
  364. b = append(b, []byte{0x20}...)
  365. b = append(b, en.monthsAbbreviated[t.Month()]...)
  366. b = append(b, []byte{0x20}...)
  367. if t.Year() > 0 {
  368. b = strconv.AppendInt(b, int64(t.Year()), 10)
  369. } else {
  370. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  371. }
  372. return string(b)
  373. }
  374. // FmtDateLong returns the long date representation of 't' for 'en_SE'
  375. func (en *en_SE) FmtDateLong(t time.Time) string {
  376. b := make([]byte, 0, 32)
  377. b = strconv.AppendInt(b, int64(t.Day()), 10)
  378. b = append(b, []byte{0x20}...)
  379. b = append(b, en.monthsWide[t.Month()]...)
  380. b = append(b, []byte{0x20}...)
  381. if t.Year() > 0 {
  382. b = strconv.AppendInt(b, int64(t.Year()), 10)
  383. } else {
  384. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  385. }
  386. return string(b)
  387. }
  388. // FmtDateFull returns the full date representation of 't' for 'en_SE'
  389. func (en *en_SE) FmtDateFull(t time.Time) string {
  390. b := make([]byte, 0, 32)
  391. b = append(b, en.daysWide[t.Weekday()]...)
  392. b = append(b, []byte{0x2c, 0x20}...)
  393. b = strconv.AppendInt(b, int64(t.Day()), 10)
  394. b = append(b, []byte{0x20}...)
  395. b = append(b, en.monthsWide[t.Month()]...)
  396. b = append(b, []byte{0x20}...)
  397. if t.Year() > 0 {
  398. b = strconv.AppendInt(b, int64(t.Year()), 10)
  399. } else {
  400. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  401. }
  402. return string(b)
  403. }
  404. // FmtTimeShort returns the short time representation of 't' for 'en_SE'
  405. func (en *en_SE) FmtTimeShort(t time.Time) string {
  406. b := make([]byte, 0, 32)
  407. if t.Hour() < 10 {
  408. b = append(b, '0')
  409. }
  410. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  411. b = append(b, en.timeSeparator...)
  412. if t.Minute() < 10 {
  413. b = append(b, '0')
  414. }
  415. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  416. return string(b)
  417. }
  418. // FmtTimeMedium returns the medium time representation of 't' for 'en_SE'
  419. func (en *en_SE) FmtTimeMedium(t time.Time) string {
  420. b := make([]byte, 0, 32)
  421. if t.Hour() < 10 {
  422. b = append(b, '0')
  423. }
  424. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  425. b = append(b, en.timeSeparator...)
  426. if t.Minute() < 10 {
  427. b = append(b, '0')
  428. }
  429. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  430. b = append(b, en.timeSeparator...)
  431. if t.Second() < 10 {
  432. b = append(b, '0')
  433. }
  434. b = strconv.AppendInt(b, int64(t.Second()), 10)
  435. return string(b)
  436. }
  437. // FmtTimeLong returns the long time representation of 't' for 'en_SE'
  438. func (en *en_SE) FmtTimeLong(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, en.timeSeparator...)
  445. if t.Minute() < 10 {
  446. b = append(b, '0')
  447. }
  448. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  449. b = append(b, en.timeSeparator...)
  450. if t.Second() < 10 {
  451. b = append(b, '0')
  452. }
  453. b = strconv.AppendInt(b, int64(t.Second()), 10)
  454. b = append(b, []byte{0x20}...)
  455. tz, _ := t.Zone()
  456. b = append(b, tz...)
  457. return string(b)
  458. }
  459. // FmtTimeFull returns the full time representation of 't' for 'en_SE'
  460. func (en *en_SE) FmtTimeFull(t time.Time) string {
  461. b := make([]byte, 0, 32)
  462. if t.Hour() < 10 {
  463. b = append(b, '0')
  464. }
  465. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  466. b = append(b, en.timeSeparator...)
  467. if t.Minute() < 10 {
  468. b = append(b, '0')
  469. }
  470. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  471. b = append(b, en.timeSeparator...)
  472. if t.Second() < 10 {
  473. b = append(b, '0')
  474. }
  475. b = strconv.AppendInt(b, int64(t.Second()), 10)
  476. b = append(b, []byte{0x20}...)
  477. tz, _ := t.Zone()
  478. if btz, ok := en.timezones[tz]; ok {
  479. b = append(b, btz...)
  480. } else {
  481. b = append(b, tz...)
  482. }
  483. return string(b)
  484. }