nds_DE.go 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  1. package nds_DE
  2. import (
  3. "math"
  4. "strconv"
  5. "time"
  6. "github.com/go-playground/locales"
  7. "github.com/go-playground/locales/currency"
  8. )
  9. type nds_DE 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 'nds_DE' locale
  42. func New() locales.Translator {
  43. return &nds_DE{
  44. locale: "nds_DE",
  45. pluralsCardinal: nil,
  46. pluralsOrdinal: nil,
  47. pluralsRange: nil,
  48. decimal: ",",
  49. group: ".",
  50. minus: "-",
  51. percent: "%",
  52. perMille: "‰",
  53. timeSeparator: ":",
  54. inifinity: "∞",
  55. currencies: []string{"ADP", "AED", "AFA", "AFN", "ALK", "ALL", "AMD", "ANG", "AOA", "AOK", "AON", "AOR", "ARA", "ARL", "ARM", "ARP", "ARS", "ATS", "AUD", "AWG", "AZM", "AZN", "BAD", "BAM", "BAN", "BBD", "BDT", "BEC", "BEF", "BEL", "BGL", "BGM", "BGN", "BGO", "BHD", "BIF", "BMD", "BND", "BOB", "BOL", "BOP", "BOV", "BRB", "BRC", "BRE", "BRL", "BRN", "BRR", "BRZ", "BSD", "BTN", "BUK", "BWP", "BYB", "BYN", "BYR", "BZD", "CAD", "CDF", "CHE", "CHF", "CHW", "CLE", "CLF", "CLP", "CNH", "CNX", "CNY", "COP", "COU", "CRC", "CSD", "CSK", "CUC", "CUP", "CVE", "CYP", "CZK", "DDM", "DEM", "DJF", "DKK", "DOP", "DZD", "ECS", "ECV", "EEK", "EGP", "ERN", "ESA", "ESB", "ESP", "ETB", "EUR", "FIM", "FJD", "FKP", "FRF", "GBP", "GEK", "GEL", "GHC", "GHS", "GIP", "GMD", "GNF", "GNS", "GQE", "GRD", "GTQ", "GWE", "GWP", "GYD", "HKD", "HNL", "HRD", "HRK", "HTG", "HUF", "IDR", "IEP", "ILP", "ILR", "ILS", "INR", "IQD", "IRR", "ISJ", "ISK", "ITL", "JMD", "JOD", "JPY", "KES", "KGS", "KHR", "KMF", "KPW", "KRH", "KRO", "KRW", "KWD", "KYD", "KZT", "LAK", "LBP", "LKR", "LRD", "LSL", "LTL", "LTT", "LUC", "LUF", "LUL", "LVL", "LVR", "LYD", "MAD", "MAF", "MCF", "MDC", "MDL", "MGA", "MGF", "MKD", "MKN", "MLF", "MMK", "MNT", "MOP", "MRO", "MTL", "MTP", "MUR", "MVP", "MVR", "MWK", "MXN", "MXP", "MXV", "MYR", "MZE", "MZM", "MZN", "NAD", "NGN", "NIC", "NIO", "NLG", "NOK", "NPR", "NZD", "OMR", "PAB", "PEI", "PEN", "PES", "PGK", "PHP", "PKR", "PLN", "PLZ", "PTE", "PYG", "QAR", "RHD", "ROL", "RON", "RSD", "RUB", "RUR", "RWF", "SAR", "SBD", "SCR", "SDD", "SDG", "SDP", "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.", "März", "Apr.", "Mai", "Juni", "Juli", "Aug.", "Sep.", "Okt.", "Nov.", "Dez."},
  60. monthsNarrow: []string{"", "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"},
  61. monthsWide: []string{"", "Januaar", "Februaar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktover", "November", "Dezember"},
  62. daysAbbreviated: []string{"Sü.", "Ma.", "Di.", "Mi.", "Du.", "Fr.", "Sa."},
  63. daysNarrow: []string{"S", "M", "D", "M", "D", "F", "S"},
  64. daysWide: []string{"Sünndag", "Maandag", "Dingsdag", "Middeweken", "Dunnersdag", "Freedag", "Sünnavend"},
  65. periodsAbbreviated: []string{"vm", "nm"},
  66. periodsWide: []string{"vm", "nm"},
  67. erasAbbreviated: []string{"v.Chr.", "n.Chr."},
  68. erasNarrow: []string{"vC", "nC"},
  69. erasWide: []string{"vör Christus", "na Christus"},
  70. timezones: map[string]string{"BOT": "BOT", "CLST": "CLST", "HEPMX": "HEPMX", "NZST": "NZST", "CDT": "Noordamerikaansch zentraal Summertiet", "ADT": "Noordamerikaansch Atlantik-Summertiet", "WIB": "Westindoneesch Tiet", "HNEG": "HNEG", "HNOG": "HNOG", "TMT": "TMT", "HNPMX": "HNPMX", "JDT": "Japaansch Summertiet", "HKT": "HKT", "HAT": "HAT", "WITA": "Indoneesch Zentraaltiet", "JST": "Japaansch Standardtiet", "EST": "Noordamerikaansch oosten Standardtiet", "COT": "COT", "PDT": "Noordamerikaansch Pazifik-Summertiet", "GFT": "GFT", "MEZ": "Zentraaleuropääsch Standardtiet", "SRT": "SRT", "GYT": "GYT", "WARST": "WARST", "GMT": "Gröönwisch-Welttiet", "ChST": "ChST", "HNCU": "HNCU", "CST": "Noordamerikaansch zentraal Standardtiet", "AKDT": "AKDT", "ACWST": "Westzentraalaustraalsch Standardtiet", "HEPM": "HEPM", "HENOMX": "HENOMX", "WIT": "Oostindoneesch Tiet", "CHADT": "CHADT", "AEST": "Oostaustraalsch Standardtiet", "AEDT": "Oostaustraalsch Summertiet", "AKST": "AKST", "SGT": "SGT", "HEEG": "HEEG", "SAST": "Söödafrikaansch Tiet", "NZDT": "NZDT", "ART": "ART", "ARST": "ARST", "PST": "Noordamerikaansch Pazifik-Standardtiet", "COST": "COST", "UYST": "UYST", "BT": "BT", "HKST": "HKST", "IST": "Indien-Tiet", "CLT": "CLT", "EAT": "Oostafrikaansch Tiet", "HADT": "HADT", "WEZ": "Westeuropääsch Standardtiet", "MYT": "MYT", "EDT": "Noordamerikaansch oosten Summertiet", "∅∅∅": "∅∅∅", "LHDT": "LHDT", "HECU": "HECU", "HNPM": "HNPM", "HNNOMX": "HNNOMX", "OEZ": "Oosteuropääsch Standardtiet", "VET": "VET", "MST": "MST", "CAT": "Zentraalafrikaansch Tiet", "HAST": "HAST", "AWDT": "Westaustraalsch Summertiet", "ECT": "ECT", "MESZ": "Zentraaleuropääsch Summertiet", "HNT": "HNT", "WAST": "Westafrikaansch Summertiet", "WAT": "Westafrikaansch Standardtiet", "WESZ": "Westeuropääsch Summertiet", "HEOG": "HEOG", "WART": "WART", "TMST": "TMST", "CHAST": "CHAST", "AST": "Noordamerikaansch Atlantik-Standardtiet", "ACDT": "Zentraalaustraalsch Summertiet", "LHST": "LHST", "MDT": "MDT", "UYT": "UYT", "AWST": "Westaustraalsch Standardtiet", "ACST": "Zentraalaustraalsch Standardtiet", "ACWDT": "Westzentraalaustraalsch Summertiet", "OESZ": "Oosteuropääsch Summertiet"},
  71. }
  72. }
  73. // Locale returns the current translators string locale
  74. func (nds *nds_DE) Locale() string {
  75. return nds.locale
  76. }
  77. // PluralsCardinal returns the list of cardinal plural rules associated with 'nds_DE'
  78. func (nds *nds_DE) PluralsCardinal() []locales.PluralRule {
  79. return nds.pluralsCardinal
  80. }
  81. // PluralsOrdinal returns the list of ordinal plural rules associated with 'nds_DE'
  82. func (nds *nds_DE) PluralsOrdinal() []locales.PluralRule {
  83. return nds.pluralsOrdinal
  84. }
  85. // PluralsRange returns the list of range plural rules associated with 'nds_DE'
  86. func (nds *nds_DE) PluralsRange() []locales.PluralRule {
  87. return nds.pluralsRange
  88. }
  89. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'nds_DE'
  90. func (nds *nds_DE) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
  91. return locales.PluralRuleUnknown
  92. }
  93. // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'nds_DE'
  94. func (nds *nds_DE) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
  95. return locales.PluralRuleUnknown
  96. }
  97. // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'nds_DE'
  98. func (nds *nds_DE) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
  99. return locales.PluralRuleUnknown
  100. }
  101. // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
  102. func (nds *nds_DE) MonthAbbreviated(month time.Month) string {
  103. return nds.monthsAbbreviated[month]
  104. }
  105. // MonthsAbbreviated returns the locales abbreviated months
  106. func (nds *nds_DE) MonthsAbbreviated() []string {
  107. return nds.monthsAbbreviated[1:]
  108. }
  109. // MonthNarrow returns the locales narrow month given the 'month' provided
  110. func (nds *nds_DE) MonthNarrow(month time.Month) string {
  111. return nds.monthsNarrow[month]
  112. }
  113. // MonthsNarrow returns the locales narrow months
  114. func (nds *nds_DE) MonthsNarrow() []string {
  115. return nds.monthsNarrow[1:]
  116. }
  117. // MonthWide returns the locales wide month given the 'month' provided
  118. func (nds *nds_DE) MonthWide(month time.Month) string {
  119. return nds.monthsWide[month]
  120. }
  121. // MonthsWide returns the locales wide months
  122. func (nds *nds_DE) MonthsWide() []string {
  123. return nds.monthsWide[1:]
  124. }
  125. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  126. func (nds *nds_DE) WeekdayAbbreviated(weekday time.Weekday) string {
  127. return nds.daysAbbreviated[weekday]
  128. }
  129. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  130. func (nds *nds_DE) WeekdaysAbbreviated() []string {
  131. return nds.daysAbbreviated
  132. }
  133. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  134. func (nds *nds_DE) WeekdayNarrow(weekday time.Weekday) string {
  135. return nds.daysNarrow[weekday]
  136. }
  137. // WeekdaysNarrow returns the locales narrow weekdays
  138. func (nds *nds_DE) WeekdaysNarrow() []string {
  139. return nds.daysNarrow
  140. }
  141. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  142. func (nds *nds_DE) WeekdayShort(weekday time.Weekday) string {
  143. return nds.daysShort[weekday]
  144. }
  145. // WeekdaysShort returns the locales short weekdays
  146. func (nds *nds_DE) WeekdaysShort() []string {
  147. return nds.daysShort
  148. }
  149. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  150. func (nds *nds_DE) WeekdayWide(weekday time.Weekday) string {
  151. return nds.daysWide[weekday]
  152. }
  153. // WeekdaysWide returns the locales wide weekdays
  154. func (nds *nds_DE) WeekdaysWide() []string {
  155. return nds.daysWide
  156. }
  157. // Decimal returns the decimal point of number
  158. func (nds *nds_DE) Decimal() string {
  159. return nds.decimal
  160. }
  161. // Group returns the group of number
  162. func (nds *nds_DE) Group() string {
  163. return nds.group
  164. }
  165. // Group returns the minus sign of number
  166. func (nds *nds_DE) Minus() string {
  167. return nds.minus
  168. }
  169. // FmtNumber returns 'num' with digits/precision of 'v' for 'nds_DE' and handles both Whole and Real numbers based on 'v'
  170. func (nds *nds_DE) FmtNumber(num float64, v uint64) string {
  171. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  172. l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
  173. count := 0
  174. inWhole := v == 0
  175. b := make([]byte, 0, l)
  176. for i := len(s) - 1; i >= 0; i-- {
  177. if s[i] == '.' {
  178. b = append(b, nds.decimal[0])
  179. inWhole = true
  180. continue
  181. }
  182. if inWhole {
  183. if count == 3 {
  184. b = append(b, nds.group[0])
  185. count = 1
  186. } else {
  187. count++
  188. }
  189. }
  190. b = append(b, s[i])
  191. }
  192. if num < 0 {
  193. b = append(b, nds.minus[0])
  194. }
  195. // reverse
  196. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  197. b[i], b[j] = b[j], b[i]
  198. }
  199. return string(b)
  200. }
  201. // FmtPercent returns 'num' with digits/precision of 'v' for 'nds_DE' and handles both Whole and Real numbers based on 'v'
  202. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
  203. func (nds *nds_DE) FmtPercent(num float64, v uint64) string {
  204. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  205. l := len(s) + 5
  206. b := make([]byte, 0, l)
  207. for i := len(s) - 1; i >= 0; i-- {
  208. if s[i] == '.' {
  209. b = append(b, nds.decimal[0])
  210. continue
  211. }
  212. b = append(b, s[i])
  213. }
  214. if num < 0 {
  215. b = append(b, nds.minus[0])
  216. }
  217. // reverse
  218. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  219. b[i], b[j] = b[j], b[i]
  220. }
  221. b = append(b, nds.percentSuffix...)
  222. b = append(b, nds.percent...)
  223. return string(b)
  224. }
  225. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'nds_DE'
  226. func (nds *nds_DE) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  227. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  228. symbol := nds.currencies[currency]
  229. l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
  230. count := 0
  231. inWhole := v == 0
  232. b := make([]byte, 0, l)
  233. for i := len(s) - 1; i >= 0; i-- {
  234. if s[i] == '.' {
  235. b = append(b, nds.decimal[0])
  236. inWhole = true
  237. continue
  238. }
  239. if inWhole {
  240. if count == 3 {
  241. b = append(b, nds.group[0])
  242. count = 1
  243. } else {
  244. count++
  245. }
  246. }
  247. b = append(b, s[i])
  248. }
  249. if num < 0 {
  250. b = append(b, nds.minus[0])
  251. }
  252. // reverse
  253. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  254. b[i], b[j] = b[j], b[i]
  255. }
  256. if int(v) < 2 {
  257. if v == 0 {
  258. b = append(b, nds.decimal...)
  259. }
  260. for i := 0; i < 2-int(v); i++ {
  261. b = append(b, '0')
  262. }
  263. }
  264. b = append(b, nds.currencyPositiveSuffix...)
  265. b = append(b, symbol...)
  266. return string(b)
  267. }
  268. // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'nds_DE'
  269. // in accounting notation.
  270. func (nds *nds_DE) FmtAccounting(num float64, v uint64, currency currency.Type) string {
  271. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  272. symbol := nds.currencies[currency]
  273. l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
  274. count := 0
  275. inWhole := v == 0
  276. b := make([]byte, 0, l)
  277. for i := len(s) - 1; i >= 0; i-- {
  278. if s[i] == '.' {
  279. b = append(b, nds.decimal[0])
  280. inWhole = true
  281. continue
  282. }
  283. if inWhole {
  284. if count == 3 {
  285. b = append(b, nds.group[0])
  286. count = 1
  287. } else {
  288. count++
  289. }
  290. }
  291. b = append(b, s[i])
  292. }
  293. if num < 0 {
  294. b = append(b, nds.minus[0])
  295. }
  296. // reverse
  297. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  298. b[i], b[j] = b[j], b[i]
  299. }
  300. if int(v) < 2 {
  301. if v == 0 {
  302. b = append(b, nds.decimal...)
  303. }
  304. for i := 0; i < 2-int(v); i++ {
  305. b = append(b, '0')
  306. }
  307. }
  308. if num < 0 {
  309. b = append(b, nds.currencyNegativeSuffix...)
  310. b = append(b, symbol...)
  311. } else {
  312. b = append(b, nds.currencyPositiveSuffix...)
  313. b = append(b, symbol...)
  314. }
  315. return string(b)
  316. }
  317. // FmtDateShort returns the short date representation of 't' for 'nds_DE'
  318. func (nds *nds_DE) FmtDateShort(t time.Time) string {
  319. b := make([]byte, 0, 32)
  320. b = strconv.AppendInt(b, int64(t.Day()), 10)
  321. b = append(b, []byte{0x2e}...)
  322. if t.Month() < 10 {
  323. b = append(b, '0')
  324. }
  325. b = strconv.AppendInt(b, int64(t.Month()), 10)
  326. b = append(b, []byte{0x2e}...)
  327. if t.Year() > 9 {
  328. b = append(b, strconv.Itoa(t.Year())[2:]...)
  329. } else {
  330. b = append(b, strconv.Itoa(t.Year())[1:]...)
  331. }
  332. return string(b)
  333. }
  334. // FmtDateMedium returns the medium date representation of 't' for 'nds_DE'
  335. func (nds *nds_DE) FmtDateMedium(t time.Time) string {
  336. b := make([]byte, 0, 32)
  337. b = strconv.AppendInt(b, int64(t.Day()), 10)
  338. b = append(b, []byte{0x2e, 0x20}...)
  339. b = append(b, nds.monthsAbbreviated[t.Month()]...)
  340. b = append(b, []byte{0x20}...)
  341. if t.Year() > 0 {
  342. b = strconv.AppendInt(b, int64(t.Year()), 10)
  343. } else {
  344. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  345. }
  346. return string(b)
  347. }
  348. // FmtDateLong returns the long date representation of 't' for 'nds_DE'
  349. func (nds *nds_DE) 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, nds.monthsWide[t.Month()]...)
  354. b = append(b, []byte{0x20}...)
  355. if t.Year() > 0 {
  356. b = strconv.AppendInt(b, int64(t.Year()), 10)
  357. } else {
  358. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  359. }
  360. return string(b)
  361. }
  362. // FmtDateFull returns the full date representation of 't' for 'nds_DE'
  363. func (nds *nds_DE) FmtDateFull(t time.Time) string {
  364. b := make([]byte, 0, 32)
  365. b = append(b, nds.daysWide[t.Weekday()]...)
  366. b = append(b, []byte{0x2c, 0x20, 0x64, 0x65}...)
  367. b = append(b, []byte{0x20}...)
  368. b = strconv.AppendInt(b, int64(t.Day()), 10)
  369. b = append(b, []byte{0x2e, 0x20}...)
  370. b = append(b, nds.monthsWide[t.Month()]...)
  371. b = append(b, []byte{0x20}...)
  372. if t.Year() > 0 {
  373. b = strconv.AppendInt(b, int64(t.Year()), 10)
  374. } else {
  375. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  376. }
  377. return string(b)
  378. }
  379. // FmtTimeShort returns the short time representation of 't' for 'nds_DE'
  380. func (nds *nds_DE) FmtTimeShort(t time.Time) string {
  381. b := make([]byte, 0, 32)
  382. b = append(b, []byte{0x4b, 0x6c}...)
  383. b = append(b, []byte{0x2e, 0x20}...)
  384. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  385. b = append(b, []byte{0x2e}...)
  386. if t.Minute() < 10 {
  387. b = append(b, '0')
  388. }
  389. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  390. return string(b)
  391. }
  392. // FmtTimeMedium returns the medium time representation of 't' for 'nds_DE'
  393. func (nds *nds_DE) FmtTimeMedium(t time.Time) string {
  394. b := make([]byte, 0, 32)
  395. b = append(b, []byte{0x4b, 0x6c, 0x6f, 0x63, 0x6b}...)
  396. b = append(b, []byte{0x20}...)
  397. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  398. b = append(b, []byte{0x2e}...)
  399. if t.Minute() < 10 {
  400. b = append(b, '0')
  401. }
  402. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  403. b = append(b, nds.timeSeparator...)
  404. if t.Second() < 10 {
  405. b = append(b, '0')
  406. }
  407. b = strconv.AppendInt(b, int64(t.Second()), 10)
  408. return string(b)
  409. }
  410. // FmtTimeLong returns the long time representation of 't' for 'nds_DE'
  411. func (nds *nds_DE) FmtTimeLong(t time.Time) string {
  412. b := make([]byte, 0, 32)
  413. b = append(b, []byte{0x4b, 0x6c, 0x6f, 0x63, 0x6b}...)
  414. b = append(b, []byte{0x20}...)
  415. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  416. b = append(b, []byte{0x2e}...)
  417. if t.Minute() < 10 {
  418. b = append(b, '0')
  419. }
  420. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  421. b = append(b, nds.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, 0x28}...)
  427. tz, _ := t.Zone()
  428. b = append(b, tz...)
  429. b = append(b, []byte{0x29}...)
  430. return string(b)
  431. }
  432. // FmtTimeFull returns the full time representation of 't' for 'nds_DE'
  433. func (nds *nds_DE) FmtTimeFull(t time.Time) string {
  434. b := make([]byte, 0, 32)
  435. b = append(b, []byte{0x4b, 0x6c, 0x6f, 0x63, 0x6b}...)
  436. b = append(b, []byte{0x20}...)
  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, nds.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, 0x28}...)
  449. tz, _ := t.Zone()
  450. if btz, ok := nds.timezones[tz]; ok {
  451. b = append(b, btz...)
  452. } else {
  453. b = append(b, tz...)
  454. }
  455. b = append(b, []byte{0x29}...)
  456. return string(b)
  457. }