1package sn
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 sn 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 'sn' locale
45func New() locales.Translator {
46	return &sn{
47		locale:                 "sn",
48		pluralsCardinal:        []locales.PluralRule{2, 6},
49		pluralsOrdinal:         nil,
50		pluralsRange:           nil,
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", "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", "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", "EUR", "FIM", "FJD", "FKP", "FRF", "GBP", "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", "NOK", "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", "STN", "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", "XOF", "XPD", "XPF", "XPT", "XRE", "XSU", "XTS", "XUA", "XXX", "YDD", "YER", "YUD", "YUM", "YUN", "YUR", "ZAL", "ZAR", "ZMK", "ZMW", "ZRN", "ZRZ", "ZWD", "ZWL", "ZWR"},
59		currencyNegativePrefix: "(",
60		currencyNegativeSuffix: ")",
61		monthsAbbreviated:      []string{"", "Ndi", "Kuk", "Kur", "Kub", "Chv", "Chk", "Chg", "Nya", "Gun", "Gum", "Mbu", "Zvi"},
62		monthsNarrow:           []string{"", "N", "K", "K", "K", "C", "C", "C", "N", "G", "G", "M", "Z"},
63		monthsWide:             []string{"", "Ndira", "Kukadzi", "Kurume", "Kubvumbi", "Chivabvu", "Chikumi", "Chikunguru", "Nyamavhuvhu", "Gunyana", "Gumiguru", "Mbudzi", "Zvita"},
64		daysAbbreviated:        []string{"Svo", "Muv", "Chp", "Cht", "Chn", "Chs", "Mug"},
65		daysNarrow:             []string{"S", "M", "C", "C", "C", "C", "M"},
66		daysShort:              []string{"Sv", "Mu", "Cp", "Ct", "Cn", "Cs", "Mg"},
67		daysWide:               []string{"Svondo", "Muvhuro", "Chipiri", "Chitatu", "China", "Chishanu", "Mugovera"},
68		periodsAbbreviated:     []string{"AM", "PM"},
69		periodsNarrow:          []string{"a", "p"},
70		periodsWide:            []string{"AM", "PM"},
71		erasAbbreviated:        []string{"BC", "AD"},
72		erasNarrow:             []string{"", ""},
73		erasWide:               []string{"Kristo asati auya", "mugore ramambo vedu"},
74		timezones:              map[string]string{"EST": "EST", "SRT": "SRT", "SAST": "SAST", "WIB": "WIB", "NZDT": "NZDT", "HEPM": "HEPM", "WITA": "WITA", "WIT": "WIT", "TMST": "TMST", "HAST": "HAST", "COT": "COT", "JST": "JST", "HNT": "HNT", "MDT": "MDT", "EAT": "EAT", "CLST": "CLST", "HADT": "HADT", "ECT": "ECT", "HNEG": "HNEG", "TMT": "TMT", "HECU": "HECU", "HNPMX": "HNPMX", "ADT": "ADT", "AKDT": "AKDT", "WAST": "WAST", "GFT": "GFT", "WART": "WART", "ARST": "ARST", "COST": "COST", "OEZ": "OEZ", "PDT": "PDT", "CST": "CST", "GYT": "GYT", "CHAST": "CHAST", "MYT": "MYT", "SGT": "SGT", "HEEG": "HEEG", "HKST": "HKST", "HNNOMX": "HNNOMX", "ACST": "ACST", "LHDT": "LHDT", "VET": "VET", "UYT": "UYT", "UYST": "UYST", "JDT": "JDT", "WAT": "WAT", "WESZ": "WESZ", "HNOG": "HNOG", "HEOG": "HEOG", "∅∅∅": "∅∅∅", "HAT": "HAT", "ART": "ART", "AEDT": "AEDT", "CLT": "CLT", "GMT": "GMT", "HNCU": "HNCU", "BT": "BT", "BOT": "BOT", "ACDT": "ACDT", "LHST": "LHST", "HNPM": "HNPM", "AWST": "AWST", "CDT": "CDT", "NZST": "NZST", "IST": "IST", "MST": "MST", "CAT": "CAT", "ChST": "ChST", "CHADT": "CHADT", "HEPMX": "HEPMX", "AKST": "AKST", "MESZ": "MESZ", "WARST": "WARST", "HENOMX": "HENOMX", "OESZ": "OESZ", "PST": "PST", "AST": "AST", "AEST": "AEST", "WEZ": "WEZ", "ACWST": "ACWST", "ACWDT": "ACWDT", "EDT": "EDT", "HKT": "HKT", "MEZ": "MEZ", "AWDT": "AWDT"},
75	}
76}
77
78// Locale returns the current translators string locale
79func (sn *sn) Locale() string {
80	return sn.locale
81}
82
83// PluralsCardinal returns the list of cardinal plural rules associated with 'sn'
84func (sn *sn) PluralsCardinal() []locales.PluralRule {
85	return sn.pluralsCardinal
86}
87
88// PluralsOrdinal returns the list of ordinal plural rules associated with 'sn'
89func (sn *sn) PluralsOrdinal() []locales.PluralRule {
90	return sn.pluralsOrdinal
91}
92
93// PluralsRange returns the list of range plural rules associated with 'sn'
94func (sn *sn) PluralsRange() []locales.PluralRule {
95	return sn.pluralsRange
96}
97
98// CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'sn'
99func (sn *sn) 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 'sn'
111func (sn *sn) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
112	return locales.PluralRuleUnknown
113}
114
115// RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'sn'
116func (sn *sn) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
117	return locales.PluralRuleUnknown
118}
119
120// MonthAbbreviated returns the locales abbreviated month given the 'month' provided
121func (sn *sn) MonthAbbreviated(month time.Month) string {
122	return sn.monthsAbbreviated[month]
123}
124
125// MonthsAbbreviated returns the locales abbreviated months
126func (sn *sn) MonthsAbbreviated() []string {
127	return sn.monthsAbbreviated[1:]
128}
129
130// MonthNarrow returns the locales narrow month given the 'month' provided
131func (sn *sn) MonthNarrow(month time.Month) string {
132	return sn.monthsNarrow[month]
133}
134
135// MonthsNarrow returns the locales narrow months
136func (sn *sn) MonthsNarrow() []string {
137	return sn.monthsNarrow[1:]
138}
139
140// MonthWide returns the locales wide month given the 'month' provided
141func (sn *sn) MonthWide(month time.Month) string {
142	return sn.monthsWide[month]
143}
144
145// MonthsWide returns the locales wide months
146func (sn *sn) MonthsWide() []string {
147	return sn.monthsWide[1:]
148}
149
150// WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
151func (sn *sn) WeekdayAbbreviated(weekday time.Weekday) string {
152	return sn.daysAbbreviated[weekday]
153}
154
155// WeekdaysAbbreviated returns the locales abbreviated weekdays
156func (sn *sn) WeekdaysAbbreviated() []string {
157	return sn.daysAbbreviated
158}
159
160// WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
161func (sn *sn) WeekdayNarrow(weekday time.Weekday) string {
162	return sn.daysNarrow[weekday]
163}
164
165// WeekdaysNarrow returns the locales narrow weekdays
166func (sn *sn) WeekdaysNarrow() []string {
167	return sn.daysNarrow
168}
169
170// WeekdayShort returns the locales short weekday given the 'weekday' provided
171func (sn *sn) WeekdayShort(weekday time.Weekday) string {
172	return sn.daysShort[weekday]
173}
174
175// WeekdaysShort returns the locales short weekdays
176func (sn *sn) WeekdaysShort() []string {
177	return sn.daysShort
178}
179
180// WeekdayWide returns the locales wide weekday given the 'weekday' provided
181func (sn *sn) WeekdayWide(weekday time.Weekday) string {
182	return sn.daysWide[weekday]
183}
184
185// WeekdaysWide returns the locales wide weekdays
186func (sn *sn) WeekdaysWide() []string {
187	return sn.daysWide
188}
189
190// Decimal returns the decimal point of number
191func (sn *sn) Decimal() string {
192	return sn.decimal
193}
194
195// Group returns the group of number
196func (sn *sn) Group() string {
197	return sn.group
198}
199
200// Group returns the minus sign of number
201func (sn *sn) Minus() string {
202	return sn.minus
203}
204
205// FmtNumber returns 'num' with digits/precision of 'v' for 'sn' and handles both Whole and Real numbers based on 'v'
206func (sn *sn) FmtNumber(num float64, v uint64) string {
207
208	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
209	l := len(s) + 2 + 1*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, sn.decimal[0])
218			inWhole = true
219			continue
220		}
221
222		if inWhole {
223			if count == 3 {
224				b = append(b, sn.group[0])
225				count = 1
226			} else {
227				count++
228			}
229		}
230
231		b = append(b, s[i])
232	}
233
234	if num < 0 {
235		b = append(b, sn.minus[0])
236	}
237
238	// reverse
239	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
240		b[i], b[j] = b[j], b[i]
241	}
242
243	return string(b)
244}
245
246// FmtPercent returns 'num' with digits/precision of 'v' for 'sn' and handles both Whole and Real numbers based on 'v'
247// NOTE: 'num' passed into FmtPercent is assumed to be in percent already
248func (sn *sn) FmtPercent(num float64, v uint64) string {
249	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
250	l := len(s) + 3
251	b := make([]byte, 0, l)
252
253	for i := len(s) - 1; i >= 0; i-- {
254
255		if s[i] == '.' {
256			b = append(b, sn.decimal[0])
257			continue
258		}
259
260		b = append(b, s[i])
261	}
262
263	if num < 0 {
264		b = append(b, sn.minus[0])
265	}
266
267	// reverse
268	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
269		b[i], b[j] = b[j], b[i]
270	}
271
272	b = append(b, sn.percent...)
273
274	return string(b)
275}
276
277// FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'sn'
278func (sn *sn) FmtCurrency(num float64, v uint64, currency currency.Type) string {
279
280	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
281	symbol := sn.currencies[currency]
282	l := len(s) + len(symbol) + 2 + 1*len(s[:len(s)-int(v)-1])/3
283	count := 0
284	inWhole := v == 0
285	b := make([]byte, 0, l)
286
287	for i := len(s) - 1; i >= 0; i-- {
288
289		if s[i] == '.' {
290			b = append(b, sn.decimal[0])
291			inWhole = true
292			continue
293		}
294
295		if inWhole {
296			if count == 3 {
297				b = append(b, sn.group[0])
298				count = 1
299			} else {
300				count++
301			}
302		}
303
304		b = append(b, s[i])
305	}
306
307	for j := len(symbol) - 1; j >= 0; j-- {
308		b = append(b, symbol[j])
309	}
310
311	if num < 0 {
312		b = append(b, sn.minus[0])
313	}
314
315	// reverse
316	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
317		b[i], b[j] = b[j], b[i]
318	}
319
320	if int(v) < 2 {
321
322		if v == 0 {
323			b = append(b, sn.decimal...)
324		}
325
326		for i := 0; i < 2-int(v); i++ {
327			b = append(b, '0')
328		}
329	}
330
331	return string(b)
332}
333
334// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sn'
335// in accounting notation.
336func (sn *sn) FmtAccounting(num float64, v uint64, currency currency.Type) string {
337
338	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
339	symbol := sn.currencies[currency]
340	l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
341	count := 0
342	inWhole := v == 0
343	b := make([]byte, 0, l)
344
345	for i := len(s) - 1; i >= 0; i-- {
346
347		if s[i] == '.' {
348			b = append(b, sn.decimal[0])
349			inWhole = true
350			continue
351		}
352
353		if inWhole {
354			if count == 3 {
355				b = append(b, sn.group[0])
356				count = 1
357			} else {
358				count++
359			}
360		}
361
362		b = append(b, s[i])
363	}
364
365	if num < 0 {
366
367		for j := len(symbol) - 1; j >= 0; j-- {
368			b = append(b, symbol[j])
369		}
370
371		b = append(b, sn.currencyNegativePrefix[0])
372
373	} else {
374
375		for j := len(symbol) - 1; j >= 0; j-- {
376			b = append(b, symbol[j])
377		}
378
379	}
380
381	// reverse
382	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
383		b[i], b[j] = b[j], b[i]
384	}
385
386	if int(v) < 2 {
387
388		if v == 0 {
389			b = append(b, sn.decimal...)
390		}
391
392		for i := 0; i < 2-int(v); i++ {
393			b = append(b, '0')
394		}
395	}
396
397	if num < 0 {
398		b = append(b, sn.currencyNegativeSuffix...)
399	}
400
401	return string(b)
402}
403
404// FmtDateShort returns the short date representation of 't' for 'sn'
405func (sn *sn) FmtDateShort(t time.Time) string {
406
407	b := make([]byte, 0, 32)
408
409	if t.Year() > 0 {
410		b = strconv.AppendInt(b, int64(t.Year()), 10)
411	} else {
412		b = strconv.AppendInt(b, int64(-t.Year()), 10)
413	}
414
415	b = append(b, []byte{0x2d}...)
416
417	if t.Month() < 10 {
418		b = append(b, '0')
419	}
420
421	b = strconv.AppendInt(b, int64(t.Month()), 10)
422
423	b = append(b, []byte{0x2d}...)
424
425	if t.Day() < 10 {
426		b = append(b, '0')
427	}
428
429	b = strconv.AppendInt(b, int64(t.Day()), 10)
430
431	return string(b)
432}
433
434// FmtDateMedium returns the medium date representation of 't' for 'sn'
435func (sn *sn) FmtDateMedium(t time.Time) string {
436
437	b := make([]byte, 0, 32)
438
439	if t.Year() > 0 {
440		b = strconv.AppendInt(b, int64(t.Year()), 10)
441	} else {
442		b = strconv.AppendInt(b, int64(-t.Year()), 10)
443	}
444
445	b = append(b, []byte{0x20}...)
446	b = append(b, sn.monthsAbbreviated[t.Month()]...)
447	b = append(b, []byte{0x20}...)
448	b = strconv.AppendInt(b, int64(t.Day()), 10)
449
450	return string(b)
451}
452
453// FmtDateLong returns the long date representation of 't' for 'sn'
454func (sn *sn) FmtDateLong(t time.Time) string {
455
456	b := make([]byte, 0, 32)
457
458	if t.Year() > 0 {
459		b = strconv.AppendInt(b, int64(t.Year()), 10)
460	} else {
461		b = strconv.AppendInt(b, int64(-t.Year()), 10)
462	}
463
464	b = append(b, []byte{0x20}...)
465	b = append(b, sn.monthsWide[t.Month()]...)
466	b = append(b, []byte{0x20}...)
467	b = strconv.AppendInt(b, int64(t.Day()), 10)
468
469	return string(b)
470}
471
472// FmtDateFull returns the full date representation of 't' for 'sn'
473func (sn *sn) FmtDateFull(t time.Time) string {
474
475	b := make([]byte, 0, 32)
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	b = append(b, []byte{0x20}...)
484	b = append(b, sn.monthsWide[t.Month()]...)
485	b = append(b, []byte{0x20}...)
486	b = strconv.AppendInt(b, int64(t.Day()), 10)
487	b = append(b, []byte{0x2c, 0x20}...)
488	b = append(b, sn.daysWide[t.Weekday()]...)
489
490	return string(b)
491}
492
493// FmtTimeShort returns the short time representation of 't' for 'sn'
494func (sn *sn) FmtTimeShort(t time.Time) string {
495
496	b := make([]byte, 0, 32)
497
498	if t.Hour() < 10 {
499		b = append(b, '0')
500	}
501
502	b = strconv.AppendInt(b, int64(t.Hour()), 10)
503	b = append(b, sn.timeSeparator...)
504
505	if t.Minute() < 10 {
506		b = append(b, '0')
507	}
508
509	b = strconv.AppendInt(b, int64(t.Minute()), 10)
510
511	return string(b)
512}
513
514// FmtTimeMedium returns the medium time representation of 't' for 'sn'
515func (sn *sn) FmtTimeMedium(t time.Time) string {
516
517	b := make([]byte, 0, 32)
518
519	if t.Hour() < 10 {
520		b = append(b, '0')
521	}
522
523	b = strconv.AppendInt(b, int64(t.Hour()), 10)
524	b = append(b, sn.timeSeparator...)
525
526	if t.Minute() < 10 {
527		b = append(b, '0')
528	}
529
530	b = strconv.AppendInt(b, int64(t.Minute()), 10)
531	b = append(b, sn.timeSeparator...)
532
533	if t.Second() < 10 {
534		b = append(b, '0')
535	}
536
537	b = strconv.AppendInt(b, int64(t.Second()), 10)
538
539	return string(b)
540}
541
542// FmtTimeLong returns the long time representation of 't' for 'sn'
543func (sn *sn) FmtTimeLong(t time.Time) string {
544
545	b := make([]byte, 0, 32)
546
547	if t.Hour() < 10 {
548		b = append(b, '0')
549	}
550
551	b = strconv.AppendInt(b, int64(t.Hour()), 10)
552	b = append(b, sn.timeSeparator...)
553
554	if t.Minute() < 10 {
555		b = append(b, '0')
556	}
557
558	b = strconv.AppendInt(b, int64(t.Minute()), 10)
559	b = append(b, sn.timeSeparator...)
560
561	if t.Second() < 10 {
562		b = append(b, '0')
563	}
564
565	b = strconv.AppendInt(b, int64(t.Second()), 10)
566	b = append(b, []byte{0x20}...)
567
568	tz, _ := t.Zone()
569	b = append(b, tz...)
570
571	return string(b)
572}
573
574// FmtTimeFull returns the full time representation of 't' for 'sn'
575func (sn *sn) FmtTimeFull(t time.Time) string {
576
577	b := make([]byte, 0, 32)
578
579	if t.Hour() < 10 {
580		b = append(b, '0')
581	}
582
583	b = strconv.AppendInt(b, int64(t.Hour()), 10)
584	b = append(b, sn.timeSeparator...)
585
586	if t.Minute() < 10 {
587		b = append(b, '0')
588	}
589
590	b = strconv.AppendInt(b, int64(t.Minute()), 10)
591	b = append(b, sn.timeSeparator...)
592
593	if t.Second() < 10 {
594		b = append(b, '0')
595	}
596
597	b = strconv.AppendInt(b, int64(t.Second()), 10)
598	b = append(b, []byte{0x20}...)
599
600	tz, _ := t.Zone()
601
602	if btz, ok := sn.timezones[tz]; ok {
603		b = append(b, btz...)
604	} else {
605		b = append(b, tz...)
606	}
607
608	return string(b)
609}
610