1package ka
2
3import (
4	"math"
5	"strconv"
6	"time"
7
8	"github.com/go-playground/locales"
9	"github.com/go-playground/locales/currency"
10)
11
12type ka 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	currencyPositiveSuffix 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 'ka' locale
45func New() locales.Translator {
46	return &ka{
47		locale:                 "ka",
48		pluralsCardinal:        []locales.PluralRule{2, 6},
49		pluralsOrdinal:         []locales.PluralRule{2, 5, 6},
50		pluralsRange:           []locales.PluralRule{2, 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", "R$", "BRN", "BRR", "BRZ", "BSD", "BTN", "BUK", "BWP", "BYB", "BYN", "BYR", "BZD", "CA$", "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", "€", "FIM", "FJD", "FKP", "FRF", "£", "GEK", "₾", "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", "MX$", "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", "NT$", "TZS", "UAH", "UAK", "UGS", "UGX", "US$", "USN", "USS", "UYI", "UYP", "UYU", "UZS", "VEB", "VEF", "VND", "VNN", "VUV", "WST", "FCFA", "XAG", "XAU", "XBA", "XBB", "XBC", "XBD", "EC$", "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		currencyPositiveSuffix: " ",
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{"AM", "PM"},
69		periodsNarrow:          []string{"a", "p"},
70		periodsWide:            []string{"AM", "PM"},
71		erasAbbreviated:        []string{"ძვ. წ.", "ახ. წ."},
72		erasNarrow:             []string{"", ""},
73		erasWide:               []string{"ძველი წელთაღრიცხვით", "ახალი წელთაღრიცხვით"},
74		timezones:              map[string]string{"WESZ": "დასავლეთ ევროპის ზაფხულის დრო", "HNNOMX": "ჩრდილო-დასავლეთ მექსიკის დრო", "CLT": "ჩილეს სტანდარტული დრო", "CLST": "ჩილეს ზაფხულის დრო", "ChST": "ჩამოროს დრო", "PST": "ჩრდილოეთ ამერიკის წყნარი ოკეანის სტანდარტული დრო", "NZST": "ახალი ზელანდიის სტანდარტული დრო", "HNOG": "დასავლეთ გრენლანდიის სტანდარტული დრო", "VET": "ვენესუელის დრო", "WITA": "ცენტრალური ინდონეზიის დრო", "ART": "არგენტინის სტანდარტული დრო", "HEPMX": "მექსიკის წყნარი ოკეანის ზაფხულის დრო", "WAT": "დასავლეთ აფრიკის სტანდარტული დრო", "JDT": "იაპონიის ზაფხულის დრო", "HEEG": "აღმოსავლეთ გრენლანდიის ზაფხულის დრო", "WARST": "დასავლეთ არგენტინის ზაფხულის დრო", "HNT": "ნიუფაუნდლენდის სტანდარტული დრო", "CAT": "ცენტრალური აფრიკის დრო", "ACST": "ავსტრალიის ცენტრალური სტანდარტული დრო", "MDT": "MDT", "COT": "კოლუმბიის სტანდარტული დრო", "CDT": "ჩრდილოეთ ამერიკის ცენტრალური ზაფხულის დრო", "HEOG": "დასავლეთ გრენლანდიის ზაფხულის დრო", "HKT": "ჰონკონგის სტანდარტული დრო", "WART": "დასავლეთ არგენტინის სტანდარტული დრო", "GYT": "გაიანის დრო", "UYT": "ურუგვაის სტანდარტული დრო", "NZDT": "ახალი ზელანდიის ზაფხულის დრო", "MEZ": "ცენტრალური ევროპის სტანდარტული დრო", "LHST": "ლორდ-ჰაუს სტანდარტული დრო", "AWST": "დასავლეთ ავსტრალიის სტანდარტული დრო", "HNCU": "კუბის სტანდარტული დრო", "ECT": "ეკვადორის დრო", "EDT": "ჩრდილოეთ ამერიკის აღმოსავლეთის ზაფხულის დრო", "ACDT": "ავსტრალიის ცენტრალური ზაფხულის დრო", "LHDT": "ლორდ-ჰაუს ზაფხულის დრო", "HAT": "ნიუფაუნდლენდის ზაფხულის დრო", "HADT": "ჰავაისა და ალეუტის ზაფხულის დრო", "MYT": "მალაიზიის დრო", "MST": "MST", "CHAST": "ჩატემის სტანდარტული დრო", "CHADT": "ჩატემის ზაფხულის დრო", "WEZ": "დასავლეთ ევროპის სტანდარტული დრო", "WIB": "დასავლეთ ინდონეზიის დრო", "SGT": "სინგაპურის დრო", "MESZ": "ცენტრალური ევროპის ზაფხულის დრო", "TMST": "თურქმენეთის ზაფხულის დრო", "HAST": "ჰავაისა და ალეუტის სტანდარტული დრო", "AEDT": "აღმოსავლეთ ავსტრალიის ზაფხულის დრო", "AKST": "ალასკის სტანდარტული დრო", "AKDT": "ალასკის ზაფხულის დრო", "ACWST": "ცენტრალური და დასავლეთ ავსტრალიის სტანდარტული დრო", "CST": "ჩრდილოეთ ამერიკის ცენტრალური სტანდარტული დრო", "PDT": "ჩრდილოეთ ამერიკის წყნარი ოკეანის ზაფხულის დრო", "AEST": "აღმოსავლეთ ავსტრალიის სტანდარტული დრო", "BT": "ბუტანის დრო", "EST": "ჩრდილოეთ ამერიკის აღმოსავლეთის სტანდარტული დრო", "HENOMX": "ჩრდილო-დასავლეთ მექსიკის ზაფხულის დრო", "AST": "ატლანტიკის ოკეანის სტანდარტული დრო", "ADT": "ატლანტიკის ოკეანის ზაფხულის დრო", "OEZ": "აღმოსავლეთ ევროპის სტანდარტული დრო", "OESZ": "აღმოსავლეთ ევროპის ზაფხულის დრო", "∅∅∅": "∅∅∅", "BOT": "ბოლივიის დრო", "HNEG": "აღმოსავლეთ გრენლანდიის სტანდარტული დრო", "HNPM": "სენ-პიერის და მიკელონის სტანდარტული დრო", "EAT": "აღმოსავლეთ აფრიკის დრო", "WIT": "აღმოსავლეთ ინდონეზიის დრო", "GMT": "გრინვიჩის საშუალო დრო", "SAST": "სამხრეთ აფრიკის დრო", "GFT": "საფრანგეთის გვიანის დრო", "TMT": "თურქმენეთის სტანდარტული დრო", "ARST": "არგენტინის ზაფხულის დრო", "WAST": "დასავლეთ აფრიკის ზაფხულის დრო", "JST": "იაპონიის სტანდარტული დრო", "ACWDT": "ცენტრალური და დასავლეთ ავსტრალიის ზაფხულის დრო", "HKST": "ჰონკონგის ზაფხულის დრო", "IST": "ინდოეთის დრო", "SRT": "სურინამის დრო", "COST": "კოლუმბიის ზაფხულის დრო", "UYST": "ურუგვაის ზაფხულის დრო", "HEPM": "სენ-პიერის და მიკელონის ზაფხულის დრო", "HECU": "კუბის ზაფხულის დრო", "AWDT": "დასავლეთ ავსტრალიის ზაფხულის დრო", "HNPMX": "მექსიკის წყნარი ოკეანის სტანდარტული დრო"},
75	}
76}
77
78// Locale returns the current translators string locale
79func (ka *ka) Locale() string {
80	return ka.locale
81}
82
83// PluralsCardinal returns the list of cardinal plural rules associated with 'ka'
84func (ka *ka) PluralsCardinal() []locales.PluralRule {
85	return ka.pluralsCardinal
86}
87
88// PluralsOrdinal returns the list of ordinal plural rules associated with 'ka'
89func (ka *ka) PluralsOrdinal() []locales.PluralRule {
90	return ka.pluralsOrdinal
91}
92
93// PluralsRange returns the list of range plural rules associated with 'ka'
94func (ka *ka) PluralsRange() []locales.PluralRule {
95	return ka.pluralsRange
96}
97
98// CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'ka'
99func (ka *ka) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
100
101	n := math.Abs(num)
102
103	if n == 1 {
104		return locales.PluralRuleOne
105	}
106
107	return locales.PluralRuleOther
108}
109
110// OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'ka'
111func (ka *ka) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
112
113	n := math.Abs(num)
114	i := int64(n)
115	iMod100 := i % 100
116
117	if i == 1 {
118		return locales.PluralRuleOne
119	} else if (i == 0) || (iMod100 >= 2 && iMod100 <= 20 && (iMod100 == 40 || iMod100 == 60 || iMod100 == 80)) {
120		return locales.PluralRuleMany
121	}
122
123	return locales.PluralRuleOther
124}
125
126// RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'ka'
127func (ka *ka) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
128
129	start := ka.CardinalPluralRule(num1, v1)
130	end := ka.CardinalPluralRule(num2, v2)
131
132	if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
133		return locales.PluralRuleOne
134	} else if start == locales.PluralRuleOther && end == locales.PluralRuleOne {
135		return locales.PluralRuleOther
136	}
137
138	return locales.PluralRuleOther
139
140}
141
142// MonthAbbreviated returns the locales abbreviated month given the 'month' provided
143func (ka *ka) MonthAbbreviated(month time.Month) string {
144	return ka.monthsAbbreviated[month]
145}
146
147// MonthsAbbreviated returns the locales abbreviated months
148func (ka *ka) MonthsAbbreviated() []string {
149	return ka.monthsAbbreviated[1:]
150}
151
152// MonthNarrow returns the locales narrow month given the 'month' provided
153func (ka *ka) MonthNarrow(month time.Month) string {
154	return ka.monthsNarrow[month]
155}
156
157// MonthsNarrow returns the locales narrow months
158func (ka *ka) MonthsNarrow() []string {
159	return ka.monthsNarrow[1:]
160}
161
162// MonthWide returns the locales wide month given the 'month' provided
163func (ka *ka) MonthWide(month time.Month) string {
164	return ka.monthsWide[month]
165}
166
167// MonthsWide returns the locales wide months
168func (ka *ka) MonthsWide() []string {
169	return ka.monthsWide[1:]
170}
171
172// WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
173func (ka *ka) WeekdayAbbreviated(weekday time.Weekday) string {
174	return ka.daysAbbreviated[weekday]
175}
176
177// WeekdaysAbbreviated returns the locales abbreviated weekdays
178func (ka *ka) WeekdaysAbbreviated() []string {
179	return ka.daysAbbreviated
180}
181
182// WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
183func (ka *ka) WeekdayNarrow(weekday time.Weekday) string {
184	return ka.daysNarrow[weekday]
185}
186
187// WeekdaysNarrow returns the locales narrow weekdays
188func (ka *ka) WeekdaysNarrow() []string {
189	return ka.daysNarrow
190}
191
192// WeekdayShort returns the locales short weekday given the 'weekday' provided
193func (ka *ka) WeekdayShort(weekday time.Weekday) string {
194	return ka.daysShort[weekday]
195}
196
197// WeekdaysShort returns the locales short weekdays
198func (ka *ka) WeekdaysShort() []string {
199	return ka.daysShort
200}
201
202// WeekdayWide returns the locales wide weekday given the 'weekday' provided
203func (ka *ka) WeekdayWide(weekday time.Weekday) string {
204	return ka.daysWide[weekday]
205}
206
207// WeekdaysWide returns the locales wide weekdays
208func (ka *ka) WeekdaysWide() []string {
209	return ka.daysWide
210}
211
212// Decimal returns the decimal point of number
213func (ka *ka) Decimal() string {
214	return ka.decimal
215}
216
217// Group returns the group of number
218func (ka *ka) Group() string {
219	return ka.group
220}
221
222// Group returns the minus sign of number
223func (ka *ka) Minus() string {
224	return ka.minus
225}
226
227// FmtNumber returns 'num' with digits/precision of 'v' for 'ka' and handles both Whole and Real numbers based on 'v'
228func (ka *ka) FmtNumber(num float64, v uint64) string {
229
230	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
231	l := len(s) + 2 + 2*len(s[:len(s)-int(v)-1])/3
232	count := 0
233	inWhole := v == 0
234	b := make([]byte, 0, l)
235
236	for i := len(s) - 1; i >= 0; i-- {
237
238		if s[i] == '.' {
239			b = append(b, ka.decimal[0])
240			inWhole = true
241			continue
242		}
243
244		if inWhole {
245			if count == 3 {
246				for j := len(ka.group) - 1; j >= 0; j-- {
247					b = append(b, ka.group[j])
248				}
249				count = 1
250			} else {
251				count++
252			}
253		}
254
255		b = append(b, s[i])
256	}
257
258	if num < 0 {
259		b = append(b, ka.minus[0])
260	}
261
262	// reverse
263	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
264		b[i], b[j] = b[j], b[i]
265	}
266
267	return string(b)
268}
269
270// FmtPercent returns 'num' with digits/precision of 'v' for 'ka' and handles both Whole and Real numbers based on 'v'
271// NOTE: 'num' passed into FmtPercent is assumed to be in percent already
272func (ka *ka) FmtPercent(num float64, v uint64) string {
273	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
274	l := len(s) + 3
275	b := make([]byte, 0, l)
276
277	for i := len(s) - 1; i >= 0; i-- {
278
279		if s[i] == '.' {
280			b = append(b, ka.decimal[0])
281			continue
282		}
283
284		b = append(b, s[i])
285	}
286
287	if num < 0 {
288		b = append(b, ka.minus[0])
289	}
290
291	// reverse
292	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
293		b[i], b[j] = b[j], b[i]
294	}
295
296	b = append(b, ka.percent...)
297
298	return string(b)
299}
300
301// FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'ka'
302func (ka *ka) FmtCurrency(num float64, v uint64, currency currency.Type) string {
303
304	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
305	symbol := ka.currencies[currency]
306	l := len(s) + len(symbol) + 4 + 2*len(s[:len(s)-int(v)-1])/3
307	count := 0
308	inWhole := v == 0
309	b := make([]byte, 0, l)
310
311	for i := len(s) - 1; i >= 0; i-- {
312
313		if s[i] == '.' {
314			b = append(b, ka.decimal[0])
315			inWhole = true
316			continue
317		}
318
319		if inWhole {
320			if count == 3 {
321				for j := len(ka.group) - 1; j >= 0; j-- {
322					b = append(b, ka.group[j])
323				}
324				count = 1
325			} else {
326				count++
327			}
328		}
329
330		b = append(b, s[i])
331	}
332
333	if num < 0 {
334		b = append(b, ka.minus[0])
335	}
336
337	// reverse
338	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
339		b[i], b[j] = b[j], b[i]
340	}
341
342	if int(v) < 2 {
343
344		if v == 0 {
345			b = append(b, ka.decimal...)
346		}
347
348		for i := 0; i < 2-int(v); i++ {
349			b = append(b, '0')
350		}
351	}
352
353	b = append(b, ka.currencyPositiveSuffix...)
354
355	b = append(b, symbol...)
356
357	return string(b)
358}
359
360// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ka'
361// in accounting notation.
362func (ka *ka) FmtAccounting(num float64, v uint64, currency currency.Type) string {
363
364	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
365	symbol := ka.currencies[currency]
366	l := len(s) + len(symbol) + 4 + 2*len(s[:len(s)-int(v)-1])/3
367	count := 0
368	inWhole := v == 0
369	b := make([]byte, 0, l)
370
371	for i := len(s) - 1; i >= 0; i-- {
372
373		if s[i] == '.' {
374			b = append(b, ka.decimal[0])
375			inWhole = true
376			continue
377		}
378
379		if inWhole {
380			if count == 3 {
381				for j := len(ka.group) - 1; j >= 0; j-- {
382					b = append(b, ka.group[j])
383				}
384				count = 1
385			} else {
386				count++
387			}
388		}
389
390		b = append(b, s[i])
391	}
392
393	if num < 0 {
394
395		b = append(b, ka.minus[0])
396
397	}
398
399	// reverse
400	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
401		b[i], b[j] = b[j], b[i]
402	}
403
404	if int(v) < 2 {
405
406		if v == 0 {
407			b = append(b, ka.decimal...)
408		}
409
410		for i := 0; i < 2-int(v); i++ {
411			b = append(b, '0')
412		}
413	}
414
415	if num < 0 {
416		b = append(b, ka.currencyNegativeSuffix...)
417		b = append(b, symbol...)
418	} else {
419
420		b = append(b, ka.currencyPositiveSuffix...)
421		b = append(b, symbol...)
422	}
423
424	return string(b)
425}
426
427// FmtDateShort returns the short date representation of 't' for 'ka'
428func (ka *ka) FmtDateShort(t time.Time) string {
429
430	b := make([]byte, 0, 32)
431
432	if t.Day() < 10 {
433		b = append(b, '0')
434	}
435
436	b = strconv.AppendInt(b, int64(t.Day()), 10)
437	b = append(b, []byte{0x2e}...)
438
439	if t.Month() < 10 {
440		b = append(b, '0')
441	}
442
443	b = strconv.AppendInt(b, int64(t.Month()), 10)
444
445	b = append(b, []byte{0x2e}...)
446
447	if t.Year() > 9 {
448		b = append(b, strconv.Itoa(t.Year())[2:]...)
449	} else {
450		b = append(b, strconv.Itoa(t.Year())[1:]...)
451	}
452
453	return string(b)
454}
455
456// FmtDateMedium returns the medium date representation of 't' for 'ka'
457func (ka *ka) FmtDateMedium(t time.Time) string {
458
459	b := make([]byte, 0, 32)
460
461	b = strconv.AppendInt(b, int64(t.Day()), 10)
462	b = append(b, []byte{0x20}...)
463	b = append(b, ka.monthsAbbreviated[t.Month()]...)
464	b = append(b, []byte{0x2e, 0x20}...)
465
466	if t.Year() > 0 {
467		b = strconv.AppendInt(b, int64(t.Year()), 10)
468	} else {
469		b = strconv.AppendInt(b, int64(-t.Year()), 10)
470	}
471
472	return string(b)
473}
474
475// FmtDateLong returns the long date representation of 't' for 'ka'
476func (ka *ka) FmtDateLong(t time.Time) string {
477
478	b := make([]byte, 0, 32)
479
480	b = strconv.AppendInt(b, int64(t.Day()), 10)
481	b = append(b, []byte{0x20}...)
482	b = append(b, ka.monthsWide[t.Month()]...)
483	b = append(b, []byte{0x2c, 0x20}...)
484
485	if t.Year() > 0 {
486		b = strconv.AppendInt(b, int64(t.Year()), 10)
487	} else {
488		b = strconv.AppendInt(b, int64(-t.Year()), 10)
489	}
490
491	return string(b)
492}
493
494// FmtDateFull returns the full date representation of 't' for 'ka'
495func (ka *ka) FmtDateFull(t time.Time) string {
496
497	b := make([]byte, 0, 32)
498
499	b = append(b, ka.daysWide[t.Weekday()]...)
500	b = append(b, []byte{0x2c, 0x20}...)
501
502	if t.Day() < 10 {
503		b = append(b, '0')
504	}
505
506	b = strconv.AppendInt(b, int64(t.Day()), 10)
507	b = append(b, []byte{0x20}...)
508	b = append(b, ka.monthsWide[t.Month()]...)
509	b = append(b, []byte{0x2c, 0x20}...)
510
511	if t.Year() > 0 {
512		b = strconv.AppendInt(b, int64(t.Year()), 10)
513	} else {
514		b = strconv.AppendInt(b, int64(-t.Year()), 10)
515	}
516
517	return string(b)
518}
519
520// FmtTimeShort returns the short time representation of 't' for 'ka'
521func (ka *ka) FmtTimeShort(t time.Time) string {
522
523	b := make([]byte, 0, 32)
524
525	if t.Hour() < 10 {
526		b = append(b, '0')
527	}
528
529	b = strconv.AppendInt(b, int64(t.Hour()), 10)
530	b = append(b, ka.timeSeparator...)
531
532	if t.Minute() < 10 {
533		b = append(b, '0')
534	}
535
536	b = strconv.AppendInt(b, int64(t.Minute()), 10)
537
538	return string(b)
539}
540
541// FmtTimeMedium returns the medium time representation of 't' for 'ka'
542func (ka *ka) FmtTimeMedium(t time.Time) string {
543
544	b := make([]byte, 0, 32)
545
546	if t.Hour() < 10 {
547		b = append(b, '0')
548	}
549
550	b = strconv.AppendInt(b, int64(t.Hour()), 10)
551	b = append(b, ka.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, ka.timeSeparator...)
559
560	if t.Second() < 10 {
561		b = append(b, '0')
562	}
563
564	b = strconv.AppendInt(b, int64(t.Second()), 10)
565
566	return string(b)
567}
568
569// FmtTimeLong returns the long time representation of 't' for 'ka'
570func (ka *ka) FmtTimeLong(t time.Time) string {
571
572	b := make([]byte, 0, 32)
573
574	if t.Hour() < 10 {
575		b = append(b, '0')
576	}
577
578	b = strconv.AppendInt(b, int64(t.Hour()), 10)
579	b = append(b, ka.timeSeparator...)
580
581	if t.Minute() < 10 {
582		b = append(b, '0')
583	}
584
585	b = strconv.AppendInt(b, int64(t.Minute()), 10)
586	b = append(b, ka.timeSeparator...)
587
588	if t.Second() < 10 {
589		b = append(b, '0')
590	}
591
592	b = strconv.AppendInt(b, int64(t.Second()), 10)
593	b = append(b, []byte{0x20}...)
594
595	tz, _ := t.Zone()
596	b = append(b, tz...)
597
598	return string(b)
599}
600
601// FmtTimeFull returns the full time representation of 't' for 'ka'
602func (ka *ka) FmtTimeFull(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, ka.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, ka.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
629	if btz, ok := ka.timezones[tz]; ok {
630		b = append(b, btz...)
631	} else {
632		b = append(b, tz...)
633	}
634
635	return string(b)
636}
637