OSDN Git Service

delete miner
[bytom/vapor.git] / vendor / github.com / go-playground / locales / nb / nb.go
1 package nb
2
3 import (
4         "math"
5         "strconv"
6         "time"
7
8         "github.com/go-playground/locales"
9         "github.com/go-playground/locales/currency"
10 )
11
12 type nb struct {
13         locale                 string
14         pluralsCardinal        []locales.PluralRule
15         pluralsOrdinal         []locales.PluralRule
16         pluralsRange           []locales.PluralRule
17         decimal                string
18         group                  string
19         minus                  string
20         percent                string
21         percentSuffix          string
22         perMille               string
23         timeSeparator          string
24         inifinity              string
25         currencies             []string // idx = enum of currency code
26         currencyPositivePrefix string
27         currencyNegativePrefix string
28         monthsAbbreviated      []string
29         monthsNarrow           []string
30         monthsWide             []string
31         daysAbbreviated        []string
32         daysNarrow             []string
33         daysShort              []string
34         daysWide               []string
35         periodsAbbreviated     []string
36         periodsNarrow          []string
37         periodsShort           []string
38         periodsWide            []string
39         erasAbbreviated        []string
40         erasNarrow             []string
41         erasWide               []string
42         timezones              map[string]string
43 }
44
45 // New returns a new instance of translator for the 'nb' locale
46 func New() locales.Translator {
47         return &nb{
48                 locale:                 "nb",
49                 pluralsCardinal:        []locales.PluralRule{2, 6},
50                 pluralsOrdinal:         []locales.PluralRule{6},
51                 pluralsRange:           []locales.PluralRule{6},
52                 decimal:                ",",
53                 group:                  " ",
54                 minus:                  "−",
55                 percent:                "%",
56                 perMille:               "‰",
57                 timeSeparator:          ":",
58                 inifinity:              "∞",
59                 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", "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", "€", "FIM", "FJD", "FKP", "FRF", "£", "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", "kr", "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", "CFA", "XPD", "XPF", "XPT", "XRE", "XSU", "XTS", "XUA", "XXX", "YDD", "YER", "YUD", "YUM", "YUN", "YUR", "ZAL", "ZAR", "ZMK", "ZMW", "ZRN", "ZRZ", "ZWD", "ZWL", "ZWR"},
60                 percentSuffix:          " ",
61                 currencyPositivePrefix: " ",
62                 currencyNegativePrefix: " ",
63                 monthsAbbreviated:      []string{"", "jan.", "feb.", "mar.", "apr.", "mai", "jun.", "jul.", "aug.", "sep.", "okt.", "nov.", "des."},
64                 monthsNarrow:           []string{"", "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"},
65                 monthsWide:             []string{"", "januar", "februar", "mars", "april", "mai", "juni", "juli", "august", "september", "oktober", "november", "desember"},
66                 daysAbbreviated:        []string{"søn.", "man.", "tir.", "ons.", "tor.", "fre.", "lør."},
67                 daysNarrow:             []string{"S", "M", "T", "O", "T", "F", "L"},
68                 daysShort:              []string{"sø.", "ma.", "ti.", "on.", "to.", "fr.", "lø."},
69                 daysWide:               []string{"søndag", "mandag", "tirsdag", "onsdag", "torsdag", "fredag", "lørdag"},
70                 periodsAbbreviated:     []string{"a.m.", "p.m."},
71                 periodsNarrow:          []string{"a", "p"},
72                 periodsWide:            []string{"a.m.", "p.m."},
73                 erasAbbreviated:        []string{"f.Kr.", "e.Kr."},
74                 erasNarrow:             []string{"f.Kr.", "e.Kr."},
75                 erasWide:               []string{"før Kristus", "etter Kristus"},
76                 timezones:              map[string]string{"HAT": "sommertid for Newfoundland", "AKDT": "alaskisk sommertid", "UYST": "uruguayansk sommertid", "LHST": "normaltid for Lord Howe-øya", "COST": "colombiansk sommertid", "GFT": "tidssone for Fransk Guyana", "∅∅∅": "sommertid for Amazonas", "MST": "Macau, standardtid", "SAST": "sørafrikansk tid", "SRT": "surinamsk tid", "WITA": "sentralindonesisk tid", "NZDT": "newzealandsk sommertid", "HNNOMX": "normaltid for nordvestlige Mexico", "LHDT": "sommertid for Lord Howe-øya", "ARST": "argentinsk sommertid", "WESZ": "vesteuropeisk sommertid", "HECU": "cubansk sommertid", "ACWST": "vest-sentralaustralsk normaltid", "COT": "colombiansk normaltid", "GMT": "Greenwich middeltid", "MDT": "Macau, sommertid", "ACWDT": "vest-sentralaustralsk sommertid", "MESZ": "sentraleuropeisk sommertid", "TMST": "turkmensk sommertid", "OEZ": "østeuropeisk normaltid", "HNOG": "vestgrønlandsk normaltid", "HKT": "normaltid for Hongkong", "ACDT": "sentralaustralsk sommertid", "ECT": "ecuadoriansk tid", "WEZ": "vesteuropeisk normaltid", "AWDT": "vestaustralsk sommertid", "NZST": "newzealandsk normaltid", "EAT": "østafrikansk tid", "HEPMX": "sommertid for den meksikanske Stillehavskysten", "PDT": "sommertid for den nordamerikanske Stillehavskysten", "TMT": "turkmensk normaltid", "HEPM": "sommertid for Saint-Pierre-et-Miquelon", "BOT": "boliviansk tid", "WIT": "østindonesisk tid", "HADT": "sommertid for Hawaii og Aleutene", "ART": "argentinsk normaltid", "WAT": "vestafrikansk normaltid", "SGT": "singaporsk tid", "HNPM": "normaltid for Saint-Pierre-et-Miquelon", "OESZ": "østeuropeisk sommertid", "AWST": "vestaustralsk normaltid", "JST": "japansk normaltid", "ADT": "atlanterhavskystlig sommertid", "WAST": "vestafrikansk sommertid", "EST": "normaltid for den nordamerikanske østkysten", "CST": "normaltid for det sentrale Nord-Amerika", "AKST": "alaskisk normaltid", "BT": "bhutansk tid", "MEZ": "sentraleuropeisk normaltid", "UYT": "uruguayansk normaltid", "JDT": "japansk sommertid", "IST": "indisk tid", "HNEG": "østgrønlandsk normaltid", "HNT": "normaltid for Newfoundland", "HNPMX": "normaltid for den meksikanske Stillehavskysten", "CDT": "sommertid for det sentrale Nord-Amerika", "CHAST": "normaltid for Chatham", "CHADT": "sommertid for Chatham", "HAST": "normaltid for Hawaii og Aleutene", "HKST": "sommertid for Hongkong", "CLST": "chilensk sommertid", "GYT": "guyansk tid", "ACST": "sentralaustralsk normaltid", "MYT": "malaysisk tid", "HENOMX": "sommertid for nordvestlige Mexico", "WART": "vestargentinsk normaltid", "WARST": "vestargentinsk sommertid", "CLT": "chilensk normaltid", "EDT": "sommertid for den nordamerikanske østkysten", "CAT": "sentralafrikansk tid", "PST": "normaltid for den nordamerikanske Stillehavskysten", "VET": "venezuelansk tid", "AST": "atlanterhavskystlig standardtid", "AEST": "østaustralsk normaltid", "ChST": "tidssone for Chamorro", "WIB": "vestindonesisk tid", "AEDT": "østaustralsk sommertid", "HEOG": "vestgrønlandsk sommertid", "HEEG": "østgrønlandsk sommertid", "HNCU": "cubansk normaltid"},
77         }
78 }
79
80 // Locale returns the current translators string locale
81 func (nb *nb) Locale() string {
82         return nb.locale
83 }
84
85 // PluralsCardinal returns the list of cardinal plural rules associated with 'nb'
86 func (nb *nb) PluralsCardinal() []locales.PluralRule {
87         return nb.pluralsCardinal
88 }
89
90 // PluralsOrdinal returns the list of ordinal plural rules associated with 'nb'
91 func (nb *nb) PluralsOrdinal() []locales.PluralRule {
92         return nb.pluralsOrdinal
93 }
94
95 // PluralsRange returns the list of range plural rules associated with 'nb'
96 func (nb *nb) PluralsRange() []locales.PluralRule {
97         return nb.pluralsRange
98 }
99
100 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'nb'
101 func (nb *nb) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
102
103         n := math.Abs(num)
104
105         if n == 1 {
106                 return locales.PluralRuleOne
107         }
108
109         return locales.PluralRuleOther
110 }
111
112 // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'nb'
113 func (nb *nb) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
114         return locales.PluralRuleOther
115 }
116
117 // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'nb'
118 func (nb *nb) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
119         return locales.PluralRuleOther
120 }
121
122 // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
123 func (nb *nb) MonthAbbreviated(month time.Month) string {
124         return nb.monthsAbbreviated[month]
125 }
126
127 // MonthsAbbreviated returns the locales abbreviated months
128 func (nb *nb) MonthsAbbreviated() []string {
129         return nb.monthsAbbreviated[1:]
130 }
131
132 // MonthNarrow returns the locales narrow month given the 'month' provided
133 func (nb *nb) MonthNarrow(month time.Month) string {
134         return nb.monthsNarrow[month]
135 }
136
137 // MonthsNarrow returns the locales narrow months
138 func (nb *nb) MonthsNarrow() []string {
139         return nb.monthsNarrow[1:]
140 }
141
142 // MonthWide returns the locales wide month given the 'month' provided
143 func (nb *nb) MonthWide(month time.Month) string {
144         return nb.monthsWide[month]
145 }
146
147 // MonthsWide returns the locales wide months
148 func (nb *nb) MonthsWide() []string {
149         return nb.monthsWide[1:]
150 }
151
152 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
153 func (nb *nb) WeekdayAbbreviated(weekday time.Weekday) string {
154         return nb.daysAbbreviated[weekday]
155 }
156
157 // WeekdaysAbbreviated returns the locales abbreviated weekdays
158 func (nb *nb) WeekdaysAbbreviated() []string {
159         return nb.daysAbbreviated
160 }
161
162 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
163 func (nb *nb) WeekdayNarrow(weekday time.Weekday) string {
164         return nb.daysNarrow[weekday]
165 }
166
167 // WeekdaysNarrow returns the locales narrow weekdays
168 func (nb *nb) WeekdaysNarrow() []string {
169         return nb.daysNarrow
170 }
171
172 // WeekdayShort returns the locales short weekday given the 'weekday' provided
173 func (nb *nb) WeekdayShort(weekday time.Weekday) string {
174         return nb.daysShort[weekday]
175 }
176
177 // WeekdaysShort returns the locales short weekdays
178 func (nb *nb) WeekdaysShort() []string {
179         return nb.daysShort
180 }
181
182 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
183 func (nb *nb) WeekdayWide(weekday time.Weekday) string {
184         return nb.daysWide[weekday]
185 }
186
187 // WeekdaysWide returns the locales wide weekdays
188 func (nb *nb) WeekdaysWide() []string {
189         return nb.daysWide
190 }
191
192 // Decimal returns the decimal point of number
193 func (nb *nb) Decimal() string {
194         return nb.decimal
195 }
196
197 // Group returns the group of number
198 func (nb *nb) Group() string {
199         return nb.group
200 }
201
202 // Group returns the minus sign of number
203 func (nb *nb) Minus() string {
204         return nb.minus
205 }
206
207 // FmtNumber returns 'num' with digits/precision of 'v' for 'nb' and handles both Whole and Real numbers based on 'v'
208 func (nb *nb) FmtNumber(num float64, v uint64) string {
209
210         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
211         l := len(s) + 4 + 2*len(s[:len(s)-int(v)-1])/3
212         count := 0
213         inWhole := v == 0
214         b := make([]byte, 0, l)
215
216         for i := len(s) - 1; i >= 0; i-- {
217
218                 if s[i] == '.' {
219                         b = append(b, nb.decimal[0])
220                         inWhole = true
221                         continue
222                 }
223
224                 if inWhole {
225                         if count == 3 {
226                                 for j := len(nb.group) - 1; j >= 0; j-- {
227                                         b = append(b, nb.group[j])
228                                 }
229                                 count = 1
230                         } else {
231                                 count++
232                         }
233                 }
234
235                 b = append(b, s[i])
236         }
237
238         if num < 0 {
239                 for j := len(nb.minus) - 1; j >= 0; j-- {
240                         b = append(b, nb.minus[j])
241                 }
242         }
243
244         // reverse
245         for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
246                 b[i], b[j] = b[j], b[i]
247         }
248
249         return string(b)
250 }
251
252 // FmtPercent returns 'num' with digits/precision of 'v' for 'nb' and handles both Whole and Real numbers based on 'v'
253 // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
254 func (nb *nb) FmtPercent(num float64, v uint64) string {
255         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
256         l := len(s) + 7
257         b := make([]byte, 0, l)
258
259         for i := len(s) - 1; i >= 0; i-- {
260
261                 if s[i] == '.' {
262                         b = append(b, nb.decimal[0])
263                         continue
264                 }
265
266                 b = append(b, s[i])
267         }
268
269         if num < 0 {
270                 for j := len(nb.minus) - 1; j >= 0; j-- {
271                         b = append(b, nb.minus[j])
272                 }
273         }
274
275         // reverse
276         for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
277                 b[i], b[j] = b[j], b[i]
278         }
279
280         b = append(b, nb.percentSuffix...)
281
282         b = append(b, nb.percent...)
283
284         return string(b)
285 }
286
287 // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'nb'
288 func (nb *nb) FmtCurrency(num float64, v uint64, currency currency.Type) string {
289
290         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
291         symbol := nb.currencies[currency]
292         l := len(s) + len(symbol) + 6 + 2*len(s[:len(s)-int(v)-1])/3
293         count := 0
294         inWhole := v == 0
295         b := make([]byte, 0, l)
296
297         for i := len(s) - 1; i >= 0; i-- {
298
299                 if s[i] == '.' {
300                         b = append(b, nb.decimal[0])
301                         inWhole = true
302                         continue
303                 }
304
305                 if inWhole {
306                         if count == 3 {
307                                 for j := len(nb.group) - 1; j >= 0; j-- {
308                                         b = append(b, nb.group[j])
309                                 }
310                                 count = 1
311                         } else {
312                                 count++
313                         }
314                 }
315
316                 b = append(b, s[i])
317         }
318
319         for j := len(symbol) - 1; j >= 0; j-- {
320                 b = append(b, symbol[j])
321         }
322
323         for j := len(nb.currencyPositivePrefix) - 1; j >= 0; j-- {
324                 b = append(b, nb.currencyPositivePrefix[j])
325         }
326
327         if num < 0 {
328                 for j := len(nb.minus) - 1; j >= 0; j-- {
329                         b = append(b, nb.minus[j])
330                 }
331         }
332
333         // reverse
334         for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
335                 b[i], b[j] = b[j], b[i]
336         }
337
338         if int(v) < 2 {
339
340                 if v == 0 {
341                         b = append(b, nb.decimal...)
342                 }
343
344                 for i := 0; i < 2-int(v); i++ {
345                         b = append(b, '0')
346                 }
347         }
348
349         return string(b)
350 }
351
352 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'nb'
353 // in accounting notation.
354 func (nb *nb) FmtAccounting(num float64, v uint64, currency currency.Type) string {
355
356         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
357         symbol := nb.currencies[currency]
358         l := len(s) + len(symbol) + 6 + 2*len(s[:len(s)-int(v)-1])/3
359         count := 0
360         inWhole := v == 0
361         b := make([]byte, 0, l)
362
363         for i := len(s) - 1; i >= 0; i-- {
364
365                 if s[i] == '.' {
366                         b = append(b, nb.decimal[0])
367                         inWhole = true
368                         continue
369                 }
370
371                 if inWhole {
372                         if count == 3 {
373                                 for j := len(nb.group) - 1; j >= 0; j-- {
374                                         b = append(b, nb.group[j])
375                                 }
376                                 count = 1
377                         } else {
378                                 count++
379                         }
380                 }
381
382                 b = append(b, s[i])
383         }
384
385         if num < 0 {
386
387                 for j := len(symbol) - 1; j >= 0; j-- {
388                         b = append(b, symbol[j])
389                 }
390
391                 for j := len(nb.currencyNegativePrefix) - 1; j >= 0; j-- {
392                         b = append(b, nb.currencyNegativePrefix[j])
393                 }
394
395                 for j := len(nb.minus) - 1; j >= 0; j-- {
396                         b = append(b, nb.minus[j])
397                 }
398
399         } else {
400
401                 for j := len(symbol) - 1; j >= 0; j-- {
402                         b = append(b, symbol[j])
403                 }
404
405                 for j := len(nb.currencyPositivePrefix) - 1; j >= 0; j-- {
406                         b = append(b, nb.currencyPositivePrefix[j])
407                 }
408
409         }
410
411         // reverse
412         for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
413                 b[i], b[j] = b[j], b[i]
414         }
415
416         if int(v) < 2 {
417
418                 if v == 0 {
419                         b = append(b, nb.decimal...)
420                 }
421
422                 for i := 0; i < 2-int(v); i++ {
423                         b = append(b, '0')
424                 }
425         }
426
427         return string(b)
428 }
429
430 // FmtDateShort returns the short date representation of 't' for 'nb'
431 func (nb *nb) FmtDateShort(t time.Time) string {
432
433         b := make([]byte, 0, 32)
434
435         if t.Day() < 10 {
436                 b = append(b, '0')
437         }
438
439         b = strconv.AppendInt(b, int64(t.Day()), 10)
440         b = append(b, []byte{0x2e}...)
441
442         if t.Month() < 10 {
443                 b = append(b, '0')
444         }
445
446         b = strconv.AppendInt(b, int64(t.Month()), 10)
447
448         b = append(b, []byte{0x2e}...)
449
450         if t.Year() > 0 {
451                 b = strconv.AppendInt(b, int64(t.Year()), 10)
452         } else {
453                 b = strconv.AppendInt(b, int64(-t.Year()), 10)
454         }
455
456         return string(b)
457 }
458
459 // FmtDateMedium returns the medium date representation of 't' for 'nb'
460 func (nb *nb) FmtDateMedium(t time.Time) string {
461
462         b := make([]byte, 0, 32)
463
464         b = strconv.AppendInt(b, int64(t.Day()), 10)
465         b = append(b, []byte{0x2e, 0x20}...)
466         b = append(b, nb.monthsAbbreviated[t.Month()]...)
467         b = append(b, []byte{0x20}...)
468
469         if t.Year() > 0 {
470                 b = strconv.AppendInt(b, int64(t.Year()), 10)
471         } else {
472                 b = strconv.AppendInt(b, int64(-t.Year()), 10)
473         }
474
475         return string(b)
476 }
477
478 // FmtDateLong returns the long date representation of 't' for 'nb'
479 func (nb *nb) FmtDateLong(t time.Time) string {
480
481         b := make([]byte, 0, 32)
482
483         b = strconv.AppendInt(b, int64(t.Day()), 10)
484         b = append(b, []byte{0x2e, 0x20}...)
485         b = append(b, nb.monthsWide[t.Month()]...)
486         b = append(b, []byte{0x20}...)
487
488         if t.Year() > 0 {
489                 b = strconv.AppendInt(b, int64(t.Year()), 10)
490         } else {
491                 b = strconv.AppendInt(b, int64(-t.Year()), 10)
492         }
493
494         return string(b)
495 }
496
497 // FmtDateFull returns the full date representation of 't' for 'nb'
498 func (nb *nb) FmtDateFull(t time.Time) string {
499
500         b := make([]byte, 0, 32)
501
502         b = append(b, nb.daysWide[t.Weekday()]...)
503         b = append(b, []byte{0x20}...)
504         b = strconv.AppendInt(b, int64(t.Day()), 10)
505         b = append(b, []byte{0x2e, 0x20}...)
506         b = append(b, nb.monthsWide[t.Month()]...)
507         b = append(b, []byte{0x20}...)
508
509         if t.Year() > 0 {
510                 b = strconv.AppendInt(b, int64(t.Year()), 10)
511         } else {
512                 b = strconv.AppendInt(b, int64(-t.Year()), 10)
513         }
514
515         return string(b)
516 }
517
518 // FmtTimeShort returns the short time representation of 't' for 'nb'
519 func (nb *nb) FmtTimeShort(t time.Time) string {
520
521         b := make([]byte, 0, 32)
522
523         if t.Hour() < 10 {
524                 b = append(b, '0')
525         }
526
527         b = strconv.AppendInt(b, int64(t.Hour()), 10)
528         b = append(b, nb.timeSeparator...)
529
530         if t.Minute() < 10 {
531                 b = append(b, '0')
532         }
533
534         b = strconv.AppendInt(b, int64(t.Minute()), 10)
535
536         return string(b)
537 }
538
539 // FmtTimeMedium returns the medium time representation of 't' for 'nb'
540 func (nb *nb) FmtTimeMedium(t time.Time) string {
541
542         b := make([]byte, 0, 32)
543
544         if t.Hour() < 10 {
545                 b = append(b, '0')
546         }
547
548         b = strconv.AppendInt(b, int64(t.Hour()), 10)
549         b = append(b, nb.timeSeparator...)
550
551         if t.Minute() < 10 {
552                 b = append(b, '0')
553         }
554
555         b = strconv.AppendInt(b, int64(t.Minute()), 10)
556         b = append(b, nb.timeSeparator...)
557
558         if t.Second() < 10 {
559                 b = append(b, '0')
560         }
561
562         b = strconv.AppendInt(b, int64(t.Second()), 10)
563
564         return string(b)
565 }
566
567 // FmtTimeLong returns the long time representation of 't' for 'nb'
568 func (nb *nb) FmtTimeLong(t time.Time) string {
569
570         b := make([]byte, 0, 32)
571
572         if t.Hour() < 10 {
573                 b = append(b, '0')
574         }
575
576         b = strconv.AppendInt(b, int64(t.Hour()), 10)
577         b = append(b, nb.timeSeparator...)
578
579         if t.Minute() < 10 {
580                 b = append(b, '0')
581         }
582
583         b = strconv.AppendInt(b, int64(t.Minute()), 10)
584         b = append(b, nb.timeSeparator...)
585
586         if t.Second() < 10 {
587                 b = append(b, '0')
588         }
589
590         b = strconv.AppendInt(b, int64(t.Second()), 10)
591         b = append(b, []byte{0x20}...)
592
593         tz, _ := t.Zone()
594         b = append(b, tz...)
595
596         return string(b)
597 }
598
599 // FmtTimeFull returns the full time representation of 't' for 'nb'
600 func (nb *nb) FmtTimeFull(t time.Time) string {
601
602         b := make([]byte, 0, 32)
603
604         if t.Hour() < 10 {
605                 b = append(b, '0')
606         }
607
608         b = strconv.AppendInt(b, int64(t.Hour()), 10)
609         b = append(b, nb.timeSeparator...)
610
611         if t.Minute() < 10 {
612                 b = append(b, '0')
613         }
614
615         b = strconv.AppendInt(b, int64(t.Minute()), 10)
616         b = append(b, nb.timeSeparator...)
617
618         if t.Second() < 10 {
619                 b = append(b, '0')
620         }
621
622         b = strconv.AppendInt(b, int64(t.Second()), 10)
623         b = append(b, []byte{0x20}...)
624
625         tz, _ := t.Zone()
626
627         if btz, ok := nb.timezones[tz]; ok {
628                 b = append(b, btz...)
629         } else {
630                 b = append(b, tz...)
631         }
632
633         return string(b)
634 }