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 currencyNegativePrefix string
28 currencyNegativeSuffix string
29 monthsAbbreviated []string
32 daysAbbreviated []string
36 periodsAbbreviated []string
37 periodsNarrow []string
40 erasAbbreviated []string
43 timezones map[string]string
46 // New returns a new instance of translator for the 'fr_LU' locale
47 func New() locales.Translator {
50 pluralsCardinal: []locales.PluralRule{2, 6},
51 pluralsOrdinal: []locales.PluralRule{2, 6},
52 pluralsRange: []locales.PluralRule{2, 6},
60 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", "F", "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"},
62 currencyPositiveSuffix: " ",
63 currencyNegativePrefix: "(",
64 currencyNegativeSuffix: " )",
65 monthsAbbreviated: []string{"", "janv.", "févr.", "mars", "avr.", "mai", "juin", "juil.", "août", "sept.", "oct.", "nov.", "déc."},
66 monthsNarrow: []string{"", "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"},
67 monthsWide: []string{"", "janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre"},
68 daysAbbreviated: []string{"dim.", "lun.", "mar.", "mer.", "jeu.", "ven.", "sam."},
69 daysNarrow: []string{"D", "L", "M", "M", "J", "V", "S"},
70 daysShort: []string{"di", "lu", "ma", "me", "je", "ve", "sa"},
71 daysWide: []string{"dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"},
72 periodsAbbreviated: []string{"AM", "PM"},
73 periodsNarrow: []string{"AM", "PM"},
74 periodsWide: []string{"AM", "PM"},
75 erasAbbreviated: []string{"av. J.-C.", "ap. J.-C."},
76 erasNarrow: []string{"av. J.-C.", "ap. J.-C."},
77 erasWide: []string{"avant Jésus-Christ", "après Jésus-Christ"},
78 timezones: map[string]string{"CST": "heure normale du centre nord-américain", "AWDT": "heure d’été de l’Ouest de l’Australie", "UYST": "heure d’été de l’Uruguay", "EAT": "heure normale d’Afrique de l’Est", "WAST": "heure d’été d’Afrique de l’Ouest", "TMT": "heure normale du Turkménistan", "ACST": "heure normale du centre de l’Australie", "HECU": "heure d’été de Cuba", "BOT": "heure de Bolivie", "NZST": "heure normale de la Nouvelle-Zélande", "AEDT": "heure d’été de l’Est de l’Australie", "HAT": "heure d’été de Terre-Neuve", "HEPMX": "heure d’été du Pacifique mexicain", "SRT": "heure du Suriname", "MEZ": "heure normale d’Europe centrale", "IST": "heure de l’Inde", "CLST": "heure d’été du Chili", "GYT": "heure du Guyana", "PDT": "heure d’été du Pacifique", "HADT": "heure d’été d’Hawaii - Aléoutiennes", "JST": "heure normale du Japon", "WARST": "heure d’été de l’Ouest argentin", "COST": "heure d’été de Colombie", "CHAST": "heure normale des îles Chatham", "MST": "heure normale de Macao", "UYT": "heure normale de l’Uruguay", "HNPMX": "heure normale du Pacifique mexicain", "ACWDT": "heure d’été du centre-ouest de l’Australie", "JDT": "heure d’été du Japon", "WART": "heure normale de l’Ouest argentin", "AST": "heure normale de l’Atlantique", "BT": "heure du Bhoutan", "WAT": "heure normale d’Afrique de l’Ouest", "CLT": "heure normale du Chili", "ECT": "heure de l’Équateur", "SGT": "heure de Singapour", "HNCU": "heure normale de Cuba", "∅∅∅": "heure d’été de l’Acre", "HAST": "heure normale d’Hawaii - Aléoutiennes", "TMST": "heure d’été du Turkménistan", "LHST": "heure normale de Lord Howe", "AKDT": "heure d’été de l’Alaska", "WESZ": "heure d’été d’Europe de l’Ouest", "WIB": "heure de l’Ouest indonésien", "HNOG": "heure normale de l’Ouest du Groenland", "MDT": "heure d’été de Macao", "HNNOMX": "heure normale du Nord-Ouest du Mexique", "WITA": "heure du Centre indonésien", "OEZ": "heure normale d’Europe de l’Est", "LHDT": "heure d’été de Lord Howe", "ART": "heure normale d’Argentine", "ARST": "heure d’été de l’Argentine", "HNEG": "heure normale de l’Est du Groenland", "HNT": "heure normale de Terre-Neuve", "WEZ": "heure normale d’Europe de l’Ouest", "CHADT": "heure d’été des îles Chatham", "MESZ": "heure d’été d’Europe centrale", "OESZ": "heure d’été d’Europe de l’Est", "HEOG": "heure d’été de l’Ouest du Groenland", "EST": "heure normale de l’Est nord-américain", "CAT": "heure normale d’Afrique centrale", "GMT": "heure moyenne de Greenwich", "HNPM": "heure normale de Saint-Pierre-et-Miquelon", "ACDT": "heure d’été du centre de l’Australie", "CDT": "heure d’été du Centre", "ACWST": "heure normale du centre-ouest de l’Australie", "MYT": "heure de la Malaisie", "ADT": "heure d’été de l’Atlantique", "HEEG": "heure d’été de l’Est du Groenland", "HKT": "heure normale de Hong Kong", "AKST": "heure normale de l’Alaska", "NZDT": "heure d’été de la Nouvelle-Zélande", "HENOMX": "heure d’été du Nord-Ouest du Mexique", "AEST": "heure normale de l’Est de l’Australie", "HKST": "heure d’été de Hong Kong", "COT": "heure normale de Colombie", "EDT": "heure d’été de l’Est", "AWST": "heure normale de l’Ouest de l’Australie", "VET": "heure du Venezuela", "SAST": "heure normale d’Afrique méridionale", "GFT": "heure de la Guyane française", "HEPM": "heure d’été de Saint-Pierre-et-Miquelon", "WIT": "heure de l’Est indonésien", "ChST": "heure des Chamorro", "PST": "heure normale du Pacifique nord-américain"},
82 // Locale returns the current translators string locale
83 func (fr *fr_LU) Locale() string {
87 // PluralsCardinal returns the list of cardinal plural rules associated with 'fr_LU'
88 func (fr *fr_LU) PluralsCardinal() []locales.PluralRule {
89 return fr.pluralsCardinal
92 // PluralsOrdinal returns the list of ordinal plural rules associated with 'fr_LU'
93 func (fr *fr_LU) PluralsOrdinal() []locales.PluralRule {
94 return fr.pluralsOrdinal
97 // PluralsRange returns the list of range plural rules associated with 'fr_LU'
98 func (fr *fr_LU) PluralsRange() []locales.PluralRule {
99 return fr.pluralsRange
102 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'fr_LU'
103 func (fr *fr_LU) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
108 if i == 0 || i == 1 {
109 return locales.PluralRuleOne
112 return locales.PluralRuleOther
115 // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'fr_LU'
116 func (fr *fr_LU) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
121 return locales.PluralRuleOne
124 return locales.PluralRuleOther
127 // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'fr_LU'
128 func (fr *fr_LU) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
130 start := fr.CardinalPluralRule(num1, v1)
131 end := fr.CardinalPluralRule(num2, v2)
133 if start == locales.PluralRuleOne && end == locales.PluralRuleOne {
134 return locales.PluralRuleOne
135 } else if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
136 return locales.PluralRuleOther
139 return locales.PluralRuleOther
143 // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
144 func (fr *fr_LU) MonthAbbreviated(month time.Month) string {
145 return fr.monthsAbbreviated[month]
148 // MonthsAbbreviated returns the locales abbreviated months
149 func (fr *fr_LU) MonthsAbbreviated() []string {
150 return fr.monthsAbbreviated[1:]
153 // MonthNarrow returns the locales narrow month given the 'month' provided
154 func (fr *fr_LU) MonthNarrow(month time.Month) string {
155 return fr.monthsNarrow[month]
158 // MonthsNarrow returns the locales narrow months
159 func (fr *fr_LU) MonthsNarrow() []string {
160 return fr.monthsNarrow[1:]
163 // MonthWide returns the locales wide month given the 'month' provided
164 func (fr *fr_LU) MonthWide(month time.Month) string {
165 return fr.monthsWide[month]
168 // MonthsWide returns the locales wide months
169 func (fr *fr_LU) MonthsWide() []string {
170 return fr.monthsWide[1:]
173 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
174 func (fr *fr_LU) WeekdayAbbreviated(weekday time.Weekday) string {
175 return fr.daysAbbreviated[weekday]
178 // WeekdaysAbbreviated returns the locales abbreviated weekdays
179 func (fr *fr_LU) WeekdaysAbbreviated() []string {
180 return fr.daysAbbreviated
183 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
184 func (fr *fr_LU) WeekdayNarrow(weekday time.Weekday) string {
185 return fr.daysNarrow[weekday]
188 // WeekdaysNarrow returns the locales narrow weekdays
189 func (fr *fr_LU) WeekdaysNarrow() []string {
193 // WeekdayShort returns the locales short weekday given the 'weekday' provided
194 func (fr *fr_LU) WeekdayShort(weekday time.Weekday) string {
195 return fr.daysShort[weekday]
198 // WeekdaysShort returns the locales short weekdays
199 func (fr *fr_LU) WeekdaysShort() []string {
203 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
204 func (fr *fr_LU) WeekdayWide(weekday time.Weekday) string {
205 return fr.daysWide[weekday]
208 // WeekdaysWide returns the locales wide weekdays
209 func (fr *fr_LU) WeekdaysWide() []string {
213 // Decimal returns the decimal point of number
214 func (fr *fr_LU) Decimal() string {
218 // Group returns the group of number
219 func (fr *fr_LU) Group() string {
223 // Group returns the minus sign of number
224 func (fr *fr_LU) Minus() string {
228 // FmtNumber returns 'num' with digits/precision of 'v' for 'fr_LU' and handles both Whole and Real numbers based on 'v'
229 func (fr *fr_LU) FmtNumber(num float64, v uint64) string {
231 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
232 l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
235 b := make([]byte, 0, l)
237 for i := len(s) - 1; i >= 0; i-- {
240 b = append(b, fr.decimal[0])
247 b = append(b, fr.group[0])
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_LU' 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_LU) 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_LU'
303 func (fr *fr_LU) 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) + 4 + 1*len(s[:len(s)-int(v)-1])/3
310 b := make([]byte, 0, l)
312 for i := len(s) - 1; i >= 0; i-- {
315 b = append(b, fr.decimal[0])
322 b = append(b, fr.group[0])
333 b = append(b, fr.minus[0])
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, fr.decimal...)
347 for i := 0; i < 2-int(v); i++ {
352 b = append(b, fr.currencyPositiveSuffix...)
354 b = append(b, symbol...)
359 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_LU'
360 // in accounting notation.
361 func (fr *fr_LU) FmtAccounting(num float64, v uint64, currency currency.Type) string {
363 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
364 symbol := fr.currencies[currency]
365 l := len(s) + len(symbol) + 6 + 1*len(s[:len(s)-int(v)-1])/3
368 b := make([]byte, 0, l)
370 for i := len(s) - 1; i >= 0; i-- {
373 b = append(b, fr.decimal[0])
380 b = append(b, fr.group[0])
392 b = append(b, fr.currencyNegativePrefix[0])
397 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
398 b[i], b[j] = b[j], b[i]
404 b = append(b, fr.decimal...)
407 for i := 0; i < 2-int(v); i++ {
413 b = append(b, fr.currencyNegativeSuffix...)
414 b = append(b, symbol...)
417 b = append(b, fr.currencyPositiveSuffix...)
418 b = append(b, symbol...)
424 // FmtDateShort returns the short date representation of 't' for 'fr_LU'
425 func (fr *fr_LU) FmtDateShort(t time.Time) string {
427 b := make([]byte, 0, 32)
433 b = strconv.AppendInt(b, int64(t.Day()), 10)
434 b = append(b, []byte{0x2f}...)
440 b = strconv.AppendInt(b, int64(t.Month()), 10)
442 b = append(b, []byte{0x2f}...)
445 b = strconv.AppendInt(b, int64(t.Year()), 10)
447 b = strconv.AppendInt(b, int64(-t.Year()), 10)
453 // FmtDateMedium returns the medium date representation of 't' for 'fr_LU'
454 func (fr *fr_LU) FmtDateMedium(t time.Time) string {
456 b := make([]byte, 0, 32)
458 b = strconv.AppendInt(b, int64(t.Day()), 10)
459 b = append(b, []byte{0x20}...)
460 b = append(b, fr.monthsAbbreviated[t.Month()]...)
461 b = append(b, []byte{0x20}...)
464 b = strconv.AppendInt(b, int64(t.Year()), 10)
466 b = strconv.AppendInt(b, int64(-t.Year()), 10)
472 // FmtDateLong returns the long date representation of 't' for 'fr_LU'
473 func (fr *fr_LU) FmtDateLong(t time.Time) string {
475 b := make([]byte, 0, 32)
477 b = strconv.AppendInt(b, int64(t.Day()), 10)
478 b = append(b, []byte{0x20}...)
479 b = append(b, fr.monthsWide[t.Month()]...)
480 b = append(b, []byte{0x20}...)
483 b = strconv.AppendInt(b, int64(t.Year()), 10)
485 b = strconv.AppendInt(b, int64(-t.Year()), 10)
491 // FmtDateFull returns the full date representation of 't' for 'fr_LU'
492 func (fr *fr_LU) FmtDateFull(t time.Time) string {
494 b := make([]byte, 0, 32)
496 b = append(b, fr.daysWide[t.Weekday()]...)
497 b = append(b, []byte{0x20}...)
498 b = strconv.AppendInt(b, int64(t.Day()), 10)
499 b = append(b, []byte{0x20}...)
500 b = append(b, fr.monthsWide[t.Month()]...)
501 b = append(b, []byte{0x20}...)
504 b = strconv.AppendInt(b, int64(t.Year()), 10)
506 b = strconv.AppendInt(b, int64(-t.Year()), 10)
512 // FmtTimeShort returns the short time representation of 't' for 'fr_LU'
513 func (fr *fr_LU) FmtTimeShort(t time.Time) string {
515 b := make([]byte, 0, 32)
521 b = strconv.AppendInt(b, int64(t.Hour()), 10)
522 b = append(b, fr.timeSeparator...)
528 b = strconv.AppendInt(b, int64(t.Minute()), 10)
533 // FmtTimeMedium returns the medium time representation of 't' for 'fr_LU'
534 func (fr *fr_LU) FmtTimeMedium(t time.Time) string {
536 b := make([]byte, 0, 32)
542 b = strconv.AppendInt(b, int64(t.Hour()), 10)
543 b = append(b, fr.timeSeparator...)
549 b = strconv.AppendInt(b, int64(t.Minute()), 10)
550 b = append(b, fr.timeSeparator...)
556 b = strconv.AppendInt(b, int64(t.Second()), 10)
561 // FmtTimeLong returns the long time representation of 't' for 'fr_LU'
562 func (fr *fr_LU) FmtTimeLong(t time.Time) string {
564 b := make([]byte, 0, 32)
570 b = strconv.AppendInt(b, int64(t.Hour()), 10)
571 b = append(b, fr.timeSeparator...)
577 b = strconv.AppendInt(b, int64(t.Minute()), 10)
578 b = append(b, fr.timeSeparator...)
584 b = strconv.AppendInt(b, int64(t.Second()), 10)
585 b = append(b, []byte{0x20}...)
593 // FmtTimeFull returns the full time representation of 't' for 'fr_LU'
594 func (fr *fr_LU) FmtTimeFull(t time.Time) string {
596 b := make([]byte, 0, 32)
602 b = strconv.AppendInt(b, int64(t.Hour()), 10)
603 b = append(b, fr.timeSeparator...)
609 b = strconv.AppendInt(b, int64(t.Minute()), 10)
610 b = append(b, fr.timeSeparator...)
616 b = strconv.AppendInt(b, int64(t.Second()), 10)
617 b = append(b, []byte{0x20}...)
621 if btz, ok := fr.timezones[tz]; ok {
622 b = append(b, btz...)