ro_RO.go 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
  1. package ro_RO
  2. import (
  3. "math"
  4. "strconv"
  5. "time"
  6. "github.com/go-playground/locales"
  7. "github.com/go-playground/locales/currency"
  8. )
  9. type ro_RO 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. currencyNegativePrefix string
  25. currencyNegativeSuffix string
  26. monthsAbbreviated []string
  27. monthsNarrow []string
  28. monthsWide []string
  29. daysAbbreviated []string
  30. daysNarrow []string
  31. daysShort []string
  32. daysWide []string
  33. periodsAbbreviated []string
  34. periodsNarrow []string
  35. periodsShort []string
  36. periodsWide []string
  37. erasAbbreviated []string
  38. erasNarrow []string
  39. erasWide []string
  40. timezones map[string]string
  41. }
  42. // New returns a new instance of translator for the 'ro_RO' locale
  43. func New() locales.Translator {
  44. return &ro_RO{
  45. locale: "ro_RO",
  46. pluralsCardinal: []locales.PluralRule{2, 4, 6},
  47. pluralsOrdinal: []locales.PluralRule{2, 6},
  48. pluralsRange: []locales.PluralRule{4, 6},
  49. decimal: ",",
  50. group: ".",
  51. minus: "-",
  52. percent: "%",
  53. perMille: "‰",
  54. timeSeparator: ":",
  55. inifinity: "∞",
  56. 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 "},
  57. percentSuffix: " ",
  58. currencyPositiveSuffix: " ",
  59. currencyNegativePrefix: "(",
  60. currencyNegativeSuffix: " )",
  61. monthsAbbreviated: []string{"", "ian.", "feb.", "mar.", "apr.", "mai", "iun.", "iul.", "aug.", "sept.", "oct.", "nov.", "dec."},
  62. monthsNarrow: []string{"", "I", "F", "M", "A", "M", "I", "I", "A", "S", "O", "N", "D"},
  63. monthsWide: []string{"", "ianuarie", "februarie", "martie", "aprilie", "mai", "iunie", "iulie", "august", "septembrie", "octombrie", "noiembrie", "decembrie"},
  64. daysAbbreviated: []string{"dum.", "lun.", "mar.", "mie.", "joi", "vin.", "sâm."},
  65. daysNarrow: []string{"D", "L", "M", "M", "J", "V", "S"},
  66. daysShort: []string{"du.", "lu.", "ma.", "mi.", "jo.", "vi.", "sâ."},
  67. daysWide: []string{"duminică", "luni", "marți", "miercuri", "joi", "vineri", "sâmbătă"},
  68. periodsAbbreviated: []string{"a.m.", "p.m."},
  69. periodsNarrow: []string{"a.m.", "p.m."},
  70. periodsWide: []string{"a.m.", "p.m."},
  71. erasAbbreviated: []string{"î.Hr.", "d.Hr."},
  72. erasNarrow: []string{"", ""},
  73. erasWide: []string{"înainte de Hristos", "după Hristos"},
  74. timezones: map[string]string{"COST": "Ora de vară a Columbiei", "WITA": "Ora Indoneziei Centrale", "WIB": "Ora Indoneziei de Vest", "GFT": "Ora Guianei Franceze", "AWST": "Ora standard a Australiei Occidentale", "ACWDT": "Ora de vară a Australiei Central Occidentale", "BT": "Ora Bhutanului", "ACDT": "Ora de vară a Australiei Centrale", "JDT": "Ora de vară a Japoniei", "SRT": "Ora Surinamului", "ChST": "Ora din Chamorro", "MEZ": "Ora standard a Europei Centrale", "BOT": "Ora Boliviei", "VET": "Ora Venezuelei", "TMST": "Ora de vară din Turkmenistan", "NZDT": "Ora de vară a Noii Zeelande", "∅∅∅": "Ora de vară din Peru", "EDT": "Ora de vară orientală nord-americană", "CAT": "Ora Africii Centrale", "HKT": "Ora standard din Hong Kong", "WARST": "Ora de vară a Argentinei Occidentale", "GMT": "Ora de Greenwhich", "CHADT": "Ora de vară din Chatham", "AEDT": "Ora de vară a Australiei Orientale", "ACWST": "Ora standard a Australiei Central Occidentale", "AST": "Ora standard în zona Atlantic nord-americană", "SGT": "Ora din Singapore", "MST": "MST", "ACST": "Ora standard a Australiei Centrale", "PST": "Ora standard în zona Pacific nord-americană", "WAT": "Ora standard a Africii Occidentale", "WAST": "Ora de vară a Africii Occidentale", "HKST": "Ora de vară din Hong Kong", "AKST": "Ora standard din Alaska", "CST": "Ora standard centrală nord-americană", "CDT": "Ora de vară centrală nord-americană", "AEST": "Ora standard a Australiei Orientale", "HAST": "Ora standard din Hawaii-Aleutine", "WIT": "Ora Indoneziei de Est", "EAT": "Ora Africii Orientale", "MYT": "Ora din Malaysia", "CHAST": "Ora standard din Chatham", "LHDT": "Ora de vară din Lord Howe", "GYT": "Ora din Guyana", "CLST": "Ora de vară din Chile", "ADT": "Ora de vară în zona Atlantic nord-americană", "IST": "Ora Indiei", "MDT": "MDT", "ART": "Ora standard a Argentinei", "ARST": "Ora de vară a Argentinei", "EST": "Ora standard orientală nord-americană", "WART": "Ora standard a Argentinei Occidentale", "OEZ": "Ora standard a Europei de Est", "HNT": "Ora standard din Newfoundland", "LHST": "Ora standard din Lord Howe", "CLT": "Ora standard din Chile", "SAST": "Ora Africii Meridionale", "OESZ": "Ora de vară a Europei de Est", "AKDT": "Ora de vară din Alaska", "AWDT": "Ora de vară a Australiei Occidentale", "WEZ": "Ora standard a Europei de Vest", "HADT": "Ora de vară din Hawaii-Aleutine", "PDT": "Ora de vară în zona Pacific nord-americană", "UYST": "Ora de vară a Uruguayului", "COT": "Ora standard a Columbiei", "WESZ": "Ora de vară a Europei de Vest", "TMT": "Ora standard din Turkmenistan", "JST": "Ora standard a Japoniei", "MESZ": "Ora de vară a Europei Centrale", "NZST": "Ora standard a Noii Zeelande", "UYT": "Ora standard a Uruguayului", "HAT": "Ora de vară din Newfoundland", "ECT": "Ora Ecuadorului"},
  75. }
  76. }
  77. // Locale returns the current translators string locale
  78. func (ro *ro_RO) Locale() string {
  79. return ro.locale
  80. }
  81. // PluralsCardinal returns the list of cardinal plural rules associated with 'ro_RO'
  82. func (ro *ro_RO) PluralsCardinal() []locales.PluralRule {
  83. return ro.pluralsCardinal
  84. }
  85. // PluralsOrdinal returns the list of ordinal plural rules associated with 'ro_RO'
  86. func (ro *ro_RO) PluralsOrdinal() []locales.PluralRule {
  87. return ro.pluralsOrdinal
  88. }
  89. // PluralsRange returns the list of range plural rules associated with 'ro_RO'
  90. func (ro *ro_RO) PluralsRange() []locales.PluralRule {
  91. return ro.pluralsRange
  92. }
  93. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'ro_RO'
  94. func (ro *ro_RO) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
  95. n := math.Abs(num)
  96. i := int64(n)
  97. nMod100 := math.Mod(n, 100)
  98. if i == 1 && v == 0 {
  99. return locales.PluralRuleOne
  100. } else if (v != 0) || (n == 0) || (n != 1 && nMod100 >= 1 && nMod100 <= 19) {
  101. return locales.PluralRuleFew
  102. }
  103. return locales.PluralRuleOther
  104. }
  105. // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'ro_RO'
  106. func (ro *ro_RO) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
  107. n := math.Abs(num)
  108. if n == 1 {
  109. return locales.PluralRuleOne
  110. }
  111. return locales.PluralRuleOther
  112. }
  113. // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'ro_RO'
  114. func (ro *ro_RO) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
  115. start := ro.CardinalPluralRule(num1, v1)
  116. end := ro.CardinalPluralRule(num2, v2)
  117. if start == locales.PluralRuleOne && end == locales.PluralRuleFew {
  118. return locales.PluralRuleFew
  119. } else if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
  120. return locales.PluralRuleOther
  121. } else if start == locales.PluralRuleFew && end == locales.PluralRuleOne {
  122. return locales.PluralRuleFew
  123. } else if start == locales.PluralRuleFew && end == locales.PluralRuleFew {
  124. return locales.PluralRuleFew
  125. } else if start == locales.PluralRuleFew && end == locales.PluralRuleOther {
  126. return locales.PluralRuleOther
  127. } else if start == locales.PluralRuleOther && end == locales.PluralRuleFew {
  128. return locales.PluralRuleFew
  129. }
  130. return locales.PluralRuleOther
  131. }
  132. // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
  133. func (ro *ro_RO) MonthAbbreviated(month time.Month) string {
  134. return ro.monthsAbbreviated[month]
  135. }
  136. // MonthsAbbreviated returns the locales abbreviated months
  137. func (ro *ro_RO) MonthsAbbreviated() []string {
  138. return ro.monthsAbbreviated[1:]
  139. }
  140. // MonthNarrow returns the locales narrow month given the 'month' provided
  141. func (ro *ro_RO) MonthNarrow(month time.Month) string {
  142. return ro.monthsNarrow[month]
  143. }
  144. // MonthsNarrow returns the locales narrow months
  145. func (ro *ro_RO) MonthsNarrow() []string {
  146. return ro.monthsNarrow[1:]
  147. }
  148. // MonthWide returns the locales wide month given the 'month' provided
  149. func (ro *ro_RO) MonthWide(month time.Month) string {
  150. return ro.monthsWide[month]
  151. }
  152. // MonthsWide returns the locales wide months
  153. func (ro *ro_RO) MonthsWide() []string {
  154. return ro.monthsWide[1:]
  155. }
  156. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  157. func (ro *ro_RO) WeekdayAbbreviated(weekday time.Weekday) string {
  158. return ro.daysAbbreviated[weekday]
  159. }
  160. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  161. func (ro *ro_RO) WeekdaysAbbreviated() []string {
  162. return ro.daysAbbreviated
  163. }
  164. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  165. func (ro *ro_RO) WeekdayNarrow(weekday time.Weekday) string {
  166. return ro.daysNarrow[weekday]
  167. }
  168. // WeekdaysNarrow returns the locales narrow weekdays
  169. func (ro *ro_RO) WeekdaysNarrow() []string {
  170. return ro.daysNarrow
  171. }
  172. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  173. func (ro *ro_RO) WeekdayShort(weekday time.Weekday) string {
  174. return ro.daysShort[weekday]
  175. }
  176. // WeekdaysShort returns the locales short weekdays
  177. func (ro *ro_RO) WeekdaysShort() []string {
  178. return ro.daysShort
  179. }
  180. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  181. func (ro *ro_RO) WeekdayWide(weekday time.Weekday) string {
  182. return ro.daysWide[weekday]
  183. }
  184. // WeekdaysWide returns the locales wide weekdays
  185. func (ro *ro_RO) WeekdaysWide() []string {
  186. return ro.daysWide
  187. }
  188. // FmtNumber returns 'num' with digits/precision of 'v' for 'ro_RO' and handles both Whole and Real numbers based on 'v'
  189. func (ro *ro_RO) FmtNumber(num float64, v uint64) string {
  190. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  191. l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
  192. count := 0
  193. inWhole := v == 0
  194. b := make([]byte, 0, l)
  195. for i := len(s) - 1; i >= 0; i-- {
  196. if s[i] == '.' {
  197. b = append(b, ro.decimal[0])
  198. inWhole = true
  199. continue
  200. }
  201. if inWhole {
  202. if count == 3 {
  203. b = append(b, ro.group[0])
  204. count = 1
  205. } else {
  206. count++
  207. }
  208. }
  209. b = append(b, s[i])
  210. }
  211. if num < 0 {
  212. b = append(b, ro.minus[0])
  213. }
  214. // reverse
  215. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  216. b[i], b[j] = b[j], b[i]
  217. }
  218. return string(b)
  219. }
  220. // FmtPercent returns 'num' with digits/precision of 'v' for 'ro_RO' and handles both Whole and Real numbers based on 'v'
  221. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
  222. func (ro *ro_RO) FmtPercent(num float64, v uint64) string {
  223. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  224. l := len(s) + 5
  225. b := make([]byte, 0, l)
  226. for i := len(s) - 1; i >= 0; i-- {
  227. if s[i] == '.' {
  228. b = append(b, ro.decimal[0])
  229. continue
  230. }
  231. b = append(b, s[i])
  232. }
  233. if num < 0 {
  234. b = append(b, ro.minus[0])
  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. b = append(b, ro.percentSuffix...)
  241. b = append(b, ro.percent...)
  242. return string(b)
  243. }
  244. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'ro_RO'
  245. func (ro *ro_RO) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  246. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  247. symbol := ro.currencies[currency]
  248. l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
  249. count := 0
  250. inWhole := v == 0
  251. b := make([]byte, 0, l)
  252. for i := len(s) - 1; i >= 0; i-- {
  253. if s[i] == '.' {
  254. b = append(b, ro.decimal[0])
  255. inWhole = true
  256. continue
  257. }
  258. if inWhole {
  259. if count == 3 {
  260. b = append(b, ro.group[0])
  261. count = 1
  262. } else {
  263. count++
  264. }
  265. }
  266. b = append(b, s[i])
  267. }
  268. if num < 0 {
  269. b = append(b, ro.minus[0])
  270. }
  271. // reverse
  272. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  273. b[i], b[j] = b[j], b[i]
  274. }
  275. if int(v) < 2 {
  276. if v == 0 {
  277. b = append(b, ro.decimal...)
  278. }
  279. for i := 0; i < 2-int(v); i++ {
  280. b = append(b, '0')
  281. }
  282. }
  283. b = append(b, ro.currencyPositiveSuffix...)
  284. b = append(b, symbol...)
  285. return string(b)
  286. }
  287. // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ro_RO'
  288. // in accounting notation.
  289. func (ro *ro_RO) FmtAccounting(num float64, v uint64, currency currency.Type) string {
  290. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  291. symbol := ro.currencies[currency]
  292. l := len(s) + len(symbol) + 6 + 1*len(s[:len(s)-int(v)-1])/3
  293. count := 0
  294. inWhole := v == 0
  295. b := make([]byte, 0, l)
  296. for i := len(s) - 1; i >= 0; i-- {
  297. if s[i] == '.' {
  298. b = append(b, ro.decimal[0])
  299. inWhole = true
  300. continue
  301. }
  302. if inWhole {
  303. if count == 3 {
  304. b = append(b, ro.group[0])
  305. count = 1
  306. } else {
  307. count++
  308. }
  309. }
  310. b = append(b, s[i])
  311. }
  312. if num < 0 {
  313. b = append(b, ro.currencyNegativePrefix[0])
  314. }
  315. // reverse
  316. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  317. b[i], b[j] = b[j], b[i]
  318. }
  319. if int(v) < 2 {
  320. if v == 0 {
  321. b = append(b, ro.decimal...)
  322. }
  323. for i := 0; i < 2-int(v); i++ {
  324. b = append(b, '0')
  325. }
  326. }
  327. if num < 0 {
  328. b = append(b, ro.currencyNegativeSuffix...)
  329. b = append(b, symbol...)
  330. } else {
  331. b = append(b, ro.currencyPositiveSuffix...)
  332. b = append(b, symbol...)
  333. }
  334. return string(b)
  335. }
  336. // FmtDateShort returns the short date representation of 't' for 'ro_RO'
  337. func (ro *ro_RO) FmtDateShort(t time.Time) string {
  338. b := make([]byte, 0, 32)
  339. if t.Day() < 10 {
  340. b = append(b, '0')
  341. }
  342. b = strconv.AppendInt(b, int64(t.Day()), 10)
  343. b = append(b, []byte{0x2e}...)
  344. if t.Month() < 10 {
  345. b = append(b, '0')
  346. }
  347. b = strconv.AppendInt(b, int64(t.Month()), 10)
  348. b = append(b, []byte{0x2e}...)
  349. b = strconv.AppendInt(b, int64(t.Year()), 10)
  350. return string(b)
  351. }
  352. // FmtDateMedium returns the medium date representation of 't' for 'ro_RO'
  353. func (ro *ro_RO) FmtDateMedium(t time.Time) string {
  354. b := make([]byte, 0, 32)
  355. b = strconv.AppendInt(b, int64(t.Day()), 10)
  356. b = append(b, []byte{0x20}...)
  357. b = append(b, ro.monthsAbbreviated[t.Month()]...)
  358. b = append(b, []byte{0x20}...)
  359. b = strconv.AppendInt(b, int64(t.Year()), 10)
  360. return string(b)
  361. }
  362. // FmtDateLong returns the long date representation of 't' for 'ro_RO'
  363. func (ro *ro_RO) FmtDateLong(t time.Time) string {
  364. b := make([]byte, 0, 32)
  365. b = strconv.AppendInt(b, int64(t.Day()), 10)
  366. b = append(b, []byte{0x20}...)
  367. b = append(b, ro.monthsWide[t.Month()]...)
  368. b = append(b, []byte{0x20}...)
  369. b = strconv.AppendInt(b, int64(t.Year()), 10)
  370. return string(b)
  371. }
  372. // FmtDateFull returns the full date representation of 't' for 'ro_RO'
  373. func (ro *ro_RO) FmtDateFull(t time.Time) string {
  374. b := make([]byte, 0, 32)
  375. b = append(b, ro.daysWide[t.Weekday()]...)
  376. b = append(b, []byte{0x2c, 0x20}...)
  377. b = strconv.AppendInt(b, int64(t.Day()), 10)
  378. b = append(b, []byte{0x20}...)
  379. b = append(b, ro.monthsWide[t.Month()]...)
  380. b = append(b, []byte{0x20}...)
  381. b = strconv.AppendInt(b, int64(t.Year()), 10)
  382. return string(b)
  383. }
  384. // FmtTimeShort returns the short time representation of 't' for 'ro_RO'
  385. func (ro *ro_RO) FmtTimeShort(t time.Time) string {
  386. b := make([]byte, 0, 32)
  387. if t.Hour() < 10 {
  388. b = append(b, '0')
  389. }
  390. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  391. b = append(b, ro.timeSeparator...)
  392. if t.Minute() < 10 {
  393. b = append(b, '0')
  394. }
  395. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  396. return string(b)
  397. }
  398. // FmtTimeMedium returns the medium time representation of 't' for 'ro_RO'
  399. func (ro *ro_RO) FmtTimeMedium(t time.Time) string {
  400. b := make([]byte, 0, 32)
  401. if t.Hour() < 10 {
  402. b = append(b, '0')
  403. }
  404. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  405. b = append(b, ro.timeSeparator...)
  406. if t.Minute() < 10 {
  407. b = append(b, '0')
  408. }
  409. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  410. b = append(b, ro.timeSeparator...)
  411. if t.Second() < 10 {
  412. b = append(b, '0')
  413. }
  414. b = strconv.AppendInt(b, int64(t.Second()), 10)
  415. return string(b)
  416. }
  417. // FmtTimeLong returns the long time representation of 't' for 'ro_RO'
  418. func (ro *ro_RO) FmtTimeLong(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, ro.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, ro.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. b = append(b, tz...)
  437. return string(b)
  438. }
  439. // FmtTimeFull returns the full time representation of 't' for 'ro_RO'
  440. func (ro *ro_RO) FmtTimeFull(t time.Time) string {
  441. b := make([]byte, 0, 32)
  442. if t.Hour() < 10 {
  443. b = append(b, '0')
  444. }
  445. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  446. b = append(b, ro.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, ro.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. if btz, ok := ro.timezones[tz]; ok {
  459. b = append(b, btz...)
  460. } else {
  461. b = append(b, tz...)
  462. }
  463. return string(b)
  464. }