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 currencyNegativeSuffix string
27 monthsAbbreviated []string
30 daysAbbreviated []string
34 periodsAbbreviated []string
35 periodsNarrow []string
38 erasAbbreviated []string
41 timezones map[string]string
44 // New returns a new instance of translator for the 'hu_HU' locale
45 func New() locales.Translator {
48 pluralsCardinal: []locales.PluralRule{2, 6},
49 pluralsOrdinal: []locales.PluralRule{2, 6},
50 pluralsRange: []locales.PluralRule{2, 6},
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", "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"},
59 currencyPositiveSuffix: " ",
60 currencyNegativeSuffix: " ",
61 monthsAbbreviated: []string{"", "jan.", "febr.", "márc.", "ápr.", "máj.", "jún.", "júl.", "aug.", "szept.", "okt.", "nov.", "dec."},
62 monthsNarrow: []string{"", "J", "F", "M", "Á", "M", "J", "J", "A", "Sz", "O", "N", "D"},
63 monthsWide: []string{"", "január", "február", "március", "április", "május", "június", "július", "augusztus", "szeptember", "október", "november", "december"},
64 daysAbbreviated: []string{"V", "H", "K", "Sze", "Cs", "P", "Szo"},
65 daysNarrow: []string{"V", "H", "K", "Sz", "Cs", "P", "Sz"},
66 daysShort: []string{"V", "H", "K", "Sze", "Cs", "P", "Szo"},
67 daysWide: []string{"vasárnap", "hétfő", "kedd", "szerda", "csütörtök", "péntek", "szombat"},
68 periodsAbbreviated: []string{"de.", "du."},
69 periodsNarrow: []string{"de.", "du."},
70 periodsWide: []string{"de.", "du."},
71 erasAbbreviated: []string{"i. e.", "i. sz."},
72 erasNarrow: []string{"ie.", "isz."},
73 erasWide: []string{"időszámításunk előtt", "időszámításunk szerint"},
74 timezones: map[string]string{"HEPMX": "mexikói csendes-óceáni nyári idő", "HAST": "hawaii-aleuti téli idő", "WART": "nyugat-argentínai téli idő", "WESZ": "nyugat-európai nyári idő", "HKT": "hongkongi téli idő", "GMT": "greenwichi középidő, téli idő", "WIT": "kelet-indonéziai idő", "JDT": "japán nyári idő", "HENOMX": "északnyugat-mexikói nyári idő", "HEEG": "kelet-grönlandi nyári idő", "COST": "kolumbiai nyári idő", "ChST": "chamorrói téli idő", "HADT": "hawaii-aleuti nyári idő", "HEOG": "nyugat-grönlandi nyári idő", "WAT": "nyugat-afrikai téli idő", "UYT": "uruguayi téli idő", "EST": "keleti államokbeli zónaidő", "HNPM": "Saint Pierre és Miquelon-i zónaidő", "NZST": "új-zélandi téli idő", "TMST": "türkmenisztáni nyári idő", "AEST": "kelet-ausztráliai téli idő", "WEZ": "nyugat-európai téli idő", "SGT": "szingapúri téli idő", "CDT": "középső államokbeli nyári idő", "MST": "Macaui zónaidő", "MDT": "Macaui nyári idő", "WIB": "nyugat-indonéziai téli idő", "HNCU": "kubai téli idő", "MEZ": "közép-európai téli idő", "NZDT": "új-zélandi nyári idő", "HNPMX": "mexikói csendes-óceáni zónaidő", "HEPM": "Saint Pierre és Miquelon-i nyári idő", "BT": "butáni idő", "ARST": "Argentínai nyári idő", "SAST": "dél-afrikai téli idő", "HNT": "új-fundlandi zónaidő", "UYST": "uruguayi nyári idő", "VET": "venezuelai idő", "HAT": "új-fundlandi nyári idő", "PST": "csendes-óceáni zónaidő", "PDT": "csendes-óceáni nyári idő", "LHDT": "Lord Howe-szigeti nyári idő", "WAST": "nyugat-afrikai nyári idő", "CAT": "közép-afrikai téli idő", "OEZ": "kelet-európai téli idő", "IST": "indiai téli idő", "GFT": "francia-guianai idő", "SRT": "szurinámi idő", "ACWST": "közép-nyugat-ausztráliai téli idő", "WITA": "közép-indonéziai idő", "AEDT": "kelet-ausztráliai nyári idő", "COT": "kolumbiai téli idő", "EDT": "keleti államokbeli nyári idő", "ECT": "ecuadori téli idő", "CHAST": "chathami téli idő", "TMT": "türkmenisztáni téli idő", "OESZ": "kelet-európai nyári idő", "AST": "atlanti-óceáni zónaidő", "HECU": "kubai nyári idő", "WARST": "nyugat-argentínai nyári idő", "EAT": "kelet-afrikai téli idő", "ACDT": "közép-ausztráliai nyári idő", "AWDT": "nyugat-ausztráliai nyári idő", "∅∅∅": "Acre nyári idő", "LHST": "Lord Howe-szigeti téli idő", "MYT": "malajziai idő", "JST": "japán téli idő", "ART": "argentínai téli idő", "HKST": "hongkongi nyári idő", "GYT": "guyanai téli idő", "BOT": "bolíviai téli idő", "AWST": "nyugat-ausztráliai téli idő", "ACWDT": "közép-nyugat-ausztráliai nyári idő", "HNNOMX": "északnyugat-mexikói zónaidő", "AKST": "alaszkai zónaidő", "AKDT": "alaszkai nyári idő", "ACST": "közép-ausztráliai téli idő", "MESZ": "közép-európai nyári idő", "CLT": "chilei téli idő", "CLST": "chilei nyári idő", "HNEG": "kelet-grönlandi téli idő", "CHADT": "chathami nyári idő", "CST": "középső államokbeli zónaidő", "ADT": "atlanti-óceáni nyári idő", "HNOG": "nyugat-grönlandi téli idő"},
78 // Locale returns the current translators string locale
79 func (hu *hu_HU) Locale() string {
83 // PluralsCardinal returns the list of cardinal plural rules associated with 'hu_HU'
84 func (hu *hu_HU) PluralsCardinal() []locales.PluralRule {
85 return hu.pluralsCardinal
88 // PluralsOrdinal returns the list of ordinal plural rules associated with 'hu_HU'
89 func (hu *hu_HU) PluralsOrdinal() []locales.PluralRule {
90 return hu.pluralsOrdinal
93 // PluralsRange returns the list of range plural rules associated with 'hu_HU'
94 func (hu *hu_HU) PluralsRange() []locales.PluralRule {
95 return hu.pluralsRange
98 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'hu_HU'
99 func (hu *hu_HU) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
104 return locales.PluralRuleOne
107 return locales.PluralRuleOther
110 // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'hu_HU'
111 func (hu *hu_HU) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
115 if n == 1 || n == 5 {
116 return locales.PluralRuleOne
119 return locales.PluralRuleOther
122 // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'hu_HU'
123 func (hu *hu_HU) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
125 start := hu.CardinalPluralRule(num1, v1)
126 end := hu.CardinalPluralRule(num2, v2)
128 if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
129 return locales.PluralRuleOther
130 } else if start == locales.PluralRuleOther && end == locales.PluralRuleOne {
131 return locales.PluralRuleOne
134 return locales.PluralRuleOther
138 // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
139 func (hu *hu_HU) MonthAbbreviated(month time.Month) string {
140 return hu.monthsAbbreviated[month]
143 // MonthsAbbreviated returns the locales abbreviated months
144 func (hu *hu_HU) MonthsAbbreviated() []string {
145 return hu.monthsAbbreviated[1:]
148 // MonthNarrow returns the locales narrow month given the 'month' provided
149 func (hu *hu_HU) MonthNarrow(month time.Month) string {
150 return hu.monthsNarrow[month]
153 // MonthsNarrow returns the locales narrow months
154 func (hu *hu_HU) MonthsNarrow() []string {
155 return hu.monthsNarrow[1:]
158 // MonthWide returns the locales wide month given the 'month' provided
159 func (hu *hu_HU) MonthWide(month time.Month) string {
160 return hu.monthsWide[month]
163 // MonthsWide returns the locales wide months
164 func (hu *hu_HU) MonthsWide() []string {
165 return hu.monthsWide[1:]
168 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
169 func (hu *hu_HU) WeekdayAbbreviated(weekday time.Weekday) string {
170 return hu.daysAbbreviated[weekday]
173 // WeekdaysAbbreviated returns the locales abbreviated weekdays
174 func (hu *hu_HU) WeekdaysAbbreviated() []string {
175 return hu.daysAbbreviated
178 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
179 func (hu *hu_HU) WeekdayNarrow(weekday time.Weekday) string {
180 return hu.daysNarrow[weekday]
183 // WeekdaysNarrow returns the locales narrow weekdays
184 func (hu *hu_HU) WeekdaysNarrow() []string {
188 // WeekdayShort returns the locales short weekday given the 'weekday' provided
189 func (hu *hu_HU) WeekdayShort(weekday time.Weekday) string {
190 return hu.daysShort[weekday]
193 // WeekdaysShort returns the locales short weekdays
194 func (hu *hu_HU) WeekdaysShort() []string {
198 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
199 func (hu *hu_HU) WeekdayWide(weekday time.Weekday) string {
200 return hu.daysWide[weekday]
203 // WeekdaysWide returns the locales wide weekdays
204 func (hu *hu_HU) WeekdaysWide() []string {
208 // Decimal returns the decimal point of number
209 func (hu *hu_HU) Decimal() string {
213 // Group returns the group of number
214 func (hu *hu_HU) Group() string {
218 // Group returns the minus sign of number
219 func (hu *hu_HU) Minus() string {
223 // FmtNumber returns 'num' with digits/precision of 'v' for 'hu_HU' and handles both Whole and Real numbers based on 'v'
224 func (hu *hu_HU) FmtNumber(num float64, v uint64) string {
226 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
227 l := len(s) + 2 + 2*len(s[:len(s)-int(v)-1])/3
230 b := make([]byte, 0, l)
232 for i := len(s) - 1; i >= 0; i-- {
235 b = append(b, hu.decimal[0])
242 for j := len(hu.group) - 1; j >= 0; j-- {
243 b = append(b, hu.group[j])
255 b = append(b, hu.minus[0])
259 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
260 b[i], b[j] = b[j], b[i]
266 // FmtPercent returns 'num' with digits/precision of 'v' for 'hu_HU' and handles both Whole and Real numbers based on 'v'
267 // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
268 func (hu *hu_HU) FmtPercent(num float64, v uint64) string {
269 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
271 b := make([]byte, 0, l)
273 for i := len(s) - 1; i >= 0; i-- {
276 b = append(b, hu.decimal[0])
284 b = append(b, hu.minus[0])
288 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
289 b[i], b[j] = b[j], b[i]
292 b = append(b, hu.percent...)
297 // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'hu_HU'
298 func (hu *hu_HU) FmtCurrency(num float64, v uint64, currency currency.Type) string {
300 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
301 symbol := hu.currencies[currency]
302 l := len(s) + len(symbol) + 4 + 2*len(s[:len(s)-int(v)-1])/3
305 b := make([]byte, 0, l)
307 for i := len(s) - 1; i >= 0; i-- {
310 b = append(b, hu.decimal[0])
317 for j := len(hu.group) - 1; j >= 0; j-- {
318 b = append(b, hu.group[j])
330 b = append(b, hu.minus[0])
334 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
335 b[i], b[j] = b[j], b[i]
341 b = append(b, hu.decimal...)
344 for i := 0; i < 2-int(v); i++ {
349 b = append(b, hu.currencyPositiveSuffix...)
351 b = append(b, symbol...)
356 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'hu_HU'
357 // in accounting notation.
358 func (hu *hu_HU) FmtAccounting(num float64, v uint64, currency currency.Type) string {
360 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
361 symbol := hu.currencies[currency]
362 l := len(s) + len(symbol) + 4 + 2*len(s[:len(s)-int(v)-1])/3
365 b := make([]byte, 0, l)
367 for i := len(s) - 1; i >= 0; i-- {
370 b = append(b, hu.decimal[0])
377 for j := len(hu.group) - 1; j >= 0; j-- {
378 b = append(b, hu.group[j])
391 b = append(b, hu.minus[0])
396 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
397 b[i], b[j] = b[j], b[i]
403 b = append(b, hu.decimal...)
406 for i := 0; i < 2-int(v); i++ {
412 b = append(b, hu.currencyNegativeSuffix...)
413 b = append(b, symbol...)
416 b = append(b, hu.currencyPositiveSuffix...)
417 b = append(b, symbol...)
423 // FmtDateShort returns the short date representation of 't' for 'hu_HU'
424 func (hu *hu_HU) FmtDateShort(t time.Time) string {
426 b := make([]byte, 0, 32)
429 b = strconv.AppendInt(b, int64(t.Year()), 10)
431 b = strconv.AppendInt(b, int64(-t.Year()), 10)
434 b = append(b, []byte{0x2e, 0x20}...)
440 b = strconv.AppendInt(b, int64(t.Month()), 10)
442 b = append(b, []byte{0x2e, 0x20}...)
448 b = strconv.AppendInt(b, int64(t.Day()), 10)
449 b = append(b, []byte{0x2e}...)
454 // FmtDateMedium returns the medium date representation of 't' for 'hu_HU'
455 func (hu *hu_HU) FmtDateMedium(t time.Time) string {
457 b := make([]byte, 0, 32)
460 b = strconv.AppendInt(b, int64(t.Year()), 10)
462 b = strconv.AppendInt(b, int64(-t.Year()), 10)
465 b = append(b, []byte{0x2e, 0x20}...)
466 b = append(b, hu.monthsAbbreviated[t.Month()]...)
467 b = append(b, []byte{0x20}...)
468 b = strconv.AppendInt(b, int64(t.Day()), 10)
469 b = append(b, []byte{0x2e}...)
474 // FmtDateLong returns the long date representation of 't' for 'hu_HU'
475 func (hu *hu_HU) FmtDateLong(t time.Time) string {
477 b := make([]byte, 0, 32)
480 b = strconv.AppendInt(b, int64(t.Year()), 10)
482 b = strconv.AppendInt(b, int64(-t.Year()), 10)
485 b = append(b, []byte{0x2e, 0x20}...)
486 b = append(b, hu.monthsWide[t.Month()]...)
487 b = append(b, []byte{0x20}...)
488 b = strconv.AppendInt(b, int64(t.Day()), 10)
489 b = append(b, []byte{0x2e}...)
494 // FmtDateFull returns the full date representation of 't' for 'hu_HU'
495 func (hu *hu_HU) FmtDateFull(t time.Time) string {
497 b := make([]byte, 0, 32)
500 b = strconv.AppendInt(b, int64(t.Year()), 10)
502 b = strconv.AppendInt(b, int64(-t.Year()), 10)
505 b = append(b, []byte{0x2e, 0x20}...)
506 b = append(b, hu.monthsWide[t.Month()]...)
507 b = append(b, []byte{0x20}...)
508 b = strconv.AppendInt(b, int64(t.Day()), 10)
509 b = append(b, []byte{0x2e, 0x2c, 0x20}...)
510 b = append(b, hu.daysWide[t.Weekday()]...)
515 // FmtTimeShort returns the short time representation of 't' for 'hu_HU'
516 func (hu *hu_HU) FmtTimeShort(t time.Time) string {
518 b := make([]byte, 0, 32)
520 b = strconv.AppendInt(b, int64(t.Hour()), 10)
521 b = append(b, hu.timeSeparator...)
527 b = strconv.AppendInt(b, int64(t.Minute()), 10)
532 // FmtTimeMedium returns the medium time representation of 't' for 'hu_HU'
533 func (hu *hu_HU) FmtTimeMedium(t time.Time) string {
535 b := make([]byte, 0, 32)
537 b = strconv.AppendInt(b, int64(t.Hour()), 10)
538 b = append(b, hu.timeSeparator...)
544 b = strconv.AppendInt(b, int64(t.Minute()), 10)
545 b = append(b, hu.timeSeparator...)
551 b = strconv.AppendInt(b, int64(t.Second()), 10)
556 // FmtTimeLong returns the long time representation of 't' for 'hu_HU'
557 func (hu *hu_HU) FmtTimeLong(t time.Time) string {
559 b := make([]byte, 0, 32)
561 b = strconv.AppendInt(b, int64(t.Hour()), 10)
562 b = append(b, hu.timeSeparator...)
568 b = strconv.AppendInt(b, int64(t.Minute()), 10)
569 b = append(b, hu.timeSeparator...)
575 b = strconv.AppendInt(b, int64(t.Second()), 10)
576 b = append(b, []byte{0x20}...)
584 // FmtTimeFull returns the full time representation of 't' for 'hu_HU'
585 func (hu *hu_HU) FmtTimeFull(t time.Time) string {
587 b := make([]byte, 0, 32)
589 b = strconv.AppendInt(b, int64(t.Hour()), 10)
590 b = append(b, hu.timeSeparator...)
596 b = strconv.AppendInt(b, int64(t.Minute()), 10)
597 b = append(b, hu.timeSeparator...)
603 b = strconv.AppendInt(b, int64(t.Second()), 10)
604 b = append(b, []byte{0x20}...)
608 if btz, ok := hu.timezones[tz]; ok {
609 b = append(b, btz...)