OSDN Git Service

new repo
[bytom/vapor.git] / vendor / github.com / go-playground / locales / uk / uk.go
1 package uk
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 uk struct {
13         locale                 string
14         pluralsCardinal        []locales.PluralRule
15         pluralsOrdinal         []locales.PluralRule
16         pluralsRange           []locales.PluralRule
17         decimal                string
18         group                  string
19         minus                  string
20         percent                string
21         perMille               string
22         timeSeparator          string
23         inifinity              string
24         currencies             []string // idx = enum of currency code
25         currencyNegativePrefix string
26         currencyNegativeSuffix string
27         monthsAbbreviated      []string
28         monthsNarrow           []string
29         monthsWide             []string
30         daysAbbreviated        []string
31         daysNarrow             []string
32         daysShort              []string
33         daysWide               []string
34         periodsAbbreviated     []string
35         periodsNarrow          []string
36         periodsShort           []string
37         periodsWide            []string
38         erasAbbreviated        []string
39         erasNarrow             []string
40         erasWide               []string
41         timezones              map[string]string
42 }
43
44 // New returns a new instance of translator for the 'uk' locale
45 func New() locales.Translator {
46         return &uk{
47                 locale:                 "uk",
48                 pluralsCardinal:        []locales.PluralRule{2, 4, 5, 6},
49                 pluralsOrdinal:         []locales.PluralRule{4, 6},
50                 pluralsRange:           []locales.PluralRule{2, 4, 5, 6},
51                 decimal:                ",",
52                 group:                  " ",
53                 minus:                  "-",
54                 percent:                "%",
55                 perMille:               "‰",
56                 timeSeparator:          ":",
57                 inifinity:              "∞",
58                 currencies:             []string{"ADP", "AED", "AFA", "AFN", "ALK", "ALL", "AMD", "ANG", "AOA", "AOK", "AON", "AOR", "ARA", "ARL", "ARM", "ARP", "ARS", "ATS", "AUD", "AWG", "AZM", "AZN", "BAD", "BAM", "BAN", "BBD", "BDT", "BEC", "BEF", "BEL", "BGL", "BGM", "BGN", "BGO", "BHD", "BIF", "BMD", "BND", "BOB", "BOL", "BOP", "BOV", "BRB", "BRC", "BRE", "BRL", "BRN", "BRR", "BRZ", "BSD", "BTN", "BUK", "BWP", "BYB", "BYN", "BYR", "BZD", "CAD", "CDF", "CHE", "CHF", "CHW", "CLE", "CLF", "CLP", "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", "¥", "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", "₴", "крб.", "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"},
59                 currencyNegativePrefix: "(",
60                 currencyNegativeSuffix: ")",
61                 monthsAbbreviated:      []string{"", "січ.", "лют.", "бер.", "квіт.", "трав.", "черв.", "лип.", "серп.", "вер.", "жовт.", "лист.", "груд."},
62                 monthsNarrow:           []string{"", "с", "л", "б", "к", "т", "ч", "л", "с", "в", "ж", "л", "г"},
63                 monthsWide:             []string{"", "січня", "лютого", "березня", "квітня", "травня", "червня", "липня", "серпня", "вересня", "жовтня", "листопада", "грудня"},
64                 daysAbbreviated:        []string{"нд", "пн", "вт", "ср", "чт", "пт", "сб"},
65                 daysNarrow:             []string{"Н", "П", "В", "С", "Ч", "П", "С"},
66                 daysShort:              []string{"нд", "пн", "вт", "ср", "чт", "пт", "сб"},
67                 daysWide:               []string{"неділя", "понеділок", "вівторок", "середа", "четвер", "пʼятниця", "субота"},
68                 periodsAbbreviated:     []string{"дп", "пп"},
69                 periodsNarrow:          []string{"дп", "пп"},
70                 periodsWide:            []string{"дп", "пп"},
71                 erasAbbreviated:        []string{"до н. е.", "н. е."},
72                 erasNarrow:             []string{"до н.е.", "н.е."},
73                 erasWide:               []string{"до нашої ери", "нашої ери"},
74                 timezones:              map[string]string{"WESZ": "за західноєвропейським літнім часом", "HECU": "за літнім часом на Кубі", "MEZ": "за центральноєвропейським стандартним часом", "AST": "за атлантичним стандартним часом", "HNT": "за стандартним часом на острові Ньюфаундленд", "HAT": "за літнім часом у Ньюфаундленд", "WEZ": "за західноєвропейським стандартним часом", "AWDT": "за літнім західноавстралійським часом", "TMT": "за стандартним часом у Туркменістані", "∅∅∅": "за літнім часом на Азорських Островах", "HNEG": "за стандартним східним часом у Гренландії", "AKST": "за стандартним часом на Алясці", "CST": "за північноамериканським центральним стандартним часом", "TMST": "за літнім часом у Туркменістані", "CHAST": "за стандартним часом на архіпелазі Чатем", "HAST": "за стандартним гавайсько-алеутським часом", "LHST": "за стандартним часом на острові Лорд-Хау", "MST": "за північноамериканським гірським стандартним часом", "ECT": "за часом в Еквадорі", "HNPMX": "за стандартним тихоокеанським часом у Мексиці", "ADT": "за атлантичним літнім часом", "ACWDT": "за літнім центральнозахідним австралійським часом", "UYST": "за літнім часом в Уругваї", "MESZ": "за центральноєвропейським літнім часом", "JST": "за японським стандартним часом", "OEZ": "за східноєвропейським стандартним часом", "CLST": "за літнім чилійським часом", "GYT": "за часом у Гаяні", "GMT": "за Гринвічем", "NZST": "за стандартним часом у Новій Зеландії", "JDT": "за японським літнім часом", "LHDT": "за літнім часом на острові Лорд-Хау", "MDT": "за північноамериканським гірським літнім часом", "IST": "за індійським стандартним часом", "SRT": "за часом у Суринамі", "HADT": "за літнім гавайсько-алеутським часом", "ART": "за стандартним аргентинським часом", "WAT": "за західноафриканським стандартним часом", "BT": "за часом у Бутані", "BOT": "за болівійським часом", "VET": "за часом у Венесуелі", "GFT": "за часом Французької Гвіани", "AKDT": "за літнім часом на Алясці", "HNPM": "за стандартним часом на островах Сен-П’єр і Мікелон", "ACWST": "за стандартним центральнозахідним австралійським часом", "WIT": "за східноіндонезійським часом", "COST": "за літнім колумбійським часом", "ACDT": "за літнім центральноавстралійським часом", "SGT": "за часом у Сінгапурі", "MYT": "за часом у Малайзії", "AEST": "за стандартним східноавстралійським часом", "HNOG": "за стандартним західним часом у Гренландії", "ACST": "за стандартним центральноавстралійським часом", "CAT": "за центральноафриканським часом", "NZDT": "за літнім часом у Новій Зеландії", "WITA": "за центральноіндонезійським часом", "EST": "за північноамериканським східним стандартним часом", "ChST": "за часом на Північних Маріанських островах", "PST": "за північноамериканським тихоокеанським стандартним часом", "HEPM": "за літнім часом на островах Сен-П’єр і Мікелон", "UYT": "за стандартним часом в Уругваї", "HENOMX": "за літнім північнозахідним часом у Мексиці", "AEDT": "за літнім східноавстралійським часом", "ARST": "за літнім аргентинським часом", "EAT": "за східноафриканським часом", "AWST": "за стандартним західноавстралійським часом", "WART": "за стандартним західноаргентинським часом", "EDT": "за північноамериканським східним літнім часом", "WIB": "за західноіндонезійським часом", "PDT": "за північноамериканським тихоокеанським літнім часом", "CHADT": "за літнім часом на архіпелазі Чатем", "HEPMX": "за літнім тихоокеанським часом у Мексиці", "WARST": "за літнім за західноаргентинським часом", "SAST": "за південноафриканським часом", "HEEG": "за літнім східним часом у Гренландії", "HKT": "за стандартним часом у Гонконзі", "HKST": "за літнім часом у Гонконзі", "HNNOMX": "за стандартним північнозахідним часом у Мексиці", "CLT": "за стандартним чилійським часом", "CDT": "за північноамериканським центральним літнім часом", "OESZ": "за східноєвропейським літнім часом", "HEOG": "за літнім західним часом у Гренландії", "WAST": "за західноафриканським літнім часом", "COT": "за стандартним колумбійським часом", "HNCU": "за стандартним часом на Кубі"},
75         }
76 }
77
78 // Locale returns the current translators string locale
79 func (uk *uk) Locale() string {
80         return uk.locale
81 }
82
83 // PluralsCardinal returns the list of cardinal plural rules associated with 'uk'
84 func (uk *uk) PluralsCardinal() []locales.PluralRule {
85         return uk.pluralsCardinal
86 }
87
88 // PluralsOrdinal returns the list of ordinal plural rules associated with 'uk'
89 func (uk *uk) PluralsOrdinal() []locales.PluralRule {
90         return uk.pluralsOrdinal
91 }
92
93 // PluralsRange returns the list of range plural rules associated with 'uk'
94 func (uk *uk) PluralsRange() []locales.PluralRule {
95         return uk.pluralsRange
96 }
97
98 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'uk'
99 func (uk *uk) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
100
101         n := math.Abs(num)
102         i := int64(n)
103         iMod10 := i % 10
104         iMod100 := i % 100
105
106         if v == 0 && iMod10 == 1 && iMod100 != 11 {
107                 return locales.PluralRuleOne
108         } else if v == 0 && iMod10 >= 2 && iMod10 <= 4 && (iMod100 < 12 || iMod100 > 14) {
109                 return locales.PluralRuleFew
110         } else if (v == 0 && iMod10 == 0) || (v == 0 && iMod10 >= 5 && iMod10 <= 9) || (v == 0 && iMod100 >= 11 && iMod100 <= 14) {
111                 return locales.PluralRuleMany
112         }
113
114         return locales.PluralRuleOther
115 }
116
117 // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'uk'
118 func (uk *uk) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
119
120         n := math.Abs(num)
121         nMod100 := math.Mod(n, 100)
122         nMod10 := math.Mod(n, 10)
123
124         if nMod10 == 3 && nMod100 != 13 {
125                 return locales.PluralRuleFew
126         }
127
128         return locales.PluralRuleOther
129 }
130
131 // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'uk'
132 func (uk *uk) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
133
134         start := uk.CardinalPluralRule(num1, v1)
135         end := uk.CardinalPluralRule(num2, v2)
136
137         if start == locales.PluralRuleOne && end == locales.PluralRuleOne {
138                 return locales.PluralRuleOne
139         } else if start == locales.PluralRuleOne && end == locales.PluralRuleFew {
140                 return locales.PluralRuleFew
141         } else if start == locales.PluralRuleOne && end == locales.PluralRuleMany {
142                 return locales.PluralRuleMany
143         } else if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
144                 return locales.PluralRuleOther
145         } else if start == locales.PluralRuleFew && end == locales.PluralRuleOne {
146                 return locales.PluralRuleOne
147         } else if start == locales.PluralRuleFew && end == locales.PluralRuleFew {
148                 return locales.PluralRuleFew
149         } else if start == locales.PluralRuleFew && end == locales.PluralRuleMany {
150                 return locales.PluralRuleMany
151         } else if start == locales.PluralRuleFew && end == locales.PluralRuleOther {
152                 return locales.PluralRuleOther
153         } else if start == locales.PluralRuleMany && end == locales.PluralRuleOne {
154                 return locales.PluralRuleOne
155         } else if start == locales.PluralRuleMany && end == locales.PluralRuleFew {
156                 return locales.PluralRuleFew
157         } else if start == locales.PluralRuleMany && end == locales.PluralRuleMany {
158                 return locales.PluralRuleMany
159         } else if start == locales.PluralRuleMany && end == locales.PluralRuleOther {
160                 return locales.PluralRuleOther
161         } else if start == locales.PluralRuleOther && end == locales.PluralRuleOne {
162                 return locales.PluralRuleOne
163         } else if start == locales.PluralRuleOther && end == locales.PluralRuleFew {
164                 return locales.PluralRuleFew
165         } else if start == locales.PluralRuleOther && end == locales.PluralRuleMany {
166                 return locales.PluralRuleMany
167         }
168
169         return locales.PluralRuleOther
170
171 }
172
173 // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
174 func (uk *uk) MonthAbbreviated(month time.Month) string {
175         return uk.monthsAbbreviated[month]
176 }
177
178 // MonthsAbbreviated returns the locales abbreviated months
179 func (uk *uk) MonthsAbbreviated() []string {
180         return uk.monthsAbbreviated[1:]
181 }
182
183 // MonthNarrow returns the locales narrow month given the 'month' provided
184 func (uk *uk) MonthNarrow(month time.Month) string {
185         return uk.monthsNarrow[month]
186 }
187
188 // MonthsNarrow returns the locales narrow months
189 func (uk *uk) MonthsNarrow() []string {
190         return uk.monthsNarrow[1:]
191 }
192
193 // MonthWide returns the locales wide month given the 'month' provided
194 func (uk *uk) MonthWide(month time.Month) string {
195         return uk.monthsWide[month]
196 }
197
198 // MonthsWide returns the locales wide months
199 func (uk *uk) MonthsWide() []string {
200         return uk.monthsWide[1:]
201 }
202
203 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
204 func (uk *uk) WeekdayAbbreviated(weekday time.Weekday) string {
205         return uk.daysAbbreviated[weekday]
206 }
207
208 // WeekdaysAbbreviated returns the locales abbreviated weekdays
209 func (uk *uk) WeekdaysAbbreviated() []string {
210         return uk.daysAbbreviated
211 }
212
213 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
214 func (uk *uk) WeekdayNarrow(weekday time.Weekday) string {
215         return uk.daysNarrow[weekday]
216 }
217
218 // WeekdaysNarrow returns the locales narrow weekdays
219 func (uk *uk) WeekdaysNarrow() []string {
220         return uk.daysNarrow
221 }
222
223 // WeekdayShort returns the locales short weekday given the 'weekday' provided
224 func (uk *uk) WeekdayShort(weekday time.Weekday) string {
225         return uk.daysShort[weekday]
226 }
227
228 // WeekdaysShort returns the locales short weekdays
229 func (uk *uk) WeekdaysShort() []string {
230         return uk.daysShort
231 }
232
233 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
234 func (uk *uk) WeekdayWide(weekday time.Weekday) string {
235         return uk.daysWide[weekday]
236 }
237
238 // WeekdaysWide returns the locales wide weekdays
239 func (uk *uk) WeekdaysWide() []string {
240         return uk.daysWide
241 }
242
243 // Decimal returns the decimal point of number
244 func (uk *uk) Decimal() string {
245         return uk.decimal
246 }
247
248 // Group returns the group of number
249 func (uk *uk) Group() string {
250         return uk.group
251 }
252
253 // Group returns the minus sign of number
254 func (uk *uk) Minus() string {
255         return uk.minus
256 }
257
258 // FmtNumber returns 'num' with digits/precision of 'v' for 'uk' and handles both Whole and Real numbers based on 'v'
259 func (uk *uk) FmtNumber(num float64, v uint64) string {
260
261         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
262         l := len(s) + 2 + 2*len(s[:len(s)-int(v)-1])/3
263         count := 0
264         inWhole := v == 0
265         b := make([]byte, 0, l)
266
267         for i := len(s) - 1; i >= 0; i-- {
268
269                 if s[i] == '.' {
270                         b = append(b, uk.decimal[0])
271                         inWhole = true
272                         continue
273                 }
274
275                 if inWhole {
276                         if count == 3 {
277                                 for j := len(uk.group) - 1; j >= 0; j-- {
278                                         b = append(b, uk.group[j])
279                                 }
280                                 count = 1
281                         } else {
282                                 count++
283                         }
284                 }
285
286                 b = append(b, s[i])
287         }
288
289         if num < 0 {
290                 b = append(b, uk.minus[0])
291         }
292
293         // reverse
294         for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
295                 b[i], b[j] = b[j], b[i]
296         }
297
298         return string(b)
299 }
300
301 // FmtPercent returns 'num' with digits/precision of 'v' for 'uk' and handles both Whole and Real numbers based on 'v'
302 // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
303 func (uk *uk) FmtPercent(num float64, v uint64) string {
304         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
305         l := len(s) + 3
306         b := make([]byte, 0, l)
307
308         for i := len(s) - 1; i >= 0; i-- {
309
310                 if s[i] == '.' {
311                         b = append(b, uk.decimal[0])
312                         continue
313                 }
314
315                 b = append(b, s[i])
316         }
317
318         if num < 0 {
319                 b = append(b, uk.minus[0])
320         }
321
322         // reverse
323         for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
324                 b[i], b[j] = b[j], b[i]
325         }
326
327         b = append(b, uk.percent...)
328
329         return string(b)
330 }
331
332 // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'uk'
333 func (uk *uk) FmtCurrency(num float64, v uint64, currency currency.Type) string {
334
335         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
336         symbol := uk.currencies[currency]
337         l := len(s) + len(symbol) + 2 + 2*len(s[:len(s)-int(v)-1])/3
338         count := 0
339         inWhole := v == 0
340         b := make([]byte, 0, l)
341
342         for i := len(s) - 1; i >= 0; i-- {
343
344                 if s[i] == '.' {
345                         b = append(b, uk.decimal[0])
346                         inWhole = true
347                         continue
348                 }
349
350                 if inWhole {
351                         if count == 3 {
352                                 for j := len(uk.group) - 1; j >= 0; j-- {
353                                         b = append(b, uk.group[j])
354                                 }
355                                 count = 1
356                         } else {
357                                 count++
358                         }
359                 }
360
361                 b = append(b, s[i])
362         }
363
364         if num < 0 {
365                 b = append(b, uk.minus[0])
366         }
367
368         // reverse
369         for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
370                 b[i], b[j] = b[j], b[i]
371         }
372
373         if int(v) < 2 {
374
375                 if v == 0 {
376                         b = append(b, uk.decimal...)
377                 }
378
379                 for i := 0; i < 2-int(v); i++ {
380                         b = append(b, '0')
381                 }
382         }
383
384         b = append(b, symbol...)
385
386         return string(b)
387 }
388
389 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'uk'
390 // in accounting notation.
391 func (uk *uk) FmtAccounting(num float64, v uint64, currency currency.Type) string {
392
393         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
394         symbol := uk.currencies[currency]
395         l := len(s) + len(symbol) + 4 + 2*len(s[:len(s)-int(v)-1])/3
396         count := 0
397         inWhole := v == 0
398         b := make([]byte, 0, l)
399
400         for i := len(s) - 1; i >= 0; i-- {
401
402                 if s[i] == '.' {
403                         b = append(b, uk.decimal[0])
404                         inWhole = true
405                         continue
406                 }
407
408                 if inWhole {
409                         if count == 3 {
410                                 for j := len(uk.group) - 1; j >= 0; j-- {
411                                         b = append(b, uk.group[j])
412                                 }
413                                 count = 1
414                         } else {
415                                 count++
416                         }
417                 }
418
419                 b = append(b, s[i])
420         }
421
422         if num < 0 {
423
424                 b = append(b, uk.currencyNegativePrefix[0])
425
426         }
427
428         // reverse
429         for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
430                 b[i], b[j] = b[j], b[i]
431         }
432
433         if int(v) < 2 {
434
435                 if v == 0 {
436                         b = append(b, uk.decimal...)
437                 }
438
439                 for i := 0; i < 2-int(v); i++ {
440                         b = append(b, '0')
441                 }
442         }
443
444         if num < 0 {
445                 b = append(b, uk.currencyNegativeSuffix...)
446                 b = append(b, symbol...)
447         } else {
448
449                 b = append(b, symbol...)
450         }
451
452         return string(b)
453 }
454
455 // FmtDateShort returns the short date representation of 't' for 'uk'
456 func (uk *uk) FmtDateShort(t time.Time) string {
457
458         b := make([]byte, 0, 32)
459
460         if t.Day() < 10 {
461                 b = append(b, '0')
462         }
463
464         b = strconv.AppendInt(b, int64(t.Day()), 10)
465         b = append(b, []byte{0x2e}...)
466
467         if t.Month() < 10 {
468                 b = append(b, '0')
469         }
470
471         b = strconv.AppendInt(b, int64(t.Month()), 10)
472
473         b = append(b, []byte{0x2e}...)
474
475         if t.Year() > 9 {
476                 b = append(b, strconv.Itoa(t.Year())[2:]...)
477         } else {
478                 b = append(b, strconv.Itoa(t.Year())[1:]...)
479         }
480
481         return string(b)
482 }
483
484 // FmtDateMedium returns the medium date representation of 't' for 'uk'
485 func (uk *uk) FmtDateMedium(t time.Time) string {
486
487         b := make([]byte, 0, 32)
488
489         b = strconv.AppendInt(b, int64(t.Day()), 10)
490         b = append(b, []byte{0x20}...)
491         b = append(b, uk.monthsAbbreviated[t.Month()]...)
492         b = append(b, []byte{0x20}...)
493
494         if t.Year() > 0 {
495                 b = strconv.AppendInt(b, int64(t.Year()), 10)
496         } else {
497                 b = strconv.AppendInt(b, int64(-t.Year()), 10)
498         }
499
500         b = append(b, []byte{0x20, 0xd1, 0x80}...)
501         b = append(b, []byte{0x2e}...)
502
503         return string(b)
504 }
505
506 // FmtDateLong returns the long date representation of 't' for 'uk'
507 func (uk *uk) FmtDateLong(t time.Time) string {
508
509         b := make([]byte, 0, 32)
510
511         b = strconv.AppendInt(b, int64(t.Day()), 10)
512         b = append(b, []byte{0x20}...)
513         b = append(b, uk.monthsWide[t.Month()]...)
514         b = append(b, []byte{0x20}...)
515
516         if t.Year() > 0 {
517                 b = strconv.AppendInt(b, int64(t.Year()), 10)
518         } else {
519                 b = strconv.AppendInt(b, int64(-t.Year()), 10)
520         }
521
522         b = append(b, []byte{0x20, 0xd1, 0x80}...)
523         b = append(b, []byte{0x2e}...)
524
525         return string(b)
526 }
527
528 // FmtDateFull returns the full date representation of 't' for 'uk'
529 func (uk *uk) FmtDateFull(t time.Time) string {
530
531         b := make([]byte, 0, 32)
532
533         b = append(b, uk.daysWide[t.Weekday()]...)
534         b = append(b, []byte{0x2c, 0x20}...)
535         b = strconv.AppendInt(b, int64(t.Day()), 10)
536         b = append(b, []byte{0x20}...)
537         b = append(b, uk.monthsWide[t.Month()]...)
538         b = append(b, []byte{0x20}...)
539
540         if t.Year() > 0 {
541                 b = strconv.AppendInt(b, int64(t.Year()), 10)
542         } else {
543                 b = strconv.AppendInt(b, int64(-t.Year()), 10)
544         }
545
546         b = append(b, []byte{0x20, 0xd1, 0x80}...)
547         b = append(b, []byte{0x2e}...)
548
549         return string(b)
550 }
551
552 // FmtTimeShort returns the short time representation of 't' for 'uk'
553 func (uk *uk) FmtTimeShort(t time.Time) string {
554
555         b := make([]byte, 0, 32)
556
557         if t.Hour() < 10 {
558                 b = append(b, '0')
559         }
560
561         b = strconv.AppendInt(b, int64(t.Hour()), 10)
562         b = append(b, uk.timeSeparator...)
563
564         if t.Minute() < 10 {
565                 b = append(b, '0')
566         }
567
568         b = strconv.AppendInt(b, int64(t.Minute()), 10)
569
570         return string(b)
571 }
572
573 // FmtTimeMedium returns the medium time representation of 't' for 'uk'
574 func (uk *uk) FmtTimeMedium(t time.Time) string {
575
576         b := make([]byte, 0, 32)
577
578         if t.Hour() < 10 {
579                 b = append(b, '0')
580         }
581
582         b = strconv.AppendInt(b, int64(t.Hour()), 10)
583         b = append(b, uk.timeSeparator...)
584
585         if t.Minute() < 10 {
586                 b = append(b, '0')
587         }
588
589         b = strconv.AppendInt(b, int64(t.Minute()), 10)
590         b = append(b, uk.timeSeparator...)
591
592         if t.Second() < 10 {
593                 b = append(b, '0')
594         }
595
596         b = strconv.AppendInt(b, int64(t.Second()), 10)
597
598         return string(b)
599 }
600
601 // FmtTimeLong returns the long time representation of 't' for 'uk'
602 func (uk *uk) FmtTimeLong(t time.Time) string {
603
604         b := make([]byte, 0, 32)
605
606         if t.Hour() < 10 {
607                 b = append(b, '0')
608         }
609
610         b = strconv.AppendInt(b, int64(t.Hour()), 10)
611         b = append(b, uk.timeSeparator...)
612
613         if t.Minute() < 10 {
614                 b = append(b, '0')
615         }
616
617         b = strconv.AppendInt(b, int64(t.Minute()), 10)
618         b = append(b, uk.timeSeparator...)
619
620         if t.Second() < 10 {
621                 b = append(b, '0')
622         }
623
624         b = strconv.AppendInt(b, int64(t.Second()), 10)
625         b = append(b, []byte{0x20}...)
626
627         tz, _ := t.Zone()
628         b = append(b, tz...)
629
630         return string(b)
631 }
632
633 // FmtTimeFull returns the full time representation of 't' for 'uk'
634 func (uk *uk) FmtTimeFull(t time.Time) string {
635
636         b := make([]byte, 0, 32)
637
638         if t.Hour() < 10 {
639                 b = append(b, '0')
640         }
641
642         b = strconv.AppendInt(b, int64(t.Hour()), 10)
643         b = append(b, uk.timeSeparator...)
644
645         if t.Minute() < 10 {
646                 b = append(b, '0')
647         }
648
649         b = strconv.AppendInt(b, int64(t.Minute()), 10)
650         b = append(b, uk.timeSeparator...)
651
652         if t.Second() < 10 {
653                 b = append(b, '0')
654         }
655
656         b = strconv.AppendInt(b, int64(t.Second()), 10)
657         b = append(b, []byte{0x20}...)
658
659         tz, _ := t.Zone()
660
661         if btz, ok := uk.timezones[tz]; ok {
662                 b = append(b, btz...)
663         } else {
664                 b = append(b, tz...)
665         }
666
667         return string(b)
668 }