OSDN Git Service

new repo
[bytom/vapor.git] / vendor / github.com / go-playground / locales / or / or.go
1 package or
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 or 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         currencyPositivePrefix string
26         currencyNegativePrefix 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 'or' locale
45 func New() locales.Translator {
46         return &or{
47                 locale:                 "or",
48                 pluralsCardinal:        []locales.PluralRule{2, 6},
49                 pluralsOrdinal:         nil,
50                 pluralsRange:           nil,
51                 decimal:                ".",
52                 group:                  ",",
53                 timeSeparator:          ":",
54                 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", "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", "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"},
55                 currencyPositivePrefix: " ",
56                 currencyNegativePrefix: " ",
57                 monthsAbbreviated:      []string{"", "ଜାନୁଆରୀ", "ଫେବୃଆରୀ", "ମାର୍ଚ୍ଚ", "ଅପ୍ରେଲ", "ମଇ", "ଜୁନ", "ଜୁଲାଇ", "ଅଗଷ୍ଟ", "ସେପ୍ଟେମ୍ବର", "ଅକ୍ଟୋବର", "ନଭେମ୍ବର", "ଡିସେମ୍ବର"},
58                 monthsNarrow:           []string{"", "ଜା", "ଫେ", "ମା", "ଅ", "ମଇ", "ଜୁ", "ଜୁ", "ଅ", "ସେ", "ଅ", "ନ", "ଡି"},
59                 monthsWide:             []string{"", "ଜାନୁଆରୀ", "ଫେବୃଆରୀ", "ମାର୍ଚ୍ଚ", "ଅପ୍ରେଲ", "ମଇ", "ଜୁନ", "ଜୁଲାଇ", "ଅଗଷ୍ଟ", "ସେପ୍ଟେମ୍ବର", "ଅକ୍ଟୋବର", "ନଭେମ୍ବର", "ଡିସେମ୍ବର"},
60                 daysAbbreviated:        []string{"ରବି", "ସୋମ", "ମଙ୍ଗଳ", "ବୁଧ", "ଗୁରୁ", "ଶୁକ୍ର", "ଶନି"},
61                 daysNarrow:             []string{"ର", "ସୋ", "ମ", "ବୁ", "ଗୁ", "ଶୁ", "ଶ"},
62                 daysWide:               []string{"ରବିବାର", "ସୋମବାର", "ମଙ୍ଗଳବାର", "ବୁଧବାର", "ଗୁରୁବାର", "ଶୁକ୍ରବାର", "ଶନିବାର"},
63                 periodsAbbreviated:     []string{"am", "pm"},
64                 periodsNarrow:          []string{"am", "pm"},
65                 periodsWide:            []string{"am", "pm"},
66                 timezones:              map[string]string{"COST": "COST", "BOT": "BOT", "ACWDT": "ACWDT", "HNOG": "HNOG", "AKST": "AKST", "PST": "PST", "MST": "MST", "AST": "AST", "ARST": "ARST", "EAT": "EAT", "HAT": "HAT", "WEZ": "WEZ", "GMT": "GMT", "WIB": "WIB", "AWST": "AWST", "AWDT": "AWDT", "WAT": "WAT", "UYST": "UYST", "HNNOMX": "HNNOMX", "JST": "JST", "ADT": "ADT", "HNCU": "HNCU", "HEEG": "HEEG", "ECT": "ECT", "HEPMX": "HEPMX", "MDT": "MDT", "SRT": "SRT", "NZST": "NZST", "AEDT": "AEDT", "EDT": "EDT", "ACST": "ACST", "MESZ": "MESZ", "OEZ": "OEZ", "HKT": "HKT", "COT": "COT", "WESZ": "WESZ", "ChST": "ChST", "CDT": "CDT", "MEZ": "MEZ", "HADT": "HADT", "HEPM": "HEPM", "NZDT": "NZDT", "TMST": "TMST", "LHDT": "LHDT", "HKST": "HKST", "PDT": "PDT", "CHADT": "CHADT", "MYT": "MYT", "HAST": "HAST", "LHST": "LHST", "CHAST": "CHAST", "ACWST": "ACWST", "VET": "VET", "HEOG": "HEOG", "CAT": "CAT", "HNPM": "HNPM", "ART": "ART", "SAST": "SAST", "CLST": "CLST", "AKDT": "AKDT", "CST": "CST", "UYT": "UYT", "HENOMX": "HENOMX", "WITA": "WITA", "OESZ": "OESZ", "HNEG": "HNEG", "GFT": "GFT", "HNT": "HNT", "∅∅∅": "∅∅∅", "HECU": "HECU", "AEST": "AEST", "WAST": "WAST", "CLT": "CLT", "GYT": "GYT", "SGT": "SGT", "WIT": "WIT", "TMT": "TMT", "JDT": "JDT", "WARST": "WARST", "IST": "IST", "EST": "EST", "ACDT": "ACDT", "HNPMX": "HNPMX", "BT": "BT", "WART": "WART"},
67         }
68 }
69
70 // Locale returns the current translators string locale
71 func (or *or) Locale() string {
72         return or.locale
73 }
74
75 // PluralsCardinal returns the list of cardinal plural rules associated with 'or'
76 func (or *or) PluralsCardinal() []locales.PluralRule {
77         return or.pluralsCardinal
78 }
79
80 // PluralsOrdinal returns the list of ordinal plural rules associated with 'or'
81 func (or *or) PluralsOrdinal() []locales.PluralRule {
82         return or.pluralsOrdinal
83 }
84
85 // PluralsRange returns the list of range plural rules associated with 'or'
86 func (or *or) PluralsRange() []locales.PluralRule {
87         return or.pluralsRange
88 }
89
90 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'or'
91 func (or *or) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
92
93         n := math.Abs(num)
94
95         if n == 1 {
96                 return locales.PluralRuleOne
97         }
98
99         return locales.PluralRuleOther
100 }
101
102 // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'or'
103 func (or *or) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
104         return locales.PluralRuleUnknown
105 }
106
107 // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'or'
108 func (or *or) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
109         return locales.PluralRuleUnknown
110 }
111
112 // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
113 func (or *or) MonthAbbreviated(month time.Month) string {
114         return or.monthsAbbreviated[month]
115 }
116
117 // MonthsAbbreviated returns the locales abbreviated months
118 func (or *or) MonthsAbbreviated() []string {
119         return or.monthsAbbreviated[1:]
120 }
121
122 // MonthNarrow returns the locales narrow month given the 'month' provided
123 func (or *or) MonthNarrow(month time.Month) string {
124         return or.monthsNarrow[month]
125 }
126
127 // MonthsNarrow returns the locales narrow months
128 func (or *or) MonthsNarrow() []string {
129         return or.monthsNarrow[1:]
130 }
131
132 // MonthWide returns the locales wide month given the 'month' provided
133 func (or *or) MonthWide(month time.Month) string {
134         return or.monthsWide[month]
135 }
136
137 // MonthsWide returns the locales wide months
138 func (or *or) MonthsWide() []string {
139         return or.monthsWide[1:]
140 }
141
142 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
143 func (or *or) WeekdayAbbreviated(weekday time.Weekday) string {
144         return or.daysAbbreviated[weekday]
145 }
146
147 // WeekdaysAbbreviated returns the locales abbreviated weekdays
148 func (or *or) WeekdaysAbbreviated() []string {
149         return or.daysAbbreviated
150 }
151
152 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
153 func (or *or) WeekdayNarrow(weekday time.Weekday) string {
154         return or.daysNarrow[weekday]
155 }
156
157 // WeekdaysNarrow returns the locales narrow weekdays
158 func (or *or) WeekdaysNarrow() []string {
159         return or.daysNarrow
160 }
161
162 // WeekdayShort returns the locales short weekday given the 'weekday' provided
163 func (or *or) WeekdayShort(weekday time.Weekday) string {
164         return or.daysShort[weekday]
165 }
166
167 // WeekdaysShort returns the locales short weekdays
168 func (or *or) WeekdaysShort() []string {
169         return or.daysShort
170 }
171
172 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
173 func (or *or) WeekdayWide(weekday time.Weekday) string {
174         return or.daysWide[weekday]
175 }
176
177 // WeekdaysWide returns the locales wide weekdays
178 func (or *or) WeekdaysWide() []string {
179         return or.daysWide
180 }
181
182 // Decimal returns the decimal point of number
183 func (or *or) Decimal() string {
184         return or.decimal
185 }
186
187 // Group returns the group of number
188 func (or *or) Group() string {
189         return or.group
190 }
191
192 // Group returns the minus sign of number
193 func (or *or) Minus() string {
194         return or.minus
195 }
196
197 // FmtNumber returns 'num' with digits/precision of 'v' for 'or' and handles both Whole and Real numbers based on 'v'
198 func (or *or) FmtNumber(num float64, v uint64) string {
199
200         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
201         l := len(s) + 1 + 1*len(s[:len(s)-int(v)-1])/3
202         count := 0
203         inWhole := v == 0
204         inSecondary := false
205         groupThreshold := 3
206
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, or.decimal[0])
213                         inWhole = true
214                         continue
215                 }
216
217                 if inWhole {
218
219                         if count == groupThreshold {
220                                 b = append(b, or.group[0])
221                                 count = 1
222
223                                 if !inSecondary {
224                                         inSecondary = true
225                                         groupThreshold = 2
226                                 }
227                         } else {
228                                 count++
229                         }
230                 }
231
232                 b = append(b, s[i])
233         }
234
235         if num < 0 {
236                 b = append(b, or.minus[0])
237         }
238
239         // reverse
240         for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
241                 b[i], b[j] = b[j], b[i]
242         }
243
244         return string(b)
245 }
246
247 // FmtPercent returns 'num' with digits/precision of 'v' for 'or' and handles both Whole and Real numbers based on 'v'
248 // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
249 func (or *or) FmtPercent(num float64, v uint64) string {
250         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
251         l := len(s) + 1
252         b := make([]byte, 0, l)
253
254         for i := len(s) - 1; i >= 0; i-- {
255
256                 if s[i] == '.' {
257                         b = append(b, or.decimal[0])
258                         continue
259                 }
260
261                 b = append(b, s[i])
262         }
263
264         if num < 0 {
265                 b = append(b, or.minus[0])
266         }
267
268         // reverse
269         for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
270                 b[i], b[j] = b[j], b[i]
271         }
272
273         b = append(b, or.percent...)
274
275         return string(b)
276 }
277
278 // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'or'
279 func (or *or) FmtCurrency(num float64, v uint64, currency currency.Type) string {
280
281         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
282         symbol := or.currencies[currency]
283         l := len(s) + len(symbol) + 3 + 1*len(s[:len(s)-int(v)-1])/3
284         count := 0
285         inWhole := v == 0
286         inSecondary := false
287         groupThreshold := 3
288
289         b := make([]byte, 0, l)
290
291         for i := len(s) - 1; i >= 0; i-- {
292
293                 if s[i] == '.' {
294                         b = append(b, or.decimal[0])
295                         inWhole = true
296                         continue
297                 }
298
299                 if inWhole {
300
301                         if count == groupThreshold {
302                                 b = append(b, or.group[0])
303                                 count = 1
304
305                                 if !inSecondary {
306                                         inSecondary = true
307                                         groupThreshold = 2
308                                 }
309                         } else {
310                                 count++
311                         }
312                 }
313
314                 b = append(b, s[i])
315         }
316
317         for j := len(symbol) - 1; j >= 0; j-- {
318                 b = append(b, symbol[j])
319         }
320
321         for j := len(or.currencyPositivePrefix) - 1; j >= 0; j-- {
322                 b = append(b, or.currencyPositivePrefix[j])
323         }
324
325         if num < 0 {
326                 b = append(b, or.minus[0])
327         }
328
329         // reverse
330         for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
331                 b[i], b[j] = b[j], b[i]
332         }
333
334         if int(v) < 2 {
335
336                 if v == 0 {
337                         b = append(b, or.decimal...)
338                 }
339
340                 for i := 0; i < 2-int(v); i++ {
341                         b = append(b, '0')
342                 }
343         }
344
345         return string(b)
346 }
347
348 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'or'
349 // in accounting notation.
350 func (or *or) FmtAccounting(num float64, v uint64, currency currency.Type) string {
351
352         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
353         symbol := or.currencies[currency]
354         l := len(s) + len(symbol) + 3 + 1*len(s[:len(s)-int(v)-1])/3
355         count := 0
356         inWhole := v == 0
357         inSecondary := false
358         groupThreshold := 3
359
360         b := make([]byte, 0, l)
361
362         for i := len(s) - 1; i >= 0; i-- {
363
364                 if s[i] == '.' {
365                         b = append(b, or.decimal[0])
366                         inWhole = true
367                         continue
368                 }
369
370                 if inWhole {
371
372                         if count == groupThreshold {
373                                 b = append(b, or.group[0])
374                                 count = 1
375
376                                 if !inSecondary {
377                                         inSecondary = true
378                                         groupThreshold = 2
379                                 }
380                         } else {
381                                 count++
382                         }
383                 }
384
385                 b = append(b, s[i])
386         }
387
388         if num < 0 {
389
390                 for j := len(symbol) - 1; j >= 0; j-- {
391                         b = append(b, symbol[j])
392                 }
393
394                 for j := len(or.currencyNegativePrefix) - 1; j >= 0; j-- {
395                         b = append(b, or.currencyNegativePrefix[j])
396                 }
397
398                 b = append(b, or.minus[0])
399
400         } else {
401
402                 for j := len(symbol) - 1; j >= 0; j-- {
403                         b = append(b, symbol[j])
404                 }
405
406                 for j := len(or.currencyPositivePrefix) - 1; j >= 0; j-- {
407                         b = append(b, or.currencyPositivePrefix[j])
408                 }
409
410         }
411
412         // reverse
413         for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
414                 b[i], b[j] = b[j], b[i]
415         }
416
417         if int(v) < 2 {
418
419                 if v == 0 {
420                         b = append(b, or.decimal...)
421                 }
422
423                 for i := 0; i < 2-int(v); i++ {
424                         b = append(b, '0')
425                 }
426         }
427
428         return string(b)
429 }
430
431 // FmtDateShort returns the short date representation of 't' for 'or'
432 func (or *or) FmtDateShort(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{0x2d}...)
438         b = strconv.AppendInt(b, int64(t.Month()), 10)
439         b = append(b, []byte{0x2d}...)
440
441         if t.Year() > 9 {
442                 b = append(b, strconv.Itoa(t.Year())[2:]...)
443         } else {
444                 b = append(b, strconv.Itoa(t.Year())[1:]...)
445         }
446
447         return string(b)
448 }
449
450 // FmtDateMedium returns the medium date representation of 't' for 'or'
451 func (or *or) FmtDateMedium(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, or.monthsAbbreviated[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 // FmtDateLong returns the long date representation of 't' for 'or'
470 func (or *or) FmtDateLong(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, or.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         return string(b)
486 }
487
488 // FmtDateFull returns the full date representation of 't' for 'or'
489 func (or *or) FmtDateFull(t time.Time) string {
490
491         b := make([]byte, 0, 32)
492
493         b = append(b, or.daysWide[t.Weekday()]...)
494         b = append(b, []byte{0x2c, 0x20}...)
495         b = strconv.AppendInt(b, int64(t.Day()), 10)
496         b = append(b, []byte{0x20}...)
497         b = append(b, or.monthsWide[t.Month()]...)
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 // FmtTimeShort returns the short time representation of 't' for 'or'
510 func (or *or) FmtTimeShort(t time.Time) string {
511
512         b := make([]byte, 0, 32)
513
514         h := t.Hour()
515
516         if h > 12 {
517                 h -= 12
518         }
519
520         b = strconv.AppendInt(b, int64(h), 10)
521         b = append(b, or.timeSeparator...)
522
523         if t.Minute() < 10 {
524                 b = append(b, '0')
525         }
526
527         b = strconv.AppendInt(b, int64(t.Minute()), 10)
528         b = append(b, []byte{0x20}...)
529
530         if t.Hour() < 12 {
531                 b = append(b, or.periodsAbbreviated[0]...)
532         } else {
533                 b = append(b, or.periodsAbbreviated[1]...)
534         }
535
536         return string(b)
537 }
538
539 // FmtTimeMedium returns the medium time representation of 't' for 'or'
540 func (or *or) FmtTimeMedium(t time.Time) string {
541
542         b := make([]byte, 0, 32)
543
544         h := t.Hour()
545
546         if h > 12 {
547                 h -= 12
548         }
549
550         b = strconv.AppendInt(b, int64(h), 10)
551         b = append(b, or.timeSeparator...)
552
553         if t.Minute() < 10 {
554                 b = append(b, '0')
555         }
556
557         b = strconv.AppendInt(b, int64(t.Minute()), 10)
558         b = append(b, or.timeSeparator...)
559
560         if t.Second() < 10 {
561                 b = append(b, '0')
562         }
563
564         b = strconv.AppendInt(b, int64(t.Second()), 10)
565         b = append(b, []byte{0x20}...)
566
567         if t.Hour() < 12 {
568                 b = append(b, or.periodsAbbreviated[0]...)
569         } else {
570                 b = append(b, or.periodsAbbreviated[1]...)
571         }
572
573         return string(b)
574 }
575
576 // FmtTimeLong returns the long time representation of 't' for 'or'
577 func (or *or) FmtTimeLong(t time.Time) string {
578
579         b := make([]byte, 0, 32)
580
581         h := t.Hour()
582
583         if h > 12 {
584                 h -= 12
585         }
586
587         b = strconv.AppendInt(b, int64(h), 10)
588         b = append(b, or.timeSeparator...)
589
590         if t.Minute() < 10 {
591                 b = append(b, '0')
592         }
593
594         b = strconv.AppendInt(b, int64(t.Minute()), 10)
595         b = append(b, or.timeSeparator...)
596
597         if t.Second() < 10 {
598                 b = append(b, '0')
599         }
600
601         b = strconv.AppendInt(b, int64(t.Second()), 10)
602         b = append(b, []byte{0x20}...)
603
604         if t.Hour() < 12 {
605                 b = append(b, or.periodsAbbreviated[0]...)
606         } else {
607                 b = append(b, or.periodsAbbreviated[1]...)
608         }
609
610         b = append(b, []byte{0x20}...)
611
612         tz, _ := t.Zone()
613         b = append(b, tz...)
614
615         return string(b)
616 }
617
618 // FmtTimeFull returns the full time representation of 't' for 'or'
619 func (or *or) FmtTimeFull(t time.Time) string {
620
621         b := make([]byte, 0, 32)
622
623         h := t.Hour()
624
625         if h > 12 {
626                 h -= 12
627         }
628
629         b = strconv.AppendInt(b, int64(h), 10)
630         b = append(b, or.timeSeparator...)
631
632         if t.Minute() < 10 {
633                 b = append(b, '0')
634         }
635
636         b = strconv.AppendInt(b, int64(t.Minute()), 10)
637         b = append(b, or.timeSeparator...)
638
639         if t.Second() < 10 {
640                 b = append(b, '0')
641         }
642
643         b = strconv.AppendInt(b, int64(t.Second()), 10)
644         b = append(b, []byte{0x20}...)
645
646         if t.Hour() < 12 {
647                 b = append(b, or.periodsAbbreviated[0]...)
648         } else {
649                 b = append(b, or.periodsAbbreviated[1]...)
650         }
651
652         b = append(b, []byte{0x20}...)
653
654         tz, _ := t.Zone()
655
656         if btz, ok := or.timezones[tz]; ok {
657                 b = append(b, btz...)
658         } else {
659                 b = append(b, tz...)
660         }
661
662         return string(b)
663 }