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 'pl_PL' locale
46 func New() locales.Translator {
49 pluralsCardinal: []locales.PluralRule{2, 4, 5, 6},
50 pluralsOrdinal: []locales.PluralRule{6},
51 pluralsRange: []locales.PluralRule{2, 4, 5, 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{"", "sty", "lut", "mar", "kwi", "maj", "cze", "lip", "sie", "wrz", "paź", "lis", "gru"},
64 monthsNarrow: []string{"", "s", "l", "m", "k", "m", "c", "l", "s", "w", "p", "l", "g"},
65 monthsWide: []string{"", "stycznia", "lutego", "marca", "kwietnia", "maja", "czerwca", "lipca", "sierpnia", "września", "października", "listopada", "grudnia"},
66 daysAbbreviated: []string{"niedz.", "pon.", "wt.", "śr.", "czw.", "pt.", "sob."},
67 daysNarrow: []string{"n", "p", "w", "ś", "c", "p", "s"},
68 daysShort: []string{"nie", "pon", "wto", "śro", "czw", "pią", "sob"},
69 daysWide: []string{"niedziela", "poniedziałek", "wtorek", "środa", "czwartek", "piątek", "sobota"},
70 periodsAbbreviated: []string{"AM", "PM"},
71 periodsNarrow: []string{"a", "p"},
72 periodsWide: []string{"AM", "PM"},
73 erasAbbreviated: []string{"p.n.e.", "n.e."},
74 erasNarrow: []string{"", ""},
75 erasWide: []string{"przed naszą erą", "naszej ery"},
76 timezones: map[string]string{"HKT": "Hongkong (czas standardowy)", "WESZ": "Czas zachodnioeuropejski letni", "AWDT": "Czas zachodnioaustralijski letni", "MYT": "Malezja", "NZST": "Nowa Zelandia (czas standardowy)", "HNEG": "Grenlandia Wschodnia (czas standardowy)", "HEEG": "Grenlandia Wschodnia (czas letni)", "CHADT": "Chatham (czas letni)", "OESZ": "Czas wschodnioeuropejski letni", "HAT": "Nowa Fundlandia (czas letni)", "HEPM": "Saint-Pierre i Miquelon (czas letni)", "UYT": "Urugwaj (czas standardowy)", "HENOMX": "Meksyk Północno-Zachodni (czas letni)", "IST": "Czas indyjski", "HEOG": "Grenlandia Zachodnia (czas letni)", "EDT": "Czas wschodnioamerykański letni", "CAT": "Czas środkowoafrykański", "HECU": "Kuba (czas letni)", "ACWDT": "Czas środkowo-zachodnioaustralijski letni", "MEZ": "Czas środkowoeuropejski standardowy", "ADT": "Czas atlantycki letni", "HNT": "Nowa Fundlandia (czas standardowy)", "ACST": "Czas środkowoaustralijski standardowy", "CDT": "Czas środkowoamerykański letni", "HADT": "Hawaje-Aleuty (czas letni)", "WART": "Argentyna Zachodnia (czas standardowy)", "WAT": "Czas zachodnioafrykański standardowy", "ACDT": "Czas środkowoaustralijski letni", "BOT": "Boliwia", "ARST": "Argentyna (czas letni)", "HKST": "Hongkong (czas letni)", "COT": "Kolumbia (czas standardowy)", "AKDT": "Alaska (czas letni)", "HNOG": "Grenlandia Zachodnia (czas standardowy)", "AEST": "Czas wschodnioaustralijski standardowy", "WAST": "Czas zachodnioafrykański letni", "ChST": "Czamorro", "PDT": "Czas pacyficzny letni", "CHAST": "Chatham (czas standardowy)", "CST": "Czas środkowoamerykański standardowy", "SRT": "Surinam", "HAST": "Hawaje-Aleuty (czas standardowy)", "EST": "Czas wschodnioamerykański standardowy", "∅∅∅": "Czas amazoński letni", "GMT": "Czas uniwersalny", "MST": "MST", "TMST": "Turkmenistan (czas letni)", "VET": "Wenezuela", "SAST": "Czas południowoafrykański", "HEPMX": "Meksyk (czas pacyficzny letni)", "WIB": "Indonezja Zachodnia", "MESZ": "Czas środkowoeuropejski letni", "LHDT": "Lord Howe (czas letni)", "WARST": "Argentyna Zachodnia (czas letni)", "AEDT": "Czas wschodnioaustralijski letni", "AKST": "Alaska (czas standardowy)", "HNCU": "Kuba (czas standardowy)", "BT": "Bhutan", "AWST": "Czas zachodnioaustralijski standardowy", "UYST": "Urugwaj (czas letni)", "GFT": "Gujana Francuska", "CLST": "Chile (czas letni)", "HNPMX": "Meksyk (czas pacyficzny standardowy)", "MDT": "MDT", "ACWST": "Czas środkowo-zachodnioaustralijski standardowy", "OEZ": "Czas wschodnioeuropejski standardowy", "ART": "Argentyna (czas standardowy)", "EAT": "Czas wschodnioafrykański", "SGT": "Singapur", "PST": "Czas pacyficzny standardowy", "TMT": "Turkmenistan (czas standardowy)", "HNNOMX": "Meksyk Północno-Zachodni (czas standardowy)", "GYT": "Gujana", "ECT": "Ekwador", "LHST": "Lord Howe (czas standardowy)", "CLT": "Chile (czas standardowy)", "NZDT": "Nowa Zelandia (czas letni)", "JST": "Japonia (czas standardowy)", "JDT": "Japonia (czas letni)", "WEZ": "Czas zachodnioeuropejski standardowy", "HNPM": "Saint-Pierre i Miquelon (czas standardowy)", "WIT": "Indonezja Wschodnia", "WITA": "Indonezja Środkowa", "AST": "Czas atlantycki standardowy", "COST": "Kolumbia (czas letni)"},
80 // Locale returns the current translators string locale
81 func (pl *pl_PL) Locale() string {
85 // PluralsCardinal returns the list of cardinal plural rules associated with 'pl_PL'
86 func (pl *pl_PL) PluralsCardinal() []locales.PluralRule {
87 return pl.pluralsCardinal
90 // PluralsOrdinal returns the list of ordinal plural rules associated with 'pl_PL'
91 func (pl *pl_PL) PluralsOrdinal() []locales.PluralRule {
92 return pl.pluralsOrdinal
95 // PluralsRange returns the list of range plural rules associated with 'pl_PL'
96 func (pl *pl_PL) PluralsRange() []locales.PluralRule {
97 return pl.pluralsRange
100 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'pl_PL'
101 func (pl *pl_PL) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
108 if i == 1 && v == 0 {
109 return locales.PluralRuleOne
110 } else if v == 0 && iMod10 >= 2 && iMod10 <= 4 && (iMod100 < 12 || iMod100 > 14) {
111 return locales.PluralRuleFew
112 } else if (v == 0 && i != 1 && iMod10 >= 0 && iMod10 <= 1) || (v == 0 && iMod10 >= 5 && iMod10 <= 9) || (v == 0 && iMod100 >= 12 && iMod100 <= 14) {
113 return locales.PluralRuleMany
116 return locales.PluralRuleOther
119 // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'pl_PL'
120 func (pl *pl_PL) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
121 return locales.PluralRuleOther
124 // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'pl_PL'
125 func (pl *pl_PL) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
127 start := pl.CardinalPluralRule(num1, v1)
128 end := pl.CardinalPluralRule(num2, v2)
130 if start == locales.PluralRuleOne && end == locales.PluralRuleFew {
131 return locales.PluralRuleFew
132 } else if start == locales.PluralRuleOne && end == locales.PluralRuleMany {
133 return locales.PluralRuleMany
134 } else if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
135 return locales.PluralRuleOther
136 } else if start == locales.PluralRuleFew && end == locales.PluralRuleFew {
137 return locales.PluralRuleFew
138 } else if start == locales.PluralRuleFew && end == locales.PluralRuleMany {
139 return locales.PluralRuleMany
140 } else if start == locales.PluralRuleFew && end == locales.PluralRuleOther {
141 return locales.PluralRuleOther
142 } else if start == locales.PluralRuleMany && end == locales.PluralRuleOne {
143 return locales.PluralRuleOne
144 } else if start == locales.PluralRuleMany && end == locales.PluralRuleFew {
145 return locales.PluralRuleFew
146 } else if start == locales.PluralRuleMany && end == locales.PluralRuleMany {
147 return locales.PluralRuleMany
148 } else if start == locales.PluralRuleMany && end == locales.PluralRuleOther {
149 return locales.PluralRuleOther
150 } else if start == locales.PluralRuleOther && end == locales.PluralRuleOne {
151 return locales.PluralRuleOne
152 } else if start == locales.PluralRuleOther && end == locales.PluralRuleFew {
153 return locales.PluralRuleFew
154 } else if start == locales.PluralRuleOther && end == locales.PluralRuleMany {
155 return locales.PluralRuleMany
158 return locales.PluralRuleOther
162 // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
163 func (pl *pl_PL) MonthAbbreviated(month time.Month) string {
164 return pl.monthsAbbreviated[month]
167 // MonthsAbbreviated returns the locales abbreviated months
168 func (pl *pl_PL) MonthsAbbreviated() []string {
169 return pl.monthsAbbreviated[1:]
172 // MonthNarrow returns the locales narrow month given the 'month' provided
173 func (pl *pl_PL) MonthNarrow(month time.Month) string {
174 return pl.monthsNarrow[month]
177 // MonthsNarrow returns the locales narrow months
178 func (pl *pl_PL) MonthsNarrow() []string {
179 return pl.monthsNarrow[1:]
182 // MonthWide returns the locales wide month given the 'month' provided
183 func (pl *pl_PL) MonthWide(month time.Month) string {
184 return pl.monthsWide[month]
187 // MonthsWide returns the locales wide months
188 func (pl *pl_PL) MonthsWide() []string {
189 return pl.monthsWide[1:]
192 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
193 func (pl *pl_PL) WeekdayAbbreviated(weekday time.Weekday) string {
194 return pl.daysAbbreviated[weekday]
197 // WeekdaysAbbreviated returns the locales abbreviated weekdays
198 func (pl *pl_PL) WeekdaysAbbreviated() []string {
199 return pl.daysAbbreviated
202 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
203 func (pl *pl_PL) WeekdayNarrow(weekday time.Weekday) string {
204 return pl.daysNarrow[weekday]
207 // WeekdaysNarrow returns the locales narrow weekdays
208 func (pl *pl_PL) WeekdaysNarrow() []string {
212 // WeekdayShort returns the locales short weekday given the 'weekday' provided
213 func (pl *pl_PL) WeekdayShort(weekday time.Weekday) string {
214 return pl.daysShort[weekday]
217 // WeekdaysShort returns the locales short weekdays
218 func (pl *pl_PL) WeekdaysShort() []string {
222 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
223 func (pl *pl_PL) WeekdayWide(weekday time.Weekday) string {
224 return pl.daysWide[weekday]
227 // WeekdaysWide returns the locales wide weekdays
228 func (pl *pl_PL) WeekdaysWide() []string {
232 // Decimal returns the decimal point of number
233 func (pl *pl_PL) Decimal() string {
237 // Group returns the group of number
238 func (pl *pl_PL) Group() string {
242 // Group returns the minus sign of number
243 func (pl *pl_PL) Minus() string {
247 // FmtNumber returns 'num' with digits/precision of 'v' for 'pl_PL' and handles both Whole and Real numbers based on 'v'
248 func (pl *pl_PL) FmtNumber(num float64, v uint64) string {
250 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
251 l := len(s) + 2 + 2*len(s[:len(s)-int(v)-1])/3
254 b := make([]byte, 0, l)
256 for i := len(s) - 1; i >= 0; i-- {
259 b = append(b, pl.decimal[0])
266 for j := len(pl.group) - 1; j >= 0; j-- {
267 b = append(b, pl.group[j])
279 b = append(b, pl.minus[0])
283 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
284 b[i], b[j] = b[j], b[i]
290 // FmtPercent returns 'num' with digits/precision of 'v' for 'pl_PL' and handles both Whole and Real numbers based on 'v'
291 // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
292 func (pl *pl_PL) FmtPercent(num float64, v uint64) string {
293 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
295 b := make([]byte, 0, l)
297 for i := len(s) - 1; i >= 0; i-- {
300 b = append(b, pl.decimal[0])
308 b = append(b, pl.minus[0])
312 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
313 b[i], b[j] = b[j], b[i]
316 b = append(b, pl.percent...)
321 // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'pl_PL'
322 func (pl *pl_PL) FmtCurrency(num float64, v uint64, currency currency.Type) string {
324 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
325 symbol := pl.currencies[currency]
326 l := len(s) + len(symbol) + 4 + 2*len(s[:len(s)-int(v)-1])/3
329 b := make([]byte, 0, l)
331 for i := len(s) - 1; i >= 0; i-- {
334 b = append(b, pl.decimal[0])
341 for j := len(pl.group) - 1; j >= 0; j-- {
342 b = append(b, pl.group[j])
354 b = append(b, pl.minus[0])
358 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
359 b[i], b[j] = b[j], b[i]
365 b = append(b, pl.decimal...)
368 for i := 0; i < 2-int(v); i++ {
373 b = append(b, pl.currencyPositiveSuffix...)
375 b = append(b, symbol...)
380 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'pl_PL'
381 // in accounting notation.
382 func (pl *pl_PL) FmtAccounting(num float64, v uint64, currency currency.Type) string {
384 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
385 symbol := pl.currencies[currency]
386 l := len(s) + len(symbol) + 6 + 2*len(s[:len(s)-int(v)-1])/3
389 b := make([]byte, 0, l)
391 for i := len(s) - 1; i >= 0; i-- {
394 b = append(b, pl.decimal[0])
401 for j := len(pl.group) - 1; j >= 0; j-- {
402 b = append(b, pl.group[j])
415 b = append(b, pl.currencyNegativePrefix[0])
420 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
421 b[i], b[j] = b[j], b[i]
427 b = append(b, pl.decimal...)
430 for i := 0; i < 2-int(v); i++ {
436 b = append(b, pl.currencyNegativeSuffix...)
437 b = append(b, symbol...)
440 b = append(b, pl.currencyPositiveSuffix...)
441 b = append(b, symbol...)
447 // FmtDateShort returns the short date representation of 't' for 'pl_PL'
448 func (pl *pl_PL) FmtDateShort(t time.Time) string {
450 b := make([]byte, 0, 32)
456 b = strconv.AppendInt(b, int64(t.Day()), 10)
457 b = append(b, []byte{0x2e}...)
463 b = strconv.AppendInt(b, int64(t.Month()), 10)
465 b = append(b, []byte{0x2e}...)
468 b = strconv.AppendInt(b, int64(t.Year()), 10)
470 b = strconv.AppendInt(b, int64(-t.Year()), 10)
476 // FmtDateMedium returns the medium date representation of 't' for 'pl_PL'
477 func (pl *pl_PL) FmtDateMedium(t time.Time) string {
479 b := make([]byte, 0, 32)
481 b = strconv.AppendInt(b, int64(t.Day()), 10)
482 b = append(b, []byte{0x20}...)
483 b = append(b, pl.monthsAbbreviated[t.Month()]...)
484 b = append(b, []byte{0x20}...)
487 b = strconv.AppendInt(b, int64(t.Year()), 10)
489 b = strconv.AppendInt(b, int64(-t.Year()), 10)
495 // FmtDateLong returns the long date representation of 't' for 'pl_PL'
496 func (pl *pl_PL) FmtDateLong(t time.Time) string {
498 b := make([]byte, 0, 32)
500 b = strconv.AppendInt(b, int64(t.Day()), 10)
501 b = append(b, []byte{0x20}...)
502 b = append(b, pl.monthsWide[t.Month()]...)
503 b = append(b, []byte{0x20}...)
506 b = strconv.AppendInt(b, int64(t.Year()), 10)
508 b = strconv.AppendInt(b, int64(-t.Year()), 10)
514 // FmtDateFull returns the full date representation of 't' for 'pl_PL'
515 func (pl *pl_PL) FmtDateFull(t time.Time) string {
517 b := make([]byte, 0, 32)
519 b = append(b, pl.daysWide[t.Weekday()]...)
520 b = append(b, []byte{0x2c, 0x20}...)
521 b = strconv.AppendInt(b, int64(t.Day()), 10)
522 b = append(b, []byte{0x20}...)
523 b = append(b, pl.monthsWide[t.Month()]...)
524 b = append(b, []byte{0x20}...)
527 b = strconv.AppendInt(b, int64(t.Year()), 10)
529 b = strconv.AppendInt(b, int64(-t.Year()), 10)
535 // FmtTimeShort returns the short time representation of 't' for 'pl_PL'
536 func (pl *pl_PL) FmtTimeShort(t time.Time) string {
538 b := make([]byte, 0, 32)
544 b = strconv.AppendInt(b, int64(t.Hour()), 10)
545 b = append(b, pl.timeSeparator...)
551 b = strconv.AppendInt(b, int64(t.Minute()), 10)
556 // FmtTimeMedium returns the medium time representation of 't' for 'pl_PL'
557 func (pl *pl_PL) FmtTimeMedium(t time.Time) string {
559 b := make([]byte, 0, 32)
565 b = strconv.AppendInt(b, int64(t.Hour()), 10)
566 b = append(b, pl.timeSeparator...)
572 b = strconv.AppendInt(b, int64(t.Minute()), 10)
573 b = append(b, pl.timeSeparator...)
579 b = strconv.AppendInt(b, int64(t.Second()), 10)
584 // FmtTimeLong returns the long time representation of 't' for 'pl_PL'
585 func (pl *pl_PL) FmtTimeLong(t time.Time) string {
587 b := make([]byte, 0, 32)
593 b = strconv.AppendInt(b, int64(t.Hour()), 10)
594 b = append(b, pl.timeSeparator...)
600 b = strconv.AppendInt(b, int64(t.Minute()), 10)
601 b = append(b, pl.timeSeparator...)
607 b = strconv.AppendInt(b, int64(t.Second()), 10)
608 b = append(b, []byte{0x20}...)
616 // FmtTimeFull returns the full time representation of 't' for 'pl_PL'
617 func (pl *pl_PL) FmtTimeFull(t time.Time) string {
619 b := make([]byte, 0, 32)
625 b = strconv.AppendInt(b, int64(t.Hour()), 10)
626 b = append(b, pl.timeSeparator...)
632 b = strconv.AppendInt(b, int64(t.Minute()), 10)
633 b = append(b, pl.timeSeparator...)
639 b = strconv.AppendInt(b, int64(t.Second()), 10)
640 b = append(b, []byte{0x20}...)
644 if btz, ok := pl.timezones[tz]; ok {
645 b = append(b, btz...)