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 currencyNegativePrefix 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 'pt_MO' locale
45 func New() locales.Translator {
48 pluralsCardinal: []locales.PluralRule{2, 6},
49 pluralsOrdinal: []locales.PluralRule{6},
50 pluralsRange: []locales.PluralRule{2, 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 currencyNegativePrefix: "(",
60 currencyNegativeSuffix: ")",
61 monthsAbbreviated: []string{"", "jan", "fev", "mar", "abr", "mai", "jun", "jul", "ago", "set", "out", "nov", "dez"},
62 monthsNarrow: []string{"", "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"},
63 monthsWide: []string{"", "janeiro", "fevereiro", "março", "abril", "maio", "junho", "julho", "agosto", "setembro", "outubro", "novembro", "dezembro"},
64 daysAbbreviated: []string{"dom", "seg", "ter", "qua", "qui", "sex", "sáb"},
65 daysNarrow: []string{"D", "S", "T", "Q", "Q", "S", "S"},
66 daysShort: []string{"dom", "seg", "ter", "qua", "qui", "sex", "sáb"},
67 daysWide: []string{"domingo", "segunda-feira", "terça-feira", "quarta-feira", "quinta-feira", "sexta-feira", "sábado"},
68 periodsAbbreviated: []string{"AM", "PM"},
69 periodsNarrow: []string{"AM", "PM"},
70 periodsWide: []string{"AM", "PM"},
71 erasAbbreviated: []string{"a.C.", "d.C."},
72 erasNarrow: []string{"", ""},
73 erasWide: []string{"antes de Cristo", "depois de Cristo"},
74 timezones: map[string]string{"CDT": "Horário de Verão Central", "TMT": "Horário Padrão do Turcomenistão", "ARST": "Horário de Verão da Argentina", "EDT": "Horário de Verão Oriental", "ChST": "Horário de Chamorro", "GMT": "Horário do Meridiano de Greenwich", "HNNOMX": "Horário Padrão do Noroeste do México", "AEST": "Horário Padrão da Austrália Oriental", "AEDT": "Horário de Verão da Austrália Oriental", "CLT": "Horário Padrão do Chile", "AKDT": "Horário de Verão do Alasca", "HEPM": "Horário de Verão de Saint Pierre e Miquelon", "PDT": "Horário de Verão do Pacífico", "WARST": "Horário de Verão da Argentina Ocidental", "HEPMX": "Horário de Verão do Pacífico do México", "ECT": "Horário do Equador", "AWDT": "Horário de Verão da Austrália Ocidental", "SRT": "Horário do Suriname", "TMST": "Horário de Verão do Turcomenistão", "HENOMX": "Horário de Verão do Noroeste do México", "ADT": "Horário de Verão do Atlântico", "MST": "Horário Padrão de Macau", "HNOG": "Horário Padrão da Groenlândia Ocidental", "ACST": "Horário Padrão da Austrália Central", "HNEG": "Horário Padrão da Groelândia Oriental", "COT": "Horário Padrão da Colômbia", "CAT": "Horário da África Central", "CHAST": "Horário Padrão de Chatham", "HADT": "Horário de Verão do Havaí e Ilhas Aleutas", "NZDT": "Horário de Verão da Nova Zelândia", "LHDT": "Horário de Verão de Lord Howe", "WAST": "Horário de Verão da África Ocidental", "BOT": "Horário da Bolívia", "UYST": "Horário de Verão do Uruguai", "HEEG": "Horário de Verão da Groelândia Oriental", "HKST": "Horário de Verão de Hong Kong", "HNPMX": "Horário Padrão do Pacífico do México", "ACDT": "Horário de Verão da Austrália Central", "PST": "Horário Padrão do Pacífico", "MDT": "Horário de Verão de Macau", "HAST": "Horário Padrão do Havaí e Ilhas Aleutas", "JST": "Horário Padrão do Japão", "ART": "Horário Padrão da Argentina", "ACWDT": "Horário de Verão da Austrália Centro-Ocidental", "HKT": "Horário Padrão de Hong Kong", "EST": "Horário Padrão Oriental", "HECU": "Horário de Verão de Cuba", "AWST": "Horário Padrão da Austrália Ocidental", "NZST": "Horário Padrão da Nova Zelândia", "CLST": "Horário de Verão do Chile", "AKST": "Horário Padrão do Alasca", "WEZ": "Horário Padrão da Europa Ocidental", "WIB": "Horário da Indonésia Ocidental", "UYT": "Horário Padrão do Uruguai", "WIT": "Horário da Indonésia Oriental", "MEZ": "Horário Padrão da Europa Central", "HEOG": "Horário de Verão da Groenlândia Ocidental", "COST": "Horário de Verão da Colômbia", "EAT": "Horário da África Oriental", "SGT": "Horário Padrão de Cingapura", "CHADT": "Horário de Verão de Chatham", "HNPM": "Horário Padrão de Saint Pierre e Miquelon", "MYT": "Horário da Malásia", "IST": "Horário Padrão da Índia", "SAST": "Horário da África do Sul", "GYT": "Horário da Guiana", "WESZ": "Horário de Verão da Europa Ocidental", "CST": "Horário Padrão Central", "MESZ": "Horário de Verão da Europa Central", "WITA": "Horário da Indonésia Central", "AST": "Horário Padrão do Atlântico", "GFT": "Horário da Guiana Francesa", "HNCU": "Horário Padrão de Cuba", "BT": "Horário do Butão", "ACWST": "Horário Padrão da Austrália Centro-Ocidental", "JDT": "Horário de Verão do Japão", "HNT": "Horário Padrão de Terra Nova", "VET": "Horário da Venezuela", "OESZ": "Horário de Verão da Europa Oriental", "HAT": "Horário de Verão de Terra Nova", "∅∅∅": "Horário de Verão de Brasília", "LHST": "Horário Padrão de Lord Howe", "WART": "Horário Padrão da Argentina Ocidental", "OEZ": "Horário Padrão da Europa Oriental", "WAT": "Horário Padrão da África Ocidental"},
78 // Locale returns the current translators string locale
79 func (pt *pt_MO) Locale() string {
83 // PluralsCardinal returns the list of cardinal plural rules associated with 'pt_MO'
84 func (pt *pt_MO) PluralsCardinal() []locales.PluralRule {
85 return pt.pluralsCardinal
88 // PluralsOrdinal returns the list of ordinal plural rules associated with 'pt_MO'
89 func (pt *pt_MO) PluralsOrdinal() []locales.PluralRule {
90 return pt.pluralsOrdinal
93 // PluralsRange returns the list of range plural rules associated with 'pt_MO'
94 func (pt *pt_MO) PluralsRange() []locales.PluralRule {
95 return pt.pluralsRange
98 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'pt_MO'
99 func (pt *pt_MO) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
104 if i >= 0 && i <= 1 {
105 return locales.PluralRuleOne
108 return locales.PluralRuleOther
111 // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'pt_MO'
112 func (pt *pt_MO) 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 'pt_MO'
117 func (pt *pt_MO) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
119 start := pt.CardinalPluralRule(num1, v1)
120 end := pt.CardinalPluralRule(num2, v2)
122 if start == locales.PluralRuleOne && end == locales.PluralRuleOne {
123 return locales.PluralRuleOne
124 } else if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
125 return locales.PluralRuleOther
126 } else if start == locales.PluralRuleOther && end == locales.PluralRuleOne {
127 return locales.PluralRuleOne
130 return locales.PluralRuleOther
134 // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
135 func (pt *pt_MO) MonthAbbreviated(month time.Month) string {
136 return pt.monthsAbbreviated[month]
139 // MonthsAbbreviated returns the locales abbreviated months
140 func (pt *pt_MO) MonthsAbbreviated() []string {
141 return pt.monthsAbbreviated[1:]
144 // MonthNarrow returns the locales narrow month given the 'month' provided
145 func (pt *pt_MO) MonthNarrow(month time.Month) string {
146 return pt.monthsNarrow[month]
149 // MonthsNarrow returns the locales narrow months
150 func (pt *pt_MO) MonthsNarrow() []string {
151 return pt.monthsNarrow[1:]
154 // MonthWide returns the locales wide month given the 'month' provided
155 func (pt *pt_MO) MonthWide(month time.Month) string {
156 return pt.monthsWide[month]
159 // MonthsWide returns the locales wide months
160 func (pt *pt_MO) MonthsWide() []string {
161 return pt.monthsWide[1:]
164 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
165 func (pt *pt_MO) WeekdayAbbreviated(weekday time.Weekday) string {
166 return pt.daysAbbreviated[weekday]
169 // WeekdaysAbbreviated returns the locales abbreviated weekdays
170 func (pt *pt_MO) WeekdaysAbbreviated() []string {
171 return pt.daysAbbreviated
174 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
175 func (pt *pt_MO) WeekdayNarrow(weekday time.Weekday) string {
176 return pt.daysNarrow[weekday]
179 // WeekdaysNarrow returns the locales narrow weekdays
180 func (pt *pt_MO) WeekdaysNarrow() []string {
184 // WeekdayShort returns the locales short weekday given the 'weekday' provided
185 func (pt *pt_MO) WeekdayShort(weekday time.Weekday) string {
186 return pt.daysShort[weekday]
189 // WeekdaysShort returns the locales short weekdays
190 func (pt *pt_MO) WeekdaysShort() []string {
194 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
195 func (pt *pt_MO) WeekdayWide(weekday time.Weekday) string {
196 return pt.daysWide[weekday]
199 // WeekdaysWide returns the locales wide weekdays
200 func (pt *pt_MO) WeekdaysWide() []string {
204 // Decimal returns the decimal point of number
205 func (pt *pt_MO) Decimal() string {
209 // Group returns the group of number
210 func (pt *pt_MO) Group() string {
214 // Group returns the minus sign of number
215 func (pt *pt_MO) Minus() string {
219 // FmtNumber returns 'num' with digits/precision of 'v' for 'pt_MO' and handles both Whole and Real numbers based on 'v'
220 func (pt *pt_MO) FmtNumber(num float64, v uint64) string {
222 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
223 l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
226 b := make([]byte, 0, l)
228 for i := len(s) - 1; i >= 0; i-- {
231 b = append(b, pt.decimal[0])
238 b = append(b, pt.group[0])
249 b = append(b, pt.minus[0])
253 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
254 b[i], b[j] = b[j], b[i]
260 // FmtPercent returns 'num' with digits/precision of 'v' for 'pt_MO' and handles both Whole and Real numbers based on 'v'
261 // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
262 func (pt *pt_MO) FmtPercent(num float64, v uint64) string {
263 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
265 b := make([]byte, 0, l)
267 for i := len(s) - 1; i >= 0; i-- {
270 b = append(b, pt.decimal[0])
278 b = append(b, pt.minus[0])
282 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
283 b[i], b[j] = b[j], b[i]
286 b = append(b, pt.percent...)
291 // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'pt_MO'
292 func (pt *pt_MO) FmtCurrency(num float64, v uint64, currency currency.Type) string {
294 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
295 symbol := pt.currencies[currency]
296 l := len(s) + len(symbol) + 2 + 1*len(s[:len(s)-int(v)-1])/3
299 b := make([]byte, 0, l)
301 for i := len(s) - 1; i >= 0; i-- {
304 b = append(b, pt.decimal[0])
311 b = append(b, pt.group[0])
321 for j := len(symbol) - 1; j >= 0; j-- {
322 b = append(b, symbol[j])
326 b = append(b, pt.minus[0])
330 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
331 b[i], b[j] = b[j], b[i]
337 b = append(b, pt.decimal...)
340 for i := 0; i < 2-int(v); i++ {
348 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'pt_MO'
349 // in accounting notation.
350 func (pt *pt_MO) FmtAccounting(num float64, v uint64, currency currency.Type) string {
352 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
353 symbol := pt.currencies[currency]
354 l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
357 b := make([]byte, 0, l)
359 for i := len(s) - 1; i >= 0; i-- {
362 b = append(b, pt.decimal[0])
369 b = append(b, pt.group[0])
381 for j := len(symbol) - 1; j >= 0; j-- {
382 b = append(b, symbol[j])
385 b = append(b, pt.currencyNegativePrefix[0])
389 for j := len(symbol) - 1; j >= 0; j-- {
390 b = append(b, symbol[j])
396 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
397 b[i], b[j] = b[j], b[i]
403 b = append(b, pt.decimal...)
406 for i := 0; i < 2-int(v); i++ {
412 b = append(b, pt.currencyNegativeSuffix...)
418 // FmtDateShort returns the short date representation of 't' for 'pt_MO'
419 func (pt *pt_MO) FmtDateShort(t time.Time) string {
421 b := make([]byte, 0, 32)
427 b = strconv.AppendInt(b, int64(t.Day()), 10)
428 b = append(b, []byte{0x2f}...)
434 b = strconv.AppendInt(b, int64(t.Month()), 10)
436 b = append(b, []byte{0x2f}...)
439 b = strconv.AppendInt(b, int64(t.Year()), 10)
441 b = strconv.AppendInt(b, int64(-t.Year()), 10)
447 // FmtDateMedium returns the medium date representation of 't' for 'pt_MO'
448 func (pt *pt_MO) FmtDateMedium(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, pt.monthsAbbreviated[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 // FmtDateLong returns the long date representation of 't' for 'pt_MO'
469 func (pt *pt_MO) FmtDateLong(t time.Time) string {
471 b := make([]byte, 0, 32)
473 b = strconv.AppendInt(b, int64(t.Day()), 10)
474 b = append(b, []byte{0x20, 0x64, 0x65}...)
475 b = append(b, []byte{0x20}...)
476 b = append(b, pt.monthsWide[t.Month()]...)
477 b = append(b, []byte{0x20, 0x64, 0x65}...)
478 b = append(b, []byte{0x20}...)
481 b = strconv.AppendInt(b, int64(t.Year()), 10)
483 b = strconv.AppendInt(b, int64(-t.Year()), 10)
489 // FmtDateFull returns the full date representation of 't' for 'pt_MO'
490 func (pt *pt_MO) FmtDateFull(t time.Time) string {
492 b := make([]byte, 0, 32)
494 b = append(b, pt.daysWide[t.Weekday()]...)
495 b = append(b, []byte{0x2c, 0x20}...)
496 b = strconv.AppendInt(b, int64(t.Day()), 10)
497 b = append(b, []byte{0x20, 0x64, 0x65}...)
498 b = append(b, []byte{0x20}...)
499 b = append(b, pt.monthsWide[t.Month()]...)
500 b = append(b, []byte{0x20, 0x64, 0x65}...)
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 'pt_MO'
513 func (pt *pt_MO) FmtTimeShort(t time.Time) string {
515 b := make([]byte, 0, 32)
523 b = strconv.AppendInt(b, int64(h), 10)
524 b = append(b, pt.timeSeparator...)
530 b = strconv.AppendInt(b, int64(t.Minute()), 10)
531 b = append(b, []byte{0x20}...)
534 b = append(b, pt.periodsAbbreviated[0]...)
536 b = append(b, pt.periodsAbbreviated[1]...)
542 // FmtTimeMedium returns the medium time representation of 't' for 'pt_MO'
543 func (pt *pt_MO) FmtTimeMedium(t time.Time) string {
545 b := make([]byte, 0, 32)
553 b = strconv.AppendInt(b, int64(h), 10)
554 b = append(b, pt.timeSeparator...)
560 b = strconv.AppendInt(b, int64(t.Minute()), 10)
561 b = append(b, pt.timeSeparator...)
567 b = strconv.AppendInt(b, int64(t.Second()), 10)
568 b = append(b, []byte{0x20}...)
571 b = append(b, pt.periodsAbbreviated[0]...)
573 b = append(b, pt.periodsAbbreviated[1]...)
579 // FmtTimeLong returns the long time representation of 't' for 'pt_MO'
580 func (pt *pt_MO) FmtTimeLong(t time.Time) string {
582 b := make([]byte, 0, 32)
590 b = strconv.AppendInt(b, int64(h), 10)
591 b = append(b, pt.timeSeparator...)
597 b = strconv.AppendInt(b, int64(t.Minute()), 10)
598 b = append(b, pt.timeSeparator...)
604 b = strconv.AppendInt(b, int64(t.Second()), 10)
605 b = append(b, []byte{0x20}...)
608 b = append(b, pt.periodsAbbreviated[0]...)
610 b = append(b, pt.periodsAbbreviated[1]...)
613 b = append(b, []byte{0x20}...)
621 // FmtTimeFull returns the full time representation of 't' for 'pt_MO'
622 func (pt *pt_MO) FmtTimeFull(t time.Time) string {
624 b := make([]byte, 0, 32)
632 b = strconv.AppendInt(b, int64(h), 10)
633 b = append(b, pt.timeSeparator...)
639 b = strconv.AppendInt(b, int64(t.Minute()), 10)
640 b = append(b, pt.timeSeparator...)
646 b = strconv.AppendInt(b, int64(t.Second()), 10)
647 b = append(b, []byte{0x20}...)
650 b = append(b, pt.periodsAbbreviated[0]...)
652 b = append(b, pt.periodsAbbreviated[1]...)
655 b = append(b, []byte{0x20}...)
659 if btz, ok := pt.timezones[tz]; ok {
660 b = append(b, btz...)