OSDN Git Service

delete miner
[bytom/vapor.git] / vendor / github.com / go-playground / locales / bs / bs.go
1 package bs
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 bs 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         currencyPositiveSuffix string
27         currencyNegativeSuffix 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 'bs' locale
46 func New() locales.Translator {
47         return &bs{
48                 locale:                 "bs",
49                 pluralsCardinal:        []locales.PluralRule{2, 4, 6},
50                 pluralsOrdinal:         []locales.PluralRule{6},
51                 pluralsRange:           []locales.PluralRule{2, 4, 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", "KM", "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", "GBP", "GEK", "GEL", "GHC", "GHS", "GIP", "GMD", "GNF", "GNS", "GQE", "GRD", "GTQ", "GWE", "GWP", "GYD", "HKD", "HNL", "HRD", "kn", "HTG", "HUF", "IDR", "IEP", "ILP", "ILR", "ILS", "₹", "IQD", "IRR", "ISJ", "ISK", "ITL", "JMD", "JOD", "¥", "KES", "KGS", "KHR", "KMF", "KPW", "KRH", "KRO", "₩", "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", "din.", "RUB", "RUR", "RWF", "SAR", "SBD", "SCR", "SDD", "SDG", "SDP", "SEK", "SGD", "SHP", "SIT", "SKK", "SLL", "SOS", "SRD", "SRG", "SSP", "STD", "SUR", "SVC", "SYP", "SZL", "฿", "TJR", "TJS", "TMM", "TMT", "TND", "TOP", "TPE", "TRL", "TRY", "TTD", "NT$", "TZS", "UAH", "UAK", "UGS", "UGX", "USD", "USN", "USS", "UYI", "UYP", "UYU", "UZS", "VEB", "VEF", "₫", "VNN", "VUV", "WST", "FCFA", "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                 currencyPositiveSuffix: " ",
62                 currencyNegativeSuffix: " ",
63                 monthsAbbreviated:      []string{"", "jan", "feb", "mar", "apr", "maj", "jun", "jul", "avg", "sep", "okt", "nov", "dec"},
64                 monthsNarrow:           []string{"", "j", "f", "m", "a", "m", "j", "j", "a", "s", "o", "n", "d"},
65                 monthsWide:             []string{"", "januar", "februar", "mart", "april", "maj", "juni", "juli", "avgust", "septembar", "oktobar", "novembar", "decembar"},
66                 daysAbbreviated:        []string{"ned", "pon", "uto", "sri", "čet", "pet", "sub"},
67                 daysNarrow:             []string{"N", "P", "U", "S", "Č", "P", "S"},
68                 daysShort:              []string{"ned", "pon", "uto", "sri", "čet", "pet", "sub"},
69                 daysWide:               []string{"nedjelja", "ponedjeljak", "utorak", "srijeda", "četvrtak", "petak", "subota"},
70                 periodsAbbreviated:     []string{"prijepodne", "popodne"},
71                 periodsNarrow:          []string{"prijepodne", "popodne"},
72                 periodsWide:            []string{"prijepodne", "popodne"},
73                 erasAbbreviated:        []string{"p. n. e.", "n. e."},
74                 erasNarrow:             []string{"pr.n.e.", "AD"},
75                 erasWide:               []string{"prije nove ere", "nove ere"},
76                 timezones:              map[string]string{"ChST": "Čamorsko standardno vrijeme", "HNCU": "Kubansko standardno vrijeme", "HADT": "Havajsko-aleućansko ljetno vrijeme", "AST": "Sjevernoameričko atlantsko standardno vrijeme", "AEDT": "Istočnoaustralijsko ljetno vrijeme", "SGT": "Singapursko standardno vrijeme", "MST": "Makao standardno vreme", "LHDT": "Ljetno vrijeme na Ostrvu Lord Hau", "IST": "Indijsko standardno vrijeme", "MDT": "Makao letnje računanje vremena", "UYT": "Urugvajsko standardno vrijeme", "JST": "Japansko standardno vrijeme", "ART": "Argentinsko standardno vrijeme", "HAT": "Njufaundlendsko ljetno vrijeme", "WEZ": "Zapadnoevropsko standardno vrijeme", "WESZ": "Zapadnoevropsko ljetno vrijeme", "HEPM": "Ljetno vrijeme na Ostrvima Sen Pjer i Mikelon", "PST": "Sjevernoameričko pacifičko standardno vrijeme", "PDT": "Sjevernoameričko pacifičko ljetno vrijeme", "OEZ": "Istočnoevropsko standardno vrijeme", "CLT": "Čileansko standardno vrijeme", "GMT": "Griničko vrijeme", "WIB": "Zapadnoindonezijsko vrijeme", "AWST": "Zapadnoaustralijsko standardno vrijeme", "OESZ": "Istočnoevropsko ljetno vrijeme", "ACST": "Centralnoaustralijsko standardno vrijeme", "AWDT": "Zapadnoaustralijsko ljetno vrijeme", "MEZ": "Centralnoevropsko standardno vrijeme", "MESZ": "Centralnoevropsko ljetno vrijeme", "NZST": "Novozelandsko standardno vrijeme", "AKST": "Aljaskansko standardno vrijeme", "AKDT": "Aljaskansko ljetno vrijeme", "SRT": "Surinamsko vrijeme", "ACWST": "Australijsko centralnozapadno standardno vrijeme", "WIT": "Istočnoindonezijsko vrijeme", "JDT": "Japansko ljetno vrijeme", "HENOMX": "Sjeverozapadno meksičko ljetno vrijeme", "WAST": "Zapadnoafričko ljetno vrijeme", "EST": "Sjevernoameričko istočno standardno vrijeme", "HKST": "Hongkonško ljetno vrijeme", "CHADT": "Čatamsko ljetno vrijeme", "∅∅∅": "Brazilijsko ljetno vrijeme", "BOT": "Bolivijsko vrijeme", "ACWDT": "Australijsko centralnozapadno ljetno vrijeme", "MYT": "Malezijsko vrijeme", "ADT": "Sjevernoameričko atlantsko ljetno vrijeme", "HEOG": "Zapadnogrenlandsko ljetno vrijeme", "COST": "Kolumbijsko ljetno vrijeme", "HNPM": "Standardno vrijeme na Ostrvima Sen Pjer i Mikelon", "UYST": "Urugvajsko ljetno vrijeme", "TMST": "Turkmenistansko ljetno vrijeme", "WART": "Zapadnoargentinsko standardno vrijeme", "EAT": "Istočnoafričko vrijeme", "ECT": "Ekvadorsko vrijeme", "LHST": "Standardno vrijeme na Ostrvu Lord Hau", "EDT": "Sjevernoameričko istočno ljetno vrijeme", "BT": "Butansko vrijeme", "CDT": "Sjevernoameričko centralno ljetno vrijeme", "NZDT": "Novozelandsko ljetno vrijeme", "VET": "Venecuelansko vrijeme", "HNOG": "Zapadnogrenlandsko standardno vrijeme", "ACDT": "Centralnoaustralijsko ljetno vrijeme", "CAT": "Centralnoafričko vrijeme", "HNPMX": "Meksičko pacifičko standardno vrijeme", "HNNOMX": "Sjeverozapadno meksičko standardno vrijeme", "AEST": "Istočnoaustralijsko standardno vrijeme", "WAT": "Zapadnoafričko standardno vrijeme", "HEEG": "Istočnogrenlandsko ljetno vrijeme", "COT": "Kolumbijsko standardno vrijeme", "GYT": "Gvajansko vrijeme", "HEPMX": "Meksičko pacifičko ljetno vrijeme", "CHAST": "Čatamsko standardno vrijeme", "HAST": "Havajsko-aleućansko standardno vrijeme", "WITA": "Centralnoindonezijsko vrijeme", "ARST": "Argentinsko ljetno vrijeme", "HNEG": "Istočnogrenlandsko standardno vrijeme", "GFT": "Francuskogvajansko vrijeme", "HECU": "Kubansko ljetno vrijeme", "CST": "Sjevernoameričko centralno standardno vrijeme", "TMT": "Turkmenistansko standardno vrijeme", "HNT": "Njufaundlendsko standardno vrijeme", "CLST": "Čileansko ljetno vrijeme", "WARST": "Zapadnoargentinsko ljetno vrijeme", "SAST": "Južnoafričko standardno vrijeme", "HKT": "Hongkonško standardno vrijeme"},
77         }
78 }
79
80 // Locale returns the current translators string locale
81 func (bs *bs) Locale() string {
82         return bs.locale
83 }
84
85 // PluralsCardinal returns the list of cardinal plural rules associated with 'bs'
86 func (bs *bs) PluralsCardinal() []locales.PluralRule {
87         return bs.pluralsCardinal
88 }
89
90 // PluralsOrdinal returns the list of ordinal plural rules associated with 'bs'
91 func (bs *bs) PluralsOrdinal() []locales.PluralRule {
92         return bs.pluralsOrdinal
93 }
94
95 // PluralsRange returns the list of range plural rules associated with 'bs'
96 func (bs *bs) PluralsRange() []locales.PluralRule {
97         return bs.pluralsRange
98 }
99
100 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'bs'
101 func (bs *bs) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
102
103         n := math.Abs(num)
104         i := int64(n)
105         f := locales.F(n, v)
106         iMod100 := i % 100
107         iMod10 := i % 10
108         fMod10 := f % 10
109         fMod100 := f % 100
110
111         if (v == 0 && iMod10 == 1 && iMod100 != 11) || (fMod10 == 1 && fMod100 != 11) {
112                 return locales.PluralRuleOne
113         } else if (v == 0 && iMod10 >= 2 && iMod10 <= 4 && (iMod100 < 12 || iMod100 > 14)) || (fMod10 >= 2 && fMod10 <= 4 && (fMod100 < 12 || fMod100 > 14)) {
114                 return locales.PluralRuleFew
115         }
116
117         return locales.PluralRuleOther
118 }
119
120 // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'bs'
121 func (bs *bs) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
122         return locales.PluralRuleOther
123 }
124
125 // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'bs'
126 func (bs *bs) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
127
128         start := bs.CardinalPluralRule(num1, v1)
129         end := bs.CardinalPluralRule(num2, v2)
130
131         if start == locales.PluralRuleOne && end == locales.PluralRuleOne {
132                 return locales.PluralRuleOne
133         } else if start == locales.PluralRuleOne && end == locales.PluralRuleFew {
134                 return locales.PluralRuleFew
135         } else if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
136                 return locales.PluralRuleOther
137         } else if start == locales.PluralRuleFew && end == locales.PluralRuleOne {
138                 return locales.PluralRuleOne
139         } else if start == locales.PluralRuleFew && end == locales.PluralRuleFew {
140                 return locales.PluralRuleFew
141         } else if start == locales.PluralRuleFew && end == locales.PluralRuleOther {
142                 return locales.PluralRuleOther
143         } else if start == locales.PluralRuleOther && end == locales.PluralRuleOne {
144                 return locales.PluralRuleOne
145         } else if start == locales.PluralRuleOther && end == locales.PluralRuleFew {
146                 return locales.PluralRuleFew
147         }
148
149         return locales.PluralRuleOther
150
151 }
152
153 // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
154 func (bs *bs) MonthAbbreviated(month time.Month) string {
155         return bs.monthsAbbreviated[month]
156 }
157
158 // MonthsAbbreviated returns the locales abbreviated months
159 func (bs *bs) MonthsAbbreviated() []string {
160         return bs.monthsAbbreviated[1:]
161 }
162
163 // MonthNarrow returns the locales narrow month given the 'month' provided
164 func (bs *bs) MonthNarrow(month time.Month) string {
165         return bs.monthsNarrow[month]
166 }
167
168 // MonthsNarrow returns the locales narrow months
169 func (bs *bs) MonthsNarrow() []string {
170         return bs.monthsNarrow[1:]
171 }
172
173 // MonthWide returns the locales wide month given the 'month' provided
174 func (bs *bs) MonthWide(month time.Month) string {
175         return bs.monthsWide[month]
176 }
177
178 // MonthsWide returns the locales wide months
179 func (bs *bs) MonthsWide() []string {
180         return bs.monthsWide[1:]
181 }
182
183 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
184 func (bs *bs) WeekdayAbbreviated(weekday time.Weekday) string {
185         return bs.daysAbbreviated[weekday]
186 }
187
188 // WeekdaysAbbreviated returns the locales abbreviated weekdays
189 func (bs *bs) WeekdaysAbbreviated() []string {
190         return bs.daysAbbreviated
191 }
192
193 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
194 func (bs *bs) WeekdayNarrow(weekday time.Weekday) string {
195         return bs.daysNarrow[weekday]
196 }
197
198 // WeekdaysNarrow returns the locales narrow weekdays
199 func (bs *bs) WeekdaysNarrow() []string {
200         return bs.daysNarrow
201 }
202
203 // WeekdayShort returns the locales short weekday given the 'weekday' provided
204 func (bs *bs) WeekdayShort(weekday time.Weekday) string {
205         return bs.daysShort[weekday]
206 }
207
208 // WeekdaysShort returns the locales short weekdays
209 func (bs *bs) WeekdaysShort() []string {
210         return bs.daysShort
211 }
212
213 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
214 func (bs *bs) WeekdayWide(weekday time.Weekday) string {
215         return bs.daysWide[weekday]
216 }
217
218 // WeekdaysWide returns the locales wide weekdays
219 func (bs *bs) WeekdaysWide() []string {
220         return bs.daysWide
221 }
222
223 // Decimal returns the decimal point of number
224 func (bs *bs) Decimal() string {
225         return bs.decimal
226 }
227
228 // Group returns the group of number
229 func (bs *bs) Group() string {
230         return bs.group
231 }
232
233 // Group returns the minus sign of number
234 func (bs *bs) Minus() string {
235         return bs.minus
236 }
237
238 // FmtNumber returns 'num' with digits/precision of 'v' for 'bs' and handles both Whole and Real numbers based on 'v'
239 func (bs *bs) FmtNumber(num float64, v uint64) string {
240
241         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
242         l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
243         count := 0
244         inWhole := v == 0
245         b := make([]byte, 0, l)
246
247         for i := len(s) - 1; i >= 0; i-- {
248
249                 if s[i] == '.' {
250                         b = append(b, bs.decimal[0])
251                         inWhole = true
252                         continue
253                 }
254
255                 if inWhole {
256                         if count == 3 {
257                                 b = append(b, bs.group[0])
258                                 count = 1
259                         } else {
260                                 count++
261                         }
262                 }
263
264                 b = append(b, s[i])
265         }
266
267         if num < 0 {
268                 b = append(b, bs.minus[0])
269         }
270
271         // reverse
272         for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
273                 b[i], b[j] = b[j], b[i]
274         }
275
276         return string(b)
277 }
278
279 // FmtPercent returns 'num' with digits/precision of 'v' for 'bs' and handles both Whole and Real numbers based on 'v'
280 // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
281 func (bs *bs) FmtPercent(num float64, v uint64) string {
282         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
283         l := len(s) + 5
284         b := make([]byte, 0, l)
285
286         for i := len(s) - 1; i >= 0; i-- {
287
288                 if s[i] == '.' {
289                         b = append(b, bs.decimal[0])
290                         continue
291                 }
292
293                 b = append(b, s[i])
294         }
295
296         if num < 0 {
297                 b = append(b, bs.minus[0])
298         }
299
300         // reverse
301         for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
302                 b[i], b[j] = b[j], b[i]
303         }
304
305         b = append(b, bs.percentSuffix...)
306
307         b = append(b, bs.percent...)
308
309         return string(b)
310 }
311
312 // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'bs'
313 func (bs *bs) FmtCurrency(num float64, v uint64, currency currency.Type) string {
314
315         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
316         symbol := bs.currencies[currency]
317         l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
318         count := 0
319         inWhole := v == 0
320         b := make([]byte, 0, l)
321
322         for i := len(s) - 1; i >= 0; i-- {
323
324                 if s[i] == '.' {
325                         b = append(b, bs.decimal[0])
326                         inWhole = true
327                         continue
328                 }
329
330                 if inWhole {
331                         if count == 3 {
332                                 b = append(b, bs.group[0])
333                                 count = 1
334                         } else {
335                                 count++
336                         }
337                 }
338
339                 b = append(b, s[i])
340         }
341
342         if num < 0 {
343                 b = append(b, bs.minus[0])
344         }
345
346         // reverse
347         for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
348                 b[i], b[j] = b[j], b[i]
349         }
350
351         if int(v) < 2 {
352
353                 if v == 0 {
354                         b = append(b, bs.decimal...)
355                 }
356
357                 for i := 0; i < 2-int(v); i++ {
358                         b = append(b, '0')
359                 }
360         }
361
362         b = append(b, bs.currencyPositiveSuffix...)
363
364         b = append(b, symbol...)
365
366         return string(b)
367 }
368
369 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'bs'
370 // in accounting notation.
371 func (bs *bs) FmtAccounting(num float64, v uint64, currency currency.Type) string {
372
373         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
374         symbol := bs.currencies[currency]
375         l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
376         count := 0
377         inWhole := v == 0
378         b := make([]byte, 0, l)
379
380         for i := len(s) - 1; i >= 0; i-- {
381
382                 if s[i] == '.' {
383                         b = append(b, bs.decimal[0])
384                         inWhole = true
385                         continue
386                 }
387
388                 if inWhole {
389                         if count == 3 {
390                                 b = append(b, bs.group[0])
391                                 count = 1
392                         } else {
393                                 count++
394                         }
395                 }
396
397                 b = append(b, s[i])
398         }
399
400         if num < 0 {
401
402                 b = append(b, bs.minus[0])
403
404         }
405
406         // reverse
407         for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
408                 b[i], b[j] = b[j], b[i]
409         }
410
411         if int(v) < 2 {
412
413                 if v == 0 {
414                         b = append(b, bs.decimal...)
415                 }
416
417                 for i := 0; i < 2-int(v); i++ {
418                         b = append(b, '0')
419                 }
420         }
421
422         if num < 0 {
423                 b = append(b, bs.currencyNegativeSuffix...)
424                 b = append(b, symbol...)
425         } else {
426
427                 b = append(b, bs.currencyPositiveSuffix...)
428                 b = append(b, symbol...)
429         }
430
431         return string(b)
432 }
433
434 // FmtDateShort returns the short date representation of 't' for 'bs'
435 func (bs *bs) FmtDateShort(t time.Time) string {
436
437         b := make([]byte, 0, 32)
438
439         b = strconv.AppendInt(b, int64(t.Day()), 10)
440         b = append(b, []byte{0x2e}...)
441         b = strconv.AppendInt(b, int64(t.Month()), 10)
442         b = append(b, []byte{0x2e}...)
443
444         if t.Year() > 9 {
445                 b = append(b, strconv.Itoa(t.Year())[2:]...)
446         } else {
447                 b = append(b, strconv.Itoa(t.Year())[1:]...)
448         }
449
450         b = append(b, []byte{0x2e}...)
451
452         return string(b)
453 }
454
455 // FmtDateMedium returns the medium date representation of 't' for 'bs'
456 func (bs *bs) FmtDateMedium(t time.Time) string {
457
458         b := make([]byte, 0, 32)
459
460         b = strconv.AppendInt(b, int64(t.Day()), 10)
461         b = append(b, []byte{0x2e, 0x20}...)
462         b = append(b, bs.monthsAbbreviated[t.Month()]...)
463         b = append(b, []byte{0x2e, 0x20}...)
464
465         if t.Year() > 0 {
466                 b = strconv.AppendInt(b, int64(t.Year()), 10)
467         } else {
468                 b = strconv.AppendInt(b, int64(-t.Year()), 10)
469         }
470
471         b = append(b, []byte{0x2e}...)
472
473         return string(b)
474 }
475
476 // FmtDateLong returns the long date representation of 't' for 'bs'
477 func (bs *bs) FmtDateLong(t time.Time) string {
478
479         b := make([]byte, 0, 32)
480
481         b = strconv.AppendInt(b, int64(t.Day()), 10)
482         b = append(b, []byte{0x2e, 0x20}...)
483         b = append(b, bs.monthsWide[t.Month()]...)
484         b = append(b, []byte{0x20}...)
485
486         if t.Year() > 0 {
487                 b = strconv.AppendInt(b, int64(t.Year()), 10)
488         } else {
489                 b = strconv.AppendInt(b, int64(-t.Year()), 10)
490         }
491
492         b = append(b, []byte{0x2e}...)
493
494         return string(b)
495 }
496
497 // FmtDateFull returns the full date representation of 't' for 'bs'
498 func (bs *bs) FmtDateFull(t time.Time) string {
499
500         b := make([]byte, 0, 32)
501
502         b = append(b, bs.daysWide[t.Weekday()]...)
503         b = append(b, []byte{0x2c, 0x20}...)
504         b = strconv.AppendInt(b, int64(t.Day()), 10)
505         b = append(b, []byte{0x2e, 0x20}...)
506         b = append(b, bs.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         b = append(b, []byte{0x2e}...)
516
517         return string(b)
518 }
519
520 // FmtTimeShort returns the short time representation of 't' for 'bs'
521 func (bs *bs) FmtTimeShort(t time.Time) string {
522
523         b := make([]byte, 0, 32)
524
525         if t.Hour() < 10 {
526                 b = append(b, '0')
527         }
528
529         b = strconv.AppendInt(b, int64(t.Hour()), 10)
530         b = append(b, bs.timeSeparator...)
531
532         if t.Minute() < 10 {
533                 b = append(b, '0')
534         }
535
536         b = strconv.AppendInt(b, int64(t.Minute()), 10)
537
538         return string(b)
539 }
540
541 // FmtTimeMedium returns the medium time representation of 't' for 'bs'
542 func (bs *bs) FmtTimeMedium(t time.Time) string {
543
544         b := make([]byte, 0, 32)
545
546         if t.Hour() < 10 {
547                 b = append(b, '0')
548         }
549
550         b = strconv.AppendInt(b, int64(t.Hour()), 10)
551         b = append(b, bs.timeSeparator...)
552
553         if t.Minute() < 10 {
554                 b = append(b, '0')
555         }
556
557         b = strconv.AppendInt(b, int64(t.Minute()), 10)
558         b = append(b, bs.timeSeparator...)
559
560         if t.Second() < 10 {
561                 b = append(b, '0')
562         }
563
564         b = strconv.AppendInt(b, int64(t.Second()), 10)
565
566         return string(b)
567 }
568
569 // FmtTimeLong returns the long time representation of 't' for 'bs'
570 func (bs *bs) FmtTimeLong(t time.Time) string {
571
572         b := make([]byte, 0, 32)
573
574         if t.Hour() < 10 {
575                 b = append(b, '0')
576         }
577
578         b = strconv.AppendInt(b, int64(t.Hour()), 10)
579         b = append(b, bs.timeSeparator...)
580
581         if t.Minute() < 10 {
582                 b = append(b, '0')
583         }
584
585         b = strconv.AppendInt(b, int64(t.Minute()), 10)
586         b = append(b, bs.timeSeparator...)
587
588         if t.Second() < 10 {
589                 b = append(b, '0')
590         }
591
592         b = strconv.AppendInt(b, int64(t.Second()), 10)
593         b = append(b, []byte{0x20}...)
594
595         tz, _ := t.Zone()
596         b = append(b, tz...)
597
598         return string(b)
599 }
600
601 // FmtTimeFull returns the full time representation of 't' for 'bs'
602 func (bs *bs) FmtTimeFull(t time.Time) string {
603
604         b := make([]byte, 0, 32)
605
606         if t.Hour() < 10 {
607                 b = append(b, '0')
608         }
609
610         b = strconv.AppendInt(b, int64(t.Hour()), 10)
611         b = append(b, bs.timeSeparator...)
612
613         if t.Minute() < 10 {
614                 b = append(b, '0')
615         }
616
617         b = strconv.AppendInt(b, int64(t.Minute()), 10)
618         b = append(b, bs.timeSeparator...)
619
620         if t.Second() < 10 {
621                 b = append(b, '0')
622         }
623
624         b = strconv.AppendInt(b, int64(t.Second()), 10)
625         b = append(b, []byte{0x20}...)
626
627         tz, _ := t.Zone()
628
629         if btz, ok := bs.timezones[tz]; ok {
630                 b = append(b, btz...)
631         } else {
632                 b = append(b, tz...)
633         }
634
635         return string(b)
636 }