da_DK.go 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588
  1. package da_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 da_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 'da_DK' locale
  42. func New() locales.Translator {
  43. return &da_DK{
  44. locale: "da_DK",
  45. pluralsCardinal: []locales.PluralRule{2, 6},
  46. pluralsOrdinal: []locales.PluralRule{6},
  47. pluralsRange: []locales.PluralRule{2, 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 ", "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 "},
  56. percentSuffix: " ",
  57. currencyPositiveSuffix: " ",
  58. currencyNegativeSuffix: " ",
  59. monthsAbbreviated: []string{"", "jan.", "feb.", "mar.", "apr.", "maj", "jun.", "jul.", "aug.", "sep.", "okt.", "nov.", "dec."},
  60. monthsNarrow: []string{"", "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"},
  61. monthsWide: []string{"", "januar", "februar", "marts", "april", "maj", "juni", "juli", "august", "september", "oktober", "november", "december"},
  62. daysAbbreviated: []string{"søn.", "man.", "tir.", "ons.", "tor.", "fre.", "lør."},
  63. daysNarrow: []string{"S", "M", "T", "O", "T", "F", "L"},
  64. daysShort: []string{"sø", "ma", "ti", "on", "to", "fr", "lø"},
  65. daysWide: []string{"søndag", "mandag", "tirsdag", "onsdag", "torsdag", "fredag", "lørdag"},
  66. periodsAbbreviated: []string{"AM", "PM"},
  67. periodsNarrow: []string{"a", "p"},
  68. periodsWide: []string{"AM", "PM"},
  69. erasAbbreviated: []string{"f.Kr.", "e.Kr."},
  70. erasNarrow: []string{"fKr", "eKr"},
  71. erasWide: []string{"f.Kr.", "e.Kr."},
  72. timezones: map[string]string{"OESZ": "Østeuropæisk sommertid", "MYT": "Malaysisk tid", "BOT": "Boliviansk tid", "COT": "Colombiansk normaltid", "HAST": "Hawaii-Aleutian-normaltid", "SGT": "Singaporeansk normaltid", "HAT": "Newfoundlandsk sommertid", "MDT": "Macao-sommertid", "CDT": "Central-sommertid", "ChST": "Chamorro-tid", "CLST": "Chilensk sommertid", "ECT": "Ecuadoriansk tid", "BT": "Bhutanesisk tid", "WART": "Vestargentinsk normaltid", "SRT": "Surinam-tid", "PDT": "Pacific-sommertid", "LHDT": "Lord Howe-sommertid", "CHADT": "Chatham-sommertid", "CAT": "Centralafrikansk tid", "ADT": "Atlantic-sommertid", "WIT": "Østindonesisk tid", "WESZ": "Vesteuropæisk sommertid", "HADT": "Hawaii-Aleutian-sommertid", "WITA": "Centralindonesisk tid", "ACDT": "Centralaustralsk sommertid", "NZST": "Newzealandsk normaltid", "AST": "Atlantic-normaltid", "AKST": "Alaska-normaltid", "AWDT": "Vestaustralsk sommertid", "WEZ": "Vesteuropæisk normaltid", "WIB": "Vestindonesisk tid", "GMT": "GMT", "MST": "Macao-normaltid", "ARST": "Argentinsk sommertid", "TMT": "Turkmensk normaltid", "PST": "Pacific-normaltid", "VET": "Venezuelansk tid", "COST": "Colombiansk sommertid", "HKT": "Hongkong-normaltid", "HKST": "Hongkong-sommertid", "OEZ": "Østeuropæisk normaltid", "∅∅∅": "Amazonas-sommertid", "EST": "Eastern-normaltid", "SAST": "Sydafrikansk tid", "HNT": "Newfoundlandsk normaltid", "CST": "Central-normaltid", "NZDT": "Newzealandsk sommertid", "UYST": "Uruguayansk sommertid", "CLT": "Chilensk normaltid", "ACWDT": "Vestlig centralaustralsk sommertid", "GFT": "Fransk Guyana-tid", "EAT": "Østafrikansk tid", "TMST": "Turkmensk sommertid", "AKDT": "Alaska-sommertid", "AWST": "Vestaustralsk normaltid", "LHST": "Lord Howe-normaltid", "UYT": "Uruguayansk normaltid", "WAST": "Vestafrikansk sommertid", "JST": "Japansk normaltid", "MEZ": "Centraleuropæisk normaltid", "WARST": "Vestargentinsk sommertid", "ART": "Argentinsk normaltid", "GYT": "Guyana-tid", "MESZ": "Centraleuropæisk sommertid", "CHAST": "Chatham-normaltid", "EDT": "Eastern-sommertid", "IST": "Indisk normaltid", "JDT": "Japansk sommertid", "AEDT": "Østaustralsk sommertid", "ACST": "Centralaustralsk normaltid", "WAT": "Vestafrikansk normaltid", "ACWST": "Vestlig centralaustralsk normaltid", "AEST": "Østaustralsk normaltid"},
  73. }
  74. }
  75. // Locale returns the current translators string locale
  76. func (da *da_DK) Locale() string {
  77. return da.locale
  78. }
  79. // PluralsCardinal returns the list of cardinal plural rules associated with 'da_DK'
  80. func (da *da_DK) PluralsCardinal() []locales.PluralRule {
  81. return da.pluralsCardinal
  82. }
  83. // PluralsOrdinal returns the list of ordinal plural rules associated with 'da_DK'
  84. func (da *da_DK) PluralsOrdinal() []locales.PluralRule {
  85. return da.pluralsOrdinal
  86. }
  87. // PluralsRange returns the list of range plural rules associated with 'da_DK'
  88. func (da *da_DK) PluralsRange() []locales.PluralRule {
  89. return da.pluralsRange
  90. }
  91. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'da_DK'
  92. func (da *da_DK) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
  93. n := math.Abs(num)
  94. i := int64(n)
  95. t := locales.T(n, v)
  96. if (n == 1) || (t != 0 && (i == 0 || i == 1)) {
  97. return locales.PluralRuleOne
  98. }
  99. return locales.PluralRuleOther
  100. }
  101. // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'da_DK'
  102. func (da *da_DK) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
  103. return locales.PluralRuleOther
  104. }
  105. // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'da_DK'
  106. func (da *da_DK) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
  107. start := da.CardinalPluralRule(num1, v1)
  108. end := da.CardinalPluralRule(num2, v2)
  109. if start == locales.PluralRuleOne && end == locales.PluralRuleOne {
  110. return locales.PluralRuleOne
  111. } else if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
  112. return locales.PluralRuleOther
  113. } else if start == locales.PluralRuleOther && end == locales.PluralRuleOne {
  114. return locales.PluralRuleOne
  115. }
  116. return locales.PluralRuleOther
  117. }
  118. // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
  119. func (da *da_DK) MonthAbbreviated(month time.Month) string {
  120. return da.monthsAbbreviated[month]
  121. }
  122. // MonthsAbbreviated returns the locales abbreviated months
  123. func (da *da_DK) MonthsAbbreviated() []string {
  124. return da.monthsAbbreviated[1:]
  125. }
  126. // MonthNarrow returns the locales narrow month given the 'month' provided
  127. func (da *da_DK) MonthNarrow(month time.Month) string {
  128. return da.monthsNarrow[month]
  129. }
  130. // MonthsNarrow returns the locales narrow months
  131. func (da *da_DK) MonthsNarrow() []string {
  132. return da.monthsNarrow[1:]
  133. }
  134. // MonthWide returns the locales wide month given the 'month' provided
  135. func (da *da_DK) MonthWide(month time.Month) string {
  136. return da.monthsWide[month]
  137. }
  138. // MonthsWide returns the locales wide months
  139. func (da *da_DK) MonthsWide() []string {
  140. return da.monthsWide[1:]
  141. }
  142. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  143. func (da *da_DK) WeekdayAbbreviated(weekday time.Weekday) string {
  144. return da.daysAbbreviated[weekday]
  145. }
  146. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  147. func (da *da_DK) WeekdaysAbbreviated() []string {
  148. return da.daysAbbreviated
  149. }
  150. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  151. func (da *da_DK) WeekdayNarrow(weekday time.Weekday) string {
  152. return da.daysNarrow[weekday]
  153. }
  154. // WeekdaysNarrow returns the locales narrow weekdays
  155. func (da *da_DK) WeekdaysNarrow() []string {
  156. return da.daysNarrow
  157. }
  158. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  159. func (da *da_DK) WeekdayShort(weekday time.Weekday) string {
  160. return da.daysShort[weekday]
  161. }
  162. // WeekdaysShort returns the locales short weekdays
  163. func (da *da_DK) WeekdaysShort() []string {
  164. return da.daysShort
  165. }
  166. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  167. func (da *da_DK) WeekdayWide(weekday time.Weekday) string {
  168. return da.daysWide[weekday]
  169. }
  170. // WeekdaysWide returns the locales wide weekdays
  171. func (da *da_DK) WeekdaysWide() []string {
  172. return da.daysWide
  173. }
  174. // FmtNumber returns 'num' with digits/precision of 'v' for 'da_DK' and handles both Whole and Real numbers based on 'v'
  175. func (da *da_DK) FmtNumber(num float64, v uint64) string {
  176. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  177. l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
  178. count := 0
  179. inWhole := v == 0
  180. b := make([]byte, 0, l)
  181. for i := len(s) - 1; i >= 0; i-- {
  182. if s[i] == '.' {
  183. b = append(b, da.decimal[0])
  184. inWhole = true
  185. continue
  186. }
  187. if inWhole {
  188. if count == 3 {
  189. b = append(b, da.group[0])
  190. count = 1
  191. } else {
  192. count++
  193. }
  194. }
  195. b = append(b, s[i])
  196. }
  197. if num < 0 {
  198. b = append(b, da.minus[0])
  199. }
  200. // reverse
  201. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  202. b[i], b[j] = b[j], b[i]
  203. }
  204. return string(b)
  205. }
  206. // FmtPercent returns 'num' with digits/precision of 'v' for 'da_DK' and handles both Whole and Real numbers based on 'v'
  207. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
  208. func (da *da_DK) FmtPercent(num float64, v uint64) string {
  209. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  210. l := len(s) + 5
  211. b := make([]byte, 0, l)
  212. for i := len(s) - 1; i >= 0; i-- {
  213. if s[i] == '.' {
  214. b = append(b, da.decimal[0])
  215. continue
  216. }
  217. b = append(b, s[i])
  218. }
  219. if num < 0 {
  220. b = append(b, da.minus[0])
  221. }
  222. // reverse
  223. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  224. b[i], b[j] = b[j], b[i]
  225. }
  226. b = append(b, da.percentSuffix...)
  227. b = append(b, da.percent...)
  228. return string(b)
  229. }
  230. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'da_DK'
  231. func (da *da_DK) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  232. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  233. symbol := da.currencies[currency]
  234. l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
  235. count := 0
  236. inWhole := v == 0
  237. b := make([]byte, 0, l)
  238. for i := len(s) - 1; i >= 0; i-- {
  239. if s[i] == '.' {
  240. b = append(b, da.decimal[0])
  241. inWhole = true
  242. continue
  243. }
  244. if inWhole {
  245. if count == 3 {
  246. b = append(b, da.group[0])
  247. count = 1
  248. } else {
  249. count++
  250. }
  251. }
  252. b = append(b, s[i])
  253. }
  254. if num < 0 {
  255. b = append(b, da.minus[0])
  256. }
  257. // reverse
  258. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  259. b[i], b[j] = b[j], b[i]
  260. }
  261. if int(v) < 2 {
  262. if v == 0 {
  263. b = append(b, da.decimal...)
  264. }
  265. for i := 0; i < 2-int(v); i++ {
  266. b = append(b, '0')
  267. }
  268. }
  269. b = append(b, da.currencyPositiveSuffix...)
  270. b = append(b, symbol...)
  271. return string(b)
  272. }
  273. // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'da_DK'
  274. // in accounting notation.
  275. func (da *da_DK) FmtAccounting(num float64, v uint64, currency currency.Type) string {
  276. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  277. symbol := da.currencies[currency]
  278. l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
  279. count := 0
  280. inWhole := v == 0
  281. b := make([]byte, 0, l)
  282. for i := len(s) - 1; i >= 0; i-- {
  283. if s[i] == '.' {
  284. b = append(b, da.decimal[0])
  285. inWhole = true
  286. continue
  287. }
  288. if inWhole {
  289. if count == 3 {
  290. b = append(b, da.group[0])
  291. count = 1
  292. } else {
  293. count++
  294. }
  295. }
  296. b = append(b, s[i])
  297. }
  298. if num < 0 {
  299. b = append(b, da.minus[0])
  300. }
  301. // reverse
  302. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  303. b[i], b[j] = b[j], b[i]
  304. }
  305. if int(v) < 2 {
  306. if v == 0 {
  307. b = append(b, da.decimal...)
  308. }
  309. for i := 0; i < 2-int(v); i++ {
  310. b = append(b, '0')
  311. }
  312. }
  313. if num < 0 {
  314. b = append(b, da.currencyNegativeSuffix...)
  315. b = append(b, symbol...)
  316. } else {
  317. b = append(b, da.currencyPositiveSuffix...)
  318. b = append(b, symbol...)
  319. }
  320. return string(b)
  321. }
  322. // FmtDateShort returns the short date representation of 't' for 'da_DK'
  323. func (da *da_DK) FmtDateShort(t time.Time) string {
  324. b := make([]byte, 0, 32)
  325. if t.Day() < 10 {
  326. b = append(b, '0')
  327. }
  328. b = strconv.AppendInt(b, int64(t.Day()), 10)
  329. b = append(b, []byte{0x2f}...)
  330. if t.Month() < 10 {
  331. b = append(b, '0')
  332. }
  333. b = strconv.AppendInt(b, int64(t.Month()), 10)
  334. b = append(b, []byte{0x2f}...)
  335. b = strconv.AppendInt(b, int64(t.Year()), 10)
  336. return string(b)
  337. }
  338. // FmtDateMedium returns the medium date representation of 't' for 'da_DK'
  339. func (da *da_DK) FmtDateMedium(t time.Time) string {
  340. b := make([]byte, 0, 32)
  341. b = strconv.AppendInt(b, int64(t.Day()), 10)
  342. b = append(b, []byte{0x2e, 0x20}...)
  343. b = append(b, da.monthsAbbreviated[t.Month()]...)
  344. b = append(b, []byte{0x20}...)
  345. b = strconv.AppendInt(b, int64(t.Year()), 10)
  346. return string(b)
  347. }
  348. // FmtDateLong returns the long date representation of 't' for 'da_DK'
  349. func (da *da_DK) FmtDateLong(t time.Time) string {
  350. b := make([]byte, 0, 32)
  351. b = strconv.AppendInt(b, int64(t.Day()), 10)
  352. b = append(b, []byte{0x2e, 0x20}...)
  353. b = append(b, da.monthsWide[t.Month()]...)
  354. b = append(b, []byte{0x20}...)
  355. b = strconv.AppendInt(b, int64(t.Year()), 10)
  356. return string(b)
  357. }
  358. // FmtDateFull returns the full date representation of 't' for 'da_DK'
  359. func (da *da_DK) FmtDateFull(t time.Time) string {
  360. b := make([]byte, 0, 32)
  361. b = append(b, da.daysWide[t.Weekday()]...)
  362. b = append(b, []byte{}...)
  363. b = append(b, []byte{0x27, 0x64, 0x65, 0x6e, 0x27, 0x20}...)
  364. b = strconv.AppendInt(b, int64(t.Day()), 10)
  365. b = append(b, []byte{0x2e, 0x20}...)
  366. b = append(b, da.monthsWide[t.Month()]...)
  367. b = append(b, []byte{0x20}...)
  368. b = strconv.AppendInt(b, int64(t.Year()), 10)
  369. return string(b)
  370. }
  371. // FmtTimeShort returns the short time representation of 't' for 'da_DK'
  372. func (da *da_DK) FmtTimeShort(t time.Time) string {
  373. b := make([]byte, 0, 32)
  374. if t.Hour() < 10 {
  375. b = append(b, '0')
  376. }
  377. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  378. b = append(b, []byte{0x2e}...)
  379. if t.Minute() < 10 {
  380. b = append(b, '0')
  381. }
  382. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  383. return string(b)
  384. }
  385. // FmtTimeMedium returns the medium time representation of 't' for 'da_DK'
  386. func (da *da_DK) FmtTimeMedium(t time.Time) string {
  387. b := make([]byte, 0, 32)
  388. if t.Hour() < 10 {
  389. b = append(b, '0')
  390. }
  391. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  392. b = append(b, []byte{0x2e}...)
  393. if t.Minute() < 10 {
  394. b = append(b, '0')
  395. }
  396. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  397. b = append(b, []byte{0x2e}...)
  398. if t.Second() < 10 {
  399. b = append(b, '0')
  400. }
  401. b = strconv.AppendInt(b, int64(t.Second()), 10)
  402. return string(b)
  403. }
  404. // FmtTimeLong returns the long time representation of 't' for 'da_DK'
  405. func (da *da_DK) FmtTimeLong(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, []byte{0x2e}...)
  412. if t.Minute() < 10 {
  413. b = append(b, '0')
  414. }
  415. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  416. b = append(b, []byte{0x2e}...)
  417. if t.Second() < 10 {
  418. b = append(b, '0')
  419. }
  420. b = strconv.AppendInt(b, int64(t.Second()), 10)
  421. b = append(b, []byte{0x20}...)
  422. tz, _ := t.Zone()
  423. b = append(b, tz...)
  424. return string(b)
  425. }
  426. // FmtTimeFull returns the full time representation of 't' for 'da_DK'
  427. func (da *da_DK) FmtTimeFull(t time.Time) string {
  428. b := make([]byte, 0, 32)
  429. if t.Hour() < 10 {
  430. b = append(b, '0')
  431. }
  432. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  433. b = append(b, []byte{0x2e}...)
  434. if t.Minute() < 10 {
  435. b = append(b, '0')
  436. }
  437. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  438. b = append(b, []byte{0x2e}...)
  439. if t.Second() < 10 {
  440. b = append(b, '0')
  441. }
  442. b = strconv.AppendInt(b, int64(t.Second()), 10)
  443. b = append(b, []byte{0x20}...)
  444. tz, _ := t.Zone()
  445. if btz, ok := da.timezones[tz]; ok {
  446. b = append(b, btz...)
  447. } else {
  448. b = append(b, tz...)
  449. }
  450. return string(b)
  451. }