1package ce_RU 2 3import ( 4 "math" 5 "strconv" 6 "time" 7 8 "github.com/go-playground/locales" 9 "github.com/go-playground/locales/currency" 10) 11 12type ce_RU struct { 13 locale string 14 pluralsCardinal []locales.PluralRule 15 pluralsOrdinal []locales.PluralRule 16 pluralsRange []locales.PluralRule 17 decimal string 18 group string 19 minus string 20 percent string 21 percentSuffix string 22 perMille string 23 timeSeparator string 24 inifinity string 25 currencies []string // idx = enum of currency code 26 currencyPositiveSuffix string 27 currencyNegativeSuffix string 28 monthsAbbreviated []string 29 monthsNarrow []string 30 monthsWide []string 31 daysAbbreviated []string 32 daysNarrow []string 33 daysShort []string 34 daysWide []string 35 periodsAbbreviated []string 36 periodsNarrow []string 37 periodsShort []string 38 periodsWide []string 39 erasAbbreviated []string 40 erasNarrow []string 41 erasWide []string 42 timezones map[string]string 43} 44 45// New returns a new instance of translator for the 'ce_RU' locale 46func New() locales.Translator { 47 return &ce_RU{ 48 locale: "ce_RU", 49 pluralsCardinal: []locales.PluralRule{2, 6}, 50 pluralsOrdinal: []locales.PluralRule{6}, 51 pluralsRange: nil, 52 decimal: ".", 53 group: ",", 54 minus: "-", 55 percent: "%", 56 perMille: "‰", 57 timeSeparator: ":", 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", "CNH", "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", "STN", "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 percentSuffix: " ", 60 currencyPositiveSuffix: " ", 61 currencyNegativeSuffix: " ", 62 monthsAbbreviated: []string{"", "янв", "фев", "мар", "апр", "май", "июн", "июл", "авг", "сен", "окт", "ноя", "дек"}, 63 monthsNarrow: []string{"", "Я", "Ф", "М", "А", "М", "И", "И", "А", "С", "О", "Н", "Д"}, 64 monthsWide: []string{"", "январь", "февраль", "март", "апрель", "май", "июнь", "июль", "август", "сентябрь", "октябрь", "ноябрь", "декабрь"}, 65 daysAbbreviated: []string{"кӀи", "ор", "ши", "кха", "еа", "пӀе", "шуо"}, 66 daysNarrow: []string{"кӀи", "ор", "ши", "кха", "еа", "пӀе", "шуо"}, 67 daysShort: []string{"кӀи", "ор", "ши", "кха", "еа", "пӀе", "шуо"}, 68 daysWide: []string{"кӀира", "оршот", "шинара", "кхаара", "еара", "пӀераска", "шуот"}, 69 erasAbbreviated: []string{"в. э. тӀ. я", "в. э"}, 70 erasNarrow: []string{"", ""}, 71 erasWide: []string{"Ӏийса пайхамар вина де кхачале", "Ӏийса пайхамар вина дийнахь дуьйна"}, 72 timezones: map[string]string{"WAST": "Малхбузен Африка, аьхкенан хан", "BOT": "Боливи", "MESZ": "Юккъера Европа, аьхкенан хан", "EAT": "Малхбален Африка", "ChST": "Чаморро", "PST": "Тийна океанан стандартан хан", "AEST": "Малхбален Австрали, стандартан хан", "WEZ": "Малхбузен Европа, стандартан хан", "ECT": "Эквадор", "ACWDT": "Юккъера Австрали, малхбузен аьхкенан хан", "HNEG": "Малхбален Гренланди, стандартан хан", "TMT": "Туркменин стандартан хан", "ART": "Аргентина, стандартан хан", "HECU": "Куба, аьхкенан хан", "WART": "Малхбузен Аргентина, стандартан хан", "COST": "Колумби, аьхкенан хан", "MDT": "Лаьмнийн аьхкенан хан (АЦШ)", "SAST": "Къилба Африка", "HKST": "Гонконг, аьхкенан хан", "HNPM": "Сен-Пьер а, Микелон а, стандартан хан", "WAT": "Малхбузен Африка, стандартан хан", "JST": "Япони, стандартан хан", "AKST": "Аляска, стандартан хан", "ACDT": "Юккъера Австрали, аьхкенан хан", "IST": "Инди", "AST": "Атлантикан стандартан хан", "ADT": "Атлантикан аьхкенан хан", "NZST": "Керла Зеланди, стандартан хан", "MYT": "Малайзи", "HAT": "Ньюфаундленд, аьхкенан хан", "VET": "Венесуэла", "COT": "Колумби, стандартан хан", "MST": "Лаьмнийн стандартан хан (АЦШ)", "BT": "Бутан", "∅∅∅": "Амазонка, аьхкенан хан", "EDT": "Малхбален Америка, аьхкенан хан", "HNCU": "Куба, стандартан хан", "CDT": "Юккъера Америка, аьхкенан хан", "AKDT": "Аляска, аьхкенан хан", "ACST": "Юккъера Австрали, стандартан хан", "HEPM": "Сен-Пьер а, Микелон а, аьхкенан хан", "CLT": "Чили, стандартан хан", "HAST": "Гавайн-алеутийн стандартан хан", "CHADT": "Чатем, аьхкенан хан", "GFT": "Французийн Гвиана", "SGT": "Сингапур", "HEEG": "Малхбален Гренланди, аьхкенан хан", "HEOG": "Малхбузен Гренланди, аьхкенан хан", "MEZ": "Юккъера Европа, стандартан хан", "AWDT": "Малхбузен Австрали, аьхкенан хан", "WESZ": "Малхбузен Европа, аьхкенан хан", "WIB": "Малхбузен Индонези", "HNNOMX": "Къилбаседа Американ Мексикан стандартан хан", "EST": "Малхбален Америка, стандартан хан", "HENOMX": "Къилбаседа Американ Мексикан аьхкенан хан", "SRT": "Суринам", "GMT": "Гринвичица юкъара хан", "CST": "Юккъера Америка, стандартан хан", "PDT": "Тийна океанан аьхкенан хан", "HNPMX": "Тийна океанан Мексикан стандартан хан", "WARST": "Малхбузен Аргентина, аьхкенан хан", "HADT": "Гавайн-алеутийн аьхкенан хан", "ARST": "Аргентина, аьхкенан хан", "CHAST": "Чатем, стандартан хан", "HNOG": "Малхбузен Гренланди, стандартан хан", "HKT": "Гонконг, стандартан хан", "WITA": "Юккъера Индонези", "GYT": "Гайана", "UYST": "Уругвай, аьхкенан хан", "HEPMX": "Тийна океанан Мексикан аьхкенан хан", "AWST": "Малхбузен Австрали, стандартан хан", "AEDT": "Малхбален Австрали, аьхкенан хан", "NZDT": "Керла Зеланди, аьхкенан хан", "ACWST": "Юккъера Австрали, малхбузен стандартан хан", "CLST": "Чили, аьхкенан хан", "WIT": "Малхбален Индонези", "UYT": "Уругвай, стандартан хан", "HNT": "Ньюфаундленд, стандартан хан", "TMST": "Туркменин аьхкенан хан", "OEZ": "Малхбален Европа, стандартан хан", "OESZ": "Малхбален Европа, аьхкенан хан", "LHDT": "Лорд-Хау, аьхкенан хан", "CAT": "Юккъера Африка", "JDT": "Япони, аьхкенан хан", "LHST": "Лорд-Хау, стандартан хан"}, 73 } 74} 75 76// Locale returns the current translators string locale 77func (ce *ce_RU) Locale() string { 78 return ce.locale 79} 80 81// PluralsCardinal returns the list of cardinal plural rules associated with 'ce_RU' 82func (ce *ce_RU) PluralsCardinal() []locales.PluralRule { 83 return ce.pluralsCardinal 84} 85 86// PluralsOrdinal returns the list of ordinal plural rules associated with 'ce_RU' 87func (ce *ce_RU) PluralsOrdinal() []locales.PluralRule { 88 return ce.pluralsOrdinal 89} 90 91// PluralsRange returns the list of range plural rules associated with 'ce_RU' 92func (ce *ce_RU) PluralsRange() []locales.PluralRule { 93 return ce.pluralsRange 94} 95 96// CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'ce_RU' 97func (ce *ce_RU) CardinalPluralRule(num float64, v uint64) locales.PluralRule { 98 99 n := math.Abs(num) 100 101 if n == 1 { 102 return locales.PluralRuleOne 103 } 104 105 return locales.PluralRuleOther 106} 107 108// OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'ce_RU' 109func (ce *ce_RU) OrdinalPluralRule(num float64, v uint64) locales.PluralRule { 110 return locales.PluralRuleOther 111} 112 113// RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'ce_RU' 114func (ce *ce_RU) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule { 115 return locales.PluralRuleUnknown 116} 117 118// MonthAbbreviated returns the locales abbreviated month given the 'month' provided 119func (ce *ce_RU) MonthAbbreviated(month time.Month) string { 120 return ce.monthsAbbreviated[month] 121} 122 123// MonthsAbbreviated returns the locales abbreviated months 124func (ce *ce_RU) MonthsAbbreviated() []string { 125 return ce.monthsAbbreviated[1:] 126} 127 128// MonthNarrow returns the locales narrow month given the 'month' provided 129func (ce *ce_RU) MonthNarrow(month time.Month) string { 130 return ce.monthsNarrow[month] 131} 132 133// MonthsNarrow returns the locales narrow months 134func (ce *ce_RU) MonthsNarrow() []string { 135 return ce.monthsNarrow[1:] 136} 137 138// MonthWide returns the locales wide month given the 'month' provided 139func (ce *ce_RU) MonthWide(month time.Month) string { 140 return ce.monthsWide[month] 141} 142 143// MonthsWide returns the locales wide months 144func (ce *ce_RU) MonthsWide() []string { 145 return ce.monthsWide[1:] 146} 147 148// WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided 149func (ce *ce_RU) WeekdayAbbreviated(weekday time.Weekday) string { 150 return ce.daysAbbreviated[weekday] 151} 152 153// WeekdaysAbbreviated returns the locales abbreviated weekdays 154func (ce *ce_RU) WeekdaysAbbreviated() []string { 155 return ce.daysAbbreviated 156} 157 158// WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided 159func (ce *ce_RU) WeekdayNarrow(weekday time.Weekday) string { 160 return ce.daysNarrow[weekday] 161} 162 163// WeekdaysNarrow returns the locales narrow weekdays 164func (ce *ce_RU) WeekdaysNarrow() []string { 165 return ce.daysNarrow 166} 167 168// WeekdayShort returns the locales short weekday given the 'weekday' provided 169func (ce *ce_RU) WeekdayShort(weekday time.Weekday) string { 170 return ce.daysShort[weekday] 171} 172 173// WeekdaysShort returns the locales short weekdays 174func (ce *ce_RU) WeekdaysShort() []string { 175 return ce.daysShort 176} 177 178// WeekdayWide returns the locales wide weekday given the 'weekday' provided 179func (ce *ce_RU) WeekdayWide(weekday time.Weekday) string { 180 return ce.daysWide[weekday] 181} 182 183// WeekdaysWide returns the locales wide weekdays 184func (ce *ce_RU) WeekdaysWide() []string { 185 return ce.daysWide 186} 187 188// Decimal returns the decimal point of number 189func (ce *ce_RU) Decimal() string { 190 return ce.decimal 191} 192 193// Group returns the group of number 194func (ce *ce_RU) Group() string { 195 return ce.group 196} 197 198// Group returns the minus sign of number 199func (ce *ce_RU) Minus() string { 200 return ce.minus 201} 202 203// FmtNumber returns 'num' with digits/precision of 'v' for 'ce_RU' and handles both Whole and Real numbers based on 'v' 204func (ce *ce_RU) FmtNumber(num float64, v uint64) string { 205 206 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64) 207 l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3 208 count := 0 209 inWhole := v == 0 210 b := make([]byte, 0, l) 211 212 for i := len(s) - 1; i >= 0; i-- { 213 214 if s[i] == '.' { 215 b = append(b, ce.decimal[0]) 216 inWhole = true 217 continue 218 } 219 220 if inWhole { 221 if count == 3 { 222 b = append(b, ce.group[0]) 223 count = 1 224 } else { 225 count++ 226 } 227 } 228 229 b = append(b, s[i]) 230 } 231 232 if num < 0 { 233 b = append(b, ce.minus[0]) 234 } 235 236 // reverse 237 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 { 238 b[i], b[j] = b[j], b[i] 239 } 240 241 return string(b) 242} 243 244// FmtPercent returns 'num' with digits/precision of 'v' for 'ce_RU' and handles both Whole and Real numbers based on 'v' 245// NOTE: 'num' passed into FmtPercent is assumed to be in percent already 246func (ce *ce_RU) FmtPercent(num float64, v uint64) string { 247 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64) 248 l := len(s) + 5 249 b := make([]byte, 0, l) 250 251 for i := len(s) - 1; i >= 0; i-- { 252 253 if s[i] == '.' { 254 b = append(b, ce.decimal[0]) 255 continue 256 } 257 258 b = append(b, s[i]) 259 } 260 261 if num < 0 { 262 b = append(b, ce.minus[0]) 263 } 264 265 // reverse 266 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 { 267 b[i], b[j] = b[j], b[i] 268 } 269 270 b = append(b, ce.percentSuffix...) 271 272 b = append(b, ce.percent...) 273 274 return string(b) 275} 276 277// FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'ce_RU' 278func (ce *ce_RU) FmtCurrency(num float64, v uint64, currency currency.Type) string { 279 280 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64) 281 symbol := ce.currencies[currency] 282 l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3 283 count := 0 284 inWhole := v == 0 285 b := make([]byte, 0, l) 286 287 for i := len(s) - 1; i >= 0; i-- { 288 289 if s[i] == '.' { 290 b = append(b, ce.decimal[0]) 291 inWhole = true 292 continue 293 } 294 295 if inWhole { 296 if count == 3 { 297 b = append(b, ce.group[0]) 298 count = 1 299 } else { 300 count++ 301 } 302 } 303 304 b = append(b, s[i]) 305 } 306 307 if num < 0 { 308 b = append(b, ce.minus[0]) 309 } 310 311 // reverse 312 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 { 313 b[i], b[j] = b[j], b[i] 314 } 315 316 if int(v) < 2 { 317 318 if v == 0 { 319 b = append(b, ce.decimal...) 320 } 321 322 for i := 0; i < 2-int(v); i++ { 323 b = append(b, '0') 324 } 325 } 326 327 b = append(b, ce.currencyPositiveSuffix...) 328 329 b = append(b, symbol...) 330 331 return string(b) 332} 333 334// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ce_RU' 335// in accounting notation. 336func (ce *ce_RU) FmtAccounting(num float64, v uint64, currency currency.Type) string { 337 338 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64) 339 symbol := ce.currencies[currency] 340 l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3 341 count := 0 342 inWhole := v == 0 343 b := make([]byte, 0, l) 344 345 for i := len(s) - 1; i >= 0; i-- { 346 347 if s[i] == '.' { 348 b = append(b, ce.decimal[0]) 349 inWhole = true 350 continue 351 } 352 353 if inWhole { 354 if count == 3 { 355 b = append(b, ce.group[0]) 356 count = 1 357 } else { 358 count++ 359 } 360 } 361 362 b = append(b, s[i]) 363 } 364 365 if num < 0 { 366 367 b = append(b, ce.minus[0]) 368 369 } 370 371 // reverse 372 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 { 373 b[i], b[j] = b[j], b[i] 374 } 375 376 if int(v) < 2 { 377 378 if v == 0 { 379 b = append(b, ce.decimal...) 380 } 381 382 for i := 0; i < 2-int(v); i++ { 383 b = append(b, '0') 384 } 385 } 386 387 if num < 0 { 388 b = append(b, ce.currencyNegativeSuffix...) 389 b = append(b, symbol...) 390 } else { 391 392 b = append(b, ce.currencyPositiveSuffix...) 393 b = append(b, symbol...) 394 } 395 396 return string(b) 397} 398 399// FmtDateShort returns the short date representation of 't' for 'ce_RU' 400func (ce *ce_RU) FmtDateShort(t time.Time) string { 401 402 b := make([]byte, 0, 32) 403 404 return string(b) 405} 406 407// FmtDateMedium returns the medium date representation of 't' for 'ce_RU' 408func (ce *ce_RU) FmtDateMedium(t time.Time) string { 409 410 b := make([]byte, 0, 32) 411 412 return string(b) 413} 414 415// FmtDateLong returns the long date representation of 't' for 'ce_RU' 416func (ce *ce_RU) FmtDateLong(t time.Time) string { 417 418 b := make([]byte, 0, 32) 419 420 return string(b) 421} 422 423// FmtDateFull returns the full date representation of 't' for 'ce_RU' 424func (ce *ce_RU) FmtDateFull(t time.Time) string { 425 426 b := make([]byte, 0, 32) 427 428 return string(b) 429} 430 431// FmtTimeShort returns the short time representation of 't' for 'ce_RU' 432func (ce *ce_RU) FmtTimeShort(t time.Time) string { 433 434 b := make([]byte, 0, 32) 435 436 return string(b) 437} 438 439// FmtTimeMedium returns the medium time representation of 't' for 'ce_RU' 440func (ce *ce_RU) FmtTimeMedium(t time.Time) string { 441 442 b := make([]byte, 0, 32) 443 444 return string(b) 445} 446 447// FmtTimeLong returns the long time representation of 't' for 'ce_RU' 448func (ce *ce_RU) FmtTimeLong(t time.Time) string { 449 450 b := make([]byte, 0, 32) 451 452 return string(b) 453} 454 455// FmtTimeFull returns the full time representation of 't' for 'ce_RU' 456func (ce *ce_RU) FmtTimeFull(t time.Time) string { 457 458 b := make([]byte, 0, 32) 459 460 return string(b) 461} 462