1package af
2
3import (
4	"math"
5	"strconv"
6	"time"
7
8	"github.com/go-playground/locales"
9	"github.com/go-playground/locales/currency"
10)
11
12type af 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	perMille               string
22	timeSeparator          string
23	inifinity              string
24	currencies             []string // idx = enum of currency code
25	currencyNegativePrefix string
26	currencyNegativeSuffix string
27	monthsAbbreviated      []string
28	monthsNarrow           []string
29	monthsWide             []string
30	daysAbbreviated        []string
31	daysNarrow             []string
32	daysShort              []string
33	daysWide               []string
34	periodsAbbreviated     []string
35	periodsNarrow          []string
36	periodsShort           []string
37	periodsWide            []string
38	erasAbbreviated        []string
39	erasNarrow             []string
40	erasWide               []string
41	timezones              map[string]string
42}
43
44// New returns a new instance of translator for the 'af' locale
45func New() locales.Translator {
46	return &af{
47		locale:                 "af",
48		pluralsCardinal:        []locales.PluralRule{2, 6},
49		pluralsOrdinal:         []locales.PluralRule{6},
50		pluralsRange:           []locales.PluralRule{6},
51		decimal:                ",",
52		group:                  " ",
53		minus:                  "-",
54		percent:                "%",
55		perMille:               "‰",
56		timeSeparator:          ":",
57		inifinity:              "∞",
58		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", "CA$", "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", "ESP", "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", "MTL", "MTP", "MUR", "MVP", "MVR", "MWK", "MXN", "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", "US$", "USN", "USS", "UYI", "UYP", "UYU", "UZS", "VEB", "VEF", "₫", "VNN", "VUV", "WST", "FCFA", "XAG", "XAU", "XBA", "XBB", "XBC", "XBD", "EC$", "XDR", "XEU", "XFO", "XFU", "CFA", "XPD", "CFPF", "XPT", "XRE", "XSU", "XTS", "XUA", "XXX", "YDD", "YER", "YUD", "YUM", "YUN", "YUR", "ZAL", "R", "ZMK", "ZMW", "ZRN", "ZRZ", "ZWD", "ZWL", "ZWR"},
59		currencyNegativePrefix: "(",
60		currencyNegativeSuffix: ")",
61		monthsAbbreviated:      []string{"", "Jan.", "Feb.", "Mrt.", "Apr.", "Mei", "Jun.", "Jul.", "Aug.", "Sep.", "Okt.", "Nov.", "Des."},
62		monthsNarrow:           []string{"", "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"},
63		monthsWide:             []string{"", "Januarie", "Februarie", "Maart", "April", "Mei", "Junie", "Julie", "Augustus", "September", "Oktober", "November", "Desember"},
64		daysAbbreviated:        []string{"So.", "Ma.", "Di.", "Wo.", "Do.", "Vr.", "Sa."},
65		daysNarrow:             []string{"S", "M", "D", "W", "D", "V", "S"},
66		daysShort:              []string{"So.", "Ma.", "Di.", "Wo.", "Do.", "Vr.", "Sa."},
67		daysWide:               []string{"Sondag", "Maandag", "Dinsdag", "Woensdag", "Donderdag", "Vrydag", "Saterdag"},
68		periodsAbbreviated:     []string{"vm.", "nm."},
69		periodsNarrow:          []string{"v", "n"},
70		periodsWide:            []string{"vm.", "nm."},
71		erasAbbreviated:        []string{"v.C.", "n.C."},
72		erasNarrow:             []string{"v.C.", "n.C."},
73		erasWide:               []string{"voor Christus", "na Christus"},
74		timezones:              map[string]string{"GMT": "Greenwich-tyd", "CHADT": "Chatham-dagligtyd", "CDT": "Noord-Amerikaanse sentrale dagligtyd", "HEPMX": "Meksikaanse Pasifiese dagligtyd", "GFT": "Frans-Guiana-tyd", "NZDT": "Nieu-Seeland-dagligtyd", "HKST": "Hongkong-somertyd", "LHST": "Lord Howe-standaardtyd", "WITA": "Sentraal-Indonesiese tyd", "CLT": "Chili-standaardtyd", "AST": "Atlantiese standaardtyd", "WAST": "Wes-Afrika-somertyd", "AKDT": "Alaska-dagligtyd", "ACST": "Sentraal-Australiese standaardtyd", "MEZ": "Sentraal-Europese standaardtyd", "HNPM": "Sint-Pierre en Miquelon-standaardtyd", "CLST": "Chili-somertyd", "MST": "Noord-Amerikaanse berg-standaardtyd", "MDT": "Noord-Amerikaanse berg-dagligtyd", "EDT": "Noord-Amerikaanse oostelike dagligtyd", "HENOMX": "Noordwes-Meksiko-dagligtyd", "CST": "Noord-Amerikaanse sentrale standaardtyd", "AWST": "Westelike Australiese standaardtyd", "SAST": "Suid-Afrika-standaardtyd", "JDT": "Japan-dagligtyd", "ACDT": "Sentraal-Australiese dagligtyd", "WART": "Wes-Argentinië-standaardtyd", "HNT": "Newfoundland-standaardtyd", "HNNOMX": "Noordwes-Meksiko-standaardtyd", "TMST": "Turkmenistan-somertyd", "HNCU": "Kuba-standaardtyd", "BT": "Bhoetan-tyd", "UYT": "Uruguay-standaardtyd", "WIB": "Wes-Indonesië-tyd", "HKT": "Hongkong-standaardtyd", "SRT": "Suriname-tyd", "AWDT": "Westelike Australiese dagligtyd", "HNPMX": "Meksikaanse Pasifiese standaardtyd", "MYT": "Maleisië-tyd", "AKST": "Alaska-standaardtyd", "HNEG": "Oos-Groenland-standaardtyd", "LHDT": "Lord Howe-dagligtyd", "PDT": "Pasifiese dagligtyd", "AEST": "Oostelike Australiese standaardtyd", "HEPM": "Sint-Pierre en Miquelon-dagligtyd", "WIT": "Oos-Indonesië-tyd", "UYST": "Uruguay-somertyd", "ADT": "Atlantiese dagligtyd", "BOT": "Bolivia-tyd", "HNOG": "Wes-Groenland-standaardtyd", "HEOG": "Wes-Groenland-somertyd", "EST": "Noord-Amerikaanse oostelike standaardtyd", "ACWST": "Sentraal-westelike Australiese standaard-tyd", "EAT": "Oos-Afrika-tyd", "OESZ": "Oos-Europese somertyd", "COST": "Colombië-somertyd", "WAT": "Wes-Afrika-standaardtyd", "ECT": "Ecuador-tyd", "WARST": "Wes-Argentinië-somertyd", "VET": "Venezuela-tyd", "ARST": "Argentinië-somertyd", "PST": "Pasifiese standaardtyd", "WESZ": "Wes-Europese somertyd", "JST": "Japan-standaardtyd", "IST": "Indië-standaardtyd", "HAST": "Hawaii-Aleoete-standaardtyd", "GYT": "Guyana-tyd", "ChST": "Chamorro-standaardtyd", "HECU": "Kuba-dagligtyd", "AEDT": "Oostelike Australiese dagligtyd", "MESZ": "Sentraal-Europese somertyd", "OEZ": "Oos-Europese standaardtyd", "ART": "Argentinië-standaardtyd", "ACWDT": "Sentraal-westelike Australiese dagligtyd", "HEEG": "Oos-Groenland-somertyd", "HAT": "Newfoundland-dagligtyd", "TMT": "Turkmenistan-standaardtyd", "CAT": "Sentraal-Afrika-tyd", "CHAST": "Chatham-standaardtyd", "∅∅∅": "Brasilia-somertyd", "WEZ": "Wes-Europese standaardtyd", "NZST": "Nieu-Seeland-standaardtyd", "SGT": "Singapoer-standaardtyd", "HADT": "Hawaii-Aleoete-dagligtyd", "COT": "Colombië-standaardtyd"},
75	}
76}
77
78// Locale returns the current translators string locale
79func (af *af) Locale() string {
80	return af.locale
81}
82
83// PluralsCardinal returns the list of cardinal plural rules associated with 'af'
84func (af *af) PluralsCardinal() []locales.PluralRule {
85	return af.pluralsCardinal
86}
87
88// PluralsOrdinal returns the list of ordinal plural rules associated with 'af'
89func (af *af) PluralsOrdinal() []locales.PluralRule {
90	return af.pluralsOrdinal
91}
92
93// PluralsRange returns the list of range plural rules associated with 'af'
94func (af *af) PluralsRange() []locales.PluralRule {
95	return af.pluralsRange
96}
97
98// CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'af'
99func (af *af) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
100
101	n := math.Abs(num)
102
103	if n == 1 {
104		return locales.PluralRuleOne
105	}
106
107	return locales.PluralRuleOther
108}
109
110// OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'af'
111func (af *af) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
112	return locales.PluralRuleOther
113}
114
115// RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'af'
116func (af *af) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
117	return locales.PluralRuleOther
118}
119
120// MonthAbbreviated returns the locales abbreviated month given the 'month' provided
121func (af *af) MonthAbbreviated(month time.Month) string {
122	return af.monthsAbbreviated[month]
123}
124
125// MonthsAbbreviated returns the locales abbreviated months
126func (af *af) MonthsAbbreviated() []string {
127	return af.monthsAbbreviated[1:]
128}
129
130// MonthNarrow returns the locales narrow month given the 'month' provided
131func (af *af) MonthNarrow(month time.Month) string {
132	return af.monthsNarrow[month]
133}
134
135// MonthsNarrow returns the locales narrow months
136func (af *af) MonthsNarrow() []string {
137	return af.monthsNarrow[1:]
138}
139
140// MonthWide returns the locales wide month given the 'month' provided
141func (af *af) MonthWide(month time.Month) string {
142	return af.monthsWide[month]
143}
144
145// MonthsWide returns the locales wide months
146func (af *af) MonthsWide() []string {
147	return af.monthsWide[1:]
148}
149
150// WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
151func (af *af) WeekdayAbbreviated(weekday time.Weekday) string {
152	return af.daysAbbreviated[weekday]
153}
154
155// WeekdaysAbbreviated returns the locales abbreviated weekdays
156func (af *af) WeekdaysAbbreviated() []string {
157	return af.daysAbbreviated
158}
159
160// WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
161func (af *af) WeekdayNarrow(weekday time.Weekday) string {
162	return af.daysNarrow[weekday]
163}
164
165// WeekdaysNarrow returns the locales narrow weekdays
166func (af *af) WeekdaysNarrow() []string {
167	return af.daysNarrow
168}
169
170// WeekdayShort returns the locales short weekday given the 'weekday' provided
171func (af *af) WeekdayShort(weekday time.Weekday) string {
172	return af.daysShort[weekday]
173}
174
175// WeekdaysShort returns the locales short weekdays
176func (af *af) WeekdaysShort() []string {
177	return af.daysShort
178}
179
180// WeekdayWide returns the locales wide weekday given the 'weekday' provided
181func (af *af) WeekdayWide(weekday time.Weekday) string {
182	return af.daysWide[weekday]
183}
184
185// WeekdaysWide returns the locales wide weekdays
186func (af *af) WeekdaysWide() []string {
187	return af.daysWide
188}
189
190// Decimal returns the decimal point of number
191func (af *af) Decimal() string {
192	return af.decimal
193}
194
195// Group returns the group of number
196func (af *af) Group() string {
197	return af.group
198}
199
200// Group returns the minus sign of number
201func (af *af) Minus() string {
202	return af.minus
203}
204
205// FmtNumber returns 'num' with digits/precision of 'v' for 'af' and handles both Whole and Real numbers based on 'v'
206func (af *af) FmtNumber(num float64, v uint64) string {
207
208	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
209	l := len(s) + 2 + 2*len(s[:len(s)-int(v)-1])/3
210	count := 0
211	inWhole := v == 0
212	b := make([]byte, 0, l)
213
214	for i := len(s) - 1; i >= 0; i-- {
215
216		if s[i] == '.' {
217			b = append(b, af.decimal[0])
218			inWhole = true
219			continue
220		}
221
222		if inWhole {
223			if count == 3 {
224				for j := len(af.group) - 1; j >= 0; j-- {
225					b = append(b, af.group[j])
226				}
227				count = 1
228			} else {
229				count++
230			}
231		}
232
233		b = append(b, s[i])
234	}
235
236	if num < 0 {
237		b = append(b, af.minus[0])
238	}
239
240	// reverse
241	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
242		b[i], b[j] = b[j], b[i]
243	}
244
245	return string(b)
246}
247
248// FmtPercent returns 'num' with digits/precision of 'v' for 'af' and handles both Whole and Real numbers based on 'v'
249// NOTE: 'num' passed into FmtPercent is assumed to be in percent already
250func (af *af) FmtPercent(num float64, v uint64) string {
251	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
252	l := len(s) + 3
253	b := make([]byte, 0, l)
254
255	for i := len(s) - 1; i >= 0; i-- {
256
257		if s[i] == '.' {
258			b = append(b, af.decimal[0])
259			continue
260		}
261
262		b = append(b, s[i])
263	}
264
265	if num < 0 {
266		b = append(b, af.minus[0])
267	}
268
269	// reverse
270	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
271		b[i], b[j] = b[j], b[i]
272	}
273
274	b = append(b, af.percent...)
275
276	return string(b)
277}
278
279// FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'af'
280func (af *af) FmtCurrency(num float64, v uint64, currency currency.Type) string {
281
282	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
283	symbol := af.currencies[currency]
284	l := len(s) + len(symbol) + 2 + 2*len(s[:len(s)-int(v)-1])/3
285	count := 0
286	inWhole := v == 0
287	b := make([]byte, 0, l)
288
289	for i := len(s) - 1; i >= 0; i-- {
290
291		if s[i] == '.' {
292			b = append(b, af.decimal[0])
293			inWhole = true
294			continue
295		}
296
297		if inWhole {
298			if count == 3 {
299				for j := len(af.group) - 1; j >= 0; j-- {
300					b = append(b, af.group[j])
301				}
302				count = 1
303			} else {
304				count++
305			}
306		}
307
308		b = append(b, s[i])
309	}
310
311	for j := len(symbol) - 1; j >= 0; j-- {
312		b = append(b, symbol[j])
313	}
314
315	if num < 0 {
316		b = append(b, af.minus[0])
317	}
318
319	// reverse
320	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
321		b[i], b[j] = b[j], b[i]
322	}
323
324	if int(v) < 2 {
325
326		if v == 0 {
327			b = append(b, af.decimal...)
328		}
329
330		for i := 0; i < 2-int(v); i++ {
331			b = append(b, '0')
332		}
333	}
334
335	return string(b)
336}
337
338// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'af'
339// in accounting notation.
340func (af *af) FmtAccounting(num float64, v uint64, currency currency.Type) string {
341
342	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
343	symbol := af.currencies[currency]
344	l := len(s) + len(symbol) + 4 + 2*len(s[:len(s)-int(v)-1])/3
345	count := 0
346	inWhole := v == 0
347	b := make([]byte, 0, l)
348
349	for i := len(s) - 1; i >= 0; i-- {
350
351		if s[i] == '.' {
352			b = append(b, af.decimal[0])
353			inWhole = true
354			continue
355		}
356
357		if inWhole {
358			if count == 3 {
359				for j := len(af.group) - 1; j >= 0; j-- {
360					b = append(b, af.group[j])
361				}
362				count = 1
363			} else {
364				count++
365			}
366		}
367
368		b = append(b, s[i])
369	}
370
371	if num < 0 {
372
373		for j := len(symbol) - 1; j >= 0; j-- {
374			b = append(b, symbol[j])
375		}
376
377		b = append(b, af.currencyNegativePrefix[0])
378
379	} else {
380
381		for j := len(symbol) - 1; j >= 0; j-- {
382			b = append(b, symbol[j])
383		}
384
385	}
386
387	// reverse
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, af.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, af.currencyNegativeSuffix...)
405	}
406
407	return string(b)
408}
409
410// FmtDateShort returns the short date representation of 't' for 'af'
411func (af *af) FmtDateShort(t time.Time) string {
412
413	b := make([]byte, 0, 32)
414
415	if t.Year() > 0 {
416		b = strconv.AppendInt(b, int64(t.Year()), 10)
417	} else {
418		b = strconv.AppendInt(b, int64(-t.Year()), 10)
419	}
420
421	b = append(b, []byte{0x2d}...)
422
423	if t.Month() < 10 {
424		b = append(b, '0')
425	}
426
427	b = strconv.AppendInt(b, int64(t.Month()), 10)
428
429	b = append(b, []byte{0x2d}...)
430
431	if t.Day() < 10 {
432		b = append(b, '0')
433	}
434
435	b = strconv.AppendInt(b, int64(t.Day()), 10)
436
437	return string(b)
438}
439
440// FmtDateMedium returns the medium date representation of 't' for 'af'
441func (af *af) FmtDateMedium(t time.Time) string {
442
443	b := make([]byte, 0, 32)
444
445	if t.Day() < 10 {
446		b = append(b, '0')
447	}
448
449	b = strconv.AppendInt(b, int64(t.Day()), 10)
450	b = append(b, []byte{0x20}...)
451	b = append(b, af.monthsAbbreviated[t.Month()]...)
452	b = append(b, []byte{0x20}...)
453
454	if t.Year() > 0 {
455		b = strconv.AppendInt(b, int64(t.Year()), 10)
456	} else {
457		b = strconv.AppendInt(b, int64(-t.Year()), 10)
458	}
459
460	return string(b)
461}
462
463// FmtDateLong returns the long date representation of 't' for 'af'
464func (af *af) FmtDateLong(t time.Time) string {
465
466	b := make([]byte, 0, 32)
467
468	if t.Day() < 10 {
469		b = append(b, '0')
470	}
471
472	b = strconv.AppendInt(b, int64(t.Day()), 10)
473	b = append(b, []byte{0x20}...)
474	b = append(b, af.monthsWide[t.Month()]...)
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// FmtDateFull returns the full date representation of 't' for 'af'
487func (af *af) FmtDateFull(t time.Time) string {
488
489	b := make([]byte, 0, 32)
490
491	b = append(b, af.daysWide[t.Weekday()]...)
492	b = append(b, []byte{0x2c, 0x20}...)
493
494	if t.Day() < 10 {
495		b = append(b, '0')
496	}
497
498	b = strconv.AppendInt(b, int64(t.Day()), 10)
499	b = append(b, []byte{0x20}...)
500	b = append(b, af.monthsWide[t.Month()]...)
501	b = append(b, []byte{0x20}...)
502
503	if t.Year() > 0 {
504		b = strconv.AppendInt(b, int64(t.Year()), 10)
505	} else {
506		b = strconv.AppendInt(b, int64(-t.Year()), 10)
507	}
508
509	return string(b)
510}
511
512// FmtTimeShort returns the short time representation of 't' for 'af'
513func (af *af) FmtTimeShort(t time.Time) string {
514
515	b := make([]byte, 0, 32)
516
517	if t.Hour() < 10 {
518		b = append(b, '0')
519	}
520
521	b = strconv.AppendInt(b, int64(t.Hour()), 10)
522	b = append(b, af.timeSeparator...)
523
524	if t.Minute() < 10 {
525		b = append(b, '0')
526	}
527
528	b = strconv.AppendInt(b, int64(t.Minute()), 10)
529
530	return string(b)
531}
532
533// FmtTimeMedium returns the medium time representation of 't' for 'af'
534func (af *af) FmtTimeMedium(t time.Time) string {
535
536	b := make([]byte, 0, 32)
537
538	if t.Hour() < 10 {
539		b = append(b, '0')
540	}
541
542	b = strconv.AppendInt(b, int64(t.Hour()), 10)
543	b = append(b, af.timeSeparator...)
544
545	if t.Minute() < 10 {
546		b = append(b, '0')
547	}
548
549	b = strconv.AppendInt(b, int64(t.Minute()), 10)
550	b = append(b, af.timeSeparator...)
551
552	if t.Second() < 10 {
553		b = append(b, '0')
554	}
555
556	b = strconv.AppendInt(b, int64(t.Second()), 10)
557
558	return string(b)
559}
560
561// FmtTimeLong returns the long time representation of 't' for 'af'
562func (af *af) FmtTimeLong(t time.Time) string {
563
564	b := make([]byte, 0, 32)
565
566	if t.Hour() < 10 {
567		b = append(b, '0')
568	}
569
570	b = strconv.AppendInt(b, int64(t.Hour()), 10)
571	b = append(b, af.timeSeparator...)
572
573	if t.Minute() < 10 {
574		b = append(b, '0')
575	}
576
577	b = strconv.AppendInt(b, int64(t.Minute()), 10)
578	b = append(b, af.timeSeparator...)
579
580	if t.Second() < 10 {
581		b = append(b, '0')
582	}
583
584	b = strconv.AppendInt(b, int64(t.Second()), 10)
585	b = append(b, []byte{0x20}...)
586
587	tz, _ := t.Zone()
588	b = append(b, tz...)
589
590	return string(b)
591}
592
593// FmtTimeFull returns the full time representation of 't' for 'af'
594func (af *af) FmtTimeFull(t time.Time) string {
595
596	b := make([]byte, 0, 32)
597
598	if t.Hour() < 10 {
599		b = append(b, '0')
600	}
601
602	b = strconv.AppendInt(b, int64(t.Hour()), 10)
603	b = append(b, af.timeSeparator...)
604
605	if t.Minute() < 10 {
606		b = append(b, '0')
607	}
608
609	b = strconv.AppendInt(b, int64(t.Minute()), 10)
610	b = append(b, af.timeSeparator...)
611
612	if t.Second() < 10 {
613		b = append(b, '0')
614	}
615
616	b = strconv.AppendInt(b, int64(t.Second()), 10)
617	b = append(b, []byte{0x20}...)
618
619	tz, _ := t.Zone()
620
621	if btz, ok := af.timezones[tz]; ok {
622		b = append(b, btz...)
623	} else {
624		b = append(b, tz...)
625	}
626
627	return string(b)
628}
629