nl_CW.go 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  1. package nl_CW
  2. import (
  3. "math"
  4. "strconv"
  5. "time"
  6. "github.com/go-playground/locales"
  7. "github.com/go-playground/locales/currency"
  8. )
  9. type nl_CW 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. perMille string
  19. timeSeparator string
  20. inifinity string
  21. currencies []string // idx = enum of currency code
  22. currencyPositivePrefix string
  23. currencyNegativePrefix 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 'nl_CW' locale
  42. func New() locales.Translator {
  43. return &nl_CW{
  44. locale: "nl_CW",
  45. pluralsCardinal: []locales.PluralRule{2, 6},
  46. pluralsOrdinal: []locales.PluralRule{6},
  47. pluralsRange: []locales.PluralRule{6, 2},
  48. timeSeparator: ":",
  49. currencies: []string{"ADP ", "AED ", "AFA ", "AFN ", "ALK ", "ALL ", "AMD ", "NAf.", "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 "},
  50. currencyPositivePrefix: " ",
  51. currencyNegativePrefix: "( ",
  52. currencyNegativeSuffix: ")",
  53. monthsAbbreviated: []string{"", "jan.", "feb.", "mrt.", "apr.", "mei", "jun.", "jul.", "aug.", "sep.", "okt.", "nov.", "dec."},
  54. monthsNarrow: []string{"", "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"},
  55. monthsWide: []string{"", "januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"},
  56. daysAbbreviated: []string{"zo", "ma", "di", "wo", "do", "vr", "za"},
  57. daysNarrow: []string{"Z", "M", "D", "W", "D", "V", "Z"},
  58. daysShort: []string{"zo", "ma", "di", "wo", "do", "vr", "za"},
  59. daysWide: []string{"zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"},
  60. periodsAbbreviated: []string{"a.m.", "p.m."},
  61. periodsNarrow: []string{"a.m.", "p.m."},
  62. periodsWide: []string{"a.m.", "p.m."},
  63. erasAbbreviated: []string{"v.Chr.", "n.Chr."},
  64. erasNarrow: []string{"v.C.", "n.C."},
  65. erasWide: []string{"voor Christus", "na Christus"},
  66. timezones: map[string]string{"ADT": "Atlantic-zomertijd", "HAST": "Hawaii-Aleoetische standaardtijd", "AKST": "Alaska-standaardtijd", "AEST": "Oost-Australische standaardtijd", "AST": "Atlantic-standaardtijd", "HKT": "Hongkongse standaardtijd", "WIT": "Oost-Indonesische tijd", "WIB": "West-Indonesische tijd", "UYT": "Uruguayaanse standaardtijd", "CAT": "Centraal-Afrikaanse tijd", "COST": "Colombiaanse zomertijd", "∅∅∅": "Acre-zomertijd", "MDT": "Macause zomertijd", "PDT": "Pacific-zomertijd", "CST": "Central-standaardtijd", "NZST": "Nieuw-Zeelandse standaardtijd", "CHAST": "Chatham-standaardtijd", "TMT": "Turkmeense standaardtijd", "AKDT": "Alaska-zomertijd", "MESZ": "Midden-Europese zomertijd", "UYST": "Uruguayaanse zomertijd", "CHADT": "Chatham-zomertijd", "HADT": "Hawaii-Aleoetische zomertijd", "SGT": "Singaporese standaardtijd", "ACDT": "Midden-Australische zomertijd", "ACWDT": "Midden-Australische westelijke zomertijd", "EDT": "Eastern-zomertijd", "MST": "Macause standaardtijd", "AWDT": "West-Australische zomertijd", "VET": "Venezolaanse tijd", "ACST": "Midden-Australische standaardtijd", "IST": "Indiase tijd", "OEZ": "Oost-Europese standaardtijd", "EST": "Eastern-standaardtijd", "COT": "Colombiaanse standaardtijd", "SAST": "Zuid-Afrikaanse tijd", "GFT": "Frans-Guyaanse tijd", "ARST": "Argentijnse zomertijd", "BT": "Bhutaanse tijd", "WART": "West-Argentijnse standaardtijd", "HNT": "Newfoundland-standaardtijd", "HAT": "Newfoundland-zomertijd", "NZDT": "Nieuw-Zeelandse zomertijd", "AWST": "West-Australische standaardtijd", "GYT": "Guyaanse tijd", "MEZ": "Midden-Europese standaardtijd", "WESZ": "West-Europese zomertijd", "WAT": "West-Afrikaanse standaardtijd", "WARST": "West-Argentijnse zomertijd", "OESZ": "Oost-Europese zomertijd", "LHDT": "Lord Howe-eilandse zomertijd", "MYT": "Maleisische tijd", "WEZ": "West-Europese standaardtijd", "ACWST": "Midden-Australische westelijke standaardtijd", "ART": "Argentijnse standaardtijd", "CDT": "Central-zomertijd", "CLST": "Chileense zomertijd", "AEDT": "Oost-Australische zomertijd", "ChST": "Chamorro-tijd", "GMT": "Greenwich Mean Time", "TMST": "Turkmeense zomertijd", "SRT": "Surinaamse tijd", "WAST": "West-Afrikaanse zomertijd", "JST": "Japanse standaardtijd", "PST": "Pacific-standaardtijd", "BOT": "Boliviaanse tijd", "ECT": "Ecuadoraanse tijd", "HKST": "Hongkongse zomertijd", "WITA": "Centraal-Indonesische tijd", "EAT": "Oost-Afrikaanse tijd", "JDT": "Japanse zomertijd", "LHST": "Lord Howe-eilandse standaardtijd", "CLT": "Chileense standaardtijd"},
  67. }
  68. }
  69. // Locale returns the current translators string locale
  70. func (nl *nl_CW) Locale() string {
  71. return nl.locale
  72. }
  73. // PluralsCardinal returns the list of cardinal plural rules associated with 'nl_CW'
  74. func (nl *nl_CW) PluralsCardinal() []locales.PluralRule {
  75. return nl.pluralsCardinal
  76. }
  77. // PluralsOrdinal returns the list of ordinal plural rules associated with 'nl_CW'
  78. func (nl *nl_CW) PluralsOrdinal() []locales.PluralRule {
  79. return nl.pluralsOrdinal
  80. }
  81. // PluralsRange returns the list of range plural rules associated with 'nl_CW'
  82. func (nl *nl_CW) PluralsRange() []locales.PluralRule {
  83. return nl.pluralsRange
  84. }
  85. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'nl_CW'
  86. func (nl *nl_CW) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
  87. n := math.Abs(num)
  88. i := int64(n)
  89. if i == 1 && v == 0 {
  90. return locales.PluralRuleOne
  91. }
  92. return locales.PluralRuleOther
  93. }
  94. // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'nl_CW'
  95. func (nl *nl_CW) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
  96. return locales.PluralRuleOther
  97. }
  98. // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'nl_CW'
  99. func (nl *nl_CW) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
  100. start := nl.CardinalPluralRule(num1, v1)
  101. end := nl.CardinalPluralRule(num2, v2)
  102. if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
  103. return locales.PluralRuleOther
  104. } else if start == locales.PluralRuleOther && end == locales.PluralRuleOne {
  105. return locales.PluralRuleOne
  106. }
  107. return locales.PluralRuleOther
  108. }
  109. // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
  110. func (nl *nl_CW) MonthAbbreviated(month time.Month) string {
  111. return nl.monthsAbbreviated[month]
  112. }
  113. // MonthsAbbreviated returns the locales abbreviated months
  114. func (nl *nl_CW) MonthsAbbreviated() []string {
  115. return nl.monthsAbbreviated[1:]
  116. }
  117. // MonthNarrow returns the locales narrow month given the 'month' provided
  118. func (nl *nl_CW) MonthNarrow(month time.Month) string {
  119. return nl.monthsNarrow[month]
  120. }
  121. // MonthsNarrow returns the locales narrow months
  122. func (nl *nl_CW) MonthsNarrow() []string {
  123. return nl.monthsNarrow[1:]
  124. }
  125. // MonthWide returns the locales wide month given the 'month' provided
  126. func (nl *nl_CW) MonthWide(month time.Month) string {
  127. return nl.monthsWide[month]
  128. }
  129. // MonthsWide returns the locales wide months
  130. func (nl *nl_CW) MonthsWide() []string {
  131. return nl.monthsWide[1:]
  132. }
  133. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  134. func (nl *nl_CW) WeekdayAbbreviated(weekday time.Weekday) string {
  135. return nl.daysAbbreviated[weekday]
  136. }
  137. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  138. func (nl *nl_CW) WeekdaysAbbreviated() []string {
  139. return nl.daysAbbreviated
  140. }
  141. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  142. func (nl *nl_CW) WeekdayNarrow(weekday time.Weekday) string {
  143. return nl.daysNarrow[weekday]
  144. }
  145. // WeekdaysNarrow returns the locales narrow weekdays
  146. func (nl *nl_CW) WeekdaysNarrow() []string {
  147. return nl.daysNarrow
  148. }
  149. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  150. func (nl *nl_CW) WeekdayShort(weekday time.Weekday) string {
  151. return nl.daysShort[weekday]
  152. }
  153. // WeekdaysShort returns the locales short weekdays
  154. func (nl *nl_CW) WeekdaysShort() []string {
  155. return nl.daysShort
  156. }
  157. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  158. func (nl *nl_CW) WeekdayWide(weekday time.Weekday) string {
  159. return nl.daysWide[weekday]
  160. }
  161. // WeekdaysWide returns the locales wide weekdays
  162. func (nl *nl_CW) WeekdaysWide() []string {
  163. return nl.daysWide
  164. }
  165. // FmtNumber returns 'num' with digits/precision of 'v' for 'nl_CW' and handles both Whole and Real numbers based on 'v'
  166. func (nl *nl_CW) FmtNumber(num float64, v uint64) string {
  167. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  168. l := len(s) + 0 + 0*len(s[:len(s)-int(v)-1])/3
  169. count := 0
  170. inWhole := v == 0
  171. b := make([]byte, 0, l)
  172. for i := len(s) - 1; i >= 0; i-- {
  173. if s[i] == '.' {
  174. b = append(b, nl.decimal[0])
  175. inWhole = true
  176. continue
  177. }
  178. if inWhole {
  179. if count == 3 {
  180. b = append(b, nl.group[0])
  181. count = 1
  182. } else {
  183. count++
  184. }
  185. }
  186. b = append(b, s[i])
  187. }
  188. if num < 0 {
  189. b = append(b, nl.minus[0])
  190. }
  191. // reverse
  192. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  193. b[i], b[j] = b[j], b[i]
  194. }
  195. return string(b)
  196. }
  197. // FmtPercent returns 'num' with digits/precision of 'v' for 'nl_CW' and handles both Whole and Real numbers based on 'v'
  198. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
  199. func (nl *nl_CW) FmtPercent(num float64, v uint64) string {
  200. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  201. l := len(s) + 0
  202. b := make([]byte, 0, l)
  203. for i := len(s) - 1; i >= 0; i-- {
  204. if s[i] == '.' {
  205. b = append(b, nl.decimal[0])
  206. continue
  207. }
  208. b = append(b, s[i])
  209. }
  210. if num < 0 {
  211. b = append(b, nl.minus[0])
  212. }
  213. // reverse
  214. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  215. b[i], b[j] = b[j], b[i]
  216. }
  217. b = append(b, nl.percent...)
  218. return string(b)
  219. }
  220. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'nl_CW'
  221. func (nl *nl_CW) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  222. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  223. symbol := nl.currencies[currency]
  224. l := len(s) + len(symbol) + 2 + 0*len(s[:len(s)-int(v)-1])/3
  225. count := 0
  226. inWhole := v == 0
  227. b := make([]byte, 0, l)
  228. for i := len(s) - 1; i >= 0; i-- {
  229. if s[i] == '.' {
  230. b = append(b, nl.decimal[0])
  231. inWhole = true
  232. continue
  233. }
  234. if inWhole {
  235. if count == 3 {
  236. b = append(b, nl.group[0])
  237. count = 1
  238. } else {
  239. count++
  240. }
  241. }
  242. b = append(b, s[i])
  243. }
  244. for j := len(symbol) - 1; j >= 0; j-- {
  245. b = append(b, symbol[j])
  246. }
  247. for j := len(nl.currencyPositivePrefix) - 1; j >= 0; j-- {
  248. b = append(b, nl.currencyPositivePrefix[j])
  249. }
  250. if num < 0 {
  251. b = append(b, nl.minus[0])
  252. }
  253. // reverse
  254. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  255. b[i], b[j] = b[j], b[i]
  256. }
  257. if int(v) < 2 {
  258. if v == 0 {
  259. b = append(b, nl.decimal...)
  260. }
  261. for i := 0; i < 2-int(v); i++ {
  262. b = append(b, '0')
  263. }
  264. }
  265. return string(b)
  266. }
  267. // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'nl_CW'
  268. // in accounting notation.
  269. func (nl *nl_CW) FmtAccounting(num float64, v uint64, currency currency.Type) string {
  270. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  271. symbol := nl.currencies[currency]
  272. l := len(s) + len(symbol) + 4 + 0*len(s[:len(s)-int(v)-1])/3
  273. count := 0
  274. inWhole := v == 0
  275. b := make([]byte, 0, l)
  276. for i := len(s) - 1; i >= 0; i-- {
  277. if s[i] == '.' {
  278. b = append(b, nl.decimal[0])
  279. inWhole = true
  280. continue
  281. }
  282. if inWhole {
  283. if count == 3 {
  284. b = append(b, nl.group[0])
  285. count = 1
  286. } else {
  287. count++
  288. }
  289. }
  290. b = append(b, s[i])
  291. }
  292. if num < 0 {
  293. for j := len(symbol) - 1; j >= 0; j-- {
  294. b = append(b, symbol[j])
  295. }
  296. for j := len(nl.currencyNegativePrefix) - 1; j >= 0; j-- {
  297. b = append(b, nl.currencyNegativePrefix[j])
  298. }
  299. } else {
  300. for j := len(symbol) - 1; j >= 0; j-- {
  301. b = append(b, symbol[j])
  302. }
  303. for j := len(nl.currencyPositivePrefix) - 1; j >= 0; j-- {
  304. b = append(b, nl.currencyPositivePrefix[j])
  305. }
  306. }
  307. // reverse
  308. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  309. b[i], b[j] = b[j], b[i]
  310. }
  311. if int(v) < 2 {
  312. if v == 0 {
  313. b = append(b, nl.decimal...)
  314. }
  315. for i := 0; i < 2-int(v); i++ {
  316. b = append(b, '0')
  317. }
  318. }
  319. if num < 0 {
  320. b = append(b, nl.currencyNegativeSuffix...)
  321. }
  322. return string(b)
  323. }
  324. // FmtDateShort returns the short date representation of 't' for 'nl_CW'
  325. func (nl *nl_CW) FmtDateShort(t time.Time) string {
  326. b := make([]byte, 0, 32)
  327. if t.Day() < 10 {
  328. b = append(b, '0')
  329. }
  330. b = strconv.AppendInt(b, int64(t.Day()), 10)
  331. b = append(b, []byte{0x2d}...)
  332. if t.Month() < 10 {
  333. b = append(b, '0')
  334. }
  335. b = strconv.AppendInt(b, int64(t.Month()), 10)
  336. b = append(b, []byte{0x2d}...)
  337. if t.Year() > 9 {
  338. b = append(b, strconv.Itoa(t.Year())[2:]...)
  339. } else {
  340. b = append(b, strconv.Itoa(t.Year())[1:]...)
  341. }
  342. return string(b)
  343. }
  344. // FmtDateMedium returns the medium date representation of 't' for 'nl_CW'
  345. func (nl *nl_CW) FmtDateMedium(t time.Time) string {
  346. b := make([]byte, 0, 32)
  347. b = strconv.AppendInt(b, int64(t.Day()), 10)
  348. b = append(b, []byte{0x20}...)
  349. b = append(b, nl.monthsAbbreviated[t.Month()]...)
  350. b = append(b, []byte{0x20}...)
  351. b = strconv.AppendInt(b, int64(t.Year()), 10)
  352. return string(b)
  353. }
  354. // FmtDateLong returns the long date representation of 't' for 'nl_CW'
  355. func (nl *nl_CW) FmtDateLong(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, nl.monthsWide[t.Month()]...)
  360. b = append(b, []byte{0x20}...)
  361. b = strconv.AppendInt(b, int64(t.Year()), 10)
  362. return string(b)
  363. }
  364. // FmtDateFull returns the full date representation of 't' for 'nl_CW'
  365. func (nl *nl_CW) FmtDateFull(t time.Time) string {
  366. b := make([]byte, 0, 32)
  367. b = append(b, nl.daysWide[t.Weekday()]...)
  368. b = append(b, []byte{0x20}...)
  369. b = strconv.AppendInt(b, int64(t.Day()), 10)
  370. b = append(b, []byte{0x20}...)
  371. b = append(b, nl.monthsWide[t.Month()]...)
  372. b = append(b, []byte{0x20}...)
  373. b = strconv.AppendInt(b, int64(t.Year()), 10)
  374. return string(b)
  375. }
  376. // FmtTimeShort returns the short time representation of 't' for 'nl_CW'
  377. func (nl *nl_CW) FmtTimeShort(t time.Time) string {
  378. b := make([]byte, 0, 32)
  379. if t.Hour() < 10 {
  380. b = append(b, '0')
  381. }
  382. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  383. b = append(b, nl.timeSeparator...)
  384. if t.Minute() < 10 {
  385. b = append(b, '0')
  386. }
  387. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  388. return string(b)
  389. }
  390. // FmtTimeMedium returns the medium time representation of 't' for 'nl_CW'
  391. func (nl *nl_CW) FmtTimeMedium(t time.Time) string {
  392. b := make([]byte, 0, 32)
  393. if t.Hour() < 10 {
  394. b = append(b, '0')
  395. }
  396. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  397. b = append(b, nl.timeSeparator...)
  398. if t.Minute() < 10 {
  399. b = append(b, '0')
  400. }
  401. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  402. b = append(b, nl.timeSeparator...)
  403. if t.Second() < 10 {
  404. b = append(b, '0')
  405. }
  406. b = strconv.AppendInt(b, int64(t.Second()), 10)
  407. return string(b)
  408. }
  409. // FmtTimeLong returns the long time representation of 't' for 'nl_CW'
  410. func (nl *nl_CW) FmtTimeLong(t time.Time) string {
  411. b := make([]byte, 0, 32)
  412. if t.Hour() < 10 {
  413. b = append(b, '0')
  414. }
  415. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  416. b = append(b, nl.timeSeparator...)
  417. if t.Minute() < 10 {
  418. b = append(b, '0')
  419. }
  420. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  421. b = append(b, nl.timeSeparator...)
  422. if t.Second() < 10 {
  423. b = append(b, '0')
  424. }
  425. b = strconv.AppendInt(b, int64(t.Second()), 10)
  426. b = append(b, []byte{0x20}...)
  427. tz, _ := t.Zone()
  428. b = append(b, tz...)
  429. return string(b)
  430. }
  431. // FmtTimeFull returns the full time representation of 't' for 'nl_CW'
  432. func (nl *nl_CW) FmtTimeFull(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, nl.timeSeparator...)
  439. if t.Minute() < 10 {
  440. b = append(b, '0')
  441. }
  442. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  443. b = append(b, nl.timeSeparator...)
  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. if btz, ok := nl.timezones[tz]; ok {
  451. b = append(b, btz...)
  452. } else {
  453. b = append(b, tz...)
  454. }
  455. return string(b)
  456. }