1 package gl
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 gl 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 &gl{
48 locale: "gl",
49 pluralsCardinal: []locales.PluralRule{2, 6},
50 pluralsOrdinal: []locales.PluralRule{6},
51 pluralsRange: []locales.PluralRule{2, 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", "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", "R$", "BRN", "BRR", "BRZ", "BSD", "BTN", "BUK", "BWP", "BYB", "BYN", "BYR", "BZD", "$", "CDF", "CHE", "CHF", "CHW", "CLE", "CLF", "CLP", "CNH", "CNX", "CN¥", "COP", "COU", "CRC", "CSD", "CSK", "CUC", "CUP", "CVE", "CYP", "CZK", "DDM", "DEM", "DJF", "DKK", "DOP", "DZD", "ECS", "ECV", "EEK", "EGP", "ERN", "ESA", "ESB", "₧", "ETB", "€", "FIM", "FJD", "FKP", "FRF", "£", "GEK", "GEL", "GHC", "GHS", "GIP", "GMD", "GNF", "GNS", "GQE", "GRD", "GTQ", "GWE", "GWP", "GYD", "HK$", "HNL", "HRD", "HRK", "HTG", "HUF", "IDR", "IEP", "ILP", "ILR", "₪", "₹", "IQD", "IRR", "ISJ", "ISK", "ITL", "JMD", "JOD", "JP¥", "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", "MRU", "MTL", "MTP", "MUR", "MVP", "MVR", "MWK", "$MX", "MXP", "MXV", "MYR", "MZE", "MZM", "MZN", "NAD", "NGN", "NIC", "NIO", "NLG", "NOK", "NPR", "NZ$", "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", "฿", "TJR", "TJS", "TMM", "TMT", "TND", "TOP", "TPE", "TRL", "TRY", "TTD", "NT$", "TZS", "UAH", "UAK", "UGS", "UGX", "$", "USN", "USS", "UYI", "UYP", "UYU", "UYW", "UZS", "VEB", "VEF", "VES", "₫", "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{"", "xan.", "feb.", "mar.", "abr.", "maio", "xuño", "xul.", "ago.", "set.", "out.", "nov.", "dec."},
64 monthsNarrow: []string{"", "x.", "f.", "m.", "a.", "m.", "x.", "x.", "a.", "s.", "o.", "n.", "d."},
65 monthsWide: []string{"", "xaneiro", "febreiro", "marzo", "abril", "maio", "xuño", "xullo", "agosto", "setembro", "outubro", "novembro", "decembro"},
66 daysAbbreviated: []string{"dom.", "luns", "mar.", "mér.", "xov.", "ven.", "sáb."},
67 daysNarrow: []string{"d.", "l.", "m.", "m.", "x.", "v.", "s."},
68 daysShort: []string{"do.", "lu.", "ma.", "mé.", "xo.", "ve.", "sá."},
69 daysWide: []string{"domingo", "luns", "martes", "mércores", "xoves", "venres", "sábado"},
70 periodsAbbreviated: []string{"a.m.", "p.m."},
71 periodsNarrow: []string{"a.m.", "p.m."},
72 periodsWide: []string{"a.m.", "p.m."},
73 erasAbbreviated: []string{"a.C.", "d.C."},
74 erasNarrow: []string{"", ""},
75 erasWide: []string{"antes de Cristo", "despois de Cristo"},
76 timezones: map[string]string{"ACDT": "Horario de verán de Australia Central", "ACST": "Horario estándar de Australia Central", "ACWDT": "Horario de verán de Australia Occidental Central", "ACWST": "Horario estándar de Australia Occidental Central", "ADT": "Horario de verán do Atlántico", "AEDT": "Horario de verán de Australia Oriental", "AEST": "Horario estándar de Australia Oriental", "AKDT": "Horario de verán de Alasca", "AKST": "Horario estándar de Alasca", "ARST": "Horario de verán da Arxentina", "ART": "Horario estándar da Arxentina", "AST": "Horario estándar do Atlántico", "AWDT": "Horario de verán de Australia Occidental", "AWST": "Horario estándar de Australia Occidental", "BOT": "Horario de Bolivia", "BT": "Horario de Bután", "CAT": "Horario de África Central", "CDT": "Horario de verán central, Norteamérica", "CHADT": "Horario de verán de Chatham", "CHAST": "Horario estándar de Chatham", "CLST": "Horario de verán de Chile", "CLT": "Horario estándar de Chile", "COST": "Horario de verán de Colombia", "COT": "Horario estándar de Colombia", "CST": "Horario estándar central, Norteamérica", "ChST": "Horario estándar chamorro", "EAT": "Horario de África Oriental", "ECT": "Horario de Ecuador", "EDT": "Horario de verán do leste, América do Norte", "EST": "Horario estándar do leste, América do Norte", "GFT": "Horario da Güiana Francesa", "GMT": "Horario do meridiano de Greenwich", "GST": "Horario do Golfo", "GYT": "Horario da Güiana", "HADT": "Horario de verán de Hawai-illas Aleutianas", "HAST": "Horario estándar de Hawai-illas Aleutianas", "HAT": "Horario de verán de Terra Nova", "HECU": "Horario de verán de Cuba", "HEEG": "Horario de verán de Groenlandia Oriental", "HENOMX": "Horario de verán do noroeste de México", "HEOG": "Horario de verán de Groenlandia Occidental", "HEPM": "Horario de verán de Saint Pierre et Miquelon", "HEPMX": "Horario de verán do Pacífico mexicano", "HKST": "Horario de verán de Hong Kong", "HKT": "Horario estándar de Hong Kong", "HNCU": "Horario estándar de Cuba", "HNEG": "Horario estándar de Groenlandia Oriental", "HNNOMX": "Horario estándar do noroeste de México", "HNOG": "Horario estándar de Groenlandia Occidental", "HNPM": "Horario estándar de Saint Pierre et Miquelon", "HNPMX": "Horario estándar do Pacífico mexicano", "HNT": "Horario estándar de Terra Nova", "IST": "Horario da India", "JDT": "Horario de verán do Xapón", "JST": "Horario estándar do Xapón", "LHDT": "Horario de verán de Lord Howe", "LHST": "Horario estándar de Lord Howe", "MDT": "Horario de verán da montaña, América do Norte", "MESZ": "Horario de verán de Europa Central", "MEZ": "Horario estándar de Europa Central", "MST": "Horario estándar da montaña, América do Norte", "MYT": "Horario de Malaisia", "NZDT": "Horario de verán de Nova Zelandia", "NZST": "Horario estándar de Nova Zelandia", "OESZ": "Horario de verán de Europa Oriental", "OEZ": "Horario estándar de Europa Oriental", "PDT": "Horario de verán do Pacífico, América do Norte", "PST": "Horario estándar do Pacífico, América do Norte", "SAST": "Horario de África Meridional", "SGT": "Horario de Singapur", "SRT": "Horario de Suriname", "TMST": "Horario de verán de Turkmenistán", "TMT": "Horario estándar de Turkmenistán", "UYST": "Horario de verán do Uruguai", "UYT": "Horario estándar do Uruguai", "VET": "Horario de Venezuela", "WARST": "Horario de verán da Arxentina Occidental", "WART": "Horario estándar da Arxentina Occidental", "WAST": "Horario de verán de África Occidental", "WAT": "Horario estándar de África Occidental", "WESZ": "Horario de verán de Europa Occidental", "WEZ": "Horario estándar de Europa Occidental", "WIB": "Horario de Indonesia Occidental", "WIT": "Horario de Indonesia Oriental", "WITA": "Horario de Indonesia Central", "∅∅∅": "Horario de verán dos Azores"},
77 }
78 }
79
80
81 func (gl *gl) Locale() string {
82 return gl.locale
83 }
84
85
86 func (gl *gl) PluralsCardinal() []locales.PluralRule {
87 return gl.pluralsCardinal
88 }
89
90
91 func (gl *gl) PluralsOrdinal() []locales.PluralRule {
92 return gl.pluralsOrdinal
93 }
94
95
96 func (gl *gl) PluralsRange() []locales.PluralRule {
97 return gl.pluralsRange
98 }
99
100
101 func (gl *gl) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
102
103 n := math.Abs(num)
104 i := int64(n)
105
106 if i == 1 && v == 0 {
107 return locales.PluralRuleOne
108 }
109
110 return locales.PluralRuleOther
111 }
112
113
114 func (gl *gl) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
115 return locales.PluralRuleOther
116 }
117
118
119 func (gl *gl) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
120
121 start := gl.CardinalPluralRule(num1, v1)
122 end := gl.CardinalPluralRule(num2, v2)
123
124 if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
125 return locales.PluralRuleOther
126 } else if start == locales.PluralRuleOther && end == locales.PluralRuleOne {
127 return locales.PluralRuleOne
128 }
129
130 return locales.PluralRuleOther
131
132 }
133
134
135 func (gl *gl) MonthAbbreviated(month time.Month) string {
136 return gl.monthsAbbreviated[month]
137 }
138
139
140 func (gl *gl) MonthsAbbreviated() []string {
141 return gl.monthsAbbreviated[1:]
142 }
143
144
145 func (gl *gl) MonthNarrow(month time.Month) string {
146 return gl.monthsNarrow[month]
147 }
148
149
150 func (gl *gl) MonthsNarrow() []string {
151 return gl.monthsNarrow[1:]
152 }
153
154
155 func (gl *gl) MonthWide(month time.Month) string {
156 return gl.monthsWide[month]
157 }
158
159
160 func (gl *gl) MonthsWide() []string {
161 return gl.monthsWide[1:]
162 }
163
164
165 func (gl *gl) WeekdayAbbreviated(weekday time.Weekday) string {
166 return gl.daysAbbreviated[weekday]
167 }
168
169
170 func (gl *gl) WeekdaysAbbreviated() []string {
171 return gl.daysAbbreviated
172 }
173
174
175 func (gl *gl) WeekdayNarrow(weekday time.Weekday) string {
176 return gl.daysNarrow[weekday]
177 }
178
179
180 func (gl *gl) WeekdaysNarrow() []string {
181 return gl.daysNarrow
182 }
183
184
185 func (gl *gl) WeekdayShort(weekday time.Weekday) string {
186 return gl.daysShort[weekday]
187 }
188
189
190 func (gl *gl) WeekdaysShort() []string {
191 return gl.daysShort
192 }
193
194
195 func (gl *gl) WeekdayWide(weekday time.Weekday) string {
196 return gl.daysWide[weekday]
197 }
198
199
200 func (gl *gl) WeekdaysWide() []string {
201 return gl.daysWide
202 }
203
204
205 func (gl *gl) Decimal() string {
206 return gl.decimal
207 }
208
209
210 func (gl *gl) Group() string {
211 return gl.group
212 }
213
214
215 func (gl *gl) Minus() string {
216 return gl.minus
217 }
218
219
220 func (gl *gl) FmtNumber(num float64, v uint64) string {
221
222 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
223 l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
224 count := 0
225 inWhole := v == 0
226 b := make([]byte, 0, l)
227
228 for i := len(s) - 1; i >= 0; i-- {
229
230 if s[i] == '.' {
231 b = append(b, gl.decimal[0])
232 inWhole = true
233 continue
234 }
235
236 if inWhole {
237 if count == 3 {
238 b = append(b, gl.group[0])
239 count = 1
240 } else {
241 count++
242 }
243 }
244
245 b = append(b, s[i])
246 }
247
248 if num < 0 {
249 b = append(b, gl.minus[0])
250 }
251
252
253 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
254 b[i], b[j] = b[j], b[i]
255 }
256
257 return string(b)
258 }
259
260
261
262 func (gl *gl) FmtPercent(num float64, v uint64) string {
263 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
264 l := len(s) + 5
265 b := make([]byte, 0, l)
266
267 for i := len(s) - 1; i >= 0; i-- {
268
269 if s[i] == '.' {
270 b = append(b, gl.decimal[0])
271 continue
272 }
273
274 b = append(b, s[i])
275 }
276
277 if num < 0 {
278 b = append(b, gl.minus[0])
279 }
280
281
282 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
283 b[i], b[j] = b[j], b[i]
284 }
285
286 b = append(b, gl.percentSuffix...)
287
288 b = append(b, gl.percent...)
289
290 return string(b)
291 }
292
293
294 func (gl *gl) FmtCurrency(num float64, v uint64, currency currency.Type) string {
295
296 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
297 symbol := gl.currencies[currency]
298 l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
299 count := 0
300 inWhole := v == 0
301 b := make([]byte, 0, l)
302
303 for i := len(s) - 1; i >= 0; i-- {
304
305 if s[i] == '.' {
306 b = append(b, gl.decimal[0])
307 inWhole = true
308 continue
309 }
310
311 if inWhole {
312 if count == 3 {
313 b = append(b, gl.group[0])
314 count = 1
315 } else {
316 count++
317 }
318 }
319
320 b = append(b, s[i])
321 }
322
323 if num < 0 {
324 b = append(b, gl.minus[0])
325 }
326
327
328 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
329 b[i], b[j] = b[j], b[i]
330 }
331
332 if int(v) < 2 {
333
334 if v == 0 {
335 b = append(b, gl.decimal...)
336 }
337
338 for i := 0; i < 2-int(v); i++ {
339 b = append(b, '0')
340 }
341 }
342
343 b = append(b, gl.currencyPositiveSuffix...)
344
345 b = append(b, symbol...)
346
347 return string(b)
348 }
349
350
351
352 func (gl *gl) FmtAccounting(num float64, v uint64, currency currency.Type) string {
353
354 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
355 symbol := gl.currencies[currency]
356 l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
357 count := 0
358 inWhole := v == 0
359 b := make([]byte, 0, l)
360
361 for i := len(s) - 1; i >= 0; i-- {
362
363 if s[i] == '.' {
364 b = append(b, gl.decimal[0])
365 inWhole = true
366 continue
367 }
368
369 if inWhole {
370 if count == 3 {
371 b = append(b, gl.group[0])
372 count = 1
373 } else {
374 count++
375 }
376 }
377
378 b = append(b, s[i])
379 }
380
381 if num < 0 {
382
383 b = append(b, gl.minus[0])
384
385 }
386
387
388 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
389 b[i], b[j] = b[j], b[i]
390 }
391
392 if int(v) < 2 {
393
394 if v == 0 {
395 b = append(b, gl.decimal...)
396 }
397
398 for i := 0; i < 2-int(v); i++ {
399 b = append(b, '0')
400 }
401 }
402
403 if num < 0 {
404 b = append(b, gl.currencyNegativeSuffix...)
405 b = append(b, symbol...)
406 } else {
407
408 b = append(b, gl.currencyPositiveSuffix...)
409 b = append(b, symbol...)
410 }
411
412 return string(b)
413 }
414
415
416 func (gl *gl) FmtDateShort(t time.Time) string {
417
418 b := make([]byte, 0, 32)
419
420 if t.Day() < 10 {
421 b = append(b, '0')
422 }
423
424 b = strconv.AppendInt(b, int64(t.Day()), 10)
425 b = append(b, []byte{0x2f}...)
426
427 if t.Month() < 10 {
428 b = append(b, '0')
429 }
430
431 b = strconv.AppendInt(b, int64(t.Month()), 10)
432
433 b = append(b, []byte{0x2f}...)
434
435 if t.Year() > 9 {
436 b = append(b, strconv.Itoa(t.Year())[2:]...)
437 } else {
438 b = append(b, strconv.Itoa(t.Year())[1:]...)
439 }
440
441 return string(b)
442 }
443
444
445 func (gl *gl) FmtDateMedium(t time.Time) string {
446
447 b := make([]byte, 0, 32)
448
449 b = strconv.AppendInt(b, int64(t.Day()), 10)
450 b = append(b, []byte{0x20, 0x64, 0x65}...)
451 b = append(b, []byte{0x20}...)
452 b = append(b, gl.monthsAbbreviated[t.Month()]...)
453 b = append(b, []byte{0x20, 0x64, 0x65}...)
454 b = append(b, []byte{0x20}...)
455
456 if t.Year() > 0 {
457 b = strconv.AppendInt(b, int64(t.Year()), 10)
458 } else {
459 b = strconv.AppendInt(b, int64(-t.Year()), 10)
460 }
461
462 return string(b)
463 }
464
465
466 func (gl *gl) FmtDateLong(t time.Time) string {
467
468 b := make([]byte, 0, 32)
469
470 b = strconv.AppendInt(b, int64(t.Day()), 10)
471 b = append(b, []byte{0x20, 0x64, 0x65}...)
472 b = append(b, []byte{0x20}...)
473 b = append(b, gl.monthsWide[t.Month()]...)
474 b = append(b, []byte{0x20, 0x64, 0x65}...)
475 b = append(b, []byte{0x20}...)
476
477 if t.Year() > 0 {
478 b = strconv.AppendInt(b, int64(t.Year()), 10)
479 } else {
480 b = strconv.AppendInt(b, int64(-t.Year()), 10)
481 }
482
483 return string(b)
484 }
485
486
487 func (gl *gl) FmtDateFull(t time.Time) string {
488
489 b := make([]byte, 0, 32)
490
491 b = append(b, gl.daysWide[t.Weekday()]...)
492 b = append(b, []byte{0x2c, 0x20}...)
493 b = strconv.AppendInt(b, int64(t.Day()), 10)
494 b = append(b, []byte{0x20, 0x64, 0x65}...)
495 b = append(b, []byte{0x20}...)
496 b = append(b, gl.monthsWide[t.Month()]...)
497 b = append(b, []byte{0x20, 0x64, 0x65}...)
498 b = append(b, []byte{0x20}...)
499
500 if t.Year() > 0 {
501 b = strconv.AppendInt(b, int64(t.Year()), 10)
502 } else {
503 b = strconv.AppendInt(b, int64(-t.Year()), 10)
504 }
505
506 return string(b)
507 }
508
509
510 func (gl *gl) FmtTimeShort(t time.Time) string {
511
512 b := make([]byte, 0, 32)
513
514 if t.Hour() < 10 {
515 b = append(b, '0')
516 }
517
518 b = strconv.AppendInt(b, int64(t.Hour()), 10)
519 b = append(b, gl.timeSeparator...)
520
521 if t.Minute() < 10 {
522 b = append(b, '0')
523 }
524
525 b = strconv.AppendInt(b, int64(t.Minute()), 10)
526
527 return string(b)
528 }
529
530
531 func (gl *gl) FmtTimeMedium(t time.Time) string {
532
533 b := make([]byte, 0, 32)
534
535 if t.Hour() < 10 {
536 b = append(b, '0')
537 }
538
539 b = strconv.AppendInt(b, int64(t.Hour()), 10)
540 b = append(b, gl.timeSeparator...)
541
542 if t.Minute() < 10 {
543 b = append(b, '0')
544 }
545
546 b = strconv.AppendInt(b, int64(t.Minute()), 10)
547 b = append(b, gl.timeSeparator...)
548
549 if t.Second() < 10 {
550 b = append(b, '0')
551 }
552
553 b = strconv.AppendInt(b, int64(t.Second()), 10)
554
555 return string(b)
556 }
557
558
559 func (gl *gl) FmtTimeLong(t time.Time) string {
560
561 b := make([]byte, 0, 32)
562
563 if t.Hour() < 10 {
564 b = append(b, '0')
565 }
566
567 b = strconv.AppendInt(b, int64(t.Hour()), 10)
568 b = append(b, gl.timeSeparator...)
569
570 if t.Minute() < 10 {
571 b = append(b, '0')
572 }
573
574 b = strconv.AppendInt(b, int64(t.Minute()), 10)
575 b = append(b, gl.timeSeparator...)
576
577 if t.Second() < 10 {
578 b = append(b, '0')
579 }
580
581 b = strconv.AppendInt(b, int64(t.Second()), 10)
582 b = append(b, []byte{0x20}...)
583
584 tz, _ := t.Zone()
585 b = append(b, tz...)
586
587 return string(b)
588 }
589
590
591 func (gl *gl) FmtTimeFull(t time.Time) string {
592
593 b := make([]byte, 0, 32)
594
595 if t.Hour() < 10 {
596 b = append(b, '0')
597 }
598
599 b = strconv.AppendInt(b, int64(t.Hour()), 10)
600 b = append(b, gl.timeSeparator...)
601
602 if t.Minute() < 10 {
603 b = append(b, '0')
604 }
605
606 b = strconv.AppendInt(b, int64(t.Minute()), 10)
607 b = append(b, gl.timeSeparator...)
608
609 if t.Second() < 10 {
610 b = append(b, '0')
611 }
612
613 b = strconv.AppendInt(b, int64(t.Second()), 10)
614 b = append(b, []byte{0x20}...)
615
616 tz, _ := t.Zone()
617
618 if btz, ok := gl.timezones[tz]; ok {
619 b = append(b, btz...)
620 } else {
621 b = append(b, tz...)
622 }
623
624 return string(b)
625 }
626
View as plain text