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 currencyPositivePrefix string
26 currencyNegativePrefix 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 'fa_AF' locale
45 func New() locales.Translator {
48 pluralsCardinal: []locales.PluralRule{2, 6},
49 pluralsOrdinal: []locales.PluralRule{6},
50 pluralsRange: []locales.PluralRule{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 currencyPositivePrefix: " ",
60 currencyNegativePrefix: " ",
61 monthsAbbreviated: []string{"", "جنو", "فبروری", "مارچ", "اپریل", "می", "جون", "جول", "اگست", "سپتمبر", "اکتوبر", "نومبر", "دسم"},
62 monthsNarrow: []string{"", "ج", "ف", "م", "ا", "م", "ج", "ج", "ا", "س", "ا", "ن", "د"},
63 monthsWide: []string{"", "جنوری", "فبروری", "مارچ", "اپریل", "می", "جون", "جولای", "اگست", "سپتمبر", "اکتوبر", "نومبر", "دسمبر"},
64 daysAbbreviated: []string{"یکشنبه", "دوشنبه", "سه\u200cشنبه", "چهارشنبه", "پنجشنبه", "جمعه", "شنبه"},
65 daysNarrow: []string{"ی", "د", "س", "چ", "پ", "ج", "ش"},
66 daysShort: []string{"۱ش", "۲ش", "۳ش", "۴ش", "۵ش", "ج", "ش"},
67 daysWide: []string{"یکشنبه", "دوشنبه", "سه\u200cشنبه", "چهارشنبه", "پنجشنبه", "جمعه", "شنبه"},
68 periodsAbbreviated: []string{"", ""},
69 periodsNarrow: []string{"", ""},
70 periodsWide: []string{"", ""},
71 erasAbbreviated: []string{"ق.م.", "م."},
72 erasNarrow: []string{"ق", "م"},
73 erasWide: []string{"قبل از میلاد", "میلادی"},
74 timezones: map[string]string{"BT": "وقت بوتان", "ADT": "وقت تابستانی آتلانتیک", "CLST": "وقت تابستانی شیلی", "HAT": "وقت تابستانی نیوفاندلند", "SGT": "وقت سنگاپور", "AWDT": "وقت تابستانی غرب استرالیا", "ACWST": "وقت عادی مرکز-غرب استرالیا", "AKDT": "وقت تابستانی آلاسکا", "ACST": "وقت عادی مرکز استرالیا", "PDT": "وقت تابستانی غرب امریکا", "WARST": "وقت تابستانی غرب آرژانتین", "JST": "وقت عادی ژاپن", "HNOG": "وقت عادی غرب گرینلند", "WAST": "وقت تابستانی غرب افریقا", "MDT": "وقت تابستانی ماکائو", "HEEG": "وقت تابستانی شرق گرینلند", "CLT": "وقت عادی شیلی", "AKST": "وقت عادی آلاسکا", "GMT": "وقت گرینویچ", "HNCU": "وقت عادی کوبا", "HNPM": "وقت عادی سنت\u200cپیر و میکلون", "TMT": "وقت عادی ترکمنستان", "HADT": "وقت تابستانی هاوایی‐الوشن", "EST": "وقت عادی شرق امریکا", "HKT": "وقت عادی هنگ\u200cکنگ", "ACDT": "وقت تابستانی مرکز استرالیا", "MST": "وقت عادی ماکائو", "VET": "وقت ونزوئلا", "LHDT": "وقت تابستانی لردهو", "ART": "وقت عادی آرژانتین", "AEDT": "وقت تابستانی شرق استرالیا", "LHST": "وقت عادی لردهو", "GFT": "وقت گویان فرانسه", "ChST": "وقت عادی چامورو", "UYT": "وقت عادی اروگوئه", "UYST": "وقت تابستانی اروگوئه", "MEZ": "وقت عادی مرکز اروپا", "HENOMX": "وقت تابستانی شمال غرب مکزیک", "OEZ": "وقت عادی شرق اروپا", "CST": "وقت عادی مرکز امریکا", "CDT": "وقت تابستانی مرکز امریکا", "AST": "وقت عادی آتلانتیک", "WART": "وقت عادی غرب آرژانتین", "HNNOMX": "وقت عادی شمال غرب مکزیک", "JDT": "وقت تابستانی ژاپن", "HEOG": "وقت تابستانی غرب گرینلند", "HEPMX": "وقت تابستانی شرق مکزیک", "HNPMX": "وقت عادی شرق مکزیک", "PST": "وقت عادی غرب امریکا", "TMST": "وقت تابستانی ترکمنستان", "MESZ": "وقت تابستانی مرکز اروپا", "WITA": "وقت مرکز اندونزی", "IST": "وقت هند", "GYT": "وقت گویان", "AWST": "وقت عادی غرب استرالیا", "NZST": "وقت عادی زلاند نو", "ARST": "وقت تابستانی آرژانتین", "COST": "وقت تابستانی کلمبیا", "HNT": "وقت عادی نیوفاندلند", "WIB": "وقت غرب اندونزی", "HEPM": "وقت تابستانی سنت\u200cپیر و میکلون", "BOT": "وقت بولیوی", "WIT": "وقت شرق اندونزی", "ECT": "وقت اکوادور", "CAT": "وقت مرکز افریقا", "EDT": "وقت تابستانی شرق امریکا", "WESZ": "وقت تابستانی غرب اروپا", "CHADT": "وقت تابستانی چت\u200cهام", "ACWDT": "وقت تابستانی مرکز-غرب استرالیا", "MYT": "وقت مالزی", "HAST": "وقت عادی هاوایی‐الوشن", "COT": "وقت عادی کلمبیا", "∅∅∅": "وقت تابستانی برازیلیا", "HNEG": "وقت عادی شرق گرینلند", "OESZ": "وقت تابستانی شرق اروپا", "WAT": "وقت عادی غرب افریقا", "HKST": "وقت تابستانی هنگ\u200cکنگ", "EAT": "وقت شرق افریقا", "SAST": "وقت عادی جنوب افریقا", "WEZ": "وقت عادی غرب اروپا", "HECU": "وقت تابستانی کوبا", "CHAST": "وقت عادی چت\u200cهام", "SRT": "وقت سورینام", "NZDT": "وقت تابستانی زلاند نو", "AEST": "وقت عادی شرق استرالیا"},
78 // Locale returns the current translators string locale
79 func (fa *fa_AF) Locale() string {
83 // PluralsCardinal returns the list of cardinal plural rules associated with 'fa_AF'
84 func (fa *fa_AF) PluralsCardinal() []locales.PluralRule {
85 return fa.pluralsCardinal
88 // PluralsOrdinal returns the list of ordinal plural rules associated with 'fa_AF'
89 func (fa *fa_AF) PluralsOrdinal() []locales.PluralRule {
90 return fa.pluralsOrdinal
93 // PluralsRange returns the list of range plural rules associated with 'fa_AF'
94 func (fa *fa_AF) PluralsRange() []locales.PluralRule {
95 return fa.pluralsRange
98 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'fa_AF'
99 func (fa *fa_AF) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
104 if (i == 0) || (n == 1) {
105 return locales.PluralRuleOne
108 return locales.PluralRuleOther
111 // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'fa_AF'
112 func (fa *fa_AF) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
113 return locales.PluralRuleOther
116 // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'fa_AF'
117 func (fa *fa_AF) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
118 return locales.PluralRuleOther
121 // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
122 func (fa *fa_AF) MonthAbbreviated(month time.Month) string {
123 return fa.monthsAbbreviated[month]
126 // MonthsAbbreviated returns the locales abbreviated months
127 func (fa *fa_AF) MonthsAbbreviated() []string {
128 return fa.monthsAbbreviated[1:]
131 // MonthNarrow returns the locales narrow month given the 'month' provided
132 func (fa *fa_AF) MonthNarrow(month time.Month) string {
133 return fa.monthsNarrow[month]
136 // MonthsNarrow returns the locales narrow months
137 func (fa *fa_AF) MonthsNarrow() []string {
138 return fa.monthsNarrow[1:]
141 // MonthWide returns the locales wide month given the 'month' provided
142 func (fa *fa_AF) MonthWide(month time.Month) string {
143 return fa.monthsWide[month]
146 // MonthsWide returns the locales wide months
147 func (fa *fa_AF) MonthsWide() []string {
148 return fa.monthsWide[1:]
151 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
152 func (fa *fa_AF) WeekdayAbbreviated(weekday time.Weekday) string {
153 return fa.daysAbbreviated[weekday]
156 // WeekdaysAbbreviated returns the locales abbreviated weekdays
157 func (fa *fa_AF) WeekdaysAbbreviated() []string {
158 return fa.daysAbbreviated
161 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
162 func (fa *fa_AF) WeekdayNarrow(weekday time.Weekday) string {
163 return fa.daysNarrow[weekday]
166 // WeekdaysNarrow returns the locales narrow weekdays
167 func (fa *fa_AF) WeekdaysNarrow() []string {
171 // WeekdayShort returns the locales short weekday given the 'weekday' provided
172 func (fa *fa_AF) WeekdayShort(weekday time.Weekday) string {
173 return fa.daysShort[weekday]
176 // WeekdaysShort returns the locales short weekdays
177 func (fa *fa_AF) WeekdaysShort() []string {
181 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
182 func (fa *fa_AF) WeekdayWide(weekday time.Weekday) string {
183 return fa.daysWide[weekday]
186 // WeekdaysWide returns the locales wide weekdays
187 func (fa *fa_AF) WeekdaysWide() []string {
191 // Decimal returns the decimal point of number
192 func (fa *fa_AF) Decimal() string {
196 // Group returns the group of number
197 func (fa *fa_AF) Group() string {
201 // Group returns the minus sign of number
202 func (fa *fa_AF) Minus() string {
206 // FmtNumber returns 'num' with digits/precision of 'v' for 'fa_AF' and handles both Whole and Real numbers based on 'v'
207 func (fa *fa_AF) FmtNumber(num float64, v uint64) string {
209 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
210 l := len(s) + 8 + 2*len(s[:len(s)-int(v)-1])/3
213 b := make([]byte, 0, l)
215 for i := len(s) - 1; i >= 0; i-- {
218 for j := len(fa.decimal) - 1; j >= 0; j-- {
219 b = append(b, fa.decimal[j])
227 for j := len(fa.group) - 1; j >= 0; j-- {
228 b = append(b, fa.group[j])
240 for j := len(fa.minus) - 1; j >= 0; j-- {
241 b = append(b, fa.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 'fa_AF' 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 (fa *fa_AF) 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 for j := len(fa.decimal) - 1; j >= 0; j-- {
264 b = append(b, fa.decimal[j])
273 for j := len(fa.minus) - 1; j >= 0; j-- {
274 b = append(b, fa.minus[j])
279 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
280 b[i], b[j] = b[j], b[i]
283 b = append(b, fa.percent...)
288 // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'fa_AF'
289 func (fa *fa_AF) FmtCurrency(num float64, v uint64, currency currency.Type) string {
291 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
292 symbol := fa.currencies[currency]
293 l := len(s) + len(symbol) + 10 + 2*len(s[:len(s)-int(v)-1])/3
296 b := make([]byte, 0, l)
298 for i := len(s) - 1; i >= 0; i-- {
301 for j := len(fa.decimal) - 1; j >= 0; j-- {
302 b = append(b, fa.decimal[j])
310 for j := len(fa.group) - 1; j >= 0; j-- {
311 b = append(b, fa.group[j])
322 for j := len(symbol) - 1; j >= 0; j-- {
323 b = append(b, symbol[j])
326 for j := len(fa.currencyPositivePrefix) - 1; j >= 0; j-- {
327 b = append(b, fa.currencyPositivePrefix[j])
331 for j := len(fa.minus) - 1; j >= 0; j-- {
332 b = append(b, fa.minus[j])
337 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
338 b[i], b[j] = b[j], b[i]
344 b = append(b, fa.decimal...)
347 for i := 0; i < 2-int(v); i++ {
355 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fa_AF'
356 // in accounting notation.
357 func (fa *fa_AF) FmtAccounting(num float64, v uint64, currency currency.Type) string {
359 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
360 symbol := fa.currencies[currency]
361 l := len(s) + len(symbol) + 10 + 2*len(s[:len(s)-int(v)-1])/3
364 b := make([]byte, 0, l)
366 for i := len(s) - 1; i >= 0; i-- {
369 for j := len(fa.decimal) - 1; j >= 0; j-- {
370 b = append(b, fa.decimal[j])
378 for j := len(fa.group) - 1; j >= 0; j-- {
379 b = append(b, fa.group[j])
392 for j := len(symbol) - 1; j >= 0; j-- {
393 b = append(b, symbol[j])
396 for j := len(fa.currencyNegativePrefix) - 1; j >= 0; j-- {
397 b = append(b, fa.currencyNegativePrefix[j])
400 for j := len(fa.minus) - 1; j >= 0; j-- {
401 b = append(b, fa.minus[j])
406 for j := len(symbol) - 1; j >= 0; j-- {
407 b = append(b, symbol[j])
410 for j := len(fa.currencyPositivePrefix) - 1; j >= 0; j-- {
411 b = append(b, fa.currencyPositivePrefix[j])
417 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
418 b[i], b[j] = b[j], b[i]
424 b = append(b, fa.decimal...)
427 for i := 0; i < 2-int(v); i++ {
435 // FmtDateShort returns the short date representation of 't' for 'fa_AF'
436 func (fa *fa_AF) FmtDateShort(t time.Time) string {
438 b := make([]byte, 0, 32)
441 b = strconv.AppendInt(b, int64(t.Year()), 10)
443 b = strconv.AppendInt(b, int64(-t.Year()), 10)
446 b = append(b, []byte{0x2f}...)
447 b = strconv.AppendInt(b, int64(t.Month()), 10)
448 b = append(b, []byte{0x2f}...)
449 b = strconv.AppendInt(b, int64(t.Day()), 10)
454 // FmtDateMedium returns the medium date representation of 't' for 'fa_AF'
455 func (fa *fa_AF) FmtDateMedium(t time.Time) string {
457 b := make([]byte, 0, 32)
459 b = strconv.AppendInt(b, int64(t.Day()), 10)
460 b = append(b, []byte{0x20}...)
461 b = append(b, fa.monthsAbbreviated[t.Month()]...)
462 b = append(b, []byte{0x20}...)
465 b = strconv.AppendInt(b, int64(t.Year()), 10)
467 b = strconv.AppendInt(b, int64(-t.Year()), 10)
473 // FmtDateLong returns the long date representation of 't' for 'fa_AF'
474 func (fa *fa_AF) FmtDateLong(t time.Time) string {
476 b := make([]byte, 0, 32)
478 b = strconv.AppendInt(b, int64(t.Day()), 10)
479 b = append(b, []byte{0x20}...)
480 b = append(b, fa.monthsWide[t.Month()]...)
481 b = append(b, []byte{0x20}...)
484 b = strconv.AppendInt(b, int64(t.Year()), 10)
486 b = strconv.AppendInt(b, int64(-t.Year()), 10)
492 // FmtDateFull returns the full date representation of 't' for 'fa_AF'
493 func (fa *fa_AF) FmtDateFull(t time.Time) string {
495 b := make([]byte, 0, 32)
497 b = append(b, fa.daysWide[t.Weekday()]...)
498 b = append(b, []byte{0x20}...)
499 b = strconv.AppendInt(b, int64(t.Day()), 10)
500 b = append(b, []byte{0x20}...)
501 b = append(b, fa.monthsWide[t.Month()]...)
502 b = append(b, []byte{0x20}...)
505 b = strconv.AppendInt(b, int64(t.Year()), 10)
507 b = strconv.AppendInt(b, int64(-t.Year()), 10)
513 // FmtTimeShort returns the short time representation of 't' for 'fa_AF'
514 func (fa *fa_AF) FmtTimeShort(t time.Time) string {
516 b := make([]byte, 0, 32)
518 b = strconv.AppendInt(b, int64(t.Hour()), 10)
519 b = append(b, fa.timeSeparator...)
525 b = strconv.AppendInt(b, int64(t.Minute()), 10)
530 // FmtTimeMedium returns the medium time representation of 't' for 'fa_AF'
531 func (fa *fa_AF) FmtTimeMedium(t time.Time) string {
533 b := make([]byte, 0, 32)
535 b = strconv.AppendInt(b, int64(t.Hour()), 10)
536 b = append(b, fa.timeSeparator...)
542 b = strconv.AppendInt(b, int64(t.Minute()), 10)
543 b = append(b, fa.timeSeparator...)
549 b = strconv.AppendInt(b, int64(t.Second()), 10)
554 // FmtTimeLong returns the long time representation of 't' for 'fa_AF'
555 func (fa *fa_AF) FmtTimeLong(t time.Time) string {
557 b := make([]byte, 0, 32)
559 b = strconv.AppendInt(b, int64(t.Hour()), 10)
560 b = append(b, fa.timeSeparator...)
566 b = strconv.AppendInt(b, int64(t.Minute()), 10)
567 b = append(b, fa.timeSeparator...)
573 b = strconv.AppendInt(b, int64(t.Second()), 10)
574 b = append(b, []byte{0x20, 0x28}...)
579 b = append(b, []byte{0x29}...)
584 // FmtTimeFull returns the full time representation of 't' for 'fa_AF'
585 func (fa *fa_AF) FmtTimeFull(t time.Time) string {
587 b := make([]byte, 0, 32)
589 b = strconv.AppendInt(b, int64(t.Hour()), 10)
590 b = append(b, fa.timeSeparator...)
596 b = strconv.AppendInt(b, int64(t.Minute()), 10)
597 b = append(b, fa.timeSeparator...)
603 b = strconv.AppendInt(b, int64(t.Second()), 10)
604 b = append(b, []byte{0x20, 0x28}...)
608 if btz, ok := fa.timezones[tz]; ok {
609 b = append(b, btz...)
614 b = append(b, []byte{0x29}...)