1 package br
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 br 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
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
46 func New() locales.Translator {
47 return &br{
48 locale: "br",
49 pluralsCardinal: []locales.PluralRule{2, 3, 4, 5, 6},
50 pluralsOrdinal: nil,
51 pluralsRange: nil,
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", "$A", "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", "$CA", "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", "€", "FIM", "FJD", "FKP", "FRF", "£ RU", "GEK", "GEL", "GHC", "GHS", "GIP", "GMD", "GNF", "GNS", "GQE", "GRD", "GTQ", "GWE", "GWP", "GYD", "$ HK", "HNL", "HRD", "HRK", "HTG", "HUF", "IDR", "IEP", "ILP", "ILR", "ILS", "₹", "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", "MRU", "MTL", "MTP", "MUR", "MVP", "MVR", "MWK", "MX$", "MXP", "MXV", "MYR", "MZE", "MZM", "MZN", "NAD", "NGN", "NIC", "NIO", "NLG", "NOK", "NPR", "$ ZN", "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", "Db", "SUR", "SVC", "SYP", "SZL", "THB", "TJR", "TJS", "TMM", "TMT", "TND", "TOP", "TPE", "TRL", "TRY", "TTD", "TWD", "TZS", "UAH", "UAK", "UGS", "UGX", "$ SU", "USN", "USS", "UYI", "UYP", "UYU", "UYW", "UZS", "VEB", "VEF", "VES", "VND", "VNN", "VUV", "WST", "FCFA", "XAG", "XAU", "XBA", "XBB", "XBC", "XBD", "XCD", "XDR", "XEU", "XFO", "XFU", "CFA", "XPD", "CFPF", "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{"", "Gen.", "Cʼhwe.", "Meur.", "Ebr.", "Mae", "Mezh.", "Goue.", "Eost", "Gwen.", "Here", "Du", "Kzu."},
64 monthsNarrow: []string{"", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"},
65 monthsWide: []string{"", "Genver", "Cʼhwevrer", "Meurzh", "Ebrel", "Mae", "Mezheven", "Gouere", "Eost", "Gwengolo", "Here", "Du", "Kerzu"},
66 daysAbbreviated: []string{"Sul", "Lun", "Meu.", "Mer.", "Yaou", "Gwe.", "Sad."},
67 daysNarrow: []string{"Su", "L", "Mz", "Mc", "Y", "G", "Sa"},
68 daysShort: []string{"Sul", "Lun", "Meu.", "Mer.", "Yaou", "Gwe.", "Sad."},
69 daysWide: []string{"Sul", "Lun", "Meurzh", "Mercʼher", "Yaou", "Gwener", "Sadorn"},
70 periodsAbbreviated: []string{"A.M.", "G.M."},
71 periodsNarrow: []string{"am", "gm"},
72 periodsWide: []string{"A.M.", "G.M."},
73 erasAbbreviated: []string{"a-raok J.K.", "goude J.K."},
74 erasNarrow: []string{"a-raok J.K.", "goude J.K."},
75 erasWide: []string{"a-raok Jezuz-Krist", "goude Jezuz-Krist"},
76 timezones: map[string]string{"ACDT": "eur hañv Kreizaostralia", "ACST": "eur cʼhoañv Kreizaostralia", "ACWDT": "eur hañv Kreizaostralia ar Cʼhornôg", "ACWST": "eur cʼhoañv Kreizaostralia ar Cʼhornôg", "ADT": "eur hañv an Atlantel", "AEDT": "eur hañv Aostralia ar Reter", "AEST": "eur cʼhoañv Aostralia ar Reter", "AKDT": "eur hañv Alaska", "AKST": "eur cʼhoañv Alaska", "ARST": "eur hañv Arcʼhantina", "ART": "eur cʼhoañv Arcʼhantina", "AST": "eur cʼhoañv an Atlantel", "AWDT": "eur hañv Aostralia ar Cʼhornôg", "AWST": "eur cʼhoañv Aostralia ar Cʼhornôg", "BOT": "eur Bolivia", "BT": "eur Bhoutan", "CAT": "eur Kreizafrika", "CDT": "eur hañv ar Cʼhreiz", "CHADT": "eur hañv Chatham", "CHAST": "eur cʼhoañv Chatham", "CLST": "eur hañv Chile", "CLT": "eur cʼhoañv Chile", "COST": "eur hañv Kolombia", "COT": "eur cʼhoañv Kolombia", "CST": "eur cʼhoañv ar Cʼhreiz", "ChST": "eur Chamorro", "EAT": "eur Afrika ar Reter", "ECT": "eur Ecuador", "EDT": "eur hañv ar Reter", "EST": "eur cʼhoañv ar Reter", "GFT": "eur Gwiana cʼhall", "GMT": "Amzer keitat Greenwich (AKG)", "GST": "eur cʼhoañv ar Pleg-mor Arab-ha-Pers", "GYT": "eur Guyana", "HADT": "HADT", "HAST": "HAST", "HAT": "eur hañv Newfoundland", "HECU": "eur hañv Kuba", "HEEG": "eur hañv Greunland ar Reter", "HENOMX": "eur hañv Gwalarn Mecʼhiko", "HEOG": "eur hañv Greunland ar Cʼhornôg", "HEPM": "eur hañv Sant-Pêr-ha-Mikelon", "HEPMX": "HEPMX", "HKST": "eur hañv Hong Kong", "HKT": "eur cʼhoañv Hong Kong", "HNCU": "eur cʼhoañv Kuba", "HNEG": "eur cʼhoañv Greunland ar Reter", "HNNOMX": "eur cʼhoañv Gwalarn Mecʼhiko", "HNOG": "eur cʼhoañv Greunland ar Cʼhornôg", "HNPM": "eur cʼhoañv Sant-Pêr-ha-Mikelon", "HNPMX": "HNPMX", "HNT": "eur cʼhoañv Newfoundland", "IST": "eur cʼhoañv India", "JDT": "eur hañv Japan", "JST": "eur cʼhoañv Japan", "LHDT": "LHDT", "LHST": "LHST", "MDT": "eur hañv ar Menezioù", "MESZ": "eur hañv Kreizeuropa", "MEZ": "eur cʼhoañv Kreizeuropa", "MST": "eur cʼhoañv ar Menezioù", "MYT": "eur Malaysia", "NZDT": "eur hañv Zeland-Nevez", "NZST": "eur cʼhoañv Zeland-Nevez", "OESZ": "eur hañv Europa ar Reter", "OEZ": "eur cʼhoañv Europa ar Reter", "PDT": "eur hañv an Habask", "PST": "eur cʼhoañv an Habask", "SAST": "eur cʼhoañv Suafrika", "SGT": "eur cʼhoañv Singapour", "SRT": "eur Surinam", "TMST": "eur hañv Turkmenistan", "TMT": "eur cʼhoañv Turkmenistan", "UYST": "eur hañv Uruguay", "UYT": "eur cʼhoañv Uruguay", "VET": "eur Venezuela", "WARST": "eur hañv Arcʼhantina ar Cʼhornôg", "WART": "eur cʼhoañv Arcʼhantina ar Cʼhornôg", "WAST": "eur hañv Afrika ar Cʼhornôg", "WAT": "eur cʼhoañv Afrika ar Cʼhornôg", "WESZ": "eur hañv Europa ar Cʼhornôg", "WEZ": "eur cʼhoañv Europa ar Cʼhornôg", "WIB": "eur Indonezia ar Cʼhornôg", "WIT": "eur Indonezia ar Reter", "WITA": "eur Kreiz Indonezia", "∅∅∅": "eur hañv Perou"},
77 }
78 }
79
80
81 func (br *br) Locale() string {
82 return br.locale
83 }
84
85
86 func (br *br) PluralsCardinal() []locales.PluralRule {
87 return br.pluralsCardinal
88 }
89
90
91 func (br *br) PluralsOrdinal() []locales.PluralRule {
92 return br.pluralsOrdinal
93 }
94
95
96 func (br *br) PluralsRange() []locales.PluralRule {
97 return br.pluralsRange
98 }
99
100
101 func (br *br) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
102
103 n := math.Abs(num)
104 nMod100 := math.Mod(n, 100)
105 nMod1000000 := math.Mod(n, 1000000)
106 nMod10 := math.Mod(n, 10)
107
108 if nMod10 == 1 && (nMod100 != 11 && nMod100 != 71 && nMod100 != 91) {
109 return locales.PluralRuleOne
110 } else if nMod10 == 2 && (nMod100 != 12 && nMod100 != 72 && nMod100 != 92) {
111 return locales.PluralRuleTwo
112 } else if nMod10 >= 3 && nMod10 <= 4 && (nMod10 == 9) && (nMod100 < 10 || nMod100 > 19) || (nMod100 < 70 || nMod100 > 79) || (nMod100 < 90 || nMod100 > 99) {
113 return locales.PluralRuleFew
114 } else if n != 0 && nMod1000000 == 0 {
115 return locales.PluralRuleMany
116 }
117
118 return locales.PluralRuleOther
119 }
120
121
122 func (br *br) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
123 return locales.PluralRuleUnknown
124 }
125
126
127 func (br *br) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
128 return locales.PluralRuleUnknown
129 }
130
131
132 func (br *br) MonthAbbreviated(month time.Month) string {
133 return br.monthsAbbreviated[month]
134 }
135
136
137 func (br *br) MonthsAbbreviated() []string {
138 return br.monthsAbbreviated[1:]
139 }
140
141
142 func (br *br) MonthNarrow(month time.Month) string {
143 return br.monthsNarrow[month]
144 }
145
146
147 func (br *br) MonthsNarrow() []string {
148 return br.monthsNarrow[1:]
149 }
150
151
152 func (br *br) MonthWide(month time.Month) string {
153 return br.monthsWide[month]
154 }
155
156
157 func (br *br) MonthsWide() []string {
158 return br.monthsWide[1:]
159 }
160
161
162 func (br *br) WeekdayAbbreviated(weekday time.Weekday) string {
163 return br.daysAbbreviated[weekday]
164 }
165
166
167 func (br *br) WeekdaysAbbreviated() []string {
168 return br.daysAbbreviated
169 }
170
171
172 func (br *br) WeekdayNarrow(weekday time.Weekday) string {
173 return br.daysNarrow[weekday]
174 }
175
176
177 func (br *br) WeekdaysNarrow() []string {
178 return br.daysNarrow
179 }
180
181
182 func (br *br) WeekdayShort(weekday time.Weekday) string {
183 return br.daysShort[weekday]
184 }
185
186
187 func (br *br) WeekdaysShort() []string {
188 return br.daysShort
189 }
190
191
192 func (br *br) WeekdayWide(weekday time.Weekday) string {
193 return br.daysWide[weekday]
194 }
195
196
197 func (br *br) WeekdaysWide() []string {
198 return br.daysWide
199 }
200
201
202 func (br *br) Decimal() string {
203 return br.decimal
204 }
205
206
207 func (br *br) Group() string {
208 return br.group
209 }
210
211
212 func (br *br) Minus() string {
213 return br.minus
214 }
215
216
217 func (br *br) FmtNumber(num float64, v uint64) string {
218
219 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
220 l := len(s) + 2 + 2*len(s[:len(s)-int(v)-1])/3
221 count := 0
222 inWhole := v == 0
223 b := make([]byte, 0, l)
224
225 for i := len(s) - 1; i >= 0; i-- {
226
227 if s[i] == '.' {
228 b = append(b, br.decimal[0])
229 inWhole = true
230 continue
231 }
232
233 if inWhole {
234 if count == 3 {
235 for j := len(br.group) - 1; j >= 0; j-- {
236 b = append(b, br.group[j])
237 }
238 count = 1
239 } else {
240 count++
241 }
242 }
243
244 b = append(b, s[i])
245 }
246
247 if num < 0 {
248 b = append(b, br.minus[0])
249 }
250
251
252 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
253 b[i], b[j] = b[j], b[i]
254 }
255
256 return string(b)
257 }
258
259
260
261 func (br *br) FmtPercent(num float64, v uint64) string {
262 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
263 l := len(s) + 5
264 b := make([]byte, 0, l)
265
266 for i := len(s) - 1; i >= 0; i-- {
267
268 if s[i] == '.' {
269 b = append(b, br.decimal[0])
270 continue
271 }
272
273 b = append(b, s[i])
274 }
275
276 if num < 0 {
277 b = append(b, br.minus[0])
278 }
279
280
281 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
282 b[i], b[j] = b[j], b[i]
283 }
284
285 b = append(b, br.percentSuffix...)
286
287 b = append(b, br.percent...)
288
289 return string(b)
290 }
291
292
293 func (br *br) FmtCurrency(num float64, v uint64, currency currency.Type) string {
294
295 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
296 symbol := br.currencies[currency]
297 l := len(s) + len(symbol) + 4 + 2*len(s[:len(s)-int(v)-1])/3
298 count := 0
299 inWhole := v == 0
300 b := make([]byte, 0, l)
301
302 for i := len(s) - 1; i >= 0; i-- {
303
304 if s[i] == '.' {
305 b = append(b, br.decimal[0])
306 inWhole = true
307 continue
308 }
309
310 if inWhole {
311 if count == 3 {
312 for j := len(br.group) - 1; j >= 0; j-- {
313 b = append(b, br.group[j])
314 }
315 count = 1
316 } else {
317 count++
318 }
319 }
320
321 b = append(b, s[i])
322 }
323
324 if num < 0 {
325 b = append(b, br.minus[0])
326 }
327
328
329 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
330 b[i], b[j] = b[j], b[i]
331 }
332
333 if int(v) < 2 {
334
335 if v == 0 {
336 b = append(b, br.decimal...)
337 }
338
339 for i := 0; i < 2-int(v); i++ {
340 b = append(b, '0')
341 }
342 }
343
344 b = append(b, br.currencyPositiveSuffix...)
345
346 b = append(b, symbol...)
347
348 return string(b)
349 }
350
351
352
353 func (br *br) FmtAccounting(num float64, v uint64, currency currency.Type) string {
354
355 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
356 symbol := br.currencies[currency]
357 l := len(s) + len(symbol) + 4 + 2*len(s[:len(s)-int(v)-1])/3
358 count := 0
359 inWhole := v == 0
360 b := make([]byte, 0, l)
361
362 for i := len(s) - 1; i >= 0; i-- {
363
364 if s[i] == '.' {
365 b = append(b, br.decimal[0])
366 inWhole = true
367 continue
368 }
369
370 if inWhole {
371 if count == 3 {
372 for j := len(br.group) - 1; j >= 0; j-- {
373 b = append(b, br.group[j])
374 }
375 count = 1
376 } else {
377 count++
378 }
379 }
380
381 b = append(b, s[i])
382 }
383
384 if num < 0 {
385
386 b = append(b, br.minus[0])
387
388 }
389
390
391 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
392 b[i], b[j] = b[j], b[i]
393 }
394
395 if int(v) < 2 {
396
397 if v == 0 {
398 b = append(b, br.decimal...)
399 }
400
401 for i := 0; i < 2-int(v); i++ {
402 b = append(b, '0')
403 }
404 }
405
406 if num < 0 {
407 b = append(b, br.currencyNegativeSuffix...)
408 b = append(b, symbol...)
409 } else {
410
411 b = append(b, br.currencyPositiveSuffix...)
412 b = append(b, symbol...)
413 }
414
415 return string(b)
416 }
417
418
419 func (br *br) FmtDateShort(t time.Time) string {
420
421 b := make([]byte, 0, 32)
422
423 if t.Day() < 10 {
424 b = append(b, '0')
425 }
426
427 b = strconv.AppendInt(b, int64(t.Day()), 10)
428 b = append(b, []byte{0x2f}...)
429
430 if t.Month() < 10 {
431 b = append(b, '0')
432 }
433
434 b = strconv.AppendInt(b, int64(t.Month()), 10)
435
436 b = append(b, []byte{0x2f}...)
437
438 if t.Year() > 0 {
439 b = strconv.AppendInt(b, int64(t.Year()), 10)
440 } else {
441 b = strconv.AppendInt(b, int64(-t.Year()), 10)
442 }
443
444 return string(b)
445 }
446
447
448 func (br *br) FmtDateMedium(t time.Time) string {
449
450 b := make([]byte, 0, 32)
451
452 b = strconv.AppendInt(b, int64(t.Day()), 10)
453 b = append(b, []byte{0x20}...)
454 b = append(b, br.monthsAbbreviated[t.Month()]...)
455 b = append(b, []byte{0x20}...)
456
457 if t.Year() > 0 {
458 b = strconv.AppendInt(b, int64(t.Year()), 10)
459 } else {
460 b = strconv.AppendInt(b, int64(-t.Year()), 10)
461 }
462
463 return string(b)
464 }
465
466
467 func (br *br) FmtDateLong(t time.Time) string {
468
469 b := make([]byte, 0, 32)
470
471 b = strconv.AppendInt(b, int64(t.Day()), 10)
472 b = append(b, []byte{0x20}...)
473 b = append(b, br.monthsWide[t.Month()]...)
474 b = append(b, []byte{0x20}...)
475
476 if t.Year() > 0 {
477 b = strconv.AppendInt(b, int64(t.Year()), 10)
478 } else {
479 b = strconv.AppendInt(b, int64(-t.Year()), 10)
480 }
481
482 return string(b)
483 }
484
485
486 func (br *br) FmtDateFull(t time.Time) string {
487
488 b := make([]byte, 0, 32)
489
490 b = append(b, br.daysWide[t.Weekday()]...)
491 b = append(b, []byte{0x20}...)
492 b = strconv.AppendInt(b, int64(t.Day()), 10)
493 b = append(b, []byte{0x20}...)
494 b = append(b, br.monthsWide[t.Month()]...)
495 b = append(b, []byte{0x20}...)
496
497 if t.Year() > 0 {
498 b = strconv.AppendInt(b, int64(t.Year()), 10)
499 } else {
500 b = strconv.AppendInt(b, int64(-t.Year()), 10)
501 }
502
503 return string(b)
504 }
505
506
507 func (br *br) FmtTimeShort(t time.Time) string {
508
509 b := make([]byte, 0, 32)
510
511 if t.Hour() < 10 {
512 b = append(b, '0')
513 }
514
515 b = strconv.AppendInt(b, int64(t.Hour()), 10)
516 b = append(b, br.timeSeparator...)
517
518 if t.Minute() < 10 {
519 b = append(b, '0')
520 }
521
522 b = strconv.AppendInt(b, int64(t.Minute()), 10)
523
524 return string(b)
525 }
526
527
528 func (br *br) FmtTimeMedium(t time.Time) string {
529
530 b := make([]byte, 0, 32)
531
532 if t.Hour() < 10 {
533 b = append(b, '0')
534 }
535
536 b = strconv.AppendInt(b, int64(t.Hour()), 10)
537 b = append(b, br.timeSeparator...)
538
539 if t.Minute() < 10 {
540 b = append(b, '0')
541 }
542
543 b = strconv.AppendInt(b, int64(t.Minute()), 10)
544 b = append(b, br.timeSeparator...)
545
546 if t.Second() < 10 {
547 b = append(b, '0')
548 }
549
550 b = strconv.AppendInt(b, int64(t.Second()), 10)
551
552 return string(b)
553 }
554
555
556 func (br *br) FmtTimeLong(t time.Time) string {
557
558 b := make([]byte, 0, 32)
559
560 if t.Hour() < 10 {
561 b = append(b, '0')
562 }
563
564 b = strconv.AppendInt(b, int64(t.Hour()), 10)
565 b = append(b, br.timeSeparator...)
566
567 if t.Minute() < 10 {
568 b = append(b, '0')
569 }
570
571 b = strconv.AppendInt(b, int64(t.Minute()), 10)
572 b = append(b, br.timeSeparator...)
573
574 if t.Second() < 10 {
575 b = append(b, '0')
576 }
577
578 b = strconv.AppendInt(b, int64(t.Second()), 10)
579 b = append(b, []byte{0x20}...)
580
581 tz, _ := t.Zone()
582 b = append(b, tz...)
583
584 return string(b)
585 }
586
587
588 func (br *br) FmtTimeFull(t time.Time) string {
589
590 b := make([]byte, 0, 32)
591
592 if t.Hour() < 10 {
593 b = append(b, '0')
594 }
595
596 b = strconv.AppendInt(b, int64(t.Hour()), 10)
597 b = append(b, br.timeSeparator...)
598
599 if t.Minute() < 10 {
600 b = append(b, '0')
601 }
602
603 b = strconv.AppendInt(b, int64(t.Minute()), 10)
604 b = append(b, br.timeSeparator...)
605
606 if t.Second() < 10 {
607 b = append(b, '0')
608 }
609
610 b = strconv.AppendInt(b, int64(t.Second()), 10)
611 b = append(b, []byte{0x20}...)
612
613 tz, _ := t.Zone()
614
615 if btz, ok := br.timezones[tz]; ok {
616 b = append(b, btz...)
617 } else {
618 b = append(b, tz...)
619 }
620
621 return string(b)
622 }
623
View as plain text