eu_ES.go 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621
  1. package eu_ES
  2. import (
  3. "math"
  4. "strconv"
  5. "time"
  6. "github.com/go-playground/locales"
  7. "github.com/go-playground/locales/currency"
  8. )
  9. type eu_ES 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. percentPrefix 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 'eu_ES' locale
  43. func New() locales.Translator {
  44. return &eu_ES{
  45. locale: "eu_ES",
  46. pluralsCardinal: []locales.PluralRule{2, 6},
  47. pluralsOrdinal: []locales.PluralRule{6},
  48. pluralsRange: []locales.PluralRule{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", "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"},
  57. percentPrefix: " ",
  58. currencyPositiveSuffix: " ",
  59. currencyNegativePrefix: "(",
  60. currencyNegativeSuffix: " )",
  61. monthsAbbreviated: []string{"", "urt.", "ots.", "mar.", "api.", "mai.", "eka.", "uzt.", "abu.", "ira.", "urr.", "aza.", "abe."},
  62. monthsNarrow: []string{"", "U", "O", "M", "A", "M", "E", "U", "A", "I", "U", "A", "A"},
  63. monthsWide: []string{"", "urtarrila", "otsaila", "martxoa", "apirila", "maiatza", "ekaina", "uztaila", "abuztua", "iraila", "urria", "azaroa", "abendua"},
  64. daysAbbreviated: []string{"ig.", "al.", "ar.", "az.", "og.", "or.", "lr."},
  65. daysNarrow: []string{"I", "A", "A", "A", "O", "O", "L"},
  66. daysShort: []string{"ig.", "al.", "ar.", "az.", "og.", "or.", "lr."},
  67. daysWide: []string{"igandea", "astelehena", "asteartea", "asteazkena", "osteguna", "ostirala", "larunbata"},
  68. periodsAbbreviated: []string{"AM", "PM"},
  69. periodsWide: []string{"AM", "PM"},
  70. erasAbbreviated: []string{"K.a.", "K.o."},
  71. erasNarrow: []string{"", ""},
  72. erasWide: []string{"K.a.", "Kristo ondoren"},
  73. timezones: map[string]string{"UYT": "Uruguayko ordu estandarra", "IST": "Indiako ordua", "HEEG": "Groenlandia ekialdeko udako ordutegia", "ACST": "Australia erdialdeko ordu estandarra", "HNPMX": "Mexikoko Pazifikoko ordutegi estandarra", "AWST": "Australia mendebaldeko ordu estandarra", "HNOG": "Groenlandia mendebaldeko ordutegi estandarra", "COT": "Kolonbiako ordu estandarra", "EST": "Ipar Amerikako ekialdeko ordutegi estandarra", "GMT": "Greenwich meridianoko ordua", "OESZ": "Europa ekialdeko udako ordua", "HAST": "Hawaii-Aleutiar uharteetako ordutegi estandarra", "OEZ": "Europa ekialdeko ordu estandarra", "AST": "Atlantikoko ordutegi estandarra", "WAST": "Afrika mendebaldeko udako ordua", "HNT": "Ternuako ordutegi estandarra", "HEPMX": "Mexikoko Pazifikoko udako ordutegia", "MEZ": "Europa erdialdeko ordu estandarra", "HNNOMX": "Mexikoko ipar-ekialdeko ordutegi estandarra", "JDT": "Japoniako udako ordua", "ARST": "Argentinako udako ordutegia", "SAST": "Afrika hegoaldeko ordua", "ChST": "Chamorroko ordu estandarra", "PDT": "Ipar Amerikako Pazifikoko udako ordutegia", "MDT": "MDT", "HKT": "Hong Kongo ordu estandarra", "CLT": "Txileko ordu estandarra", "GYT": "Guyanako ordua", "AEDT": "Australia ekialdeko udako ordua", "WIT": "Indonesia ekialdeko ordua", "WART": "Argentina mendebaldeko ordutegia estandarra", "ADT": "Atlantikoko udako ordutegia", "CLST": "Txileko udako ordua", "EDT": "Ipar Amerikako ekialdeko udako ordutegia", "CHADT": "Chathamgo udako ordua", "HEPM": "Saint-Pierre eta Mikeluneko udako ordutegia", "AWDT": "Australia mendebaldeko udako ordua", "NZST": "Zeelanda Berriko ordu estandarra", "JST": "Japoniako ordu estandarra", "WAT": "Afrika mendebaldeko ordu estandarra", "GFT": "Guyana Frantseseko ordua", "HKST": "Hong Kongo udako ordua", "∅∅∅": "∅∅∅", "LHST": "Lord Howeko ordu estandarra", "WARST": "Argentina mendebaldeko udako ordutegia", "HEOG": "Groenlandia mendebaldeko udako ordutegia", "EAT": "Afrika ekialdeko ordua", "HENOMX": "Mexikoko ipar-ekialdeko udako ordutegia", "WEZ": "Europa mendebaldeko ordu estandarra", "WESZ": "Europa mendebaldeko udako ordua", "AEST": "Australia ekialdeko ordu estandarra", "HADT": "Hawaii-Aleutiar uharteetako udako ordutegia", "ACDT": "Australia erdialdeko udako ordua", "ECT": "Ekuadorreko ordua", "WIB": "Indonesia mendebaldeko ordua", "CST": "Ipar Amerikako erdialdeko ordu estandarra", "TMT": "Turkmenistango ordu estandarra", "HAT": "Ternuako udako ordutegia", "SGT": "Singapurreko ordu estandarra", "MST": "MST", "ACWDT": "Australia erdi-mendebaldeko udako ordua", "TMST": "Turkmenistango udako ordua", "ART": "Argentinako ordutegi estandarra", "HNEG": "Groenlandia ekialdeko ordutegi estandarra", "AKDT": "Alaskako udako ordutegia", "PST": "Ipar Amerikako Pazifikoko ordutegi estandarra", "CHAST": "Chathamgo ordu estandarra", "BT": "Bhutango ordua", "CDT": "Ipar Amerikako erdialdeko udako ordutegia", "BOT": "Boliviako ordutegia", "MESZ": "Europa erdialdeko udako ordua", "WITA": "Indonesia erdialdeko ordua", "LHDT": "Lord Howeko udako ordua", "COST": "Kolonbiako udako ordua", "AKST": "Alaskako ordutegi estandarra", "HNPM": "Saint-Pierre eta Mikeluneko ordutegi estandarra", "ACWST": "Australia erdi-mendebaldeko ordu estandarra", "VET": "Venezuelako ordua", "CAT": "Afrika erdialdeko ordua", "HNCU": "Kubako ordutegi estandarra", "UYST": "Uruguayko udako ordua", "MYT": "Malaysiako ordua", "NZDT": "Zeelanda Berriko udako ordua", "HECU": "Kubako udako ordutegia", "SRT": "Surinamgo ordua"},
  74. }
  75. }
  76. // Locale returns the current translators string locale
  77. func (eu *eu_ES) Locale() string {
  78. return eu.locale
  79. }
  80. // PluralsCardinal returns the list of cardinal plural rules associated with 'eu_ES'
  81. func (eu *eu_ES) PluralsCardinal() []locales.PluralRule {
  82. return eu.pluralsCardinal
  83. }
  84. // PluralsOrdinal returns the list of ordinal plural rules associated with 'eu_ES'
  85. func (eu *eu_ES) PluralsOrdinal() []locales.PluralRule {
  86. return eu.pluralsOrdinal
  87. }
  88. // PluralsRange returns the list of range plural rules associated with 'eu_ES'
  89. func (eu *eu_ES) PluralsRange() []locales.PluralRule {
  90. return eu.pluralsRange
  91. }
  92. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'eu_ES'
  93. func (eu *eu_ES) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
  94. n := math.Abs(num)
  95. if n == 1 {
  96. return locales.PluralRuleOne
  97. }
  98. return locales.PluralRuleOther
  99. }
  100. // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'eu_ES'
  101. func (eu *eu_ES) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
  102. return locales.PluralRuleOther
  103. }
  104. // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'eu_ES'
  105. func (eu *eu_ES) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
  106. return locales.PluralRuleOther
  107. }
  108. // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
  109. func (eu *eu_ES) MonthAbbreviated(month time.Month) string {
  110. return eu.monthsAbbreviated[month]
  111. }
  112. // MonthsAbbreviated returns the locales abbreviated months
  113. func (eu *eu_ES) MonthsAbbreviated() []string {
  114. return eu.monthsAbbreviated[1:]
  115. }
  116. // MonthNarrow returns the locales narrow month given the 'month' provided
  117. func (eu *eu_ES) MonthNarrow(month time.Month) string {
  118. return eu.monthsNarrow[month]
  119. }
  120. // MonthsNarrow returns the locales narrow months
  121. func (eu *eu_ES) MonthsNarrow() []string {
  122. return eu.monthsNarrow[1:]
  123. }
  124. // MonthWide returns the locales wide month given the 'month' provided
  125. func (eu *eu_ES) MonthWide(month time.Month) string {
  126. return eu.monthsWide[month]
  127. }
  128. // MonthsWide returns the locales wide months
  129. func (eu *eu_ES) MonthsWide() []string {
  130. return eu.monthsWide[1:]
  131. }
  132. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  133. func (eu *eu_ES) WeekdayAbbreviated(weekday time.Weekday) string {
  134. return eu.daysAbbreviated[weekday]
  135. }
  136. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  137. func (eu *eu_ES) WeekdaysAbbreviated() []string {
  138. return eu.daysAbbreviated
  139. }
  140. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  141. func (eu *eu_ES) WeekdayNarrow(weekday time.Weekday) string {
  142. return eu.daysNarrow[weekday]
  143. }
  144. // WeekdaysNarrow returns the locales narrow weekdays
  145. func (eu *eu_ES) WeekdaysNarrow() []string {
  146. return eu.daysNarrow
  147. }
  148. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  149. func (eu *eu_ES) WeekdayShort(weekday time.Weekday) string {
  150. return eu.daysShort[weekday]
  151. }
  152. // WeekdaysShort returns the locales short weekdays
  153. func (eu *eu_ES) WeekdaysShort() []string {
  154. return eu.daysShort
  155. }
  156. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  157. func (eu *eu_ES) WeekdayWide(weekday time.Weekday) string {
  158. return eu.daysWide[weekday]
  159. }
  160. // WeekdaysWide returns the locales wide weekdays
  161. func (eu *eu_ES) WeekdaysWide() []string {
  162. return eu.daysWide
  163. }
  164. // Decimal returns the decimal point of number
  165. func (eu *eu_ES) Decimal() string {
  166. return eu.decimal
  167. }
  168. // Group returns the group of number
  169. func (eu *eu_ES) Group() string {
  170. return eu.group
  171. }
  172. // Group returns the minus sign of number
  173. func (eu *eu_ES) Minus() string {
  174. return eu.minus
  175. }
  176. // FmtNumber returns 'num' with digits/precision of 'v' for 'eu_ES' and handles both Whole and Real numbers based on 'v'
  177. func (eu *eu_ES) FmtNumber(num float64, v uint64) string {
  178. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  179. l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
  180. count := 0
  181. inWhole := v == 0
  182. b := make([]byte, 0, l)
  183. for i := len(s) - 1; i >= 0; i-- {
  184. if s[i] == '.' {
  185. b = append(b, eu.decimal[0])
  186. inWhole = true
  187. continue
  188. }
  189. if inWhole {
  190. if count == 3 {
  191. b = append(b, eu.group[0])
  192. count = 1
  193. } else {
  194. count++
  195. }
  196. }
  197. b = append(b, s[i])
  198. }
  199. if num < 0 {
  200. b = append(b, eu.minus[0])
  201. }
  202. // reverse
  203. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  204. b[i], b[j] = b[j], b[i]
  205. }
  206. return string(b)
  207. }
  208. // FmtPercent returns 'num' with digits/precision of 'v' for 'eu_ES' and handles both Whole and Real numbers based on 'v'
  209. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
  210. func (eu *eu_ES) FmtPercent(num float64, v uint64) string {
  211. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  212. l := len(s) + 5 + 1*len(s[:len(s)-int(v)-1])/3
  213. count := 0
  214. inWhole := v == 0
  215. b := make([]byte, 0, l)
  216. for i := len(s) - 1; i >= 0; i-- {
  217. if s[i] == '.' {
  218. b = append(b, eu.decimal[0])
  219. inWhole = true
  220. continue
  221. }
  222. if inWhole {
  223. if count == 3 {
  224. b = append(b, eu.group[0])
  225. count = 1
  226. } else {
  227. count++
  228. }
  229. }
  230. b = append(b, s[i])
  231. }
  232. if num < 0 {
  233. b = append(b, eu.minus[0])
  234. }
  235. for j := len(eu.percentPrefix) - 1; j >= 0; j-- {
  236. b = append(b, eu.percentPrefix[j])
  237. }
  238. b = append(b, eu.percent[0])
  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. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'eu_ES'
  246. func (eu *eu_ES) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  247. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  248. symbol := eu.currencies[currency]
  249. l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
  250. count := 0
  251. inWhole := v == 0
  252. b := make([]byte, 0, l)
  253. for i := len(s) - 1; i >= 0; i-- {
  254. if s[i] == '.' {
  255. b = append(b, eu.decimal[0])
  256. inWhole = true
  257. continue
  258. }
  259. if inWhole {
  260. if count == 3 {
  261. b = append(b, eu.group[0])
  262. count = 1
  263. } else {
  264. count++
  265. }
  266. }
  267. b = append(b, s[i])
  268. }
  269. if num < 0 {
  270. b = append(b, eu.minus[0])
  271. }
  272. // reverse
  273. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  274. b[i], b[j] = b[j], b[i]
  275. }
  276. if int(v) < 2 {
  277. if v == 0 {
  278. b = append(b, eu.decimal...)
  279. }
  280. for i := 0; i < 2-int(v); i++ {
  281. b = append(b, '0')
  282. }
  283. }
  284. b = append(b, eu.currencyPositiveSuffix...)
  285. b = append(b, symbol...)
  286. return string(b)
  287. }
  288. // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'eu_ES'
  289. // in accounting notation.
  290. func (eu *eu_ES) FmtAccounting(num float64, v uint64, currency currency.Type) string {
  291. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  292. symbol := eu.currencies[currency]
  293. l := len(s) + len(symbol) + 6 + 1*len(s[:len(s)-int(v)-1])/3
  294. count := 0
  295. inWhole := v == 0
  296. b := make([]byte, 0, l)
  297. for i := len(s) - 1; i >= 0; i-- {
  298. if s[i] == '.' {
  299. b = append(b, eu.decimal[0])
  300. inWhole = true
  301. continue
  302. }
  303. if inWhole {
  304. if count == 3 {
  305. b = append(b, eu.group[0])
  306. count = 1
  307. } else {
  308. count++
  309. }
  310. }
  311. b = append(b, s[i])
  312. }
  313. if num < 0 {
  314. b = append(b, eu.currencyNegativePrefix[0])
  315. }
  316. // reverse
  317. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  318. b[i], b[j] = b[j], b[i]
  319. }
  320. if int(v) < 2 {
  321. if v == 0 {
  322. b = append(b, eu.decimal...)
  323. }
  324. for i := 0; i < 2-int(v); i++ {
  325. b = append(b, '0')
  326. }
  327. }
  328. if num < 0 {
  329. b = append(b, eu.currencyNegativeSuffix...)
  330. b = append(b, symbol...)
  331. } else {
  332. b = append(b, eu.currencyPositiveSuffix...)
  333. b = append(b, symbol...)
  334. }
  335. return string(b)
  336. }
  337. // FmtDateShort returns the short date representation of 't' for 'eu_ES'
  338. func (eu *eu_ES) FmtDateShort(t time.Time) string {
  339. b := make([]byte, 0, 32)
  340. if t.Year() > 9 {
  341. b = append(b, strconv.Itoa(t.Year())[2:]...)
  342. } else {
  343. b = append(b, strconv.Itoa(t.Year())[1:]...)
  344. }
  345. b = append(b, []byte{0x2f}...)
  346. b = strconv.AppendInt(b, int64(t.Month()), 10)
  347. b = append(b, []byte{0x2f}...)
  348. b = strconv.AppendInt(b, int64(t.Day()), 10)
  349. return string(b)
  350. }
  351. // FmtDateMedium returns the medium date representation of 't' for 'eu_ES'
  352. func (eu *eu_ES) FmtDateMedium(t time.Time) string {
  353. b := make([]byte, 0, 32)
  354. if t.Year() > 0 {
  355. b = strconv.AppendInt(b, int64(t.Year()), 10)
  356. } else {
  357. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  358. }
  359. b = append(b, []byte{0x20}...)
  360. b = append(b, eu.monthsAbbreviated[t.Month()]...)
  361. b = append(b, []byte{0x20}...)
  362. b = strconv.AppendInt(b, int64(t.Day()), 10)
  363. return string(b)
  364. }
  365. // FmtDateLong returns the long date representation of 't' for 'eu_ES'
  366. func (eu *eu_ES) FmtDateLong(t time.Time) string {
  367. b := make([]byte, 0, 32)
  368. if t.Year() > 0 {
  369. b = strconv.AppendInt(b, int64(t.Year()), 10)
  370. } else {
  371. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  372. }
  373. b = append(b, []byte{0x28, 0x65}...)
  374. b = append(b, []byte{0x29, 0x6b, 0x6f}...)
  375. b = append(b, []byte{0x20}...)
  376. b = append(b, eu.monthsWide[t.Month()]...)
  377. b = append(b, []byte{0x20}...)
  378. b = strconv.AppendInt(b, int64(t.Day()), 10)
  379. return string(b)
  380. }
  381. // FmtDateFull returns the full date representation of 't' for 'eu_ES'
  382. func (eu *eu_ES) FmtDateFull(t time.Time) string {
  383. b := make([]byte, 0, 32)
  384. if t.Year() > 0 {
  385. b = strconv.AppendInt(b, int64(t.Year()), 10)
  386. } else {
  387. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  388. }
  389. b = append(b, []byte{0x28, 0x65}...)
  390. b = append(b, []byte{0x29, 0x6b, 0x6f}...)
  391. b = append(b, []byte{0x20}...)
  392. b = append(b, eu.monthsWide[t.Month()]...)
  393. b = append(b, []byte{0x20}...)
  394. b = strconv.AppendInt(b, int64(t.Day()), 10)
  395. b = append(b, []byte{0x2c, 0x20}...)
  396. b = append(b, eu.daysWide[t.Weekday()]...)
  397. return string(b)
  398. }
  399. // FmtTimeShort returns the short time representation of 't' for 'eu_ES'
  400. func (eu *eu_ES) FmtTimeShort(t time.Time) string {
  401. b := make([]byte, 0, 32)
  402. if t.Hour() < 10 {
  403. b = append(b, '0')
  404. }
  405. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  406. b = append(b, eu.timeSeparator...)
  407. if t.Minute() < 10 {
  408. b = append(b, '0')
  409. }
  410. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  411. return string(b)
  412. }
  413. // FmtTimeMedium returns the medium time representation of 't' for 'eu_ES'
  414. func (eu *eu_ES) FmtTimeMedium(t time.Time) string {
  415. b := make([]byte, 0, 32)
  416. if t.Hour() < 10 {
  417. b = append(b, '0')
  418. }
  419. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  420. b = append(b, eu.timeSeparator...)
  421. if t.Minute() < 10 {
  422. b = append(b, '0')
  423. }
  424. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  425. b = append(b, eu.timeSeparator...)
  426. if t.Second() < 10 {
  427. b = append(b, '0')
  428. }
  429. b = strconv.AppendInt(b, int64(t.Second()), 10)
  430. return string(b)
  431. }
  432. // FmtTimeLong returns the long time representation of 't' for 'eu_ES'
  433. func (eu *eu_ES) FmtTimeLong(t time.Time) string {
  434. b := make([]byte, 0, 32)
  435. if t.Hour() < 10 {
  436. b = append(b, '0')
  437. }
  438. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  439. b = append(b, eu.timeSeparator...)
  440. if t.Minute() < 10 {
  441. b = append(b, '0')
  442. }
  443. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  444. b = append(b, eu.timeSeparator...)
  445. if t.Second() < 10 {
  446. b = append(b, '0')
  447. }
  448. b = strconv.AppendInt(b, int64(t.Second()), 10)
  449. b = append(b, []byte{0x20, 0x28}...)
  450. tz, _ := t.Zone()
  451. b = append(b, tz...)
  452. b = append(b, []byte{0x29}...)
  453. return string(b)
  454. }
  455. // FmtTimeFull returns the full time representation of 't' for 'eu_ES'
  456. func (eu *eu_ES) FmtTimeFull(t time.Time) string {
  457. b := make([]byte, 0, 32)
  458. if t.Hour() < 10 {
  459. b = append(b, '0')
  460. }
  461. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  462. b = append(b, eu.timeSeparator...)
  463. if t.Minute() < 10 {
  464. b = append(b, '0')
  465. }
  466. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  467. b = append(b, eu.timeSeparator...)
  468. if t.Second() < 10 {
  469. b = append(b, '0')
  470. }
  471. b = strconv.AppendInt(b, int64(t.Second()), 10)
  472. b = append(b, []byte{0x20, 0x28}...)
  473. tz, _ := t.Zone()
  474. if btz, ok := eu.timezones[tz]; ok {
  475. b = append(b, btz...)
  476. } else {
  477. b = append(b, tz...)
  478. }
  479. b = append(b, []byte{0x29}...)
  480. return string(b)
  481. }