OSDN Git Service

new repo
[bytom/vapor.git] / vendor / github.com / go-playground / locales / fi / fi.go
1 package fi
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 fi 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 'fi' locale
46 func New() locales.Translator {
47         return &fi{
48                 locale:                 "fi",
49                 pluralsCardinal:        []locales.PluralRule{2, 6},
50                 pluralsOrdinal:         []locales.PluralRule{6},
51                 pluralsRange:           []locales.PluralRule{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", "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", "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", "€", "mk", "FJD", "FKP", "FRF", "£", "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", "¥", "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", "SUR", "SVC", "SYP", "SZL", "THB", "TJR", "TJS", "TMM", "TMT", "TND", "TOP", "TPE", "TRL", "TRY", "TTD", "TWD", "TZS", "UAH", "UAK", "UGS", "UGX", "$", "USN", "USS", "UYI", "UYP", "UYU", "UZS", "VEB", "VEF", "VND", "VNN", "VUV", "WST", "FCFA", "XAG", "XAU", "XBA", "XBB", "XBC", "XBD", "XCD", "XDR", "XEU", "XFO", "XFU", "CFA", "XPD", "XPF", "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{"", "tammik.", "helmik.", "maalisk.", "huhtik.", "toukok.", "kesäk.", "heinäk.", "elok.", "syysk.", "lokak.", "marrask.", "jouluk."},
64                 monthsNarrow:           []string{"", "T", "H", "M", "H", "T", "K", "H", "E", "S", "L", "M", "J"},
65                 monthsWide:             []string{"", "tammikuuta", "helmikuuta", "maaliskuuta", "huhtikuuta", "toukokuuta", "kesäkuuta", "heinäkuuta", "elokuuta", "syyskuuta", "lokakuuta", "marraskuuta", "joulukuuta"},
66                 daysAbbreviated:        []string{"su", "ma", "ti", "ke", "to", "pe", "la"},
67                 daysNarrow:             []string{"S", "M", "T", "K", "T", "P", "L"},
68                 daysShort:              []string{"su", "ma", "ti", "ke", "to", "pe", "la"},
69                 daysWide:               []string{"sunnuntaina", "maanantaina", "tiistaina", "keskiviikkona", "torstaina", "perjantaina", "lauantaina"},
70                 periodsAbbreviated:     []string{"ap.", "ip."},
71                 periodsNarrow:          []string{"ap.", "ip."},
72                 periodsWide:            []string{"ap.", "ip."},
73                 erasAbbreviated:        []string{"eKr.", "jKr."},
74                 erasNarrow:             []string{"eKr", "jKr"},
75                 erasWide:               []string{"ennen Kristuksen syntymää", "jälkeen Kristuksen syntymän"},
76                 timezones:              map[string]string{"HEEG": "Itä-Grönlannin kesäaika", "AKDT": "Alaskan kesäaika", "ChST": "Tšamorron aika", "AWST": "Länsi-Australian normaaliaika", "ACWDT": "Läntisen Keski-Australian kesäaika", "IST": "Intian aika", "COT": "Kolumbian normaaliaika", "∅∅∅": "Amazonin kesäaika", "AEST": "Itä-Australian normaaliaika", "HNOG": "Länsi-Grönlannin normaaliaika", "TMST": "Turkmenistanin kesäaika", "HKST": "Hongkongin kesäaika", "EDT": "Yhdysvaltain itäinen kesäaika", "WEZ": "Länsi-Euroopan normaaliaika", "ACWST": "Läntisen Keski-Australian normaaliaika", "UYT": "Uruguayn normaaliaika", "TMT": "Turkmenistanin normaaliaika", "HEPMX": "Meksikon Tyynenmeren kesäaika", "SRT": "Surinamen aika", "WIT": "Itä-Indonesian aika", "LHDT": "Lord Howen kesäaika", "WART": "Länsi-Argentiinan normaaliaika", "HAT": "Newfoundlandin kesäaika", "EST": "Yhdysvaltain itäinen normaaliaika", "SGT": "Singaporen aika", "PST": "Yhdysvaltain Tyynenmeren normaaliaika", "HNCU": "Kuuban normaaliaika", "HEOG": "Länsi-Grönlannin kesäaika", "MST": "Macaon normaaliaika", "OESZ": "Itä-Euroopan kesäaika", "HNT": "Newfoundlandin normaaliaika", "CLT": "Chilen normaaliaika", "AKST": "Alaskan normaaliaika", "ACDT": "Keski-Australian kesäaika", "WESZ": "Länsi-Euroopan kesäaika", "HECU": "Kuuban kesäaika", "GFT": "Ranskan Guayanan aika", "WARST": "Länsi-Argentiinan kesäaika", "ART": "Argentiinan normaaliaika", "LHST": "Lord Howen normaaliaika", "VET": "Venezuelan aika", "EAT": "Itä-Afrikan aika", "SAST": "Etelä-Afrikan aika", "GYT": "Guyanan aika", "ACST": "Keski-Australian normaaliaika", "CST": "Yhdysvaltain keskinen normaaliaika", "HADT": "Havaijin-Aleuttien kesäaika", "HNNOMX": "Luoteis-Meksikon normaaliaika", "HENOMX": "Luoteis-Meksikon kesäaika", "ARST": "Argentiinan kesäaika", "CLST": "Chilen kesäaika", "CAT": "Keski-Afrikan aika", "GMT": "Greenwichin normaaliaika", "CHAST": "Chathamin normaaliaika", "CHADT": "Chathamin kesäaika", "BT": "Bhutanin aika", "HNPM": "Saint-Pierren ja Miquelonin normaaliaika", "MYT": "Malesian aika", "NZST": "Uuden-Seelannin normaaliaika", "ADT": "Kanadan Atlantin kesäaika", "WAT": "Länsi-Afrikan normaaliaika", "COST": "Kolumbian kesäaika", "WIB": "Länsi-Indonesian aika", "CDT": "Yhdysvaltain keskinen kesäaika", "UYST": "Uruguayn kesäaika", "WITA": "Keski-Indonesian aika", "PDT": "Yhdysvaltain Tyynenmeren kesäaika", "AWDT": "Länsi-Australian kesäaika", "MESZ": "Keski-Euroopan kesäaika", "JDT": "Japanin kesäaika", "AEDT": "Itä-Australian kesäaika", "ECT": "Ecuadorin aika", "HAST": "Havaijin-Aleuttien normaaliaika", "NZDT": "Uuden-Seelannin kesäaika", "WAST": "Länsi-Afrikan kesäaika", "MEZ": "Keski-Euroopan normaaliaika", "JST": "Japanin normaaliaika", "AST": "Kanadan Atlantin normaaliaika", "HKT": "Hongkongin normaaliaika", "HNPMX": "Meksikon Tyynenmeren normaaliaika", "MDT": "Macaon kesäaika", "OEZ": "Itä-Euroopan normaaliaika", "HNEG": "Itä-Grönlannin normaaliaika", "HEPM": "Saint-Pierren ja Miquelonin kesäaika", "BOT": "Bolivian aika"},
77         }
78 }
79
80 // Locale returns the current translators string locale
81 func (fi *fi) Locale() string {
82         return fi.locale
83 }
84
85 // PluralsCardinal returns the list of cardinal plural rules associated with 'fi'
86 func (fi *fi) PluralsCardinal() []locales.PluralRule {
87         return fi.pluralsCardinal
88 }
89
90 // PluralsOrdinal returns the list of ordinal plural rules associated with 'fi'
91 func (fi *fi) PluralsOrdinal() []locales.PluralRule {
92         return fi.pluralsOrdinal
93 }
94
95 // PluralsRange returns the list of range plural rules associated with 'fi'
96 func (fi *fi) PluralsRange() []locales.PluralRule {
97         return fi.pluralsRange
98 }
99
100 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'fi'
101 func (fi *fi) 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 // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'fi'
114 func (fi *fi) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
115         return locales.PluralRuleOther
116 }
117
118 // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'fi'
119 func (fi *fi) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
120         return locales.PluralRuleOther
121 }
122
123 // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
124 func (fi *fi) MonthAbbreviated(month time.Month) string {
125         return fi.monthsAbbreviated[month]
126 }
127
128 // MonthsAbbreviated returns the locales abbreviated months
129 func (fi *fi) MonthsAbbreviated() []string {
130         return fi.monthsAbbreviated[1:]
131 }
132
133 // MonthNarrow returns the locales narrow month given the 'month' provided
134 func (fi *fi) MonthNarrow(month time.Month) string {
135         return fi.monthsNarrow[month]
136 }
137
138 // MonthsNarrow returns the locales narrow months
139 func (fi *fi) MonthsNarrow() []string {
140         return fi.monthsNarrow[1:]
141 }
142
143 // MonthWide returns the locales wide month given the 'month' provided
144 func (fi *fi) MonthWide(month time.Month) string {
145         return fi.monthsWide[month]
146 }
147
148 // MonthsWide returns the locales wide months
149 func (fi *fi) MonthsWide() []string {
150         return fi.monthsWide[1:]
151 }
152
153 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
154 func (fi *fi) WeekdayAbbreviated(weekday time.Weekday) string {
155         return fi.daysAbbreviated[weekday]
156 }
157
158 // WeekdaysAbbreviated returns the locales abbreviated weekdays
159 func (fi *fi) WeekdaysAbbreviated() []string {
160         return fi.daysAbbreviated
161 }
162
163 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
164 func (fi *fi) WeekdayNarrow(weekday time.Weekday) string {
165         return fi.daysNarrow[weekday]
166 }
167
168 // WeekdaysNarrow returns the locales narrow weekdays
169 func (fi *fi) WeekdaysNarrow() []string {
170         return fi.daysNarrow
171 }
172
173 // WeekdayShort returns the locales short weekday given the 'weekday' provided
174 func (fi *fi) WeekdayShort(weekday time.Weekday) string {
175         return fi.daysShort[weekday]
176 }
177
178 // WeekdaysShort returns the locales short weekdays
179 func (fi *fi) WeekdaysShort() []string {
180         return fi.daysShort
181 }
182
183 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
184 func (fi *fi) WeekdayWide(weekday time.Weekday) string {
185         return fi.daysWide[weekday]
186 }
187
188 // WeekdaysWide returns the locales wide weekdays
189 func (fi *fi) WeekdaysWide() []string {
190         return fi.daysWide
191 }
192
193 // Decimal returns the decimal point of number
194 func (fi *fi) Decimal() string {
195         return fi.decimal
196 }
197
198 // Group returns the group of number
199 func (fi *fi) Group() string {
200         return fi.group
201 }
202
203 // Group returns the minus sign of number
204 func (fi *fi) Minus() string {
205         return fi.minus
206 }
207
208 // FmtNumber returns 'num' with digits/precision of 'v' for 'fi' and handles both Whole and Real numbers based on 'v'
209 func (fi *fi) FmtNumber(num float64, v uint64) string {
210
211         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
212         l := len(s) + 4 + 2*len(s[:len(s)-int(v)-1])/3
213         count := 0
214         inWhole := v == 0
215         b := make([]byte, 0, l)
216
217         for i := len(s) - 1; i >= 0; i-- {
218
219                 if s[i] == '.' {
220                         b = append(b, fi.decimal[0])
221                         inWhole = true
222                         continue
223                 }
224
225                 if inWhole {
226                         if count == 3 {
227                                 for j := len(fi.group) - 1; j >= 0; j-- {
228                                         b = append(b, fi.group[j])
229                                 }
230                                 count = 1
231                         } else {
232                                 count++
233                         }
234                 }
235
236                 b = append(b, s[i])
237         }
238
239         if num < 0 {
240                 for j := len(fi.minus) - 1; j >= 0; j-- {
241                         b = append(b, fi.minus[j])
242                 }
243         }
244
245         // reverse
246         for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
247                 b[i], b[j] = b[j], b[i]
248         }
249
250         return string(b)
251 }
252
253 // FmtPercent returns 'num' with digits/precision of 'v' for 'fi' and handles both Whole and Real numbers based on 'v'
254 // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
255 func (fi *fi) FmtPercent(num float64, v uint64) string {
256         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
257         l := len(s) + 7
258         b := make([]byte, 0, l)
259
260         for i := len(s) - 1; i >= 0; i-- {
261
262                 if s[i] == '.' {
263                         b = append(b, fi.decimal[0])
264                         continue
265                 }
266
267                 b = append(b, s[i])
268         }
269
270         if num < 0 {
271                 for j := len(fi.minus) - 1; j >= 0; j-- {
272                         b = append(b, fi.minus[j])
273                 }
274         }
275
276         // reverse
277         for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
278                 b[i], b[j] = b[j], b[i]
279         }
280
281         b = append(b, fi.percentSuffix...)
282
283         b = append(b, fi.percent...)
284
285         return string(b)
286 }
287
288 // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'fi'
289 func (fi *fi) FmtCurrency(num float64, v uint64, currency currency.Type) string {
290
291         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
292         symbol := fi.currencies[currency]
293         l := len(s) + len(symbol) + 6 + 2*len(s[:len(s)-int(v)-1])/3
294         count := 0
295         inWhole := v == 0
296         b := make([]byte, 0, l)
297
298         for i := len(s) - 1; i >= 0; i-- {
299
300                 if s[i] == '.' {
301                         b = append(b, fi.decimal[0])
302                         inWhole = true
303                         continue
304                 }
305
306                 if inWhole {
307                         if count == 3 {
308                                 for j := len(fi.group) - 1; j >= 0; j-- {
309                                         b = append(b, fi.group[j])
310                                 }
311                                 count = 1
312                         } else {
313                                 count++
314                         }
315                 }
316
317                 b = append(b, s[i])
318         }
319
320         if num < 0 {
321                 for j := len(fi.minus) - 1; j >= 0; j-- {
322                         b = append(b, fi.minus[j])
323                 }
324         }
325
326         // reverse
327         for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
328                 b[i], b[j] = b[j], b[i]
329         }
330
331         if int(v) < 2 {
332
333                 if v == 0 {
334                         b = append(b, fi.decimal...)
335                 }
336
337                 for i := 0; i < 2-int(v); i++ {
338                         b = append(b, '0')
339                 }
340         }
341
342         b = append(b, fi.currencyPositiveSuffix...)
343
344         b = append(b, symbol...)
345
346         return string(b)
347 }
348
349 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fi'
350 // in accounting notation.
351 func (fi *fi) FmtAccounting(num float64, v uint64, currency currency.Type) string {
352
353         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
354         symbol := fi.currencies[currency]
355         l := len(s) + len(symbol) + 6 + 2*len(s[:len(s)-int(v)-1])/3
356         count := 0
357         inWhole := v == 0
358         b := make([]byte, 0, l)
359
360         for i := len(s) - 1; i >= 0; i-- {
361
362                 if s[i] == '.' {
363                         b = append(b, fi.decimal[0])
364                         inWhole = true
365                         continue
366                 }
367
368                 if inWhole {
369                         if count == 3 {
370                                 for j := len(fi.group) - 1; j >= 0; j-- {
371                                         b = append(b, fi.group[j])
372                                 }
373                                 count = 1
374                         } else {
375                                 count++
376                         }
377                 }
378
379                 b = append(b, s[i])
380         }
381
382         if num < 0 {
383
384                 for j := len(fi.minus) - 1; j >= 0; j-- {
385                         b = append(b, fi.minus[j])
386                 }
387
388         }
389
390         // reverse
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, fi.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, fi.currencyNegativeSuffix...)
408                 b = append(b, symbol...)
409         } else {
410
411                 b = append(b, fi.currencyPositiveSuffix...)
412                 b = append(b, symbol...)
413         }
414
415         return string(b)
416 }
417
418 // FmtDateShort returns the short date representation of 't' for 'fi'
419 func (fi *fi) FmtDateShort(t time.Time) string {
420
421         b := make([]byte, 0, 32)
422
423         b = strconv.AppendInt(b, int64(t.Day()), 10)
424         b = append(b, []byte{0x2e}...)
425         b = strconv.AppendInt(b, int64(t.Month()), 10)
426         b = append(b, []byte{0x2e}...)
427
428         if t.Year() > 0 {
429                 b = strconv.AppendInt(b, int64(t.Year()), 10)
430         } else {
431                 b = strconv.AppendInt(b, int64(-t.Year()), 10)
432         }
433
434         return string(b)
435 }
436
437 // FmtDateMedium returns the medium date representation of 't' for 'fi'
438 func (fi *fi) FmtDateMedium(t time.Time) string {
439
440         b := make([]byte, 0, 32)
441
442         b = strconv.AppendInt(b, int64(t.Day()), 10)
443         b = append(b, []byte{0x2e}...)
444         b = strconv.AppendInt(b, int64(t.Month()), 10)
445         b = append(b, []byte{0x2e}...)
446
447         if t.Year() > 0 {
448                 b = strconv.AppendInt(b, int64(t.Year()), 10)
449         } else {
450                 b = strconv.AppendInt(b, int64(-t.Year()), 10)
451         }
452
453         return string(b)
454 }
455
456 // FmtDateLong returns the long date representation of 't' for 'fi'
457 func (fi *fi) FmtDateLong(t time.Time) string {
458
459         b := make([]byte, 0, 32)
460
461         b = strconv.AppendInt(b, int64(t.Day()), 10)
462         b = append(b, []byte{0x2e, 0x20}...)
463         b = append(b, fi.monthsWide[t.Month()]...)
464         b = append(b, []byte{0x20}...)
465
466         if t.Year() > 0 {
467                 b = strconv.AppendInt(b, int64(t.Year()), 10)
468         } else {
469                 b = strconv.AppendInt(b, int64(-t.Year()), 10)
470         }
471
472         return string(b)
473 }
474
475 // FmtDateFull returns the full date representation of 't' for 'fi'
476 func (fi *fi) FmtDateFull(t time.Time) string {
477
478         b := make([]byte, 0, 32)
479
480         b = append(b, []byte{0x63, 0x63, 0x63, 0x63, 0x20}...)
481         b = strconv.AppendInt(b, int64(t.Day()), 10)
482         b = append(b, []byte{0x2e, 0x20}...)
483         b = append(b, fi.monthsWide[t.Month()]...)
484         b = append(b, []byte{0x20}...)
485
486         if t.Year() > 0 {
487                 b = strconv.AppendInt(b, int64(t.Year()), 10)
488         } else {
489                 b = strconv.AppendInt(b, int64(-t.Year()), 10)
490         }
491
492         return string(b)
493 }
494
495 // FmtTimeShort returns the short time representation of 't' for 'fi'
496 func (fi *fi) FmtTimeShort(t time.Time) string {
497
498         b := make([]byte, 0, 32)
499
500         b = strconv.AppendInt(b, int64(t.Hour()), 10)
501         b = append(b, []byte{0x2e}...)
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 'fi'
513 func (fi *fi) FmtTimeMedium(t time.Time) string {
514
515         b := make([]byte, 0, 32)
516
517         b = strconv.AppendInt(b, int64(t.Hour()), 10)
518         b = append(b, []byte{0x2e}...)
519
520         if t.Minute() < 10 {
521                 b = append(b, '0')
522         }
523
524         b = strconv.AppendInt(b, int64(t.Minute()), 10)
525         b = append(b, []byte{0x2e}...)
526
527         if t.Second() < 10 {
528                 b = append(b, '0')
529         }
530
531         b = strconv.AppendInt(b, int64(t.Second()), 10)
532
533         return string(b)
534 }
535
536 // FmtTimeLong returns the long time representation of 't' for 'fi'
537 func (fi *fi) FmtTimeLong(t time.Time) string {
538
539         b := make([]byte, 0, 32)
540
541         b = strconv.AppendInt(b, int64(t.Hour()), 10)
542         b = append(b, []byte{0x2e}...)
543
544         if t.Minute() < 10 {
545                 b = append(b, '0')
546         }
547
548         b = strconv.AppendInt(b, int64(t.Minute()), 10)
549         b = append(b, []byte{0x2e}...)
550
551         if t.Second() < 10 {
552                 b = append(b, '0')
553         }
554
555         b = strconv.AppendInt(b, int64(t.Second()), 10)
556         b = append(b, []byte{0x20}...)
557
558         tz, _ := t.Zone()
559         b = append(b, tz...)
560
561         return string(b)
562 }
563
564 // FmtTimeFull returns the full time representation of 't' for 'fi'
565 func (fi *fi) FmtTimeFull(t time.Time) string {
566
567         b := make([]byte, 0, 32)
568
569         b = strconv.AppendInt(b, int64(t.Hour()), 10)
570         b = append(b, []byte{0x2e}...)
571
572         if t.Minute() < 10 {
573                 b = append(b, '0')
574         }
575
576         b = strconv.AppendInt(b, int64(t.Minute()), 10)
577         b = append(b, []byte{0x2e}...)
578
579         if t.Second() < 10 {
580                 b = append(b, '0')
581         }
582
583         b = strconv.AppendInt(b, int64(t.Second()), 10)
584         b = append(b, []byte{0x20}...)
585
586         tz, _ := t.Zone()
587
588         if btz, ok := fi.timezones[tz]; ok {
589                 b = append(b, btz...)
590         } else {
591                 b = append(b, tz...)
592         }
593
594         return string(b)
595 }