cu_RU.go 19 KB

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