nnh.go 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. package nnh
  2. import (
  3. "math"
  4. "strconv"
  5. "time"
  6. "github.com/go-playground/locales"
  7. "github.com/go-playground/locales/currency"
  8. )
  9. type nnh 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. monthsAbbreviated []string
  25. monthsNarrow []string
  26. monthsWide []string
  27. daysAbbreviated []string
  28. daysNarrow []string
  29. daysShort []string
  30. daysWide []string
  31. periodsAbbreviated []string
  32. periodsNarrow []string
  33. periodsShort []string
  34. periodsWide []string
  35. erasAbbreviated []string
  36. erasNarrow []string
  37. erasWide []string
  38. timezones map[string]string
  39. }
  40. // New returns a new instance of translator for the 'nnh' locale
  41. func New() locales.Translator {
  42. return &nnh{
  43. locale: "nnh",
  44. pluralsCardinal: []locales.PluralRule{2, 6},
  45. pluralsOrdinal: nil,
  46. pluralsRange: nil,
  47. decimal: ",",
  48. group: ".",
  49. percent: "%",
  50. timeSeparator: ":",
  51. 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", "FCFA", "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"},
  52. currencyPositivePrefix: " ",
  53. currencyNegativePrefix: " ",
  54. monthsAbbreviated: []string{"", "saŋ tsetsɛ̀ɛ lùm", "saŋ kàg ngwóŋ", "saŋ lepyè shúm", "saŋ cÿó", "saŋ tsɛ̀ɛ cÿó", "saŋ njÿoláʼ", "saŋ tyɛ̀b tyɛ̀b mbʉ̀ŋ", "saŋ mbʉ̀ŋ", "saŋ ngwɔ̀ʼ mbÿɛ", "saŋ tàŋa tsetsáʼ", "saŋ mejwoŋó", "saŋ lùm"},
  55. monthsWide: []string{"", "saŋ tsetsɛ̀ɛ lùm", "saŋ kàg ngwóŋ", "saŋ lepyè shúm", "saŋ cÿó", "saŋ tsɛ̀ɛ cÿó", "saŋ njÿoláʼ", "saŋ tyɛ̀b tyɛ̀b mbʉ̀ŋ", "saŋ mbʉ̀ŋ", "saŋ ngwɔ̀ʼ mbÿɛ", "saŋ tàŋa tsetsáʼ", "saŋ mejwoŋó", "saŋ lùm"},
  56. daysAbbreviated: []string{"lyɛʼɛ́ sẅíŋtè", "mvfò lyɛ̌ʼ", "mbɔ́ɔntè mvfò lyɛ̌ʼ", "tsètsɛ̀ɛ lyɛ̌ʼ", "mbɔ́ɔntè tsetsɛ̀ɛ lyɛ̌ʼ", "mvfò màga lyɛ̌ʼ", "màga lyɛ̌ʼ"},
  57. daysShort: []string{"lyɛʼɛ́ sẅíŋtè", "mvfò lyɛ̌ʼ", "mbɔ́ɔntè mvfò lyɛ̌ʼ", "tsètsɛ̀ɛ lyɛ̌ʼ", "mbɔ́ɔntè tsetsɛ̀ɛ lyɛ̌ʼ", "mvfò màga lyɛ̌ʼ", "màga lyɛ̌ʼ"},
  58. daysWide: []string{"lyɛʼɛ́ sẅíŋtè", "mvfò lyɛ̌ʼ", "mbɔ́ɔntè mvfò lyɛ̌ʼ", "tsètsɛ̀ɛ lyɛ̌ʼ", "mbɔ́ɔntè tsetsɛ̀ɛ lyɛ̌ʼ", "mvfò màga lyɛ̌ʼ", "màga lyɛ̌ʼ"},
  59. periodsAbbreviated: []string{"mbaʼámbaʼ", "ncwònzém"},
  60. periodsWide: []string{"mbaʼámbaʼ", "ncwònzém"},
  61. erasAbbreviated: []string{"m.z.Y.", "m.g.n.Y."},
  62. erasNarrow: []string{"", ""},
  63. erasWide: []string{"mé zyé Yěsô", "mé gÿo ńzyé Yěsô"},
  64. timezones: map[string]string{"CHADT": "CHADT", "AEDT": "AEDT", "WAT": "WAT", "TMT": "TMT", "∅∅∅": "∅∅∅", "WARST": "WARST", "HNNOMX": "HNNOMX", "CLT": "CLT", "HAST": "HAST", "CHAST": "CHAST", "MESZ": "MESZ", "LHST": "LHST", "ART": "ART", "PST": "PST", "MEZ": "MEZ", "TMST": "TMST", "HNCU": "HNCU", "CST": "CST", "AWST": "AWST", "AEST": "AEST", "ECT": "ECT", "HADT": "HADT", "ADT": "ADT", "WESZ": "WESZ", "NZST": "NZST", "HEEG": "HEEG", "ACWDT": "ACWDT", "HENOMX": "HENOMX", "ARST": "ARST", "JST": "JST", "EDT": "EDT", "HNEG": "HNEG", "HNOG": "HNOG", "HNT": "HNT", "VET": "VET", "HNPM": "HNPM", "WITA": "WITA", "SRT": "SRT", "AKDT": "AKDT", "MYT": "MYT", "UYST": "UYST", "WIT": "WIT", "CDT": "CDT", "BOT": "BOT", "MDT": "MDT", "OESZ": "OESZ", "ChST": "ChST", "HNPMX": "HNPMX", "JDT": "JDT", "BT": "BT", "CAT": "CAT", "LHDT": "LHDT", "WART": "WART", "CLST": "CLST", "COST": "COST", "GYT": "GYT", "HECU": "HECU", "SGT": "SGT", "IST": "IST", "EAT": "EAT", "AWDT": "AWDT", "AST": "AST", "WEZ": "WEZ", "ACDT": "ACDT", "OEZ": "OEZ", "GMT": "GMT", "AKST": "AKST", "COT": "COT", "NZDT": "NZDT", "HKT": "HKT", "ACWST": "ACWST", "HKST": "HKST", "HEPM": "HEPM", "PDT": "PDT", "HEPMX": "HEPMX", "ACST": "ACST", "HEOG": "HEOG", "HAT": "HAT", "UYT": "UYT", "SAST": "SAST", "GFT": "GFT", "EST": "EST", "WAST": "WAST", "WIB": "WIB", "MST": "MST"},
  65. }
  66. }
  67. // Locale returns the current translators string locale
  68. func (nnh *nnh) Locale() string {
  69. return nnh.locale
  70. }
  71. // PluralsCardinal returns the list of cardinal plural rules associated with 'nnh'
  72. func (nnh *nnh) PluralsCardinal() []locales.PluralRule {
  73. return nnh.pluralsCardinal
  74. }
  75. // PluralsOrdinal returns the list of ordinal plural rules associated with 'nnh'
  76. func (nnh *nnh) PluralsOrdinal() []locales.PluralRule {
  77. return nnh.pluralsOrdinal
  78. }
  79. // PluralsRange returns the list of range plural rules associated with 'nnh'
  80. func (nnh *nnh) PluralsRange() []locales.PluralRule {
  81. return nnh.pluralsRange
  82. }
  83. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'nnh'
  84. func (nnh *nnh) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
  85. n := math.Abs(num)
  86. if n == 1 {
  87. return locales.PluralRuleOne
  88. }
  89. return locales.PluralRuleOther
  90. }
  91. // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'nnh'
  92. func (nnh *nnh) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
  93. return locales.PluralRuleUnknown
  94. }
  95. // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'nnh'
  96. func (nnh *nnh) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
  97. return locales.PluralRuleUnknown
  98. }
  99. // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
  100. func (nnh *nnh) MonthAbbreviated(month time.Month) string {
  101. return nnh.monthsAbbreviated[month]
  102. }
  103. // MonthsAbbreviated returns the locales abbreviated months
  104. func (nnh *nnh) MonthsAbbreviated() []string {
  105. return nnh.monthsAbbreviated[1:]
  106. }
  107. // MonthNarrow returns the locales narrow month given the 'month' provided
  108. func (nnh *nnh) MonthNarrow(month time.Month) string {
  109. return nnh.monthsNarrow[month]
  110. }
  111. // MonthsNarrow returns the locales narrow months
  112. func (nnh *nnh) MonthsNarrow() []string {
  113. return nil
  114. }
  115. // MonthWide returns the locales wide month given the 'month' provided
  116. func (nnh *nnh) MonthWide(month time.Month) string {
  117. return nnh.monthsWide[month]
  118. }
  119. // MonthsWide returns the locales wide months
  120. func (nnh *nnh) MonthsWide() []string {
  121. return nnh.monthsWide[1:]
  122. }
  123. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  124. func (nnh *nnh) WeekdayAbbreviated(weekday time.Weekday) string {
  125. return nnh.daysAbbreviated[weekday]
  126. }
  127. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  128. func (nnh *nnh) WeekdaysAbbreviated() []string {
  129. return nnh.daysAbbreviated
  130. }
  131. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  132. func (nnh *nnh) WeekdayNarrow(weekday time.Weekday) string {
  133. return nnh.daysNarrow[weekday]
  134. }
  135. // WeekdaysNarrow returns the locales narrow weekdays
  136. func (nnh *nnh) WeekdaysNarrow() []string {
  137. return nnh.daysNarrow
  138. }
  139. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  140. func (nnh *nnh) WeekdayShort(weekday time.Weekday) string {
  141. return nnh.daysShort[weekday]
  142. }
  143. // WeekdaysShort returns the locales short weekdays
  144. func (nnh *nnh) WeekdaysShort() []string {
  145. return nnh.daysShort
  146. }
  147. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  148. func (nnh *nnh) WeekdayWide(weekday time.Weekday) string {
  149. return nnh.daysWide[weekday]
  150. }
  151. // WeekdaysWide returns the locales wide weekdays
  152. func (nnh *nnh) WeekdaysWide() []string {
  153. return nnh.daysWide
  154. }
  155. // Decimal returns the decimal point of number
  156. func (nnh *nnh) Decimal() string {
  157. return nnh.decimal
  158. }
  159. // Group returns the group of number
  160. func (nnh *nnh) Group() string {
  161. return nnh.group
  162. }
  163. // Group returns the minus sign of number
  164. func (nnh *nnh) Minus() string {
  165. return nnh.minus
  166. }
  167. // FmtNumber returns 'num' with digits/precision of 'v' for 'nnh' and handles both Whole and Real numbers based on 'v'
  168. func (nnh *nnh) FmtNumber(num float64, v uint64) string {
  169. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  170. l := len(s) + 1 + 1*len(s[:len(s)-int(v)-1])/3
  171. count := 0
  172. inWhole := v == 0
  173. b := make([]byte, 0, l)
  174. for i := len(s) - 1; i >= 0; i-- {
  175. if s[i] == '.' {
  176. b = append(b, nnh.decimal[0])
  177. inWhole = true
  178. continue
  179. }
  180. if inWhole {
  181. if count == 3 {
  182. b = append(b, nnh.group[0])
  183. count = 1
  184. } else {
  185. count++
  186. }
  187. }
  188. b = append(b, s[i])
  189. }
  190. if num < 0 {
  191. b = append(b, nnh.minus[0])
  192. }
  193. // reverse
  194. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  195. b[i], b[j] = b[j], b[i]
  196. }
  197. return string(b)
  198. }
  199. // FmtPercent returns 'num' with digits/precision of 'v' for 'nnh' and handles both Whole and Real numbers based on 'v'
  200. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
  201. func (nnh *nnh) FmtPercent(num float64, v uint64) string {
  202. return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  203. }
  204. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'nnh'
  205. func (nnh *nnh) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  206. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  207. symbol := nnh.currencies[currency]
  208. l := len(s) + len(symbol) + 3 + 1*len(s[:len(s)-int(v)-1])/3
  209. count := 0
  210. inWhole := v == 0
  211. b := make([]byte, 0, l)
  212. for i := len(s) - 1; i >= 0; i-- {
  213. if s[i] == '.' {
  214. b = append(b, nnh.decimal[0])
  215. inWhole = true
  216. continue
  217. }
  218. if inWhole {
  219. if count == 3 {
  220. b = append(b, nnh.group[0])
  221. count = 1
  222. } else {
  223. count++
  224. }
  225. }
  226. b = append(b, s[i])
  227. }
  228. for j := len(symbol) - 1; j >= 0; j-- {
  229. b = append(b, symbol[j])
  230. }
  231. for j := len(nnh.currencyPositivePrefix) - 1; j >= 0; j-- {
  232. b = append(b, nnh.currencyPositivePrefix[j])
  233. }
  234. if num < 0 {
  235. b = append(b, nnh.minus[0])
  236. }
  237. // reverse
  238. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  239. b[i], b[j] = b[j], b[i]
  240. }
  241. if int(v) < 2 {
  242. if v == 0 {
  243. b = append(b, nnh.decimal...)
  244. }
  245. for i := 0; i < 2-int(v); i++ {
  246. b = append(b, '0')
  247. }
  248. }
  249. return string(b)
  250. }
  251. // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'nnh'
  252. // in accounting notation.
  253. func (nnh *nnh) FmtAccounting(num float64, v uint64, currency currency.Type) string {
  254. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  255. symbol := nnh.currencies[currency]
  256. l := len(s) + len(symbol) + 3 + 1*len(s[:len(s)-int(v)-1])/3
  257. count := 0
  258. inWhole := v == 0
  259. b := make([]byte, 0, l)
  260. for i := len(s) - 1; i >= 0; i-- {
  261. if s[i] == '.' {
  262. b = append(b, nnh.decimal[0])
  263. inWhole = true
  264. continue
  265. }
  266. if inWhole {
  267. if count == 3 {
  268. b = append(b, nnh.group[0])
  269. count = 1
  270. } else {
  271. count++
  272. }
  273. }
  274. b = append(b, s[i])
  275. }
  276. if num < 0 {
  277. for j := len(symbol) - 1; j >= 0; j-- {
  278. b = append(b, symbol[j])
  279. }
  280. for j := len(nnh.currencyNegativePrefix) - 1; j >= 0; j-- {
  281. b = append(b, nnh.currencyNegativePrefix[j])
  282. }
  283. b = append(b, nnh.minus[0])
  284. } else {
  285. for j := len(symbol) - 1; j >= 0; j-- {
  286. b = append(b, symbol[j])
  287. }
  288. for j := len(nnh.currencyPositivePrefix) - 1; j >= 0; j-- {
  289. b = append(b, nnh.currencyPositivePrefix[j])
  290. }
  291. }
  292. // reverse
  293. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  294. b[i], b[j] = b[j], b[i]
  295. }
  296. if int(v) < 2 {
  297. if v == 0 {
  298. b = append(b, nnh.decimal...)
  299. }
  300. for i := 0; i < 2-int(v); i++ {
  301. b = append(b, '0')
  302. }
  303. }
  304. return string(b)
  305. }
  306. // FmtDateShort returns the short date representation of 't' for 'nnh'
  307. func (nnh *nnh) FmtDateShort(t time.Time) string {
  308. b := make([]byte, 0, 32)
  309. if t.Day() < 10 {
  310. b = append(b, '0')
  311. }
  312. b = strconv.AppendInt(b, int64(t.Day()), 10)
  313. b = append(b, []byte{0x2f}...)
  314. if t.Month() < 10 {
  315. b = append(b, '0')
  316. }
  317. b = strconv.AppendInt(b, int64(t.Month()), 10)
  318. b = append(b, []byte{0x2f}...)
  319. if t.Year() > 9 {
  320. b = append(b, strconv.Itoa(t.Year())[2:]...)
  321. } else {
  322. b = append(b, strconv.Itoa(t.Year())[1:]...)
  323. }
  324. return string(b)
  325. }
  326. // FmtDateMedium returns the medium date representation of 't' for 'nnh'
  327. func (nnh *nnh) FmtDateMedium(t time.Time) string {
  328. b := make([]byte, 0, 32)
  329. b = strconv.AppendInt(b, int64(t.Day()), 10)
  330. b = append(b, []byte{0x20}...)
  331. b = append(b, nnh.monthsAbbreviated[t.Month()]...)
  332. b = append(b, []byte{0x2c, 0x20}...)
  333. if t.Year() > 0 {
  334. b = strconv.AppendInt(b, int64(t.Year()), 10)
  335. } else {
  336. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  337. }
  338. return string(b)
  339. }
  340. // FmtDateLong returns the long date representation of 't' for 'nnh'
  341. func (nnh *nnh) FmtDateLong(t time.Time) string {
  342. b := make([]byte, 0, 32)
  343. b = append(b, []byte{0x6c, 0x79, 0xc9, 0x9b}...)
  344. b = append(b, []byte{0xcc, 0x8c, 0xca, 0xbc, 0x20}...)
  345. b = strconv.AppendInt(b, int64(t.Day()), 10)
  346. b = append(b, []byte{0x20, 0x6e, 0x61}...)
  347. b = append(b, []byte{0x20}...)
  348. b = append(b, nnh.monthsWide[t.Month()]...)
  349. b = append(b, []byte{0x2c, 0x20}...)
  350. if t.Year() > 0 {
  351. b = strconv.AppendInt(b, int64(t.Year()), 10)
  352. } else {
  353. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  354. }
  355. return string(b)
  356. }
  357. // FmtDateFull returns the full date representation of 't' for 'nnh'
  358. func (nnh *nnh) FmtDateFull(t time.Time) string {
  359. b := make([]byte, 0, 32)
  360. b = append(b, nnh.daysWide[t.Weekday()]...)
  361. b = append(b, []byte{0x20, 0x2c, 0x20, 0x6c, 0x79, 0xc9, 0x9b}...)
  362. b = append(b, []byte{0xcc, 0x8c, 0xca, 0xbc, 0x20}...)
  363. b = strconv.AppendInt(b, int64(t.Day()), 10)
  364. b = append(b, []byte{0x20, 0x6e, 0x61}...)
  365. b = append(b, []byte{0x20}...)
  366. b = append(b, nnh.monthsWide[t.Month()]...)
  367. b = append(b, []byte{0x2c, 0x20}...)
  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. return string(b)
  374. }
  375. // FmtTimeShort returns the short time representation of 't' for 'nnh'
  376. func (nnh *nnh) FmtTimeShort(t time.Time) string {
  377. b := make([]byte, 0, 32)
  378. return string(b)
  379. }
  380. // FmtTimeMedium returns the medium time representation of 't' for 'nnh'
  381. func (nnh *nnh) FmtTimeMedium(t time.Time) string {
  382. b := make([]byte, 0, 32)
  383. return string(b)
  384. }
  385. // FmtTimeLong returns the long time representation of 't' for 'nnh'
  386. func (nnh *nnh) FmtTimeLong(t time.Time) string {
  387. b := make([]byte, 0, 32)
  388. return string(b)
  389. }
  390. // FmtTimeFull returns the full time representation of 't' for 'nnh'
  391. func (nnh *nnh) FmtTimeFull(t time.Time) string {
  392. b := make([]byte, 0, 32)
  393. return string(b)
  394. }