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 'es_DO' 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", "RD$", "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", "US$", "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{"", "ene.", "feb.", "mar.", "abr.", "may.", "jun.", "jul.", "ago.", "sept.", "oct.", "nov.", "dic."},
62 monthsNarrow: []string{"", "E", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"},
63 monthsWide: []string{"", "enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"},
64 daysAbbreviated: []string{"dom.", "lun.", "mar.", "mié.", "jue.", "vie.", "sáb."},
65 daysNarrow: []string{"D", "L", "M", "M", "J", "V", "S"},
66 daysShort: []string{"DO", "LU", "MA", "MI", "JU", "VI", "SA"},
67 daysWide: []string{"domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado"},
68 periodsAbbreviated: []string{"a. m.", "p. m."},
69 periodsNarrow: []string{"", ""},
70 periodsWide: []string{"a. m.", "p. m."},
71 erasAbbreviated: []string{"", ""},
72 erasNarrow: []string{"", ""},
73 erasWide: []string{"antes de la Era Común", "Era Común"},
74 timezones: map[string]string{"MDT": "Hora de verano de Macao", "MEZ": "hora estándar de Europa central", "NZDT": "hora de verano de Nueva Zelanda", "WARST": "hora de verano de Argentina occidental", "HNEG": "hora estándar de Groenlandia oriental", "BT": "hora de Bután", "BOT": "hora de Bolivia", "CLT": "hora estándar de Chile", "JST": "hora estándar de Japón", "ART": "hora estándar de Argentina", "HEPMX": "hora de verano del Pacífico de México", "AWDT": "hora de verano de Australia occidental", "HNOG": "hora estándar de Groenlandia occidental", "HEEG": "hora de verano de Groenlandia oriental", "MESZ": "hora de verano de Europa central", "OESZ": "hora de verano de Europa oriental", "WAT": "hora estándar de África occidental", "AKST": "hora estándar de Alaska", "ACWDT": "hora de verano de Australia centroccidental", "AST": "hora estándar del Atlántico", "GYT": "hora de Guyana", "WEZ": "hora estándar de Europa occidental", "MYT": "hora de Malasia", "HEOG": "hora de verano de Groenlandia occidental", "ADT": "hora de verano del Atlántico", "AEDT": "hora de verano de Australia oriental", "WAST": "hora de verano de África occidental", "EDT": "hora de verano oriental", "HECU": "hora de verano de Cuba", "SRT": "hora de Surinam", "SGT": "hora de Singapur", "HADT": "hora de verano de Hawái-Aleutiano", "LHDT": "hora de verano de Lord Howe", "IST": "hora estándar de la India", "HKST": "hora de verano de Hong Kong", "COT": "hora estándar de Colombia", "EST": "hora estándar oriental", "GMT": "hora del meridiano de Greenwich", "PDT": "hora de verano del Pacífico", "CHAST": "hora estándar de Chatham", "CHADT": "hora de verano de Chatham", "ARST": "hora de verano de Argentina", "ACDT": "hora de verano de Australia central", "CAT": "hora de África central", "∅∅∅": "hora de verano de Perú", "WIB": "hora de Indonesia occidental", "WART": "hora estándar de Argentina occidental", "HKT": "hora estándar de Hong Kong", "AKDT": "hora de verano de Alaska", "ACST": "hora estándar de Australia central", "CST": "hora estándar central", "AWST": "hora estándar de Australia occidental", "HEPM": "hora de verano de San Pedro y Miquelón", "ACWST": "hora estándar de Australia centroccidental", "HNNOMX": "hora estándar del noroeste de México", "LHST": "hora estándar de Lord Howe", "PST": "hora estándar del Pacífico", "HNPM": "hora estándar de San Pedro y Miquelón", "HNT": "hora estándar de Terranova", "COST": "hora de verano de Colombia", "TMT": "hora estándar de Turkmenistán", "EAT": "hora de África oriental", "HNCU": "hora estándar de Cuba", "MST": "Hora estándar de Macao", "UYST": "hora de verano de Uruguay", "NZST": "hora estándar de Nueva Zelanda", "HENOMX": "hora de verano del noroeste de México", "WITA": "hora de Indonesia central", "ChST": "hora estándar de Chamorro", "HNPMX": "hora estándar del Pacífico de México", "GFT": "hora de la Guayana Francesa", "ECT": "hora de Ecuador", "OEZ": "hora estándar de Europa oriental", "VET": "hora de Venezuela", "AEST": "hora estándar de Australia oriental", "HAT": "hora de verano de Terranova", "WESZ": "hora de verano de Europa occidental", "CDT": "hora de verano central", "TMST": "hora de verano de Turkmenistán", "HAST": "hora estándar de Hawái-Aleutiano", "JDT": "hora de verano de Japón", "SAST": "hora de Sudáfrica", "CLST": "hora de verano de Chile", "UYT": "hora estándar de Uruguay", "WIT": "hora de Indonesia oriental"},
78 // Locale returns the current translators string locale
79 func (es *es_DO) Locale() string {
83 // PluralsCardinal returns the list of cardinal plural rules associated with 'es_DO'
84 func (es *es_DO) PluralsCardinal() []locales.PluralRule {
85 return es.pluralsCardinal
88 // PluralsOrdinal returns the list of ordinal plural rules associated with 'es_DO'
89 func (es *es_DO) PluralsOrdinal() []locales.PluralRule {
90 return es.pluralsOrdinal
93 // PluralsRange returns the list of range plural rules associated with 'es_DO'
94 func (es *es_DO) PluralsRange() []locales.PluralRule {
95 return es.pluralsRange
98 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'es_DO'
99 func (es *es_DO) 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 'es_DO'
111 func (es *es_DO) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
112 return locales.PluralRuleOther
115 // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'es_DO'
116 func (es *es_DO) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
117 return locales.PluralRuleOther
120 // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
121 func (es *es_DO) MonthAbbreviated(month time.Month) string {
122 return es.monthsAbbreviated[month]
125 // MonthsAbbreviated returns the locales abbreviated months
126 func (es *es_DO) MonthsAbbreviated() []string {
127 return es.monthsAbbreviated[1:]
130 // MonthNarrow returns the locales narrow month given the 'month' provided
131 func (es *es_DO) MonthNarrow(month time.Month) string {
132 return es.monthsNarrow[month]
135 // MonthsNarrow returns the locales narrow months
136 func (es *es_DO) MonthsNarrow() []string {
137 return es.monthsNarrow[1:]
140 // MonthWide returns the locales wide month given the 'month' provided
141 func (es *es_DO) MonthWide(month time.Month) string {
142 return es.monthsWide[month]
145 // MonthsWide returns the locales wide months
146 func (es *es_DO) MonthsWide() []string {
147 return es.monthsWide[1:]
150 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
151 func (es *es_DO) WeekdayAbbreviated(weekday time.Weekday) string {
152 return es.daysAbbreviated[weekday]
155 // WeekdaysAbbreviated returns the locales abbreviated weekdays
156 func (es *es_DO) WeekdaysAbbreviated() []string {
157 return es.daysAbbreviated
160 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
161 func (es *es_DO) WeekdayNarrow(weekday time.Weekday) string {
162 return es.daysNarrow[weekday]
165 // WeekdaysNarrow returns the locales narrow weekdays
166 func (es *es_DO) WeekdaysNarrow() []string {
170 // WeekdayShort returns the locales short weekday given the 'weekday' provided
171 func (es *es_DO) WeekdayShort(weekday time.Weekday) string {
172 return es.daysShort[weekday]
175 // WeekdaysShort returns the locales short weekdays
176 func (es *es_DO) WeekdaysShort() []string {
180 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
181 func (es *es_DO) WeekdayWide(weekday time.Weekday) string {
182 return es.daysWide[weekday]
185 // WeekdaysWide returns the locales wide weekdays
186 func (es *es_DO) WeekdaysWide() []string {
190 // Decimal returns the decimal point of number
191 func (es *es_DO) Decimal() string {
195 // Group returns the group of number
196 func (es *es_DO) Group() string {
200 // Group returns the minus sign of number
201 func (es *es_DO) Minus() string {
205 // FmtNumber returns 'num' with digits/precision of 'v' for 'es_DO' and handles both Whole and Real numbers based on 'v'
206 func (es *es_DO) FmtNumber(num float64, v uint64) string {
208 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
209 l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
212 b := make([]byte, 0, l)
214 for i := len(s) - 1; i >= 0; i-- {
217 b = append(b, es.decimal[0])
224 b = append(b, es.group[0])
235 b = append(b, es.minus[0])
239 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
240 b[i], b[j] = b[j], b[i]
246 // FmtPercent returns 'num' with digits/precision of 'v' for 'es_DO' and handles both Whole and Real numbers based on 'v'
247 // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
248 func (es *es_DO) FmtPercent(num float64, v uint64) string {
249 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
251 b := make([]byte, 0, l)
253 for i := len(s) - 1; i >= 0; i-- {
256 b = append(b, es.decimal[0])
264 b = append(b, es.minus[0])
268 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
269 b[i], b[j] = b[j], b[i]
272 b = append(b, es.percent...)
277 // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'es_DO'
278 func (es *es_DO) FmtCurrency(num float64, v uint64, currency currency.Type) string {
280 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
281 symbol := es.currencies[currency]
282 l := len(s) + len(symbol) + 3 + 1*len(s[:len(s)-int(v)-1])/3
285 b := make([]byte, 0, l)
287 for i := len(s) - 1; i >= 0; i-- {
290 b = append(b, es.decimal[0])
297 b = append(b, es.group[0])
307 for j := len(symbol) - 1; j >= 0; j-- {
308 b = append(b, symbol[j])
312 b = append(b, es.minus[0])
316 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
317 b[i], b[j] = b[j], b[i]
323 b = append(b, es.decimal...)
326 for i := 0; i < 2-int(v); i++ {
331 b = append(b, es.currencyPositiveSuffix...)
336 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'es_DO'
337 // in accounting notation.
338 func (es *es_DO) FmtAccounting(num float64, v uint64, currency currency.Type) string {
340 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
341 symbol := es.currencies[currency]
342 l := len(s) + len(symbol) + 3 + 1*len(s[:len(s)-int(v)-1])/3
345 b := make([]byte, 0, l)
347 for i := len(s) - 1; i >= 0; i-- {
350 b = append(b, es.decimal[0])
357 b = append(b, es.group[0])
369 for j := len(symbol) - 1; j >= 0; j-- {
370 b = append(b, symbol[j])
373 b = append(b, es.minus[0])
377 for j := len(symbol) - 1; j >= 0; j-- {
378 b = append(b, symbol[j])
384 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
385 b[i], b[j] = b[j], b[i]
391 b = append(b, es.decimal...)
394 for i := 0; i < 2-int(v); i++ {
400 b = append(b, es.currencyNegativeSuffix...)
403 b = append(b, es.currencyPositiveSuffix...)
409 // FmtDateShort returns the short date representation of 't' for 'es_DO'
410 func (es *es_DO) FmtDateShort(t time.Time) string {
412 b := make([]byte, 0, 32)
414 b = strconv.AppendInt(b, int64(t.Day()), 10)
415 b = append(b, []byte{0x2f}...)
416 b = strconv.AppendInt(b, int64(t.Month()), 10)
417 b = append(b, []byte{0x2f}...)
420 b = append(b, strconv.Itoa(t.Year())[2:]...)
422 b = append(b, strconv.Itoa(t.Year())[1:]...)
428 // FmtDateMedium returns the medium date representation of 't' for 'es_DO'
429 func (es *es_DO) FmtDateMedium(t time.Time) string {
431 b := make([]byte, 0, 32)
433 b = strconv.AppendInt(b, int64(t.Day()), 10)
434 b = append(b, []byte{0x20}...)
435 b = append(b, es.monthsAbbreviated[t.Month()]...)
436 b = append(b, []byte{0x20}...)
439 b = strconv.AppendInt(b, int64(t.Year()), 10)
441 b = strconv.AppendInt(b, int64(-t.Year()), 10)
447 // FmtDateLong returns the long date representation of 't' for 'es_DO'
448 func (es *es_DO) FmtDateLong(t time.Time) string {
450 b := make([]byte, 0, 32)
452 b = strconv.AppendInt(b, int64(t.Day()), 10)
453 b = append(b, []byte{0x20, 0x64, 0x65}...)
454 b = append(b, []byte{0x20}...)
455 b = append(b, es.monthsWide[t.Month()]...)
456 b = append(b, []byte{0x20, 0x64, 0x65}...)
457 b = append(b, []byte{0x20}...)
460 b = strconv.AppendInt(b, int64(t.Year()), 10)
462 b = strconv.AppendInt(b, int64(-t.Year()), 10)
468 // FmtDateFull returns the full date representation of 't' for 'es_DO'
469 func (es *es_DO) FmtDateFull(t time.Time) string {
471 b := make([]byte, 0, 32)
473 b = append(b, es.daysWide[t.Weekday()]...)
474 b = append(b, []byte{0x2c, 0x20}...)
475 b = strconv.AppendInt(b, int64(t.Day()), 10)
476 b = append(b, []byte{0x20, 0x64, 0x65}...)
477 b = append(b, []byte{0x20}...)
478 b = append(b, es.monthsWide[t.Month()]...)
479 b = append(b, []byte{0x20, 0x64, 0x65}...)
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 // FmtTimeShort returns the short time representation of 't' for 'es_DO'
492 func (es *es_DO) FmtTimeShort(t time.Time) string {
494 b := make([]byte, 0, 32)
502 b = strconv.AppendInt(b, int64(h), 10)
503 b = append(b, es.timeSeparator...)
509 b = strconv.AppendInt(b, int64(t.Minute()), 10)
510 b = append(b, []byte{0x20}...)
513 b = append(b, es.periodsAbbreviated[0]...)
515 b = append(b, es.periodsAbbreviated[1]...)
521 // FmtTimeMedium returns the medium time representation of 't' for 'es_DO'
522 func (es *es_DO) FmtTimeMedium(t time.Time) string {
524 b := make([]byte, 0, 32)
532 b = strconv.AppendInt(b, int64(h), 10)
533 b = append(b, es.timeSeparator...)
539 b = strconv.AppendInt(b, int64(t.Minute()), 10)
540 b = append(b, es.timeSeparator...)
546 b = strconv.AppendInt(b, int64(t.Second()), 10)
547 b = append(b, []byte{0x20}...)
550 b = append(b, es.periodsAbbreviated[0]...)
552 b = append(b, es.periodsAbbreviated[1]...)
558 // FmtTimeLong returns the long time representation of 't' for 'es_DO'
559 func (es *es_DO) FmtTimeLong(t time.Time) string {
561 b := make([]byte, 0, 32)
569 b = strconv.AppendInt(b, int64(h), 10)
570 b = append(b, es.timeSeparator...)
576 b = strconv.AppendInt(b, int64(t.Minute()), 10)
577 b = append(b, es.timeSeparator...)
583 b = strconv.AppendInt(b, int64(t.Second()), 10)
584 b = append(b, []byte{0x20}...)
587 b = append(b, es.periodsAbbreviated[0]...)
589 b = append(b, es.periodsAbbreviated[1]...)
592 b = append(b, []byte{0x20}...)
600 // FmtTimeFull returns the full time representation of 't' for 'es_DO'
601 func (es *es_DO) FmtTimeFull(t time.Time) string {
603 b := make([]byte, 0, 32)
611 b = strconv.AppendInt(b, int64(h), 10)
612 b = append(b, es.timeSeparator...)
618 b = strconv.AppendInt(b, int64(t.Minute()), 10)
619 b = append(b, es.timeSeparator...)
625 b = strconv.AppendInt(b, int64(t.Second()), 10)
626 b = append(b, []byte{0x20}...)
629 b = append(b, es.periodsAbbreviated[0]...)
631 b = append(b, es.periodsAbbreviated[1]...)
634 b = append(b, []byte{0x20}...)
638 if btz, ok := es.timezones[tz]; ok {
639 b = append(b, btz...)