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 'ro_RO' locale
47 func New() locales.Translator {
50 pluralsCardinal: []locales.PluralRule{2, 4, 6},
51 pluralsOrdinal: []locales.PluralRule{2, 6},
52 pluralsRange: []locales.PluralRule{4, 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", "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"},
62 currencyPositiveSuffix: " ",
63 currencyNegativePrefix: "(",
64 currencyNegativeSuffix: " )",
65 monthsAbbreviated: []string{"", "ian.", "feb.", "mar.", "apr.", "mai", "iun.", "iul.", "aug.", "sept.", "oct.", "nov.", "dec."},
66 monthsNarrow: []string{"", "I", "F", "M", "A", "M", "I", "I", "A", "S", "O", "N", "D"},
67 monthsWide: []string{"", "ianuarie", "februarie", "martie", "aprilie", "mai", "iunie", "iulie", "august", "septembrie", "octombrie", "noiembrie", "decembrie"},
68 daysAbbreviated: []string{"dum.", "lun.", "mar.", "mie.", "joi", "vin.", "sâm."},
69 daysNarrow: []string{"D", "L", "M", "M", "J", "V", "S"},
70 daysShort: []string{"du.", "lu.", "ma.", "mi.", "joi", "vi.", "sâ."},
71 daysWide: []string{"duminică", "luni", "marți", "miercuri", "joi", "vineri", "sâmbătă"},
72 periodsAbbreviated: []string{"a.m.", "p.m."},
73 periodsNarrow: []string{"a.m.", "p.m."},
74 periodsWide: []string{"a.m.", "p.m."},
75 erasAbbreviated: []string{"î.Hr.", "d.Hr."},
76 erasNarrow: []string{"", ""},
77 erasWide: []string{"înainte de Hristos", "după Hristos"},
78 timezones: map[string]string{"WITA": "Ora Indoneziei Centrale", "CLT": "Ora standard din Chile", "EDT": "Ora de vară orientală nord-americană", "GYT": "Ora din Guyana", "ACST": "Ora standard a Australiei Centrale", "CHADT": "Ora de vară din Chatham", "UYST": "Ora de vară a Uruguayului", "AWST": "Ora standard a Australiei Occidentale", "AKDT": "Ora de vară din Alaska", "WARST": "Ora de vară a Argentinei Occidentale", "JDT": "Ora de vară a Japoniei", "ART": "Ora standard a Argentinei", "WAT": "Ora standard a Africii Occidentale", "HAT": "Ora de vară din Newfoundland", "HKT": "Ora standard din Hong Kong", "CLST": "Ora de vară din Chile", "MYT": "Ora din Malaysia", "HNCU": "Ora standard a Cubei", "BT": "Ora Bhutanului", "ECT": "Ora Ecuadorului", "AEST": "Ora standard a Australiei Orientale", "MEZ": "Ora standard a Europei Centrale", "LHDT": "Ora de vară din Lord Howe", "JST": "Ora standard a Japoniei", "EAT": "Ora Africii Orientale", "HNT": "Ora standard din Newfoundland", "GFT": "Ora din Guyana Franceză", "AKST": "Ora standard din Alaska", "ACDT": "Ora de vară a Australiei Centrale", "NZST": "Ora standard a Noii Zeelande", "BOT": "Ora Boliviei", "SRT": "Ora Surinamului", "WESZ": "Ora de vară a Europei de Vest", "PST": "Ora standard în zona Pacific nord-americană", "PDT": "Ora de vară în zona Pacific nord-americană", "CDT": "Ora de vară centrală nord-americană", "AEDT": "Ora de vară a Australiei Orientale", "VET": "Ora Venezuelei", "IST": "Ora Indiei", "ADT": "Ora de vară în zona Atlantic nord-americană", "ChST": "Ora din Chamorro", "OESZ": "Ora de vară a Europei de Est", "MESZ": "Ora de vară a Europei Centrale", "HADT": "Ora de vară din Hawaii-Aleutine", "WART": "Ora standard a Argentinei Occidentale", "HENOMX": "Ora de vară a Mexicului de nord-vest", "AST": "Ora standard în zona Atlantic nord-americană", "WEZ": "Ora standard a Europei de Vest", "ACWDT": "Ora de vară a Australiei Central Occidentale", "HKST": "Ora de vară din Hong Kong", "CAT": "Ora Africii Centrale", "HEPM": "Ora de vară din Saint-Pierre și Miquelon", "WIT": "Ora Indoneziei de Est", "HNOG": "Ora standard a Groenlandei occidentale", "SGT": "Ora din Singapore", "HECU": "Ora de vară a Cubei", "ACWST": "Ora standard a Australiei Central Occidentale", "HAST": "Ora standard din Hawaii-Aleutine", "OEZ": "Ora standard a Europei de Est", "HEEG": "Ora de vară a Groenlandei orientale", "COT": "Ora standard a Columbiei", "COST": "Ora de vară a Columbiei", "GMT": "Ora de Greenwhich", "HNPM": "Ora standard din Saint-Pierre și Miquelon", "UYT": "Ora standard a Uruguayului", "TMT": "Ora standard din Turkmenistan", "MDT": "Ora de vară în zona montană nord-americană", "HNEG": "Ora standard a Groenlandei orientale", "NZDT": "Ora de vară a Noii Zeelande", "SAST": "Ora Africii Meridionale", "WAST": "Ora de vară a Africii Occidentale", "WIB": "Ora Indoneziei de Vest", "HEOG": "Ora de vară a Groenlandei occidentale", "CST": "Ora standard centrală nord-americană", "HNNOMX": "Ora standard a Mexicului de nord-vest", "EST": "Ora standard orientală nord-americană", "HEPMX": "Ora de vară a zonei Pacific mexicane", "CHAST": "Ora standard din Chatham", "LHST": "Ora standard din Lord Howe", "MST": "Ora standard în zona montană nord-americană", "∅∅∅": "Ora de vară din Azore", "ARST": "Ora de vară a Argentinei", "HNPMX": "Ora standard a zonei Pacific mexicane", "AWDT": "Ora de vară a Australiei Occidentale", "TMST": "Ora de vară din Turkmenistan"},
82 // Locale returns the current translators string locale
83 func (ro *ro_RO) Locale() string {
87 // PluralsCardinal returns the list of cardinal plural rules associated with 'ro_RO'
88 func (ro *ro_RO) PluralsCardinal() []locales.PluralRule {
89 return ro.pluralsCardinal
92 // PluralsOrdinal returns the list of ordinal plural rules associated with 'ro_RO'
93 func (ro *ro_RO) PluralsOrdinal() []locales.PluralRule {
94 return ro.pluralsOrdinal
97 // PluralsRange returns the list of range plural rules associated with 'ro_RO'
98 func (ro *ro_RO) PluralsRange() []locales.PluralRule {
99 return ro.pluralsRange
102 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'ro_RO'
103 func (ro *ro_RO) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
107 nMod100 := math.Mod(n, 100)
109 if i == 1 && v == 0 {
110 return locales.PluralRuleOne
111 } else if (v != 0) || (n == 0) || (n != 1 && nMod100 >= 1 && nMod100 <= 19) {
112 return locales.PluralRuleFew
115 return locales.PluralRuleOther
118 // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'ro_RO'
119 func (ro *ro_RO) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
124 return locales.PluralRuleOne
127 return locales.PluralRuleOther
130 // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'ro_RO'
131 func (ro *ro_RO) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
133 start := ro.CardinalPluralRule(num1, v1)
134 end := ro.CardinalPluralRule(num2, v2)
136 if start == locales.PluralRuleOne && end == locales.PluralRuleFew {
137 return locales.PluralRuleFew
138 } else if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
139 return locales.PluralRuleOther
140 } else if start == locales.PluralRuleFew && end == locales.PluralRuleOne {
141 return locales.PluralRuleFew
142 } else if start == locales.PluralRuleFew && end == locales.PluralRuleFew {
143 return locales.PluralRuleFew
144 } else if start == locales.PluralRuleFew && end == locales.PluralRuleOther {
145 return locales.PluralRuleOther
146 } else if start == locales.PluralRuleOther && end == locales.PluralRuleFew {
147 return locales.PluralRuleFew
150 return locales.PluralRuleOther
154 // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
155 func (ro *ro_RO) MonthAbbreviated(month time.Month) string {
156 return ro.monthsAbbreviated[month]
159 // MonthsAbbreviated returns the locales abbreviated months
160 func (ro *ro_RO) MonthsAbbreviated() []string {
161 return ro.monthsAbbreviated[1:]
164 // MonthNarrow returns the locales narrow month given the 'month' provided
165 func (ro *ro_RO) MonthNarrow(month time.Month) string {
166 return ro.monthsNarrow[month]
169 // MonthsNarrow returns the locales narrow months
170 func (ro *ro_RO) MonthsNarrow() []string {
171 return ro.monthsNarrow[1:]
174 // MonthWide returns the locales wide month given the 'month' provided
175 func (ro *ro_RO) MonthWide(month time.Month) string {
176 return ro.monthsWide[month]
179 // MonthsWide returns the locales wide months
180 func (ro *ro_RO) MonthsWide() []string {
181 return ro.monthsWide[1:]
184 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
185 func (ro *ro_RO) WeekdayAbbreviated(weekday time.Weekday) string {
186 return ro.daysAbbreviated[weekday]
189 // WeekdaysAbbreviated returns the locales abbreviated weekdays
190 func (ro *ro_RO) WeekdaysAbbreviated() []string {
191 return ro.daysAbbreviated
194 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
195 func (ro *ro_RO) WeekdayNarrow(weekday time.Weekday) string {
196 return ro.daysNarrow[weekday]
199 // WeekdaysNarrow returns the locales narrow weekdays
200 func (ro *ro_RO) WeekdaysNarrow() []string {
204 // WeekdayShort returns the locales short weekday given the 'weekday' provided
205 func (ro *ro_RO) WeekdayShort(weekday time.Weekday) string {
206 return ro.daysShort[weekday]
209 // WeekdaysShort returns the locales short weekdays
210 func (ro *ro_RO) WeekdaysShort() []string {
214 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
215 func (ro *ro_RO) WeekdayWide(weekday time.Weekday) string {
216 return ro.daysWide[weekday]
219 // WeekdaysWide returns the locales wide weekdays
220 func (ro *ro_RO) WeekdaysWide() []string {
224 // Decimal returns the decimal point of number
225 func (ro *ro_RO) Decimal() string {
229 // Group returns the group of number
230 func (ro *ro_RO) Group() string {
234 // Group returns the minus sign of number
235 func (ro *ro_RO) Minus() string {
239 // FmtNumber returns 'num' with digits/precision of 'v' for 'ro_RO' and handles both Whole and Real numbers based on 'v'
240 func (ro *ro_RO) FmtNumber(num float64, v uint64) string {
242 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
243 l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
246 b := make([]byte, 0, l)
248 for i := len(s) - 1; i >= 0; i-- {
251 b = append(b, ro.decimal[0])
258 b = append(b, ro.group[0])
269 b = append(b, ro.minus[0])
273 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
274 b[i], b[j] = b[j], b[i]
280 // FmtPercent returns 'num' with digits/precision of 'v' for 'ro_RO' and handles both Whole and Real numbers based on 'v'
281 // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
282 func (ro *ro_RO) FmtPercent(num float64, v uint64) string {
283 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
285 b := make([]byte, 0, l)
287 for i := len(s) - 1; i >= 0; i-- {
290 b = append(b, ro.decimal[0])
298 b = append(b, ro.minus[0])
302 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
303 b[i], b[j] = b[j], b[i]
306 b = append(b, ro.percentSuffix...)
308 b = append(b, ro.percent...)
313 // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'ro_RO'
314 func (ro *ro_RO) FmtCurrency(num float64, v uint64, currency currency.Type) string {
316 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
317 symbol := ro.currencies[currency]
318 l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
321 b := make([]byte, 0, l)
323 for i := len(s) - 1; i >= 0; i-- {
326 b = append(b, ro.decimal[0])
333 b = append(b, ro.group[0])
344 b = append(b, ro.minus[0])
348 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
349 b[i], b[j] = b[j], b[i]
355 b = append(b, ro.decimal...)
358 for i := 0; i < 2-int(v); i++ {
363 b = append(b, ro.currencyPositiveSuffix...)
365 b = append(b, symbol...)
370 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ro_RO'
371 // in accounting notation.
372 func (ro *ro_RO) FmtAccounting(num float64, v uint64, currency currency.Type) string {
374 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
375 symbol := ro.currencies[currency]
376 l := len(s) + len(symbol) + 6 + 1*len(s[:len(s)-int(v)-1])/3
379 b := make([]byte, 0, l)
381 for i := len(s) - 1; i >= 0; i-- {
384 b = append(b, ro.decimal[0])
391 b = append(b, ro.group[0])
403 b = append(b, ro.currencyNegativePrefix[0])
408 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
409 b[i], b[j] = b[j], b[i]
415 b = append(b, ro.decimal...)
418 for i := 0; i < 2-int(v); i++ {
424 b = append(b, ro.currencyNegativeSuffix...)
425 b = append(b, symbol...)
428 b = append(b, ro.currencyPositiveSuffix...)
429 b = append(b, symbol...)
435 // FmtDateShort returns the short date representation of 't' for 'ro_RO'
436 func (ro *ro_RO) FmtDateShort(t time.Time) string {
438 b := make([]byte, 0, 32)
444 b = strconv.AppendInt(b, int64(t.Day()), 10)
445 b = append(b, []byte{0x2e}...)
451 b = strconv.AppendInt(b, int64(t.Month()), 10)
453 b = append(b, []byte{0x2e}...)
456 b = strconv.AppendInt(b, int64(t.Year()), 10)
458 b = strconv.AppendInt(b, int64(-t.Year()), 10)
464 // FmtDateMedium returns the medium date representation of 't' for 'ro_RO'
465 func (ro *ro_RO) FmtDateMedium(t time.Time) string {
467 b := make([]byte, 0, 32)
469 b = strconv.AppendInt(b, int64(t.Day()), 10)
470 b = append(b, []byte{0x20}...)
471 b = append(b, ro.monthsAbbreviated[t.Month()]...)
472 b = append(b, []byte{0x20}...)
475 b = strconv.AppendInt(b, int64(t.Year()), 10)
477 b = strconv.AppendInt(b, int64(-t.Year()), 10)
483 // FmtDateLong returns the long date representation of 't' for 'ro_RO'
484 func (ro *ro_RO) FmtDateLong(t time.Time) string {
486 b := make([]byte, 0, 32)
488 b = strconv.AppendInt(b, int64(t.Day()), 10)
489 b = append(b, []byte{0x20}...)
490 b = append(b, ro.monthsWide[t.Month()]...)
491 b = append(b, []byte{0x20}...)
494 b = strconv.AppendInt(b, int64(t.Year()), 10)
496 b = strconv.AppendInt(b, int64(-t.Year()), 10)
502 // FmtDateFull returns the full date representation of 't' for 'ro_RO'
503 func (ro *ro_RO) FmtDateFull(t time.Time) string {
505 b := make([]byte, 0, 32)
507 b = append(b, ro.daysWide[t.Weekday()]...)
508 b = append(b, []byte{0x2c, 0x20}...)
509 b = strconv.AppendInt(b, int64(t.Day()), 10)
510 b = append(b, []byte{0x20}...)
511 b = append(b, ro.monthsWide[t.Month()]...)
512 b = append(b, []byte{0x20}...)
515 b = strconv.AppendInt(b, int64(t.Year()), 10)
517 b = strconv.AppendInt(b, int64(-t.Year()), 10)
523 // FmtTimeShort returns the short time representation of 't' for 'ro_RO'
524 func (ro *ro_RO) FmtTimeShort(t time.Time) string {
526 b := make([]byte, 0, 32)
532 b = strconv.AppendInt(b, int64(t.Hour()), 10)
533 b = append(b, ro.timeSeparator...)
539 b = strconv.AppendInt(b, int64(t.Minute()), 10)
544 // FmtTimeMedium returns the medium time representation of 't' for 'ro_RO'
545 func (ro *ro_RO) FmtTimeMedium(t time.Time) string {
547 b := make([]byte, 0, 32)
553 b = strconv.AppendInt(b, int64(t.Hour()), 10)
554 b = append(b, ro.timeSeparator...)
560 b = strconv.AppendInt(b, int64(t.Minute()), 10)
561 b = append(b, ro.timeSeparator...)
567 b = strconv.AppendInt(b, int64(t.Second()), 10)
572 // FmtTimeLong returns the long time representation of 't' for 'ro_RO'
573 func (ro *ro_RO) FmtTimeLong(t time.Time) string {
575 b := make([]byte, 0, 32)
581 b = strconv.AppendInt(b, int64(t.Hour()), 10)
582 b = append(b, ro.timeSeparator...)
588 b = strconv.AppendInt(b, int64(t.Minute()), 10)
589 b = append(b, ro.timeSeparator...)
595 b = strconv.AppendInt(b, int64(t.Second()), 10)
596 b = append(b, []byte{0x20}...)
604 // FmtTimeFull returns the full time representation of 't' for 'ro_RO'
605 func (ro *ro_RO) FmtTimeFull(t time.Time) string {
607 b := make([]byte, 0, 32)
613 b = strconv.AppendInt(b, int64(t.Hour()), 10)
614 b = append(b, ro.timeSeparator...)
620 b = strconv.AppendInt(b, int64(t.Minute()), 10)
621 b = append(b, ro.timeSeparator...)
627 b = strconv.AppendInt(b, int64(t.Second()), 10)
628 b = append(b, []byte{0x20}...)
632 if btz, ok := ro.timezones[tz]; ok {
633 b = append(b, btz...)