en_DK.go 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621
  1. package en_DK
  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_DK 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_DK' locale
  42. func New() locales.Translator {
  43. return &en_DK{
  44. locale: "en_DK",
  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", "kr.", "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"},
  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{"AEDT": "Australian Eastern Daylight Time", "CLT": "Chile Standard Time", "EDT": "Eastern Daylight Time", "VET": "Venezuela Time", "HNPM": "St. Pierre & Miquelon Standard Time", "WITA": "Central Indonesia Time", "ARST": "Argentina Summer Time", "GFT": "French Guiana Time", "ACWST": "Australian Central Western Standard Time", "IST": "India Standard Time", "HNT": "Newfoundland Standard Time", "HAT": "Newfoundland Daylight Time", "ART": "Argentina Standard Time", "HECU": "Cuba Daylight Time", "PST": "Pacific Standard Time", "ACDT": "Australian Central Daylight Time", "MESZ": "Central European Summer Time", "WART": "Western Argentina Standard Time", "HEPM": "St. Pierre & Miquelon Daylight Time", "CHAST": "Chatham Standard Time", "ACWDT": "Australian Central Western Daylight Time", "CAT": "Central Africa Time", "EAT": "East Africa Time", "UYST": "Uruguay Summer Time", "AST": "Atlantic Standard Time", "MYT": "Malaysia Time", "HKST": "Hong Kong Summer Time", "LHDT": "Lord Howe Daylight Time", "CLST": "Chile Summer Time", "AWDT": "Australian Western Daylight Time", "WAST": "West Africa Summer Time", "BOT": "Bolivia Time", "WARST": "Western Argentina Summer Time", "HAST": "Hawaii-Aleutian Standard Time", "HNOG": "West Greenland Standard Time", "COT": "Colombia Standard Time", "HNCU": "Cuba Standard Time", "CST": "Central Standard Time", "HNPMX": "Mexican Pacific Standard Time", "ADT": "Atlantic Daylight Time", "WAT": "West Africa Standard Time", "WIB": "Western Indonesia Time", "SGT": "Singapore Standard Time", "MEZ": "Central European Standard Time", "GYT": "Guyana Time", "CDT": "Central Daylight Time", "HEPMX": "Mexican Pacific Daylight Time", "SAST": "South Africa Standard Time", "JDT": "Japan Daylight Time", "NZDT": "New Zealand Daylight Time", "HEOG": "West Greenland Summer Time", "HEEG": "East Greenland Summer Time", "SRT": "Suriname Time", "OESZ": "Eastern European Summer Time", "COST": "Colombia Summer Time", "CHADT": "Chatham Daylight Time", "BT": "Bhutan Time", "AKST": "Alaska Standard Time", "TMT": "Turkmenistan Standard Time", "WESZ": "Western European Summer Time", "JST": "Japan Standard Time", "NZST": "New Zealand Standard Time", "ECT": "Ecuador Time", "WIT": "Eastern Indonesia Time", "ChST": "Chamorro Standard Time", "AEST": "Australian Eastern Standard Time", "AKDT": "Alaska Daylight Time", "EST": "Eastern Standard Time", "TMST": "Turkmenistan Summer Time", "HADT": "Hawaii-Aleutian Daylight Time", "PDT": "Pacific Daylight Time", "MST": "Mountain Standard Time", "ACST": "Australian Central Standard Time", "HNEG": "East Greenland Standard Time", "HKT": "Hong Kong Standard Time", "OEZ": "Eastern European Standard Time", "WEZ": "Western European Standard Time", "LHST": "Lord Howe Standard Time", "HNNOMX": "Northwest Mexico Standard Time", "GMT": "Greenwich Mean Time", "UYT": "Uruguay Standard Time", "∅∅∅": "Brasilia Summer Time", "AWST": "Australian Western Standard Time", "MDT": "Mountain Daylight Time", "HENOMX": "Northwest Mexico Daylight Time"},
  73. }
  74. }
  75. // Locale returns the current translators string locale
  76. func (en *en_DK) Locale() string {
  77. return en.locale
  78. }
  79. // PluralsCardinal returns the list of cardinal plural rules associated with 'en_DK'
  80. func (en *en_DK) PluralsCardinal() []locales.PluralRule {
  81. return en.pluralsCardinal
  82. }
  83. // PluralsOrdinal returns the list of ordinal plural rules associated with 'en_DK'
  84. func (en *en_DK) PluralsOrdinal() []locales.PluralRule {
  85. return en.pluralsOrdinal
  86. }
  87. // PluralsRange returns the list of range plural rules associated with 'en_DK'
  88. func (en *en_DK) PluralsRange() []locales.PluralRule {
  89. return en.pluralsRange
  90. }
  91. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'en_DK'
  92. func (en *en_DK) 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_DK'
  101. func (en *en_DK) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
  102. n := math.Abs(num)
  103. nMod100 := math.Mod(n, 100)
  104. nMod10 := math.Mod(n, 10)
  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_DK'
  115. func (en *en_DK) 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_DK) MonthAbbreviated(month time.Month) string {
  120. return en.monthsAbbreviated[month]
  121. }
  122. // MonthsAbbreviated returns the locales abbreviated months
  123. func (en *en_DK) MonthsAbbreviated() []string {
  124. return en.monthsAbbreviated[1:]
  125. }
  126. // MonthNarrow returns the locales narrow month given the 'month' provided
  127. func (en *en_DK) MonthNarrow(month time.Month) string {
  128. return en.monthsNarrow[month]
  129. }
  130. // MonthsNarrow returns the locales narrow months
  131. func (en *en_DK) MonthsNarrow() []string {
  132. return en.monthsNarrow[1:]
  133. }
  134. // MonthWide returns the locales wide month given the 'month' provided
  135. func (en *en_DK) MonthWide(month time.Month) string {
  136. return en.monthsWide[month]
  137. }
  138. // MonthsWide returns the locales wide months
  139. func (en *en_DK) MonthsWide() []string {
  140. return en.monthsWide[1:]
  141. }
  142. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  143. func (en *en_DK) WeekdayAbbreviated(weekday time.Weekday) string {
  144. return en.daysAbbreviated[weekday]
  145. }
  146. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  147. func (en *en_DK) WeekdaysAbbreviated() []string {
  148. return en.daysAbbreviated
  149. }
  150. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  151. func (en *en_DK) WeekdayNarrow(weekday time.Weekday) string {
  152. return en.daysNarrow[weekday]
  153. }
  154. // WeekdaysNarrow returns the locales narrow weekdays
  155. func (en *en_DK) WeekdaysNarrow() []string {
  156. return en.daysNarrow
  157. }
  158. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  159. func (en *en_DK) WeekdayShort(weekday time.Weekday) string {
  160. return en.daysShort[weekday]
  161. }
  162. // WeekdaysShort returns the locales short weekdays
  163. func (en *en_DK) WeekdaysShort() []string {
  164. return en.daysShort
  165. }
  166. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  167. func (en *en_DK) WeekdayWide(weekday time.Weekday) string {
  168. return en.daysWide[weekday]
  169. }
  170. // WeekdaysWide returns the locales wide weekdays
  171. func (en *en_DK) WeekdaysWide() []string {
  172. return en.daysWide
  173. }
  174. // Decimal returns the decimal point of number
  175. func (en *en_DK) Decimal() string {
  176. return en.decimal
  177. }
  178. // Group returns the group of number
  179. func (en *en_DK) Group() string {
  180. return en.group
  181. }
  182. // Group returns the minus sign of number
  183. func (en *en_DK) Minus() string {
  184. return en.minus
  185. }
  186. // FmtNumber returns 'num' with digits/precision of 'v' for 'en_DK' and handles both Whole and Real numbers based on 'v'
  187. func (en *en_DK) FmtNumber(num float64, v uint64) string {
  188. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  189. l := len(s) + 2 + 1*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. b = append(b, en.group[0])
  202. count = 1
  203. } else {
  204. count++
  205. }
  206. }
  207. b = append(b, s[i])
  208. }
  209. if num < 0 {
  210. b = append(b, en.minus[0])
  211. }
  212. // reverse
  213. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  214. b[i], b[j] = b[j], b[i]
  215. }
  216. return string(b)
  217. }
  218. // FmtPercent returns 'num' with digits/precision of 'v' for 'en_DK' and handles both Whole and Real numbers based on 'v'
  219. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
  220. func (en *en_DK) FmtPercent(num float64, v uint64) string {
  221. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  222. l := len(s) + 5
  223. b := make([]byte, 0, l)
  224. for i := len(s) - 1; i >= 0; i-- {
  225. if s[i] == '.' {
  226. b = append(b, en.decimal[0])
  227. continue
  228. }
  229. b = append(b, s[i])
  230. }
  231. if num < 0 {
  232. b = append(b, en.minus[0])
  233. }
  234. // reverse
  235. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  236. b[i], b[j] = b[j], b[i]
  237. }
  238. b = append(b, en.percentSuffix...)
  239. b = append(b, en.percent...)
  240. return string(b)
  241. }
  242. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'en_DK'
  243. func (en *en_DK) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  244. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  245. symbol := en.currencies[currency]
  246. l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
  247. count := 0
  248. inWhole := v == 0
  249. b := make([]byte, 0, l)
  250. for i := len(s) - 1; i >= 0; i-- {
  251. if s[i] == '.' {
  252. b = append(b, en.decimal[0])
  253. inWhole = true
  254. continue
  255. }
  256. if inWhole {
  257. if count == 3 {
  258. b = append(b, en.group[0])
  259. count = 1
  260. } else {
  261. count++
  262. }
  263. }
  264. b = append(b, s[i])
  265. }
  266. if num < 0 {
  267. b = append(b, en.minus[0])
  268. }
  269. // reverse
  270. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  271. b[i], b[j] = b[j], b[i]
  272. }
  273. if int(v) < 2 {
  274. if v == 0 {
  275. b = append(b, en.decimal...)
  276. }
  277. for i := 0; i < 2-int(v); i++ {
  278. b = append(b, '0')
  279. }
  280. }
  281. b = append(b, en.currencyPositiveSuffix...)
  282. b = append(b, symbol...)
  283. return string(b)
  284. }
  285. // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_DK'
  286. // in accounting notation.
  287. func (en *en_DK) FmtAccounting(num float64, v uint64, currency currency.Type) string {
  288. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  289. symbol := en.currencies[currency]
  290. l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
  291. count := 0
  292. inWhole := v == 0
  293. b := make([]byte, 0, l)
  294. for i := len(s) - 1; i >= 0; i-- {
  295. if s[i] == '.' {
  296. b = append(b, en.decimal[0])
  297. inWhole = true
  298. continue
  299. }
  300. if inWhole {
  301. if count == 3 {
  302. b = append(b, en.group[0])
  303. count = 1
  304. } else {
  305. count++
  306. }
  307. }
  308. b = append(b, s[i])
  309. }
  310. if num < 0 {
  311. b = append(b, en.minus[0])
  312. }
  313. // reverse
  314. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  315. b[i], b[j] = b[j], b[i]
  316. }
  317. if int(v) < 2 {
  318. if v == 0 {
  319. b = append(b, en.decimal...)
  320. }
  321. for i := 0; i < 2-int(v); i++ {
  322. b = append(b, '0')
  323. }
  324. }
  325. if num < 0 {
  326. b = append(b, en.currencyNegativeSuffix...)
  327. b = append(b, symbol...)
  328. } else {
  329. b = append(b, en.currencyPositiveSuffix...)
  330. b = append(b, symbol...)
  331. }
  332. return string(b)
  333. }
  334. // FmtDateShort returns the short date representation of 't' for 'en_DK'
  335. func (en *en_DK) FmtDateShort(t time.Time) string {
  336. b := make([]byte, 0, 32)
  337. if t.Day() < 10 {
  338. b = append(b, '0')
  339. }
  340. b = strconv.AppendInt(b, int64(t.Day()), 10)
  341. b = append(b, []byte{0x2f}...)
  342. if t.Month() < 10 {
  343. b = append(b, '0')
  344. }
  345. b = strconv.AppendInt(b, int64(t.Month()), 10)
  346. b = append(b, []byte{0x2f}...)
  347. if t.Year() > 0 {
  348. b = strconv.AppendInt(b, int64(t.Year()), 10)
  349. } else {
  350. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  351. }
  352. return string(b)
  353. }
  354. // FmtDateMedium returns the medium date representation of 't' for 'en_DK'
  355. func (en *en_DK) FmtDateMedium(t time.Time) string {
  356. b := make([]byte, 0, 32)
  357. b = strconv.AppendInt(b, int64(t.Day()), 10)
  358. b = append(b, []byte{0x20}...)
  359. b = append(b, en.monthsAbbreviated[t.Month()]...)
  360. b = append(b, []byte{0x20}...)
  361. if t.Year() > 0 {
  362. b = strconv.AppendInt(b, int64(t.Year()), 10)
  363. } else {
  364. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  365. }
  366. return string(b)
  367. }
  368. // FmtDateLong returns the long date representation of 't' for 'en_DK'
  369. func (en *en_DK) FmtDateLong(t time.Time) string {
  370. b := make([]byte, 0, 32)
  371. b = strconv.AppendInt(b, int64(t.Day()), 10)
  372. b = append(b, []byte{0x20}...)
  373. b = append(b, en.monthsWide[t.Month()]...)
  374. b = append(b, []byte{0x20}...)
  375. if t.Year() > 0 {
  376. b = strconv.AppendInt(b, int64(t.Year()), 10)
  377. } else {
  378. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  379. }
  380. return string(b)
  381. }
  382. // FmtDateFull returns the full date representation of 't' for 'en_DK'
  383. func (en *en_DK) FmtDateFull(t time.Time) string {
  384. b := make([]byte, 0, 32)
  385. b = append(b, en.daysWide[t.Weekday()]...)
  386. b = append(b, []byte{0x2c, 0x20}...)
  387. b = strconv.AppendInt(b, int64(t.Day()), 10)
  388. b = append(b, []byte{0x20}...)
  389. b = append(b, en.monthsWide[t.Month()]...)
  390. b = append(b, []byte{0x20}...)
  391. if t.Year() > 0 {
  392. b = strconv.AppendInt(b, int64(t.Year()), 10)
  393. } else {
  394. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  395. }
  396. return string(b)
  397. }
  398. // FmtTimeShort returns the short time representation of 't' for 'en_DK'
  399. func (en *en_DK) FmtTimeShort(t time.Time) string {
  400. b := make([]byte, 0, 32)
  401. if t.Hour() < 10 {
  402. b = append(b, '0')
  403. }
  404. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  405. b = append(b, []byte{0x2e}...)
  406. if t.Minute() < 10 {
  407. b = append(b, '0')
  408. }
  409. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  410. return string(b)
  411. }
  412. // FmtTimeMedium returns the medium time representation of 't' for 'en_DK'
  413. func (en *en_DK) FmtTimeMedium(t time.Time) string {
  414. b := make([]byte, 0, 32)
  415. if t.Hour() < 10 {
  416. b = append(b, '0')
  417. }
  418. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  419. b = append(b, []byte{0x2e}...)
  420. if t.Minute() < 10 {
  421. b = append(b, '0')
  422. }
  423. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  424. b = append(b, []byte{0x2e}...)
  425. if t.Second() < 10 {
  426. b = append(b, '0')
  427. }
  428. b = strconv.AppendInt(b, int64(t.Second()), 10)
  429. return string(b)
  430. }
  431. // FmtTimeLong returns the long time representation of 't' for 'en_DK'
  432. func (en *en_DK) FmtTimeLong(t time.Time) string {
  433. b := make([]byte, 0, 32)
  434. if t.Hour() < 10 {
  435. b = append(b, '0')
  436. }
  437. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  438. b = append(b, []byte{0x2e}...)
  439. if t.Minute() < 10 {
  440. b = append(b, '0')
  441. }
  442. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  443. b = append(b, []byte{0x2e}...)
  444. if t.Second() < 10 {
  445. b = append(b, '0')
  446. }
  447. b = strconv.AppendInt(b, int64(t.Second()), 10)
  448. b = append(b, []byte{0x20}...)
  449. tz, _ := t.Zone()
  450. b = append(b, tz...)
  451. return string(b)
  452. }
  453. // FmtTimeFull returns the full time representation of 't' for 'en_DK'
  454. func (en *en_DK) FmtTimeFull(t time.Time) string {
  455. b := make([]byte, 0, 32)
  456. if t.Hour() < 10 {
  457. b = append(b, '0')
  458. }
  459. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  460. b = append(b, []byte{0x2e}...)
  461. if t.Minute() < 10 {
  462. b = append(b, '0')
  463. }
  464. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  465. b = append(b, []byte{0x2e}...)
  466. if t.Second() < 10 {
  467. b = append(b, '0')
  468. }
  469. b = strconv.AppendInt(b, int64(t.Second()), 10)
  470. b = append(b, []byte{0x20}...)
  471. tz, _ := t.Zone()
  472. if btz, ok := en.timezones[tz]; ok {
  473. b = append(b, btz...)
  474. } else {
  475. b = append(b, tz...)
  476. }
  477. return string(b)
  478. }