1 package sr_Cyrl
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 sr_Cyrl 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
25 currencyPositiveSuffix string
26 currencyNegativePrefix 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
46 func New() locales.Translator {
47 return &sr_Cyrl{
48 locale: "sr_Cyrl",
49 pluralsCardinal: []locales.PluralRule{2, 4, 6},
50 pluralsOrdinal: []locales.PluralRule{6},
51 pluralsRange: []locales.PluralRule{2, 4, 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", "CNH", "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", "MRU", "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", "STN", "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", "UYW", "UZS", "VEB", "VEF", "VES", "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"},
60 currencyPositiveSuffix: " ",
61 currencyNegativePrefix: "(",
62 currencyNegativeSuffix: " )",
63 monthsAbbreviated: []string{"", "јан", "феб", "мар", "апр", "мај", "јун", "јул", "авг", "сеп", "окт", "нов", "дец"},
64 monthsNarrow: []string{"", "ј", "ф", "м", "а", "м", "ј", "ј", "а", "с", "о", "н", "д"},
65 monthsWide: []string{"", "јануар", "фебруар", "март", "април", "мај", "јун", "јул", "август", "септембар", "октобар", "новембар", "децембар"},
66 daysAbbreviated: []string{"нед", "пон", "уто", "сре", "чет", "пет", "суб"},
67 daysNarrow: []string{"н", "п", "у", "с", "ч", "п", "с"},
68 daysShort: []string{"не", "по", "ут", "ср", "че", "пе", "су"},
69 daysWide: []string{"недеља", "понедељак", "уторак", "среда", "четвртак", "петак", "субота"},
70 periodsAbbreviated: []string{"пре подне", "по подне"},
71 periodsNarrow: []string{"a", "p"},
72 periodsWide: []string{"пре подне", "по подне"},
73 erasAbbreviated: []string{"п. н. е.", "н. е."},
74 erasNarrow: []string{"п.н.е.", "н.е."},
75 erasWide: []string{"пре нове ере", "нове ере"},
76 timezones: map[string]string{"ACDT": "Аустралијско централно летње време", "ACST": "Аустралијско централно стандардно време", "ACWDT": "Аустралијско централно западно летње време", "ACWST": "Аустралијско централно западно стандардно време", "ADT": "Атлантско летње време", "AEDT": "Аустралијско источно летње време", "AEST": "Аустралијско источно стандардно време", "AKDT": "Аљаска, летње време", "AKST": "Аљаска, стандардно време", "ARST": "Аргентина, летње време", "ART": "Аргентина, стандардно време", "AST": "Атлантско стандардно време", "AWDT": "Аустралијско западно летње време", "AWST": "Аустралијско западно стандардно време", "BOT": "Боливија време", "BT": "Бутан време", "CAT": "Централно-афричко време", "CDT": "Северноамеричко централно летње време", "CHADT": "Чатам, летње време", "CHAST": "Чатам, стандардно време", "CLST": "Чиле, летње време", "CLT": "Чиле, стандардно време", "COST": "Колумбија, летње време", "COT": "Колумбија, стандардно време", "CST": "Северноамеричко централно стандардно време", "ChST": "Чаморо време", "EAT": "Источно-афричко време", "ECT": "Еквадор време", "EDT": "Северноамеричко источно летње време", "EST": "Северноамеричко источно стандардно време", "GFT": "Француска Гвајана време", "GMT": "Средње време по Гриничу", "GST": "Заливско време", "GYT": "Гвајана време", "HADT": "Хавајско-алеутско летње време", "HAST": "Хавајско-алеутско стандардно време", "HAT": "Њуфаундленд, летње време", "HECU": "Куба, летње време", "HEEG": "Источни Гренланд, летње време", "HENOMX": "Северозападни Мексико, летње време", "HEOG": "Западни Гренланд, летње време", "HEPM": "Сен Пјер и Микелон, летње време", "HEPMX": "Мексички Пацифик, летње време", "HKST": "Хонг Конг, летње време", "HKT": "Хонг Конг, стандардно време", "HNCU": "Куба, стандардно време", "HNEG": "Источни Гренланд, стандардно време", "HNNOMX": "Северозападни Мексико, стандардно време", "HNOG": "Западни Гренланд, стандардно време", "HNPM": "Сен Пјер и Микелон, стандардно време", "HNPMX": "Мексички Пацифик, стандардно време", "HNT": "Њуфаундленд, стандардно време", "IST": "Индијско стандардно време", "JDT": "Јапанско летње време", "JST": "Јапанско стандардно време", "LHDT": "Лорд Хов, летње време", "LHST": "Лорд Хов, стандардно време", "MDT": "Северноамеричко планинско летње време", "MESZ": "Средњеевропско летње време", "MEZ": "Средњеевропско стандардно време", "MST": "Северноамеричко планинско стандардно време", "MYT": "Малезија време", "NZDT": "Нови Зеланд, летње време", "NZST": "Нови Зеланд, стандардно време", "OESZ": "Источноевропско летње време", "OEZ": "Источноевропско стандардно време", "PDT": "Северноамеричко пацифичко летње време", "PST": "Северноамеричко пацифичко стандардно време", "SAST": "Јужно-афричко време", "SGT": "Сингапур, стандардно време", "SRT": "Суринам време", "TMST": "Туркменистан, летње време", "TMT": "Туркменистан, стандардно време", "UYST": "Уругвај, летње време", "UYT": "Уругвај, стандардно време", "VET": "Венецуела време", "WARST": "Западна Аргентина, летње време", "WART": "Западна Аргентина, стандардно време", "WAST": "Западно-афричко летње време", "WAT": "Западно-афричко стандардно време", "WESZ": "Западноевропско летње време", "WEZ": "Западноевропско стандардно време", "WIB": "Западно-индонезијско време", "WIT": "Источно-индонезијско време", "WITA": "Централно-индонезијско време", "∅∅∅": "Бразилија, летње време"},
77 }
78 }
79
80
81 func (sr *sr_Cyrl) Locale() string {
82 return sr.locale
83 }
84
85
86 func (sr *sr_Cyrl) PluralsCardinal() []locales.PluralRule {
87 return sr.pluralsCardinal
88 }
89
90
91 func (sr *sr_Cyrl) PluralsOrdinal() []locales.PluralRule {
92 return sr.pluralsOrdinal
93 }
94
95
96 func (sr *sr_Cyrl) PluralsRange() []locales.PluralRule {
97 return sr.pluralsRange
98 }
99
100
101 func (sr *sr_Cyrl) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
102
103 n := math.Abs(num)
104 i := int64(n)
105 f := locales.F(n, v)
106 iMod10 := i % 10
107 iMod100 := i % 100
108 fMod10 := f % 10
109 fMod100 := f % 100
110
111 if (v == 0 && iMod10 == 1 && iMod100 != 11) || (fMod10 == 1 && fMod100 != 11) {
112 return locales.PluralRuleOne
113 } else if (v == 0 && iMod10 >= 2 && iMod10 <= 4 && (iMod100 < 12 || iMod100 > 14)) || (fMod10 >= 2 && fMod10 <= 4 && (fMod100 < 12 || fMod100 > 14)) {
114 return locales.PluralRuleFew
115 }
116
117 return locales.PluralRuleOther
118 }
119
120
121 func (sr *sr_Cyrl) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
122 return locales.PluralRuleOther
123 }
124
125
126 func (sr *sr_Cyrl) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
127
128 start := sr.CardinalPluralRule(num1, v1)
129 end := sr.CardinalPluralRule(num2, v2)
130
131 if start == locales.PluralRuleOne && end == locales.PluralRuleOne {
132 return locales.PluralRuleOne
133 } else if start == locales.PluralRuleOne && end == locales.PluralRuleFew {
134 return locales.PluralRuleFew
135 } else if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
136 return locales.PluralRuleOther
137 } else if start == locales.PluralRuleFew && end == locales.PluralRuleOne {
138 return locales.PluralRuleOne
139 } else if start == locales.PluralRuleFew && end == locales.PluralRuleFew {
140 return locales.PluralRuleFew
141 } else if start == locales.PluralRuleFew && end == locales.PluralRuleOther {
142 return locales.PluralRuleOther
143 } else if start == locales.PluralRuleOther && end == locales.PluralRuleOne {
144 return locales.PluralRuleOne
145 } else if start == locales.PluralRuleOther && end == locales.PluralRuleFew {
146 return locales.PluralRuleFew
147 }
148
149 return locales.PluralRuleOther
150
151 }
152
153
154 func (sr *sr_Cyrl) MonthAbbreviated(month time.Month) string {
155 return sr.monthsAbbreviated[month]
156 }
157
158
159 func (sr *sr_Cyrl) MonthsAbbreviated() []string {
160 return sr.monthsAbbreviated[1:]
161 }
162
163
164 func (sr *sr_Cyrl) MonthNarrow(month time.Month) string {
165 return sr.monthsNarrow[month]
166 }
167
168
169 func (sr *sr_Cyrl) MonthsNarrow() []string {
170 return sr.monthsNarrow[1:]
171 }
172
173
174 func (sr *sr_Cyrl) MonthWide(month time.Month) string {
175 return sr.monthsWide[month]
176 }
177
178
179 func (sr *sr_Cyrl) MonthsWide() []string {
180 return sr.monthsWide[1:]
181 }
182
183
184 func (sr *sr_Cyrl) WeekdayAbbreviated(weekday time.Weekday) string {
185 return sr.daysAbbreviated[weekday]
186 }
187
188
189 func (sr *sr_Cyrl) WeekdaysAbbreviated() []string {
190 return sr.daysAbbreviated
191 }
192
193
194 func (sr *sr_Cyrl) WeekdayNarrow(weekday time.Weekday) string {
195 return sr.daysNarrow[weekday]
196 }
197
198
199 func (sr *sr_Cyrl) WeekdaysNarrow() []string {
200 return sr.daysNarrow
201 }
202
203
204 func (sr *sr_Cyrl) WeekdayShort(weekday time.Weekday) string {
205 return sr.daysShort[weekday]
206 }
207
208
209 func (sr *sr_Cyrl) WeekdaysShort() []string {
210 return sr.daysShort
211 }
212
213
214 func (sr *sr_Cyrl) WeekdayWide(weekday time.Weekday) string {
215 return sr.daysWide[weekday]
216 }
217
218
219 func (sr *sr_Cyrl) WeekdaysWide() []string {
220 return sr.daysWide
221 }
222
223
224 func (sr *sr_Cyrl) Decimal() string {
225 return sr.decimal
226 }
227
228
229 func (sr *sr_Cyrl) Group() string {
230 return sr.group
231 }
232
233
234 func (sr *sr_Cyrl) Minus() string {
235 return sr.minus
236 }
237
238
239 func (sr *sr_Cyrl) FmtNumber(num float64, v uint64) string {
240
241 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
242 l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
243 count := 0
244 inWhole := v == 0
245 b := make([]byte, 0, l)
246
247 for i := len(s) - 1; i >= 0; i-- {
248
249 if s[i] == '.' {
250 b = append(b, sr.decimal[0])
251 inWhole = true
252 continue
253 }
254
255 if inWhole {
256 if count == 3 {
257 b = append(b, sr.group[0])
258 count = 1
259 } else {
260 count++
261 }
262 }
263
264 b = append(b, s[i])
265 }
266
267 if num < 0 {
268 b = append(b, sr.minus[0])
269 }
270
271
272 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
273 b[i], b[j] = b[j], b[i]
274 }
275
276 return string(b)
277 }
278
279
280
281 func (sr *sr_Cyrl) FmtPercent(num float64, v uint64) string {
282 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
283 l := len(s) + 3
284 b := make([]byte, 0, l)
285
286 for i := len(s) - 1; i >= 0; i-- {
287
288 if s[i] == '.' {
289 b = append(b, sr.decimal[0])
290 continue
291 }
292
293 b = append(b, s[i])
294 }
295
296 if num < 0 {
297 b = append(b, sr.minus[0])
298 }
299
300
301 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
302 b[i], b[j] = b[j], b[i]
303 }
304
305 b = append(b, sr.percent...)
306
307 return string(b)
308 }
309
310
311 func (sr *sr_Cyrl) FmtCurrency(num float64, v uint64, currency currency.Type) string {
312
313 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
314 symbol := sr.currencies[currency]
315 l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
316 count := 0
317 inWhole := v == 0
318 b := make([]byte, 0, l)
319
320 for i := len(s) - 1; i >= 0; i-- {
321
322 if s[i] == '.' {
323 b = append(b, sr.decimal[0])
324 inWhole = true
325 continue
326 }
327
328 if inWhole {
329 if count == 3 {
330 b = append(b, sr.group[0])
331 count = 1
332 } else {
333 count++
334 }
335 }
336
337 b = append(b, s[i])
338 }
339
340 if num < 0 {
341 b = append(b, sr.minus[0])
342 }
343
344
345 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
346 b[i], b[j] = b[j], b[i]
347 }
348
349 if int(v) < 2 {
350
351 if v == 0 {
352 b = append(b, sr.decimal...)
353 }
354
355 for i := 0; i < 2-int(v); i++ {
356 b = append(b, '0')
357 }
358 }
359
360 b = append(b, sr.currencyPositiveSuffix...)
361
362 b = append(b, symbol...)
363
364 return string(b)
365 }
366
367
368
369 func (sr *sr_Cyrl) FmtAccounting(num float64, v uint64, currency currency.Type) string {
370
371 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
372 symbol := sr.currencies[currency]
373 l := len(s) + len(symbol) + 6 + 1*len(s[:len(s)-int(v)-1])/3
374 count := 0
375 inWhole := v == 0
376 b := make([]byte, 0, l)
377
378 for i := len(s) - 1; i >= 0; i-- {
379
380 if s[i] == '.' {
381 b = append(b, sr.decimal[0])
382 inWhole = true
383 continue
384 }
385
386 if inWhole {
387 if count == 3 {
388 b = append(b, sr.group[0])
389 count = 1
390 } else {
391 count++
392 }
393 }
394
395 b = append(b, s[i])
396 }
397
398 if num < 0 {
399
400 b = append(b, sr.currencyNegativePrefix[0])
401
402 }
403
404
405 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
406 b[i], b[j] = b[j], b[i]
407 }
408
409 if int(v) < 2 {
410
411 if v == 0 {
412 b = append(b, sr.decimal...)
413 }
414
415 for i := 0; i < 2-int(v); i++ {
416 b = append(b, '0')
417 }
418 }
419
420 if num < 0 {
421 b = append(b, sr.currencyNegativeSuffix...)
422 b = append(b, symbol...)
423 } else {
424
425 b = append(b, sr.currencyPositiveSuffix...)
426 b = append(b, symbol...)
427 }
428
429 return string(b)
430 }
431
432
433 func (sr *sr_Cyrl) FmtDateShort(t time.Time) string {
434
435 b := make([]byte, 0, 32)
436
437 b = strconv.AppendInt(b, int64(t.Day()), 10)
438 b = append(b, []byte{0x2e}...)
439 b = strconv.AppendInt(b, int64(t.Month()), 10)
440 b = append(b, []byte{0x2e}...)
441
442 if t.Year() > 9 {
443 b = append(b, strconv.Itoa(t.Year())[2:]...)
444 } else {
445 b = append(b, strconv.Itoa(t.Year())[1:]...)
446 }
447
448 b = append(b, []byte{0x2e}...)
449
450 return string(b)
451 }
452
453
454 func (sr *sr_Cyrl) FmtDateMedium(t time.Time) string {
455
456 b := make([]byte, 0, 32)
457
458 if t.Day() < 10 {
459 b = append(b, '0')
460 }
461
462 b = strconv.AppendInt(b, int64(t.Day()), 10)
463 b = append(b, []byte{0x2e}...)
464
465 if t.Month() < 10 {
466 b = append(b, '0')
467 }
468
469 b = strconv.AppendInt(b, int64(t.Month()), 10)
470
471 b = append(b, []byte{0x2e}...)
472
473 if t.Year() > 0 {
474 b = strconv.AppendInt(b, int64(t.Year()), 10)
475 } else {
476 b = strconv.AppendInt(b, int64(-t.Year()), 10)
477 }
478
479 b = append(b, []byte{0x2e}...)
480
481 return string(b)
482 }
483
484
485 func (sr *sr_Cyrl) FmtDateLong(t time.Time) string {
486
487 b := make([]byte, 0, 32)
488
489 if t.Day() < 10 {
490 b = append(b, '0')
491 }
492
493 b = strconv.AppendInt(b, int64(t.Day()), 10)
494 b = append(b, []byte{0x2e, 0x20}...)
495 b = append(b, sr.monthsWide[t.Month()]...)
496 b = append(b, []byte{0x20}...)
497
498 if t.Year() > 0 {
499 b = strconv.AppendInt(b, int64(t.Year()), 10)
500 } else {
501 b = strconv.AppendInt(b, int64(-t.Year()), 10)
502 }
503
504 b = append(b, []byte{0x2e}...)
505
506 return string(b)
507 }
508
509
510 func (sr *sr_Cyrl) FmtDateFull(t time.Time) string {
511
512 b := make([]byte, 0, 32)
513
514 b = append(b, sr.daysWide[t.Weekday()]...)
515 b = append(b, []byte{0x2c, 0x20}...)
516
517 if t.Day() < 10 {
518 b = append(b, '0')
519 }
520
521 b = strconv.AppendInt(b, int64(t.Day()), 10)
522 b = append(b, []byte{0x2e, 0x20}...)
523 b = append(b, sr.monthsWide[t.Month()]...)
524 b = append(b, []byte{0x20}...)
525
526 if t.Year() > 0 {
527 b = strconv.AppendInt(b, int64(t.Year()), 10)
528 } else {
529 b = strconv.AppendInt(b, int64(-t.Year()), 10)
530 }
531
532 b = append(b, []byte{0x2e}...)
533
534 return string(b)
535 }
536
537
538 func (sr *sr_Cyrl) FmtTimeShort(t time.Time) string {
539
540 b := make([]byte, 0, 32)
541
542 if t.Hour() < 10 {
543 b = append(b, '0')
544 }
545
546 b = strconv.AppendInt(b, int64(t.Hour()), 10)
547 b = append(b, sr.timeSeparator...)
548
549 if t.Minute() < 10 {
550 b = append(b, '0')
551 }
552
553 b = strconv.AppendInt(b, int64(t.Minute()), 10)
554
555 return string(b)
556 }
557
558
559 func (sr *sr_Cyrl) FmtTimeMedium(t time.Time) string {
560
561 b := make([]byte, 0, 32)
562
563 if t.Hour() < 10 {
564 b = append(b, '0')
565 }
566
567 b = strconv.AppendInt(b, int64(t.Hour()), 10)
568 b = append(b, sr.timeSeparator...)
569
570 if t.Minute() < 10 {
571 b = append(b, '0')
572 }
573
574 b = strconv.AppendInt(b, int64(t.Minute()), 10)
575 b = append(b, sr.timeSeparator...)
576
577 if t.Second() < 10 {
578 b = append(b, '0')
579 }
580
581 b = strconv.AppendInt(b, int64(t.Second()), 10)
582
583 return string(b)
584 }
585
586
587 func (sr *sr_Cyrl) FmtTimeLong(t time.Time) string {
588
589 b := make([]byte, 0, 32)
590
591 if t.Hour() < 10 {
592 b = append(b, '0')
593 }
594
595 b = strconv.AppendInt(b, int64(t.Hour()), 10)
596 b = append(b, sr.timeSeparator...)
597
598 if t.Minute() < 10 {
599 b = append(b, '0')
600 }
601
602 b = strconv.AppendInt(b, int64(t.Minute()), 10)
603 b = append(b, sr.timeSeparator...)
604
605 if t.Second() < 10 {
606 b = append(b, '0')
607 }
608
609 b = strconv.AppendInt(b, int64(t.Second()), 10)
610 b = append(b, []byte{0x20}...)
611
612 tz, _ := t.Zone()
613 b = append(b, tz...)
614
615 return string(b)
616 }
617
618
619 func (sr *sr_Cyrl) FmtTimeFull(t time.Time) string {
620
621 b := make([]byte, 0, 32)
622
623 if t.Hour() < 10 {
624 b = append(b, '0')
625 }
626
627 b = strconv.AppendInt(b, int64(t.Hour()), 10)
628 b = append(b, sr.timeSeparator...)
629
630 if t.Minute() < 10 {
631 b = append(b, '0')
632 }
633
634 b = strconv.AppendInt(b, int64(t.Minute()), 10)
635 b = append(b, sr.timeSeparator...)
636
637 if t.Second() < 10 {
638 b = append(b, '0')
639 }
640
641 b = strconv.AppendInt(b, int64(t.Second()), 10)
642 b = append(b, []byte{0x20}...)
643
644 tz, _ := t.Zone()
645
646 if btz, ok := sr.timezones[tz]; ok {
647 b = append(b, btz...)
648 } else {
649 b = append(b, tz...)
650 }
651
652 return string(b)
653 }
654
View as plain text