OSDN Git Service

new repo
[bytom/vapor.git] / vendor / github.com / go-playground / locales / tk / tk.go
1 package tk
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 tk 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 'tk' locale
46 func New() locales.Translator {
47         return &tk{
48                 locale:                 "tk",
49                 pluralsCardinal:        []locales.PluralRule{2, 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", "R$", "BRN", "BRR", "BRZ", "BSD", "BTN", "BUK", "BWP", "BYB", "BYN", "BYR", "BZD", "CA$", "CDF", "CHE", "CHF", "CHW", "CLE", "CLF", "CLP", "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", "EUR", "FIM", "FJD", "FKP", "FRF", "GBP", "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", "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", "SUR", "SVC", "SYP", "SZL", "THB", "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", "ZAR", "ZMK", "ZMW", "ZRN", "ZRZ", "ZWD", "ZWL", "ZWR"},
60                 percentSuffix:          " ",
61                 currencyPositiveSuffix: " ",
62                 currencyNegativeSuffix: " ",
63                 monthsAbbreviated:      []string{"", "ýan", "few", "mart", "apr", "maý", "iýun", "iýul", "awg", "sen", "okt", "noý", "dek"},
64                 monthsNarrow:           []string{"", "Ý", "F", "M", "A", "M", "I", "I", "A", "S", "O", "N", "D"},
65                 monthsWide:             []string{"", "ýanwar", "fewral", "mart", "aprel", "maý", "iýun", "iýul", "awgust", "sentýabr", "oktýabr", "noýabr", "dekabr"},
66                 daysAbbreviated:        []string{"ýb", "db", "sb", "çb", "pb", "an", "şb"},
67                 daysNarrow:             []string{"Ý", "D", "S", "Ç", "P", "A", "Ş"},
68                 daysWide:               []string{"ýekşenbe", "duşenbe", "sişenbe", "çarşenbe", "penşenbe", "anna", "şenbe"},
69                 timezones:              map[string]string{"CST": "Merkezi Amerika, standart wagt", "MYT": "Malaýziýa", "COT": "Kolumbiýa, standart wagt", "HKT": "Gonkong, standart wagt", "CLST": "Çili, tomusky wagt", "ACST": "Merkezi Awstraliýa, standart wagt", "ECT": "Ekwador", "BOT": "Boliwiýa", "UYST": "Urugwaý, tomusky wagt", "OEZ": "Gündogar Ýewropa, standart wagt", "IST": "Hindistan", "GFT": "Fransuz Gwiana", "EDT": "Günorta Amerika, tomusky wagt", "GMT": "Grinwiç boýunça orta wagt", "AWDT": "Günbatar Awstraliýa, tomusky wagt", "HNOG": "Günbatar Grenlandiýa, standart wagt", "MDT": "MDT", "HNNOMX": "D.g.-G.b. Meksika, standart wagt", "AST": "Atlantika, standart wagt", "ART": "Argentina, standart wagt", "HEEG": "Gündogar Grenlandiýa, tomusky wagt", "WAST": "Günbatar Afrika, tomusky wagt", "HNT": "Nýufaundlend, standart wagt", "BT": "Butan", "HAST": "Gawaý-Aleut, standart wagt", "JST": "Ýaponiýa, standart wagt", "HKST": "Gonkong, tomusky wagt", "EST": "Günorta Amerika, standart wagt", "HEPMX": "Meksikan Ýuwaş umman, tomusky wagt", "HNPM": "Sen Pýer we Mikelon, standart wagt", "HECU": "Kuba, tomusky wagt", "MEZ": "Merkezi Ýewropa, standart wagt", "OESZ": "Gündogar Ýewropa, tomusky wagt", "HNEG": "Gündogar Grenlandiýa, standart wagt", "AKDT": "Alýaska, tomusky wagt", "CAT": "Merkezi Afrika", "ChST": "Çamorro", "HNPMX": "Meksikan Ýuwaş umman, standart wagt", "JDT": "Ýaponiýa, tomusky wagt", "ADT": "Atlantika, tomusky wagt", "EAT": "Gündogar Afrika", "AKST": "Alýaska, standart wagt", "SGT": "Singapur, standart wagt", "MESZ": "Merkezi Ýewropa, tomusky wagt", "HADT": "Gawaý-Aleut, tomusky wagt", "PST": "Ýuwaş umman, standart wagt", "CHADT": "Çatem, tomusky wagt", "MST": "MST", "NZST": "Täze Zelandiýa, standart wagt", "WART": "Günbatar Argentina, standart wagt", "WITA": "Merkezi Indoneziýa", "CLT": "Çili, standart wagt", "VET": "Wenesuela", "SAST": "Günorta Afrika, standart wagt", "GYT": "Gaýana", "WEZ": "Günbatar Ýewropa, standart wagt", "WIB": "Günbatar Indoneziýa", "ACWDT": "Merkezi Awstraliýa, günbatar tarap, tomusky wagt", "LHST": "Lord-Hau, standart wagt", "ARST": "Argentina, tomusky wagt", "CHAST": "Çatem, standart wagt", "HNCU": "Kuba, standart wagt", "WARST": "Günbatar Argentina, tomusky wagt", "COST": "Kolumbiýa, tomusky wagt", "PDT": "Ýuwaş umman, tomusky wagt", "SRT": "Surinam", "AWST": "Günbatar Awstraliýa, standart wagt", "HENOMX": "D.g.-G.b. Meksika, tomusky wagt", "AEDT": "Gündogar Awstraliýa, tomusky wagt", "WAT": "Günbatar Afrika, standart wagt", "WESZ": "Günbatar Ýewropa, tomusky wagt", "CDT": "Merkezi Amerika, tomusky wagt", "TMT": "Türkmenistan, standart wagt", "TMST": "Türkmenistan, tomusky wagt", "HEOG": "Günbatar Grenlandiýa, tomusky wagt", "AEST": "Gündogar Awstraliýa, standart wagt", "ACDT": "Merkezi Awstraliýa, tomusky wagt", "UYT": "Urugwaý, standart wagt", "∅∅∅": "Azor adalary, tomusky wagt", "HAT": "Nýufaundlend, tomusky wagt", "HEPM": "Sen Pýer we Mikelon, tomusky wagt", "WIT": "Gündogar Indoneziýa", "LHDT": "Lord-Hau, tomusky wagt", "ACWST": "Merkezi Awstraliýa, günbatar tarap, standart wagt", "NZDT": "Täze Zelandiýa, tomusky wagt"},
70         }
71 }
72
73 // Locale returns the current translators string locale
74 func (tk *tk) Locale() string {
75         return tk.locale
76 }
77
78 // PluralsCardinal returns the list of cardinal plural rules associated with 'tk'
79 func (tk *tk) PluralsCardinal() []locales.PluralRule {
80         return tk.pluralsCardinal
81 }
82
83 // PluralsOrdinal returns the list of ordinal plural rules associated with 'tk'
84 func (tk *tk) PluralsOrdinal() []locales.PluralRule {
85         return tk.pluralsOrdinal
86 }
87
88 // PluralsRange returns the list of range plural rules associated with 'tk'
89 func (tk *tk) PluralsRange() []locales.PluralRule {
90         return tk.pluralsRange
91 }
92
93 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'tk'
94 func (tk *tk) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
95
96         n := math.Abs(num)
97
98         if n == 1 {
99                 return locales.PluralRuleOne
100         }
101
102         return locales.PluralRuleOther
103 }
104
105 // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'tk'
106 func (tk *tk) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
107         return locales.PluralRuleUnknown
108 }
109
110 // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'tk'
111 func (tk *tk) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
112         return locales.PluralRuleUnknown
113 }
114
115 // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
116 func (tk *tk) MonthAbbreviated(month time.Month) string {
117         return tk.monthsAbbreviated[month]
118 }
119
120 // MonthsAbbreviated returns the locales abbreviated months
121 func (tk *tk) MonthsAbbreviated() []string {
122         return tk.monthsAbbreviated[1:]
123 }
124
125 // MonthNarrow returns the locales narrow month given the 'month' provided
126 func (tk *tk) MonthNarrow(month time.Month) string {
127         return tk.monthsNarrow[month]
128 }
129
130 // MonthsNarrow returns the locales narrow months
131 func (tk *tk) MonthsNarrow() []string {
132         return tk.monthsNarrow[1:]
133 }
134
135 // MonthWide returns the locales wide month given the 'month' provided
136 func (tk *tk) MonthWide(month time.Month) string {
137         return tk.monthsWide[month]
138 }
139
140 // MonthsWide returns the locales wide months
141 func (tk *tk) MonthsWide() []string {
142         return tk.monthsWide[1:]
143 }
144
145 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
146 func (tk *tk) WeekdayAbbreviated(weekday time.Weekday) string {
147         return tk.daysAbbreviated[weekday]
148 }
149
150 // WeekdaysAbbreviated returns the locales abbreviated weekdays
151 func (tk *tk) WeekdaysAbbreviated() []string {
152         return tk.daysAbbreviated
153 }
154
155 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
156 func (tk *tk) WeekdayNarrow(weekday time.Weekday) string {
157         return tk.daysNarrow[weekday]
158 }
159
160 // WeekdaysNarrow returns the locales narrow weekdays
161 func (tk *tk) WeekdaysNarrow() []string {
162         return tk.daysNarrow
163 }
164
165 // WeekdayShort returns the locales short weekday given the 'weekday' provided
166 func (tk *tk) WeekdayShort(weekday time.Weekday) string {
167         return tk.daysShort[weekday]
168 }
169
170 // WeekdaysShort returns the locales short weekdays
171 func (tk *tk) WeekdaysShort() []string {
172         return tk.daysShort
173 }
174
175 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
176 func (tk *tk) WeekdayWide(weekday time.Weekday) string {
177         return tk.daysWide[weekday]
178 }
179
180 // WeekdaysWide returns the locales wide weekdays
181 func (tk *tk) WeekdaysWide() []string {
182         return tk.daysWide
183 }
184
185 // Decimal returns the decimal point of number
186 func (tk *tk) Decimal() string {
187         return tk.decimal
188 }
189
190 // Group returns the group of number
191 func (tk *tk) Group() string {
192         return tk.group
193 }
194
195 // Group returns the minus sign of number
196 func (tk *tk) Minus() string {
197         return tk.minus
198 }
199
200 // FmtNumber returns 'num' with digits/precision of 'v' for 'tk' and handles both Whole and Real numbers based on 'v'
201 func (tk *tk) FmtNumber(num float64, v uint64) string {
202
203         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
204         l := len(s) + 2 + 2*len(s[:len(s)-int(v)-1])/3
205         count := 0
206         inWhole := v == 0
207         b := make([]byte, 0, l)
208
209         for i := len(s) - 1; i >= 0; i-- {
210
211                 if s[i] == '.' {
212                         b = append(b, tk.decimal[0])
213                         inWhole = true
214                         continue
215                 }
216
217                 if inWhole {
218                         if count == 3 {
219                                 for j := len(tk.group) - 1; j >= 0; j-- {
220                                         b = append(b, tk.group[j])
221                                 }
222                                 count = 1
223                         } else {
224                                 count++
225                         }
226                 }
227
228                 b = append(b, s[i])
229         }
230
231         if num < 0 {
232                 b = append(b, tk.minus[0])
233         }
234
235         // reverse
236         for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
237                 b[i], b[j] = b[j], b[i]
238         }
239
240         return string(b)
241 }
242
243 // FmtPercent returns 'num' with digits/precision of 'v' for 'tk' and handles both Whole and Real numbers based on 'v'
244 // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
245 func (tk *tk) FmtPercent(num float64, v uint64) string {
246         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
247         l := len(s) + 5
248         b := make([]byte, 0, l)
249
250         for i := len(s) - 1; i >= 0; i-- {
251
252                 if s[i] == '.' {
253                         b = append(b, tk.decimal[0])
254                         continue
255                 }
256
257                 b = append(b, s[i])
258         }
259
260         if num < 0 {
261                 b = append(b, tk.minus[0])
262         }
263
264         // reverse
265         for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
266                 b[i], b[j] = b[j], b[i]
267         }
268
269         b = append(b, tk.percentSuffix...)
270
271         b = append(b, tk.percent...)
272
273         return string(b)
274 }
275
276 // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'tk'
277 func (tk *tk) FmtCurrency(num float64, v uint64, currency currency.Type) string {
278
279         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
280         symbol := tk.currencies[currency]
281         l := len(s) + len(symbol) + 4 + 2*len(s[:len(s)-int(v)-1])/3
282         count := 0
283         inWhole := v == 0
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, tk.decimal[0])
290                         inWhole = true
291                         continue
292                 }
293
294                 if inWhole {
295                         if count == 3 {
296                                 for j := len(tk.group) - 1; j >= 0; j-- {
297                                         b = append(b, tk.group[j])
298                                 }
299                                 count = 1
300                         } else {
301                                 count++
302                         }
303                 }
304
305                 b = append(b, s[i])
306         }
307
308         if num < 0 {
309                 b = append(b, tk.minus[0])
310         }
311
312         // reverse
313         for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
314                 b[i], b[j] = b[j], b[i]
315         }
316
317         if int(v) < 2 {
318
319                 if v == 0 {
320                         b = append(b, tk.decimal...)
321                 }
322
323                 for i := 0; i < 2-int(v); i++ {
324                         b = append(b, '0')
325                 }
326         }
327
328         b = append(b, tk.currencyPositiveSuffix...)
329
330         b = append(b, symbol...)
331
332         return string(b)
333 }
334
335 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'tk'
336 // in accounting notation.
337 func (tk *tk) FmtAccounting(num float64, v uint64, currency currency.Type) string {
338
339         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
340         symbol := tk.currencies[currency]
341         l := len(s) + len(symbol) + 4 + 2*len(s[:len(s)-int(v)-1])/3
342         count := 0
343         inWhole := v == 0
344         b := make([]byte, 0, l)
345
346         for i := len(s) - 1; i >= 0; i-- {
347
348                 if s[i] == '.' {
349                         b = append(b, tk.decimal[0])
350                         inWhole = true
351                         continue
352                 }
353
354                 if inWhole {
355                         if count == 3 {
356                                 for j := len(tk.group) - 1; j >= 0; j-- {
357                                         b = append(b, tk.group[j])
358                                 }
359                                 count = 1
360                         } else {
361                                 count++
362                         }
363                 }
364
365                 b = append(b, s[i])
366         }
367
368         if num < 0 {
369
370                 b = append(b, tk.minus[0])
371
372         }
373
374         // reverse
375         for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
376                 b[i], b[j] = b[j], b[i]
377         }
378
379         if int(v) < 2 {
380
381                 if v == 0 {
382                         b = append(b, tk.decimal...)
383                 }
384
385                 for i := 0; i < 2-int(v); i++ {
386                         b = append(b, '0')
387                 }
388         }
389
390         if num < 0 {
391                 b = append(b, tk.currencyNegativeSuffix...)
392                 b = append(b, symbol...)
393         } else {
394
395                 b = append(b, tk.currencyPositiveSuffix...)
396                 b = append(b, symbol...)
397         }
398
399         return string(b)
400 }
401
402 // FmtDateShort returns the short date representation of 't' for 'tk'
403 func (tk *tk) FmtDateShort(t time.Time) string {
404
405         b := make([]byte, 0, 32)
406
407         if t.Day() < 10 {
408                 b = append(b, '0')
409         }
410
411         b = strconv.AppendInt(b, int64(t.Day()), 10)
412         b = append(b, []byte{0x2e}...)
413
414         if t.Month() < 10 {
415                 b = append(b, '0')
416         }
417
418         b = strconv.AppendInt(b, int64(t.Month()), 10)
419
420         b = append(b, []byte{0x2e}...)
421
422         if t.Year() > 0 {
423                 b = strconv.AppendInt(b, int64(t.Year()), 10)
424         } else {
425                 b = strconv.AppendInt(b, int64(-t.Year()), 10)
426         }
427
428         return string(b)
429 }
430
431 // FmtDateMedium returns the medium date representation of 't' for 'tk'
432 func (tk *tk) FmtDateMedium(t time.Time) string {
433
434         b := make([]byte, 0, 32)
435
436         b = strconv.AppendInt(b, int64(t.Day()), 10)
437         b = append(b, []byte{0x20}...)
438         b = append(b, tk.monthsAbbreviated[t.Month()]...)
439         b = append(b, []byte{0x20}...)
440
441         if t.Year() > 0 {
442                 b = strconv.AppendInt(b, int64(t.Year()), 10)
443         } else {
444                 b = strconv.AppendInt(b, int64(-t.Year()), 10)
445         }
446
447         return string(b)
448 }
449
450 // FmtDateLong returns the long date representation of 't' for 'tk'
451 func (tk *tk) FmtDateLong(t time.Time) string {
452
453         b := make([]byte, 0, 32)
454
455         b = strconv.AppendInt(b, int64(t.Day()), 10)
456         b = append(b, []byte{0x20}...)
457         b = append(b, tk.monthsWide[t.Month()]...)
458         b = append(b, []byte{0x20}...)
459
460         if t.Year() > 0 {
461                 b = strconv.AppendInt(b, int64(t.Year()), 10)
462         } else {
463                 b = strconv.AppendInt(b, int64(-t.Year()), 10)
464         }
465
466         return string(b)
467 }
468
469 // FmtDateFull returns the full date representation of 't' for 'tk'
470 func (tk *tk) FmtDateFull(t time.Time) string {
471
472         b := make([]byte, 0, 32)
473
474         b = strconv.AppendInt(b, int64(t.Day()), 10)
475         b = append(b, []byte{0x20}...)
476         b = append(b, tk.monthsWide[t.Month()]...)
477         b = append(b, []byte{0x20}...)
478
479         if t.Year() > 0 {
480                 b = strconv.AppendInt(b, int64(t.Year()), 10)
481         } else {
482                 b = strconv.AppendInt(b, int64(-t.Year()), 10)
483         }
484
485         b = append(b, []byte{0x20}...)
486         b = append(b, tk.daysWide[t.Weekday()]...)
487
488         return string(b)
489 }
490
491 // FmtTimeShort returns the short time representation of 't' for 'tk'
492 func (tk *tk) FmtTimeShort(t time.Time) string {
493
494         b := make([]byte, 0, 32)
495
496         if t.Hour() < 10 {
497                 b = append(b, '0')
498         }
499
500         b = strconv.AppendInt(b, int64(t.Hour()), 10)
501         b = append(b, tk.timeSeparator...)
502
503         if t.Minute() < 10 {
504                 b = append(b, '0')
505         }
506
507         b = strconv.AppendInt(b, int64(t.Minute()), 10)
508
509         return string(b)
510 }
511
512 // FmtTimeMedium returns the medium time representation of 't' for 'tk'
513 func (tk *tk) FmtTimeMedium(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, tk.timeSeparator...)
523
524         if t.Minute() < 10 {
525                 b = append(b, '0')
526         }
527
528         b = strconv.AppendInt(b, int64(t.Minute()), 10)
529         b = append(b, tk.timeSeparator...)
530
531         if t.Second() < 10 {
532                 b = append(b, '0')
533         }
534
535         b = strconv.AppendInt(b, int64(t.Second()), 10)
536
537         return string(b)
538 }
539
540 // FmtTimeLong returns the long time representation of 't' for 'tk'
541 func (tk *tk) FmtTimeLong(t time.Time) string {
542
543         b := make([]byte, 0, 32)
544
545         if t.Hour() < 10 {
546                 b = append(b, '0')
547         }
548
549         b = strconv.AppendInt(b, int64(t.Hour()), 10)
550         b = append(b, tk.timeSeparator...)
551
552         if t.Minute() < 10 {
553                 b = append(b, '0')
554         }
555
556         b = strconv.AppendInt(b, int64(t.Minute()), 10)
557         b = append(b, tk.timeSeparator...)
558
559         if t.Second() < 10 {
560                 b = append(b, '0')
561         }
562
563         b = strconv.AppendInt(b, int64(t.Second()), 10)
564         b = append(b, []byte{0x20}...)
565
566         tz, _ := t.Zone()
567         b = append(b, tz...)
568
569         return string(b)
570 }
571
572 // FmtTimeFull returns the full time representation of 't' for 'tk'
573 func (tk *tk) FmtTimeFull(t time.Time) string {
574
575         b := make([]byte, 0, 32)
576
577         if t.Hour() < 10 {
578                 b = append(b, '0')
579         }
580
581         b = strconv.AppendInt(b, int64(t.Hour()), 10)
582         b = append(b, tk.timeSeparator...)
583
584         if t.Minute() < 10 {
585                 b = append(b, '0')
586         }
587
588         b = strconv.AppendInt(b, int64(t.Minute()), 10)
589         b = append(b, tk.timeSeparator...)
590
591         if t.Second() < 10 {
592                 b = append(b, '0')
593         }
594
595         b = strconv.AppendInt(b, int64(t.Second()), 10)
596         b = append(b, []byte{0x20}...)
597
598         tz, _ := t.Zone()
599
600         if btz, ok := tk.timezones[tz]; ok {
601                 b = append(b, btz...)
602         } else {
603                 b = append(b, tz...)
604         }
605
606         return string(b)
607 }