OSDN Git Service

new repo
[bytom/vapor.git] / vendor / github.com / go-playground / locales / ro / ro.go
1 package ro
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 ro 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         currencyNegativePrefix string
28         currencyNegativeSuffix string
29         monthsAbbreviated      []string
30         monthsNarrow           []string
31         monthsWide             []string
32         daysAbbreviated        []string
33         daysNarrow             []string
34         daysShort              []string
35         daysWide               []string
36         periodsAbbreviated     []string
37         periodsNarrow          []string
38         periodsShort           []string
39         periodsWide            []string
40         erasAbbreviated        []string
41         erasNarrow             []string
42         erasWide               []string
43         timezones              map[string]string
44 }
45
46 // New returns a new instance of translator for the 'ro' locale
47 func New() locales.Translator {
48         return &ro{
49                 locale:                 "ro",
50                 pluralsCardinal:        []locales.PluralRule{2, 4, 6},
51                 pluralsOrdinal:         []locales.PluralRule{2, 6},
52                 pluralsRange:           []locales.PluralRule{4, 6},
53                 decimal:                ",",
54                 group:                  ".",
55                 minus:                  "-",
56                 percent:                "%",
57                 perMille:               "‰",
58                 timeSeparator:          ":",
59                 inifinity:              "∞",
60                 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", "FCFA", "XAG", "XAU", "XBA", "XBB", "XBC", "XBD", "XCD", "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"},
61                 percentSuffix:          " ",
62                 currencyPositiveSuffix: " ",
63                 currencyNegativePrefix: "(",
64                 currencyNegativeSuffix: " )",
65                 monthsAbbreviated:      []string{"", "ian.", "feb.", "mar.", "apr.", "mai", "iun.", "iul.", "aug.", "sept.", "oct.", "nov.", "dec."},
66                 monthsNarrow:           []string{"", "I", "F", "M", "A", "M", "I", "I", "A", "S", "O", "N", "D"},
67                 monthsWide:             []string{"", "ianuarie", "februarie", "martie", "aprilie", "mai", "iunie", "iulie", "august", "septembrie", "octombrie", "noiembrie", "decembrie"},
68                 daysAbbreviated:        []string{"dum.", "lun.", "mar.", "mie.", "joi", "vin.", "sâm."},
69                 daysNarrow:             []string{"D", "L", "M", "M", "J", "V", "S"},
70                 daysShort:              []string{"du.", "lu.", "ma.", "mi.", "joi", "vi.", "sâ."},
71                 daysWide:               []string{"duminică", "luni", "marți", "miercuri", "joi", "vineri", "sâmbătă"},
72                 periodsAbbreviated:     []string{"a.m.", "p.m."},
73                 periodsNarrow:          []string{"a.m.", "p.m."},
74                 periodsWide:            []string{"a.m.", "p.m."},
75                 erasAbbreviated:        []string{"î.Hr.", "d.Hr."},
76                 erasNarrow:             []string{"", ""},
77                 erasWide:               []string{"înainte de Hristos", "după Hristos"},
78                 timezones:              map[string]string{"CDT": "Ora de vară centrală nord-americană", "TMST": "Ora de vară din Turkmenistan", "WART": "Ora standard a Argentinei Occidentale", "AEDT": "Ora de vară a Australiei Orientale", "EST": "Ora standard orientală nord-americană", "SGT": "Ora din Singapore", "BOT": "Ora Boliviei", "WIT": "Ora Indoneziei de Est", "MYT": "Ora din Malaysia", "COT": "Ora standard a Columbiei", "UYT": "Ora standard a Uruguayului", "WARST": "Ora de vară a Argentinei Occidentale", "JST": "Ora standard a Japoniei", "WAT": "Ora standard a Africii Occidentale", "HNT": "Ora standard din Newfoundland", "EDT": "Ora de vară orientală nord-americană", "GYT": "Ora din Guyana", "ACWDT": "Ora de vară a Australiei Central Occidentale", "MEZ": "Ora standard a Europei Centrale", "JDT": "Ora de vară a Japoniei", "HNOG": "Ora standard a Groenlandei occidentale", "CST": "Ora standard centrală nord-americană", "MST": "MST", "LHST": "Ora standard din Lord Howe", "COST": "Ora de vară a Columbiei", "HAT": "Ora de vară din Newfoundland", "WIB": "Ora Indoneziei de Vest", "HADT": "Ora de vară din Hawaii-Aleutine", "BT": "Ora Bhutanului", "SRT": "Ora Surinamului", "VET": "Ora Venezuelei", "HNEG": "Ora standard a Groenlandei orientale", "GFT": "Ora din Guyana Franceză", "HKT": "Ora standard din Hong Kong", "CLT": "Ora standard din Chile", "HNCU": "Ora standard a Cubei", "MESZ": "Ora de vară a Europei Centrale", "CAT": "Ora Africii Centrale", "∅∅∅": "Ora de vară din Peru", "AWST": "Ora standard a Australiei Occidentale", "ACWST": "Ora standard a Australiei Central Occidentale", "NZST": "Ora standard a Noii Zeelande", "AKDT": "Ora de vară din Alaska", "ChST": "Ora din Chamorro", "UYST": "Ora de vară a Uruguayului", "WITA": "Ora Indoneziei Centrale", "HEPMX": "Ora de vară a zonei Pacific mexicane", "CHADT": "Ora de vară din Chatham", "HAST": "Ora standard din Hawaii-Aleutine", "HEEG": "Ora de vară a Groenlandei orientale", "GMT": "Ora de Greenwhich", "HNPMX": "Ora standard a zonei Pacific mexicane", "ADT": "Ora de vară în zona Atlantic nord-americană", "CLST": "Ora de vară din Chile", "ECT": "Ora Ecuadorului", "CHAST": "Ora standard din Chatham", "AWDT": "Ora de vară a Australiei Occidentale", "TMT": "Ora standard din Turkmenistan", "HNNOMX": "Ora standard a Mexicului de nord-vest", "OESZ": "Ora de vară a Europei de Est", "IST": "Ora Indiei", "AST": "Ora standard în zona Atlantic nord-americană", "ARST": "Ora de vară a Argentinei", "SAST": "Ora Africii Meridionale", "ACDT": "Ora de vară a Australiei Centrale", "HNPM": "Ora standard din Saint-Pierre și Miquelon", "HECU": "Ora de vară a Cubei", "NZDT": "Ora de vară a Noii Zeelande", "LHDT": "Ora de vară din Lord Howe", "AEST": "Ora standard a Australiei Orientale", "ART": "Ora standard a Argentinei", "AKST": "Ora standard din Alaska", "ACST": "Ora standard a Australiei Centrale", "WESZ": "Ora de vară a Europei de Vest", "HENOMX": "Ora de vară a Mexicului de nord-vest", "OEZ": "Ora standard a Europei de Est", "HEOG": "Ora de vară a Groenlandei occidentale", "EAT": "Ora Africii Orientale", "HEPM": "Ora de vară din Saint-Pierre și Miquelon", "PST": "Ora standard în zona Pacific nord-americană", "PDT": "Ora de vară în zona Pacific nord-americană", "MDT": "MDT", "WAST": "Ora de vară a Africii Occidentale", "HKST": "Ora de vară din Hong Kong", "WEZ": "Ora standard a Europei de Vest"},
79         }
80 }
81
82 // Locale returns the current translators string locale
83 func (ro *ro) Locale() string {
84         return ro.locale
85 }
86
87 // PluralsCardinal returns the list of cardinal plural rules associated with 'ro'
88 func (ro *ro) PluralsCardinal() []locales.PluralRule {
89         return ro.pluralsCardinal
90 }
91
92 // PluralsOrdinal returns the list of ordinal plural rules associated with 'ro'
93 func (ro *ro) PluralsOrdinal() []locales.PluralRule {
94         return ro.pluralsOrdinal
95 }
96
97 // PluralsRange returns the list of range plural rules associated with 'ro'
98 func (ro *ro) PluralsRange() []locales.PluralRule {
99         return ro.pluralsRange
100 }
101
102 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'ro'
103 func (ro *ro) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
104
105         n := math.Abs(num)
106         i := int64(n)
107         nMod100 := math.Mod(n, 100)
108
109         if i == 1 && v == 0 {
110                 return locales.PluralRuleOne
111         } else if (v != 0) || (n == 0) || (n != 1 && nMod100 >= 1 && nMod100 <= 19) {
112                 return locales.PluralRuleFew
113         }
114
115         return locales.PluralRuleOther
116 }
117
118 // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'ro'
119 func (ro *ro) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
120
121         n := math.Abs(num)
122
123         if n == 1 {
124                 return locales.PluralRuleOne
125         }
126
127         return locales.PluralRuleOther
128 }
129
130 // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'ro'
131 func (ro *ro) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
132
133         start := ro.CardinalPluralRule(num1, v1)
134         end := ro.CardinalPluralRule(num2, v2)
135
136         if start == locales.PluralRuleOne && end == locales.PluralRuleFew {
137                 return locales.PluralRuleFew
138         } else if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
139                 return locales.PluralRuleOther
140         } else if start == locales.PluralRuleFew && end == locales.PluralRuleOne {
141                 return locales.PluralRuleFew
142         } else if start == locales.PluralRuleFew && end == locales.PluralRuleFew {
143                 return locales.PluralRuleFew
144         } else if start == locales.PluralRuleFew && end == locales.PluralRuleOther {
145                 return locales.PluralRuleOther
146         } else if start == locales.PluralRuleOther && end == locales.PluralRuleFew {
147                 return locales.PluralRuleFew
148         }
149
150         return locales.PluralRuleOther
151
152 }
153
154 // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
155 func (ro *ro) MonthAbbreviated(month time.Month) string {
156         return ro.monthsAbbreviated[month]
157 }
158
159 // MonthsAbbreviated returns the locales abbreviated months
160 func (ro *ro) MonthsAbbreviated() []string {
161         return ro.monthsAbbreviated[1:]
162 }
163
164 // MonthNarrow returns the locales narrow month given the 'month' provided
165 func (ro *ro) MonthNarrow(month time.Month) string {
166         return ro.monthsNarrow[month]
167 }
168
169 // MonthsNarrow returns the locales narrow months
170 func (ro *ro) MonthsNarrow() []string {
171         return ro.monthsNarrow[1:]
172 }
173
174 // MonthWide returns the locales wide month given the 'month' provided
175 func (ro *ro) MonthWide(month time.Month) string {
176         return ro.monthsWide[month]
177 }
178
179 // MonthsWide returns the locales wide months
180 func (ro *ro) MonthsWide() []string {
181         return ro.monthsWide[1:]
182 }
183
184 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
185 func (ro *ro) WeekdayAbbreviated(weekday time.Weekday) string {
186         return ro.daysAbbreviated[weekday]
187 }
188
189 // WeekdaysAbbreviated returns the locales abbreviated weekdays
190 func (ro *ro) WeekdaysAbbreviated() []string {
191         return ro.daysAbbreviated
192 }
193
194 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
195 func (ro *ro) WeekdayNarrow(weekday time.Weekday) string {
196         return ro.daysNarrow[weekday]
197 }
198
199 // WeekdaysNarrow returns the locales narrow weekdays
200 func (ro *ro) WeekdaysNarrow() []string {
201         return ro.daysNarrow
202 }
203
204 // WeekdayShort returns the locales short weekday given the 'weekday' provided
205 func (ro *ro) WeekdayShort(weekday time.Weekday) string {
206         return ro.daysShort[weekday]
207 }
208
209 // WeekdaysShort returns the locales short weekdays
210 func (ro *ro) WeekdaysShort() []string {
211         return ro.daysShort
212 }
213
214 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
215 func (ro *ro) WeekdayWide(weekday time.Weekday) string {
216         return ro.daysWide[weekday]
217 }
218
219 // WeekdaysWide returns the locales wide weekdays
220 func (ro *ro) WeekdaysWide() []string {
221         return ro.daysWide
222 }
223
224 // Decimal returns the decimal point of number
225 func (ro *ro) Decimal() string {
226         return ro.decimal
227 }
228
229 // Group returns the group of number
230 func (ro *ro) Group() string {
231         return ro.group
232 }
233
234 // Group returns the minus sign of number
235 func (ro *ro) Minus() string {
236         return ro.minus
237 }
238
239 // FmtNumber returns 'num' with digits/precision of 'v' for 'ro' and handles both Whole and Real numbers based on 'v'
240 func (ro *ro) FmtNumber(num float64, v uint64) string {
241
242         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
243         l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
244         count := 0
245         inWhole := v == 0
246         b := make([]byte, 0, l)
247
248         for i := len(s) - 1; i >= 0; i-- {
249
250                 if s[i] == '.' {
251                         b = append(b, ro.decimal[0])
252                         inWhole = true
253                         continue
254                 }
255
256                 if inWhole {
257                         if count == 3 {
258                                 b = append(b, ro.group[0])
259                                 count = 1
260                         } else {
261                                 count++
262                         }
263                 }
264
265                 b = append(b, s[i])
266         }
267
268         if num < 0 {
269                 b = append(b, ro.minus[0])
270         }
271
272         // reverse
273         for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
274                 b[i], b[j] = b[j], b[i]
275         }
276
277         return string(b)
278 }
279
280 // FmtPercent returns 'num' with digits/precision of 'v' for 'ro' and handles both Whole and Real numbers based on 'v'
281 // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
282 func (ro *ro) FmtPercent(num float64, v uint64) string {
283         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
284         l := len(s) + 5
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, ro.decimal[0])
291                         continue
292                 }
293
294                 b = append(b, s[i])
295         }
296
297         if num < 0 {
298                 b = append(b, ro.minus[0])
299         }
300
301         // reverse
302         for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
303                 b[i], b[j] = b[j], b[i]
304         }
305
306         b = append(b, ro.percentSuffix...)
307
308         b = append(b, ro.percent...)
309
310         return string(b)
311 }
312
313 // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'ro'
314 func (ro *ro) FmtCurrency(num float64, v uint64, currency currency.Type) string {
315
316         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
317         symbol := ro.currencies[currency]
318         l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
319         count := 0
320         inWhole := v == 0
321         b := make([]byte, 0, l)
322
323         for i := len(s) - 1; i >= 0; i-- {
324
325                 if s[i] == '.' {
326                         b = append(b, ro.decimal[0])
327                         inWhole = true
328                         continue
329                 }
330
331                 if inWhole {
332                         if count == 3 {
333                                 b = append(b, ro.group[0])
334                                 count = 1
335                         } else {
336                                 count++
337                         }
338                 }
339
340                 b = append(b, s[i])
341         }
342
343         if num < 0 {
344                 b = append(b, ro.minus[0])
345         }
346
347         // reverse
348         for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
349                 b[i], b[j] = b[j], b[i]
350         }
351
352         if int(v) < 2 {
353
354                 if v == 0 {
355                         b = append(b, ro.decimal...)
356                 }
357
358                 for i := 0; i < 2-int(v); i++ {
359                         b = append(b, '0')
360                 }
361         }
362
363         b = append(b, ro.currencyPositiveSuffix...)
364
365         b = append(b, symbol...)
366
367         return string(b)
368 }
369
370 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ro'
371 // in accounting notation.
372 func (ro *ro) FmtAccounting(num float64, v uint64, currency currency.Type) string {
373
374         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
375         symbol := ro.currencies[currency]
376         l := len(s) + len(symbol) + 6 + 1*len(s[:len(s)-int(v)-1])/3
377         count := 0
378         inWhole := v == 0
379         b := make([]byte, 0, l)
380
381         for i := len(s) - 1; i >= 0; i-- {
382
383                 if s[i] == '.' {
384                         b = append(b, ro.decimal[0])
385                         inWhole = true
386                         continue
387                 }
388
389                 if inWhole {
390                         if count == 3 {
391                                 b = append(b, ro.group[0])
392                                 count = 1
393                         } else {
394                                 count++
395                         }
396                 }
397
398                 b = append(b, s[i])
399         }
400
401         if num < 0 {
402
403                 b = append(b, ro.currencyNegativePrefix[0])
404
405         }
406
407         // reverse
408         for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
409                 b[i], b[j] = b[j], b[i]
410         }
411
412         if int(v) < 2 {
413
414                 if v == 0 {
415                         b = append(b, ro.decimal...)
416                 }
417
418                 for i := 0; i < 2-int(v); i++ {
419                         b = append(b, '0')
420                 }
421         }
422
423         if num < 0 {
424                 b = append(b, ro.currencyNegativeSuffix...)
425                 b = append(b, symbol...)
426         } else {
427
428                 b = append(b, ro.currencyPositiveSuffix...)
429                 b = append(b, symbol...)
430         }
431
432         return string(b)
433 }
434
435 // FmtDateShort returns the short date representation of 't' for 'ro'
436 func (ro *ro) FmtDateShort(t time.Time) string {
437
438         b := make([]byte, 0, 32)
439
440         if t.Day() < 10 {
441                 b = append(b, '0')
442         }
443
444         b = strconv.AppendInt(b, int64(t.Day()), 10)
445         b = append(b, []byte{0x2e}...)
446
447         if t.Month() < 10 {
448                 b = append(b, '0')
449         }
450
451         b = strconv.AppendInt(b, int64(t.Month()), 10)
452
453         b = append(b, []byte{0x2e}...)
454
455         if t.Year() > 0 {
456                 b = strconv.AppendInt(b, int64(t.Year()), 10)
457         } else {
458                 b = strconv.AppendInt(b, int64(-t.Year()), 10)
459         }
460
461         return string(b)
462 }
463
464 // FmtDateMedium returns the medium date representation of 't' for 'ro'
465 func (ro *ro) FmtDateMedium(t time.Time) string {
466
467         b := make([]byte, 0, 32)
468
469         b = strconv.AppendInt(b, int64(t.Day()), 10)
470         b = append(b, []byte{0x20}...)
471         b = append(b, ro.monthsAbbreviated[t.Month()]...)
472         b = append(b, []byte{0x20}...)
473
474         if t.Year() > 0 {
475                 b = strconv.AppendInt(b, int64(t.Year()), 10)
476         } else {
477                 b = strconv.AppendInt(b, int64(-t.Year()), 10)
478         }
479
480         return string(b)
481 }
482
483 // FmtDateLong returns the long date representation of 't' for 'ro'
484 func (ro *ro) FmtDateLong(t time.Time) string {
485
486         b := make([]byte, 0, 32)
487
488         b = strconv.AppendInt(b, int64(t.Day()), 10)
489         b = append(b, []byte{0x20}...)
490         b = append(b, ro.monthsWide[t.Month()]...)
491         b = append(b, []byte{0x20}...)
492
493         if t.Year() > 0 {
494                 b = strconv.AppendInt(b, int64(t.Year()), 10)
495         } else {
496                 b = strconv.AppendInt(b, int64(-t.Year()), 10)
497         }
498
499         return string(b)
500 }
501
502 // FmtDateFull returns the full date representation of 't' for 'ro'
503 func (ro *ro) FmtDateFull(t time.Time) string {
504
505         b := make([]byte, 0, 32)
506
507         b = append(b, ro.daysWide[t.Weekday()]...)
508         b = append(b, []byte{0x2c, 0x20}...)
509         b = strconv.AppendInt(b, int64(t.Day()), 10)
510         b = append(b, []byte{0x20}...)
511         b = append(b, ro.monthsWide[t.Month()]...)
512         b = append(b, []byte{0x20}...)
513
514         if t.Year() > 0 {
515                 b = strconv.AppendInt(b, int64(t.Year()), 10)
516         } else {
517                 b = strconv.AppendInt(b, int64(-t.Year()), 10)
518         }
519
520         return string(b)
521 }
522
523 // FmtTimeShort returns the short time representation of 't' for 'ro'
524 func (ro *ro) FmtTimeShort(t time.Time) string {
525
526         b := make([]byte, 0, 32)
527
528         if t.Hour() < 10 {
529                 b = append(b, '0')
530         }
531
532         b = strconv.AppendInt(b, int64(t.Hour()), 10)
533         b = append(b, ro.timeSeparator...)
534
535         if t.Minute() < 10 {
536                 b = append(b, '0')
537         }
538
539         b = strconv.AppendInt(b, int64(t.Minute()), 10)
540
541         return string(b)
542 }
543
544 // FmtTimeMedium returns the medium time representation of 't' for 'ro'
545 func (ro *ro) FmtTimeMedium(t time.Time) string {
546
547         b := make([]byte, 0, 32)
548
549         if t.Hour() < 10 {
550                 b = append(b, '0')
551         }
552
553         b = strconv.AppendInt(b, int64(t.Hour()), 10)
554         b = append(b, ro.timeSeparator...)
555
556         if t.Minute() < 10 {
557                 b = append(b, '0')
558         }
559
560         b = strconv.AppendInt(b, int64(t.Minute()), 10)
561         b = append(b, ro.timeSeparator...)
562
563         if t.Second() < 10 {
564                 b = append(b, '0')
565         }
566
567         b = strconv.AppendInt(b, int64(t.Second()), 10)
568
569         return string(b)
570 }
571
572 // FmtTimeLong returns the long time representation of 't' for 'ro'
573 func (ro *ro) FmtTimeLong(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, ro.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, ro.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         b = append(b, tz...)
600
601         return string(b)
602 }
603
604 // FmtTimeFull returns the full time representation of 't' for 'ro'
605 func (ro *ro) FmtTimeFull(t time.Time) string {
606
607         b := make([]byte, 0, 32)
608
609         if t.Hour() < 10 {
610                 b = append(b, '0')
611         }
612
613         b = strconv.AppendInt(b, int64(t.Hour()), 10)
614         b = append(b, ro.timeSeparator...)
615
616         if t.Minute() < 10 {
617                 b = append(b, '0')
618         }
619
620         b = strconv.AppendInt(b, int64(t.Minute()), 10)
621         b = append(b, ro.timeSeparator...)
622
623         if t.Second() < 10 {
624                 b = append(b, '0')
625         }
626
627         b = strconv.AppendInt(b, int64(t.Second()), 10)
628         b = append(b, []byte{0x20}...)
629
630         tz, _ := t.Zone()
631
632         if btz, ok := ro.timezones[tz]; ok {
633                 b = append(b, btz...)
634         } else {
635                 b = append(b, tz...)
636         }
637
638         return string(b)
639 }