ru_BY.go 23 KB

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