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
25 currencies []string // idx = enum of currency code
26 currencyPositiveSuffix 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 'fr_CA' locale
46 func New() locales.Translator {
49 pluralsCardinal: []locales.PluralRule{2, 6},
50 pluralsOrdinal: []locales.PluralRule{2, 6},
51 pluralsRange: []locales.PluralRule{2, 6},
59 currencies: []string{"ADP", "AED", "AFA", "AFN", "ALK", "ALL", "AMD", "ANG", "AOA", "AOK", "AON", "AOR", "ARA", "ARL", "ARM", "ARP", "ARS", "ATS", "$\u00a0AU", "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", "$", "CDF", "CHE", "CHF", "CHW", "CLE", "CLF", "CLP", "CNX", "CN¥", "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", "£", "GEK", "GEL", "GHC", "GHS", "GIP", "GMD", "GNF", "GNS", "GQE", "GRD", "GTQ", "GWE", "GWP", "GYD", "$\u00a0HK", "HNL", "HRD", "HRK", "HTG", "HUF", "IDR", "IEP", "ILP", "ILR", "ILS", "INR", "IQD", "IRR", "ISJ", "ISK", "ITL", "JMD", "JOD", "¥", "KES", "KGS", "KHR", "CF", "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", "C$", "NLG", "NOK", "NPR", "$\u00a0NZ", "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", "$\u00a0SG", "SHP", "SIT", "SKK", "SLL", "SOS", "SRD", "SRG", "SSP", "STD", "SUR", "SVC", "SYP", "SZL", "THB", "TJR", "TJS", "TMM", "TMT", "TND", "TOP", "TPE", "TRL", "TL", "TTD", "TWD", "TZS", "UAH", "UAK", "UGS", "UGX", "$\u00a0US", "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", "ZK", "ZRN", "ZRZ", "ZWD", "ZWL", "ZWR"},
61 currencyPositiveSuffix: " mn ",
62 currencyNegativeSuffix: " mn ",
63 monthsAbbreviated: []string{"", "janv.", "févr.", "mars", "avr.", "mai", "juin", "juill.", "août", "sept.", "oct.", "nov.", "déc."},
64 monthsNarrow: []string{"", "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"},
65 monthsWide: []string{"", "janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre"},
66 daysAbbreviated: []string{"dim.", "lun.", "mar.", "mer.", "jeu.", "ven.", "sam."},
67 daysNarrow: []string{"D", "L", "M", "M", "J", "V", "S"},
68 daysShort: []string{"di", "lu", "ma", "me", "je", "ve", "sa"},
69 daysWide: []string{"dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"},
70 periodsAbbreviated: []string{"a.m.", "p.m."},
71 periodsNarrow: []string{"a", "p"},
72 periodsWide: []string{"a.m.", "p.m."},
73 erasAbbreviated: []string{"", ""},
74 erasNarrow: []string{"", ""},
75 erasWide: []string{"avant l’ère chrétienne", "de l’ère chrétienne"},
76 timezones: map[string]string{"SAST": "heure normale d’Afrique du Sud", "COST": "heure avancée de Colombie", "HNOG": "heure normale de l’Ouest du Groenland", "AWDT": "heure avancée de l’Ouest de l’Australie", "VET": "heure du Venezuela", "HNEG": "heure normale de l’Est du Groenland", "EAT": "Heure d’Afrique orientale", "WEZ": "heure normale d’Europe de l’Ouest", "HECU": "heure avancée de Cuba", "MESZ": "heure avancée d’Europe centrale", "HAST": "heure normale d’Hawaï-Aléoutiennes", "JDT": "heure avancée du Japon", "ADT": "heure avancée de l’Atlantique", "CLT": "heure normale du Chili", "AKDT": "heure avancée de l’Alaska", "SRT": "heure du Suriname", "JST": "heure normale du Japon", "COT": "heure normale de Colombie", "WIB": "heure de l’Ouest indonésien", "MDT": "heure avancée de Macao", "CST": "heure normale du Centre", "HNNOMX": "heure normale du Nord-Ouest du Mexique", "HENOMX": "heure avancée du Nord-Ouest du Mexique", "LHDT": "heure avancée de Lord Howe", "HKST": "heure avancée de Hong Kong", "EST": "heure normale de l’Est", "PDT": "heure avancée du Pacifique", "AEST": "heure normale de l’Est de l’Australie", "∅∅∅": "heure avancée de Brasilia", "ECT": "heure de l’Équateur", "AWST": "heure normale de l’Ouest de l’Australie", "ACWDT": "heure avancée du centre-ouest de l’Australie", "MEZ": "heure normale d’Europe centrale", "HNPM": "heure normale de Saint-Pierre-et-Miquelon", "TMT": "heure normale du Turkménistan", "OEZ": "heure normale d’Europe de l’Est", "HEOG": "heure avancée de l’Ouest du Groenland", "HEEG": "heure avancée de l’Est du Groenland", "HNT": "heure normale de Terre-Neuve", "ACST": "heure normale du centre de l’Australie", "CAT": "heure d’Afrique centrale", "BOT": "heure de Bolivie", "WIT": "heure de l’Est indonésien", "MYT": "heure de la Malaisie", "CLST": "heure avancée du Chili", "PST": "heure normale du Pacifique", "UYT": "heure normale de l’Uruguay", "GFT": "heure de Guyane française", "HKT": "heure normale de Hong Kong", "HEPMX": "heure avancée du Pacifique mexicain", "HNCU": "heure normale de Cuba", "ACWST": "heure normale du centre-ouest de l’Australie", "LHST": "heure normale de Lord Howe", "ART": "heure normale d’Argentine", "ARST": "heure avancée de l’Argentine", "WAST": "heure avancée d’Afrique de l’Ouest", "ACDT": "heure avancée du centre de l’Australie", "BT": "heure du Bhoutan", "TMST": "heure avancée du Turkménistan", "HADT": "heure avancée d’Hawaï-Aléoutiennes", "HAT": "heure avancée de Terre-Neuve", "EDT": "heure avancée de l’Est", "GYT": "heure du Guyana", "AKST": "heure normale de l’Alaska", "HNPMX": "heure normale du Pacifique mexicain", "CHADT": "heure avancée des Îles Chatham", "AST": "heure normale de l’Atlantique", "WAT": "heure normale d’Afrique de l’Ouest", "CDT": "heure avancée du Centre", "CHAST": "heure normale des Îles Chatham", "NZST": "heure normale de la Nouvelle-Zélande", "NZDT": "heure avancée de la Nouvelle-Zélande", "WART": "heure normale de l’Ouest argentin", "OESZ": "heure avancée d’Europe de l’Est", "SGT": "heure de Singapour", "ChST": "heure des Chamorro", "HEPM": "heure avancée de Saint-Pierre-et-Miquelon", "UYST": "heure avancée de l’Uruguay", "WARST": "heure avancée de l’Ouest argentin", "WITA": "heure du Centre indonésien", "IST": "heure de l’Inde", "AEDT": "heure avancée de l’Est de l’Australie", "WESZ": "heure avancée d’Europe de l’Ouest", "GMT": "heure moyenne de Greenwich", "MST": "heure normale de Macao"},
80 // Locale returns the current translators string locale
81 func (fr *fr_CA) Locale() string {
85 // PluralsCardinal returns the list of cardinal plural rules associated with 'fr_CA'
86 func (fr *fr_CA) PluralsCardinal() []locales.PluralRule {
87 return fr.pluralsCardinal
90 // PluralsOrdinal returns the list of ordinal plural rules associated with 'fr_CA'
91 func (fr *fr_CA) PluralsOrdinal() []locales.PluralRule {
92 return fr.pluralsOrdinal
95 // PluralsRange returns the list of range plural rules associated with 'fr_CA'
96 func (fr *fr_CA) PluralsRange() []locales.PluralRule {
97 return fr.pluralsRange
100 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'fr_CA'
101 func (fr *fr_CA) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
106 if i == 0 || i == 1 {
107 return locales.PluralRuleOne
110 return locales.PluralRuleOther
113 // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'fr_CA'
114 func (fr *fr_CA) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
119 return locales.PluralRuleOne
122 return locales.PluralRuleOther
125 // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'fr_CA'
126 func (fr *fr_CA) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
128 start := fr.CardinalPluralRule(num1, v1)
129 end := fr.CardinalPluralRule(num2, v2)
131 if start == locales.PluralRuleOne && end == locales.PluralRuleOne {
132 return locales.PluralRuleOne
133 } else if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
134 return locales.PluralRuleOther
137 return locales.PluralRuleOther
141 // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
142 func (fr *fr_CA) MonthAbbreviated(month time.Month) string {
143 return fr.monthsAbbreviated[month]
146 // MonthsAbbreviated returns the locales abbreviated months
147 func (fr *fr_CA) MonthsAbbreviated() []string {
148 return fr.monthsAbbreviated[1:]
151 // MonthNarrow returns the locales narrow month given the 'month' provided
152 func (fr *fr_CA) MonthNarrow(month time.Month) string {
153 return fr.monthsNarrow[month]
156 // MonthsNarrow returns the locales narrow months
157 func (fr *fr_CA) MonthsNarrow() []string {
158 return fr.monthsNarrow[1:]
161 // MonthWide returns the locales wide month given the 'month' provided
162 func (fr *fr_CA) MonthWide(month time.Month) string {
163 return fr.monthsWide[month]
166 // MonthsWide returns the locales wide months
167 func (fr *fr_CA) MonthsWide() []string {
168 return fr.monthsWide[1:]
171 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
172 func (fr *fr_CA) WeekdayAbbreviated(weekday time.Weekday) string {
173 return fr.daysAbbreviated[weekday]
176 // WeekdaysAbbreviated returns the locales abbreviated weekdays
177 func (fr *fr_CA) WeekdaysAbbreviated() []string {
178 return fr.daysAbbreviated
181 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
182 func (fr *fr_CA) WeekdayNarrow(weekday time.Weekday) string {
183 return fr.daysNarrow[weekday]
186 // WeekdaysNarrow returns the locales narrow weekdays
187 func (fr *fr_CA) WeekdaysNarrow() []string {
191 // WeekdayShort returns the locales short weekday given the 'weekday' provided
192 func (fr *fr_CA) WeekdayShort(weekday time.Weekday) string {
193 return fr.daysShort[weekday]
196 // WeekdaysShort returns the locales short weekdays
197 func (fr *fr_CA) WeekdaysShort() []string {
201 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
202 func (fr *fr_CA) WeekdayWide(weekday time.Weekday) string {
203 return fr.daysWide[weekday]
206 // WeekdaysWide returns the locales wide weekdays
207 func (fr *fr_CA) WeekdaysWide() []string {
211 // Decimal returns the decimal point of number
212 func (fr *fr_CA) Decimal() string {
216 // Group returns the group of number
217 func (fr *fr_CA) Group() string {
221 // Group returns the minus sign of number
222 func (fr *fr_CA) Minus() string {
226 // FmtNumber returns 'num' with digits/precision of 'v' for 'fr_CA' and handles both Whole and Real numbers based on 'v'
227 func (fr *fr_CA) FmtNumber(num float64, v uint64) string {
229 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
230 l := len(s) + 2 + 2*len(s[:len(s)-int(v)-1])/3
233 b := make([]byte, 0, l)
235 for i := len(s) - 1; i >= 0; i-- {
238 b = append(b, fr.decimal[0])
245 for j := len(fr.group) - 1; j >= 0; j-- {
246 b = append(b, fr.group[j])
258 b = append(b, fr.minus[0])
262 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
263 b[i], b[j] = b[j], b[i]
269 // FmtPercent returns 'num' with digits/precision of 'v' for 'fr_CA' and handles both Whole and Real numbers based on 'v'
270 // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
271 func (fr *fr_CA) FmtPercent(num float64, v uint64) string {
272 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
274 b := make([]byte, 0, l)
276 for i := len(s) - 1; i >= 0; i-- {
279 b = append(b, fr.decimal[0])
287 b = append(b, fr.minus[0])
291 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
292 b[i], b[j] = b[j], b[i]
295 b = append(b, fr.percentSuffix...)
297 b = append(b, fr.percent...)
302 // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'fr_CA'
303 func (fr *fr_CA) FmtCurrency(num float64, v uint64, currency currency.Type) string {
305 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
306 symbol := fr.currencies[currency]
307 l := len(s) + len(symbol) + 8
309 b := make([]byte, 0, l)
311 for i := len(s) - 1; i >= 0; i-- {
314 b = append(b, fr.decimal[0])
322 b = append(b, fr.minus[0])
326 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
327 b[i], b[j] = b[j], b[i]
330 b = append(b, fr.currencyPositiveSuffix...)
332 b = append(b, symbol...)
337 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_CA'
338 // in accounting notation.
339 func (fr *fr_CA) FmtAccounting(num float64, v uint64, currency currency.Type) string {
341 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
342 symbol := fr.currencies[currency]
343 l := len(s) + len(symbol) + 8
345 b := make([]byte, 0, l)
347 for i := len(s) - 1; i >= 0; i-- {
350 b = append(b, fr.decimal[0])
359 b = append(b, fr.minus[0])
364 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
365 b[i], b[j] = b[j], b[i]
369 b = append(b, fr.currencyNegativeSuffix...)
370 b = append(b, symbol...)
373 b = append(b, fr.currencyPositiveSuffix...)
374 b = append(b, symbol...)
380 // FmtDateShort returns the short date representation of 't' for 'fr_CA'
381 func (fr *fr_CA) FmtDateShort(t time.Time) string {
383 b := make([]byte, 0, 32)
386 b = append(b, strconv.Itoa(t.Year())[2:]...)
388 b = append(b, strconv.Itoa(t.Year())[1:]...)
391 b = append(b, []byte{0x2d}...)
397 b = strconv.AppendInt(b, int64(t.Month()), 10)
399 b = append(b, []byte{0x2d}...)
405 b = strconv.AppendInt(b, int64(t.Day()), 10)
410 // FmtDateMedium returns the medium date representation of 't' for 'fr_CA'
411 func (fr *fr_CA) FmtDateMedium(t time.Time) string {
413 b := make([]byte, 0, 32)
415 b = strconv.AppendInt(b, int64(t.Day()), 10)
416 b = append(b, []byte{0x20}...)
417 b = append(b, fr.monthsAbbreviated[t.Month()]...)
418 b = append(b, []byte{0x20}...)
421 b = strconv.AppendInt(b, int64(t.Year()), 10)
423 b = strconv.AppendInt(b, int64(-t.Year()), 10)
429 // FmtDateLong returns the long date representation of 't' for 'fr_CA'
430 func (fr *fr_CA) FmtDateLong(t time.Time) string {
432 b := make([]byte, 0, 32)
434 b = strconv.AppendInt(b, int64(t.Day()), 10)
435 b = append(b, []byte{0x20}...)
436 b = append(b, fr.monthsWide[t.Month()]...)
437 b = append(b, []byte{0x20}...)
440 b = strconv.AppendInt(b, int64(t.Year()), 10)
442 b = strconv.AppendInt(b, int64(-t.Year()), 10)
448 // FmtDateFull returns the full date representation of 't' for 'fr_CA'
449 func (fr *fr_CA) FmtDateFull(t time.Time) string {
451 b := make([]byte, 0, 32)
453 b = append(b, fr.daysWide[t.Weekday()]...)
454 b = append(b, []byte{0x20}...)
455 b = strconv.AppendInt(b, int64(t.Day()), 10)
456 b = append(b, []byte{0x20}...)
457 b = append(b, fr.monthsWide[t.Month()]...)
458 b = append(b, []byte{0x20}...)
461 b = strconv.AppendInt(b, int64(t.Year()), 10)
463 b = strconv.AppendInt(b, int64(-t.Year()), 10)
469 // FmtTimeShort returns the short time representation of 't' for 'fr_CA'
470 func (fr *fr_CA) FmtTimeShort(t time.Time) string {
472 b := make([]byte, 0, 32)
478 b = strconv.AppendInt(b, int64(t.Hour()), 10)
479 b = append(b, []byte{0x20, 0x68}...)
480 b = append(b, []byte{0x20}...)
486 b = strconv.AppendInt(b, int64(t.Minute()), 10)
491 // FmtTimeMedium returns the medium time representation of 't' for 'fr_CA'
492 func (fr *fr_CA) FmtTimeMedium(t time.Time) string {
494 b := make([]byte, 0, 32)
500 b = strconv.AppendInt(b, int64(t.Hour()), 10)
501 b = append(b, fr.timeSeparator...)
507 b = strconv.AppendInt(b, int64(t.Minute()), 10)
508 b = append(b, fr.timeSeparator...)
514 b = strconv.AppendInt(b, int64(t.Second()), 10)
519 // FmtTimeLong returns the long time representation of 't' for 'fr_CA'
520 func (fr *fr_CA) FmtTimeLong(t time.Time) string {
522 b := make([]byte, 0, 32)
528 b = strconv.AppendInt(b, int64(t.Hour()), 10)
529 b = append(b, fr.timeSeparator...)
535 b = strconv.AppendInt(b, int64(t.Minute()), 10)
536 b = append(b, fr.timeSeparator...)
542 b = strconv.AppendInt(b, int64(t.Second()), 10)
543 b = append(b, []byte{0x20}...)
551 // FmtTimeFull returns the full time representation of 't' for 'fr_CA'
552 func (fr *fr_CA) FmtTimeFull(t time.Time) string {
554 b := make([]byte, 0, 32)
560 b = strconv.AppendInt(b, int64(t.Hour()), 10)
561 b = append(b, fr.timeSeparator...)
567 b = strconv.AppendInt(b, int64(t.Minute()), 10)
568 b = append(b, fr.timeSeparator...)
574 b = strconv.AppendInt(b, int64(t.Second()), 10)
575 b = append(b, []byte{0x20}...)
579 if btz, ok := fr.timezones[tz]; ok {
580 b = append(b, btz...)