8 "github.com/go-playground/locales"
9 "github.com/go-playground/locales/currency"
14 pluralsCardinal []locales.PluralRule
15 pluralsOrdinal []locales.PluralRule
16 pluralsRange []locales.PluralRule
24 currencies []string // idx = enum of currency code
25 currencyPositiveSuffix string
26 currencyNegativePrefix string
27 currencyNegativeSuffix string
28 monthsAbbreviated []string
31 daysAbbreviated []string
35 periodsAbbreviated []string
36 periodsNarrow []string
39 erasAbbreviated []string
42 timezones map[string]string
45 // New returns a new instance of translator for the 'et_EE' locale
46 func New() locales.Translator {
49 pluralsCardinal: []locales.PluralRule{2, 6},
50 pluralsOrdinal: []locales.PluralRule{6},
51 pluralsRange: []locales.PluralRule{6},
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", "CNX", "CNY", "COP", "COU", "CRC", "CSD", "CSK", "CUC", "CUP", "CVE", "CYP", "CZK", "DDM", "DEM", "DJF", "DKK", "DOP", "DZD", "ECS", "ECV", "EEK", "EGP", "ERN", "ESA", "ESB", "ESP", "ETB", "EUR", "FIM", "FJD", "FKP", "FRF", "GBP", "GEK", "GEL", "GHC", "GHS", "GIP", "GMD", "GNF", "GNS", "GQE", "GRD", "GTQ", "GWE", "GWP", "GYD", "HKD", "HNL", "HRD", "HRK", "HTG", "HUF", "IDR", "IEP", "ILP", "ILR", "ILS", "INR", "IQD", "IRR", "ISJ", "ISK", "ITL", "JMD", "JOD", "JPY", "KES", "KGS", "KHR", "KMF", "KPW", "KRH", "KRO", "KRW", "KWD", "KYD", "KZT", "LAK", "LBP", "LKR", "LRD", "LSL", "LTL", "LTT", "LUC", "LUF", "LUL", "LVL", "LVR", "LYD", "MAD", "MAF", "MCF", "MDC", "MDL", "MGA", "MGF", "MKD", "MKN", "MLF", "MMK", "MNT", "MOP", "MRO", "MTL", "MTP", "MUR", "MVP", "MVR", "MWK", "MXN", "MXP", "MXV", "MYR", "MZE", "MZM", "MZN", "NAD", "NGN", "NIC", "NIO", "NLG", "NOK", "NPR", "NZD", "OMR", "PAB", "PEI", "PEN", "PES", "PGK", "PHP", "PKR", "PLN", "PLZ", "PTE", "PYG", "QAR", "RHD", "ROL", "RON", "RSD", "RUB", "RUR", "RWF", "SAR", "SBD", "SCR", "SDD", "SDG", "SDP", "SEK", "SGD", "SHP", "SIT", "SKK", "SLL", "SOS", "SRD", "SRG", "SSP", "STD", "SUR", "SVC", "SYP", "SZL", "THB", "TJR", "TJS", "TMM", "TMT", "TND", "TOP", "TPE", "TRL", "TRY", "TTD", "TWD", "TZS", "UAH", "UAK", "UGS", "UGX", "USD", "USN", "USS", "UYI", "UYP", "UYU", "UZS", "VEB", "VEF", "VND", "VNN", "VUV", "WST", "XAF", "XAG", "XAU", "XBA", "XBB", "XBC", "XBD", "XCD", "XDR", "XEU", "XFO", "XFU", "XOF", "XPD", "XPF", "XPT", "XRE", "XSU", "XTS", "XUA", "XXX", "YDD", "YER", "YUD", "YUM", "YUN", "YUR", "ZAL", "ZAR", "ZMK", "ZMW", "ZRN", "ZRZ", "ZWD", "ZWL", "ZWR"},
60 currencyPositiveSuffix: " ",
61 currencyNegativePrefix: "(",
62 currencyNegativeSuffix: " )",
63 monthsAbbreviated: []string{"", "jaan", "veebr", "märts", "apr", "mai", "juuni", "juuli", "aug", "sept", "okt", "nov", "dets"},
64 monthsNarrow: []string{"", "J", "V", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"},
65 monthsWide: []string{"", "jaanuar", "veebruar", "märts", "aprill", "mai", "juuni", "juuli", "august", "september", "oktoober", "november", "detsember"},
66 daysAbbreviated: []string{"P", "E", "T", "K", "N", "R", "L"},
67 daysNarrow: []string{"P", "E", "T", "K", "N", "R", "L"},
68 daysShort: []string{"P", "E", "T", "K", "N", "R", "L"},
69 daysWide: []string{"pühapäev", "esmaspäev", "teisipäev", "kolmapäev", "neljapäev", "reede", "laupäev"},
70 periodsAbbreviated: []string{"AM", "PM"},
71 periodsNarrow: []string{"AM", "PM"},
72 periodsWide: []string{"AM", "PM"},
73 erasAbbreviated: []string{"eKr", "pKr"},
74 erasNarrow: []string{"eKr", "pKr"},
75 erasWide: []string{"enne Kristust", "pärast Kristust"},
76 timezones: map[string]string{"ACST": "Kesk-Austraalia standardaeg", "HNCU": "Kuuba standardaeg", "HNEG": "Ida-Gröönimaa standardaeg", "TMT": "Türkmenistani standardaeg", "AKST": "Alaska standardaeg", "ACDT": "Kesk-Austraalia suveaeg", "MST": "MST", "MYT": "Malaisia \u200b\u200baeg", "OEZ": "Ida-Euroopa standardaeg", "OESZ": "Ida-Euroopa suveaeg", "HNT": "Newfoundlandi standardaeg", "CDT": "Kesk-Ameerika suveaeg", "MDT": "MDT", "PST": "Vaikse ookeani standardaeg", "WART": "Lääne-Argentina standardaeg", "IST": "India aeg", "ARST": "Argentina suveaeg", "EAT": "Ida-Aafrika aeg", "COT": "Colombia standardaeg", "GFT": "Prantsuse Guajaana aeg", "HEPM": "Saint-Pierre’i ja Miqueloni suveaeg", "JST": "Jaapani standardaeg", "CAT": "Kesk-Aafrika aeg", "WITA": "Kesk-Indoneesia aeg", "HNOG": "Lääne-Gröönimaa standardaeg", "WEZ": "Lääne-Euroopa standardaeg", "HECU": "Kuuba suveaeg", "HADT": "Hawaii-Aleuudi suveaeg", "AST": "Atlandi standardaeg", "WAST": "Lääne-Aafrika suveaeg", "HAT": "Newfoundlandi suveaeg", "CLST": "Tšiili suveaeg", "GYT": "Guyana aeg", "ECT": "Ecuadori aeg", "HNPM": "Saint-Pierre’i ja Miqueloni standardaeg", "NZDT": "Uus-Meremaa suveaeg", "TMST": "Türkmenistani suveaeg", "LHDT": "Lord Howe’i suveaeg", "HNNOMX": "Loode-Mehhiko standardaeg", "CLT": "Tšiili standardaeg", "EDT": "Idaranniku suveaeg", "PDT": "Vaikse ookeani suveaeg", "BOT": "Boliivia aeg", "EST": "Idaranniku standardaeg", "WIB": "Lääne-Indoneesia aeg", "HKST": "Hongkongi suveaeg", "ACWDT": "Kesk-Lääne Austraalia suveaeg", "UYST": "Uruguay suveaeg", "JDT": "Jaapani suveaeg", "SAST": "Lõuna-Aafrika standardaeg", "BT": "Bhutani aeg", "CST": "Kesk-Ameerika standardaeg", "HEOG": "Lääne-Gröönimaa suveaeg", "WAT": "Lääne-Aafrika standardaeg", "HKT": "Hongkongi standardaeg", "ChST": "Tšamorro standardaeg", "AEST": "Ida-Austraalia standardaeg", "NZST": "Uus-Meremaa standardaeg", "HEEG": "Ida-Gröönimaa suveaeg", "WESZ": "Lääne-Euroopa suveaeg", "AWST": "Lääne-Austraalia standardaeg", "MESZ": "Kesk-Euroopa suveaeg", "AWDT": "Lääne-Austraalia suveaeg", "ACWST": "Kesk-Lääne Austraalia standardaeg", "UYT": "Uruguay standardaeg", "WIT": "Ida-Indoneesia aeg", "HAST": "Hawaii-Aleuudi standardaeg", "VET": "Venezuela aeg", "∅∅∅": "Peruu suveaeg", "HNPMX": "Mehhiko Vaikse ookeani standardaeg", "COST": "Colombia suveaeg", "SRT": "Suriname aeg", "CHAST": "Chathami standardaeg", "CHADT": "Chathami suveaeg", "MEZ": "Kesk-Euroopa standardaeg", "LHST": "Lord Howe’i standardaeg", "ADT": "Atlandi suveaeg", "ART": "Argentina standardaeg", "GMT": "Greenwichi aeg", "HEPMX": "Mehhiko Vaikse ookeani suveaeg", "AEDT": "Ida-Austraalia suveaeg", "AKDT": "Alaska suveaeg", "SGT": "Singapuri standardaeg", "WARST": "Lääne-Argentina suveaeg", "HENOMX": "Loode-Mehhiko suveaeg"},
80 // Locale returns the current translators string locale
81 func (et *et_EE) Locale() string {
85 // PluralsCardinal returns the list of cardinal plural rules associated with 'et_EE'
86 func (et *et_EE) PluralsCardinal() []locales.PluralRule {
87 return et.pluralsCardinal
90 // PluralsOrdinal returns the list of ordinal plural rules associated with 'et_EE'
91 func (et *et_EE) PluralsOrdinal() []locales.PluralRule {
92 return et.pluralsOrdinal
95 // PluralsRange returns the list of range plural rules associated with 'et_EE'
96 func (et *et_EE) PluralsRange() []locales.PluralRule {
97 return et.pluralsRange
100 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'et_EE'
101 func (et *et_EE) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
106 if i == 1 && v == 0 {
107 return locales.PluralRuleOne
110 return locales.PluralRuleOther
113 // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'et_EE'
114 func (et *et_EE) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
115 return locales.PluralRuleOther
118 // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'et_EE'
119 func (et *et_EE) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
120 return locales.PluralRuleOther
123 // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
124 func (et *et_EE) MonthAbbreviated(month time.Month) string {
125 return et.monthsAbbreviated[month]
128 // MonthsAbbreviated returns the locales abbreviated months
129 func (et *et_EE) MonthsAbbreviated() []string {
130 return et.monthsAbbreviated[1:]
133 // MonthNarrow returns the locales narrow month given the 'month' provided
134 func (et *et_EE) MonthNarrow(month time.Month) string {
135 return et.monthsNarrow[month]
138 // MonthsNarrow returns the locales narrow months
139 func (et *et_EE) MonthsNarrow() []string {
140 return et.monthsNarrow[1:]
143 // MonthWide returns the locales wide month given the 'month' provided
144 func (et *et_EE) MonthWide(month time.Month) string {
145 return et.monthsWide[month]
148 // MonthsWide returns the locales wide months
149 func (et *et_EE) MonthsWide() []string {
150 return et.monthsWide[1:]
153 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
154 func (et *et_EE) WeekdayAbbreviated(weekday time.Weekday) string {
155 return et.daysAbbreviated[weekday]
158 // WeekdaysAbbreviated returns the locales abbreviated weekdays
159 func (et *et_EE) WeekdaysAbbreviated() []string {
160 return et.daysAbbreviated
163 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
164 func (et *et_EE) WeekdayNarrow(weekday time.Weekday) string {
165 return et.daysNarrow[weekday]
168 // WeekdaysNarrow returns the locales narrow weekdays
169 func (et *et_EE) WeekdaysNarrow() []string {
173 // WeekdayShort returns the locales short weekday given the 'weekday' provided
174 func (et *et_EE) WeekdayShort(weekday time.Weekday) string {
175 return et.daysShort[weekday]
178 // WeekdaysShort returns the locales short weekdays
179 func (et *et_EE) WeekdaysShort() []string {
183 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
184 func (et *et_EE) WeekdayWide(weekday time.Weekday) string {
185 return et.daysWide[weekday]
188 // WeekdaysWide returns the locales wide weekdays
189 func (et *et_EE) WeekdaysWide() []string {
193 // Decimal returns the decimal point of number
194 func (et *et_EE) Decimal() string {
198 // Group returns the group of number
199 func (et *et_EE) Group() string {
203 // Group returns the minus sign of number
204 func (et *et_EE) Minus() string {
208 // FmtNumber returns 'num' with digits/precision of 'v' for 'et_EE' and handles both Whole and Real numbers based on 'v'
209 func (et *et_EE) FmtNumber(num float64, v uint64) string {
211 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
212 l := len(s) + 4 + 2*len(s[:len(s)-int(v)-1])/3
215 b := make([]byte, 0, l)
217 for i := len(s) - 1; i >= 0; i-- {
220 b = append(b, et.decimal[0])
227 for j := len(et.group) - 1; j >= 0; j-- {
228 b = append(b, et.group[j])
240 for j := len(et.minus) - 1; j >= 0; j-- {
241 b = append(b, et.minus[j])
246 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
247 b[i], b[j] = b[j], b[i]
253 // FmtPercent returns 'num' with digits/precision of 'v' for 'et_EE' and handles both Whole and Real numbers based on 'v'
254 // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
255 func (et *et_EE) FmtPercent(num float64, v uint64) string {
256 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
258 b := make([]byte, 0, l)
260 for i := len(s) - 1; i >= 0; i-- {
263 b = append(b, et.decimal[0])
271 for j := len(et.minus) - 1; j >= 0; j-- {
272 b = append(b, et.minus[j])
277 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
278 b[i], b[j] = b[j], b[i]
281 b = append(b, et.percent...)
286 // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'et_EE'
287 func (et *et_EE) FmtCurrency(num float64, v uint64, currency currency.Type) string {
289 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
290 symbol := et.currencies[currency]
291 l := len(s) + len(symbol) + 6 + 2*len(s[:len(s)-int(v)-1])/3
294 b := make([]byte, 0, l)
296 for i := len(s) - 1; i >= 0; i-- {
299 b = append(b, et.decimal[0])
306 for j := len(et.group) - 1; j >= 0; j-- {
307 b = append(b, et.group[j])
319 for j := len(et.minus) - 1; j >= 0; j-- {
320 b = append(b, et.minus[j])
325 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
326 b[i], b[j] = b[j], b[i]
332 b = append(b, et.decimal...)
335 for i := 0; i < 2-int(v); i++ {
340 b = append(b, et.currencyPositiveSuffix...)
342 b = append(b, symbol...)
347 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'et_EE'
348 // in accounting notation.
349 func (et *et_EE) FmtAccounting(num float64, v uint64, currency currency.Type) string {
351 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
352 symbol := et.currencies[currency]
353 l := len(s) + len(symbol) + 8 + 2*len(s[:len(s)-int(v)-1])/3
356 b := make([]byte, 0, l)
358 for i := len(s) - 1; i >= 0; i-- {
361 b = append(b, et.decimal[0])
368 for j := len(et.group) - 1; j >= 0; j-- {
369 b = append(b, et.group[j])
382 b = append(b, et.currencyNegativePrefix[0])
387 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
388 b[i], b[j] = b[j], b[i]
394 b = append(b, et.decimal...)
397 for i := 0; i < 2-int(v); i++ {
403 b = append(b, et.currencyNegativeSuffix...)
404 b = append(b, symbol...)
407 b = append(b, et.currencyPositiveSuffix...)
408 b = append(b, symbol...)
414 // FmtDateShort returns the short date representation of 't' for 'et_EE'
415 func (et *et_EE) FmtDateShort(t time.Time) string {
417 b := make([]byte, 0, 32)
423 b = strconv.AppendInt(b, int64(t.Day()), 10)
424 b = append(b, []byte{0x2e}...)
430 b = strconv.AppendInt(b, int64(t.Month()), 10)
432 b = append(b, []byte{0x2e}...)
435 b = append(b, strconv.Itoa(t.Year())[2:]...)
437 b = append(b, strconv.Itoa(t.Year())[1:]...)
443 // FmtDateMedium returns the medium date representation of 't' for 'et_EE'
444 func (et *et_EE) FmtDateMedium(t time.Time) string {
446 b := make([]byte, 0, 32)
448 b = strconv.AppendInt(b, int64(t.Day()), 10)
449 b = append(b, []byte{0x2e, 0x20}...)
450 b = append(b, et.monthsAbbreviated[t.Month()]...)
451 b = append(b, []byte{0x20}...)
454 b = strconv.AppendInt(b, int64(t.Year()), 10)
456 b = strconv.AppendInt(b, int64(-t.Year()), 10)
462 // FmtDateLong returns the long date representation of 't' for 'et_EE'
463 func (et *et_EE) FmtDateLong(t time.Time) string {
465 b := make([]byte, 0, 32)
467 b = strconv.AppendInt(b, int64(t.Day()), 10)
468 b = append(b, []byte{0x2e, 0x20}...)
469 b = append(b, et.monthsWide[t.Month()]...)
470 b = append(b, []byte{0x20}...)
473 b = strconv.AppendInt(b, int64(t.Year()), 10)
475 b = strconv.AppendInt(b, int64(-t.Year()), 10)
481 // FmtDateFull returns the full date representation of 't' for 'et_EE'
482 func (et *et_EE) FmtDateFull(t time.Time) string {
484 b := make([]byte, 0, 32)
486 b = append(b, et.daysWide[t.Weekday()]...)
487 b = append(b, []byte{0x2c, 0x20}...)
488 b = strconv.AppendInt(b, int64(t.Day()), 10)
489 b = append(b, []byte{0x2e, 0x20}...)
490 b = append(b, et.monthsWide[t.Month()]...)
491 b = append(b, []byte{0x20}...)
494 b = strconv.AppendInt(b, int64(t.Year()), 10)
496 b = strconv.AppendInt(b, int64(-t.Year()), 10)
502 // FmtTimeShort returns the short time representation of 't' for 'et_EE'
503 func (et *et_EE) FmtTimeShort(t time.Time) string {
505 b := make([]byte, 0, 32)
511 b = strconv.AppendInt(b, int64(t.Hour()), 10)
512 b = append(b, et.timeSeparator...)
518 b = strconv.AppendInt(b, int64(t.Minute()), 10)
523 // FmtTimeMedium returns the medium time representation of 't' for 'et_EE'
524 func (et *et_EE) FmtTimeMedium(t time.Time) string {
526 b := make([]byte, 0, 32)
532 b = strconv.AppendInt(b, int64(t.Hour()), 10)
533 b = append(b, et.timeSeparator...)
539 b = strconv.AppendInt(b, int64(t.Minute()), 10)
540 b = append(b, et.timeSeparator...)
546 b = strconv.AppendInt(b, int64(t.Second()), 10)
551 // FmtTimeLong returns the long time representation of 't' for 'et_EE'
552 func (et *et_EE) FmtTimeLong(t time.Time) string {
554 b := make([]byte, 0, 32)
560 b = strconv.AppendInt(b, int64(t.Hour()), 10)
561 b = append(b, et.timeSeparator...)
567 b = strconv.AppendInt(b, int64(t.Minute()), 10)
568 b = append(b, et.timeSeparator...)
574 b = strconv.AppendInt(b, int64(t.Second()), 10)
575 b = append(b, []byte{0x20}...)
583 // FmtTimeFull returns the full time representation of 't' for 'et_EE'
584 func (et *et_EE) FmtTimeFull(t time.Time) string {
586 b := make([]byte, 0, 32)
592 b = strconv.AppendInt(b, int64(t.Hour()), 10)
593 b = append(b, et.timeSeparator...)
599 b = strconv.AppendInt(b, int64(t.Minute()), 10)
600 b = append(b, et.timeSeparator...)
606 b = strconv.AppendInt(b, int64(t.Second()), 10)
607 b = append(b, []byte{0x20}...)
611 if btz, ok := et.timezones[tz]; ok {
612 b = append(b, btz...)