pt_CV.go 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595
  1. package pt_CV
  2. import (
  3. "math"
  4. "strconv"
  5. "time"
  6. "github.com/go-playground/locales"
  7. "github.com/go-playground/locales/currency"
  8. )
  9. type pt_CV 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. perMille string
  19. timeSeparator string
  20. inifinity string
  21. currencies []string // idx = enum of currency code
  22. currencyNegativePrefix string
  23. currencyNegativeSuffix string
  24. monthsAbbreviated []string
  25. monthsNarrow []string
  26. monthsWide []string
  27. daysAbbreviated []string
  28. daysNarrow []string
  29. daysShort []string
  30. daysWide []string
  31. periodsAbbreviated []string
  32. periodsNarrow []string
  33. periodsShort []string
  34. periodsWide []string
  35. erasAbbreviated []string
  36. erasNarrow []string
  37. erasWide []string
  38. timezones map[string]string
  39. }
  40. // New returns a new instance of translator for the 'pt_CV' locale
  41. func New() locales.Translator {
  42. return &pt_CV{
  43. locale: "pt_CV",
  44. pluralsCardinal: []locales.PluralRule{2, 6},
  45. pluralsOrdinal: []locales.PluralRule{6},
  46. pluralsRange: []locales.PluralRule{6, 2},
  47. decimal: ",",
  48. group: ".",
  49. minus: "-",
  50. percent: "%",
  51. perMille: "‰",
  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 ", "\u200b", "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 ", "\u200bPTE", "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. currencyNegativePrefix: "(",
  56. currencyNegativeSuffix: ")",
  57. monthsAbbreviated: []string{"", "jan", "fev", "mar", "abr", "mai", "jun", "jul", "ago", "set", "out", "nov", "dez"},
  58. monthsNarrow: []string{"", "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"},
  59. monthsWide: []string{"", "janeiro", "fevereiro", "março", "abril", "maio", "junho", "julho", "agosto", "setembro", "outubro", "novembro", "dezembro"},
  60. daysAbbreviated: []string{"dom", "seg", "ter", "qua", "qui", "sex", "sáb"},
  61. daysNarrow: []string{"D", "S", "T", "Q", "Q", "S", "S"},
  62. daysShort: []string{"dom", "seg", "ter", "qua", "qui", "sex", "sáb"},
  63. daysWide: []string{"domingo", "segunda-feira", "terça-feira", "quarta-feira", "quinta-feira", "sexta-feira", "sábado"},
  64. periodsAbbreviated: []string{"AM", "PM"},
  65. periodsNarrow: []string{"a", "p"},
  66. periodsWide: []string{"AM", "PM"},
  67. erasAbbreviated: []string{"a.C.", "d.C."},
  68. erasNarrow: []string{"", ""},
  69. erasWide: []string{"antes de Cristo", "depois de Cristo"},
  70. timezones: map[string]string{"WEZ": "Horário Padrão da Europa Ocidental", "COT": "Horário Padrão da Colômbia", "ACST": "Horário Padrão da Austrália Central", "CAT": "Horário da África Central", "MST": "Horário Padrão de Macau", "NZST": "Horário Padrão da Nova Zelândia", "CLST": "Horário de Verão do Chile", "OESZ": "Horário de Verão da Europa Oriental", "GFT": "Horário da Guiana Francesa", "ChST": "Horário de Chamorro", "AST": "Horário Padrão do Atlântico", "WAT": "Horário Padrão da África Ocidental", "JST": "Horário Padrão do Japão", "MESZ": "Horário de Verão da Europa Central", "TMST": "Horário de Verão do Turcomenistão", "OEZ": "Horário Padrão da Europa Oriental", "GMT": "Horário do Meridiano de Greenwich", "CLT": "Horário Padrão do Chile", "CHAST": "Horário Padrão de Chatham", "SGT": "Horário Padrão de Cingapura", "WIB": "Horário da Indonésia Ocidental", "CST": "Horário Padrão Central", "PDT": "Horário de Verão do Pacífico", "CDT": "Horário de Verão Central", "NZDT": "Horário de Verão da Nova Zelândia", "ADT": "Horário de Verão do Atlântico", "EAT": "Horário da África Oriental", "ART": "Horário Padrão da Argentina", "MYT": "Horário da Malásia", "EDT": "Horário de Verão Oriental", "COST": "Horário de Verão da Colômbia", "SAST": "Horário da África do Sul", "WAST": "Horário de Verão da África Ocidental", "HKST": "Horário de Verão de Hong Kong", "AKST": "Horário Padrão do Alasca", "PST": "Horário Padrão do Pacífico", "ACWDT": "Horário de Verão da Austrália Centro-Ocidental", "CHADT": "Horário de Verão de Chatham", "EST": "Horário Padrão Oriental", "HADT": "Horário de Verão do Havaí e Ilhas Aleutas", "ACDT": "Horário de Verão da Austrália Central", "GYT": "Horário da Guiana", "AWDT": "Horário de Verão da Austrália Ocidental", "AEST": "Horário Padrão da Austrália Oriental", "AEDT": "Horário de Verão da Austrália Oriental", "HAT": "Horário de Verão de Terra Nova", "AKDT": "Horário de Verão do Alasca", "SRT": "Horário do Suriname", "ECT": "Horário do Equador", "HAST": "Horário Padrão do Havaí e Ilhas Aleutas", "ARST": "Horário de Verão da Argentina", "TMT": "Horário Padrão do Turcomenistão", "BOT": "Horário da Bolívia", "VET": "Horário da Venezuela", "WARST": "Horário de Verão da Argentina Ocidental", "LHDT": "Horário de Verão de Lord Howe", "MEZ": "Horário Padrão da Europa Central", "LHST": "Horário Padrão de Lord Howe", "UYT": "Horário Padrão do Uruguai", "WESZ": "Horário de Verão da Europa Ocidental", "ACWST": "Horário Padrão da Austrália Centro-Ocidental", "WART": "Horário Padrão da Argentina Ocidental", "WIT": "Horário da Indonésia Oriental", "AWST": "Horário Padrão da Austrália Ocidental", "WITA": "Horário da Indonésia Central", "MDT": "Horário de Verão de Macau", "∅∅∅": "Horário de Verão do Amazonas", "UYST": "Horário de Verão do Uruguai", "BT": "Horário do Butão", "IST": "Horário Padrão da Índia", "HNT": "Horário Padrão de Terra Nova", "JDT": "Horário de Verão do Japão", "HKT": "Horário Padrão de Hong Kong"},
  71. }
  72. }
  73. // Locale returns the current translators string locale
  74. func (pt *pt_CV) Locale() string {
  75. return pt.locale
  76. }
  77. // PluralsCardinal returns the list of cardinal plural rules associated with 'pt_CV'
  78. func (pt *pt_CV) PluralsCardinal() []locales.PluralRule {
  79. return pt.pluralsCardinal
  80. }
  81. // PluralsOrdinal returns the list of ordinal plural rules associated with 'pt_CV'
  82. func (pt *pt_CV) PluralsOrdinal() []locales.PluralRule {
  83. return pt.pluralsOrdinal
  84. }
  85. // PluralsRange returns the list of range plural rules associated with 'pt_CV'
  86. func (pt *pt_CV) PluralsRange() []locales.PluralRule {
  87. return pt.pluralsRange
  88. }
  89. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'pt_CV'
  90. func (pt *pt_CV) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
  91. n := math.Abs(num)
  92. if n >= 0 && n <= 2 && n != 2 {
  93. return locales.PluralRuleOne
  94. }
  95. return locales.PluralRuleOther
  96. }
  97. // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'pt_CV'
  98. func (pt *pt_CV) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
  99. return locales.PluralRuleOther
  100. }
  101. // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'pt_CV'
  102. func (pt *pt_CV) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
  103. start := pt.CardinalPluralRule(num1, v1)
  104. end := pt.CardinalPluralRule(num2, v2)
  105. if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
  106. return locales.PluralRuleOther
  107. } else if start == locales.PluralRuleOther && end == locales.PluralRuleOne {
  108. return locales.PluralRuleOne
  109. }
  110. return locales.PluralRuleOther
  111. }
  112. // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
  113. func (pt *pt_CV) MonthAbbreviated(month time.Month) string {
  114. return pt.monthsAbbreviated[month]
  115. }
  116. // MonthsAbbreviated returns the locales abbreviated months
  117. func (pt *pt_CV) MonthsAbbreviated() []string {
  118. return pt.monthsAbbreviated[1:]
  119. }
  120. // MonthNarrow returns the locales narrow month given the 'month' provided
  121. func (pt *pt_CV) MonthNarrow(month time.Month) string {
  122. return pt.monthsNarrow[month]
  123. }
  124. // MonthsNarrow returns the locales narrow months
  125. func (pt *pt_CV) MonthsNarrow() []string {
  126. return pt.monthsNarrow[1:]
  127. }
  128. // MonthWide returns the locales wide month given the 'month' provided
  129. func (pt *pt_CV) MonthWide(month time.Month) string {
  130. return pt.monthsWide[month]
  131. }
  132. // MonthsWide returns the locales wide months
  133. func (pt *pt_CV) MonthsWide() []string {
  134. return pt.monthsWide[1:]
  135. }
  136. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  137. func (pt *pt_CV) WeekdayAbbreviated(weekday time.Weekday) string {
  138. return pt.daysAbbreviated[weekday]
  139. }
  140. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  141. func (pt *pt_CV) WeekdaysAbbreviated() []string {
  142. return pt.daysAbbreviated
  143. }
  144. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  145. func (pt *pt_CV) WeekdayNarrow(weekday time.Weekday) string {
  146. return pt.daysNarrow[weekday]
  147. }
  148. // WeekdaysNarrow returns the locales narrow weekdays
  149. func (pt *pt_CV) WeekdaysNarrow() []string {
  150. return pt.daysNarrow
  151. }
  152. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  153. func (pt *pt_CV) WeekdayShort(weekday time.Weekday) string {
  154. return pt.daysShort[weekday]
  155. }
  156. // WeekdaysShort returns the locales short weekdays
  157. func (pt *pt_CV) WeekdaysShort() []string {
  158. return pt.daysShort
  159. }
  160. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  161. func (pt *pt_CV) WeekdayWide(weekday time.Weekday) string {
  162. return pt.daysWide[weekday]
  163. }
  164. // WeekdaysWide returns the locales wide weekdays
  165. func (pt *pt_CV) WeekdaysWide() []string {
  166. return pt.daysWide
  167. }
  168. // FmtNumber returns 'num' with digits/precision of 'v' for 'pt_CV' and handles both Whole and Real numbers based on 'v'
  169. func (pt *pt_CV) FmtNumber(num float64, v uint64) string {
  170. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  171. l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
  172. count := 0
  173. inWhole := v == 0
  174. b := make([]byte, 0, l)
  175. for i := len(s) - 1; i >= 0; i-- {
  176. if s[i] == '.' {
  177. b = append(b, pt.decimal[0])
  178. inWhole = true
  179. continue
  180. }
  181. if inWhole {
  182. if count == 3 {
  183. b = append(b, pt.group[0])
  184. count = 1
  185. } else {
  186. count++
  187. }
  188. }
  189. b = append(b, s[i])
  190. }
  191. if num < 0 {
  192. b = append(b, pt.minus[0])
  193. }
  194. // reverse
  195. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  196. b[i], b[j] = b[j], b[i]
  197. }
  198. return string(b)
  199. }
  200. // FmtPercent returns 'num' with digits/precision of 'v' for 'pt_CV' and handles both Whole and Real numbers based on 'v'
  201. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
  202. func (pt *pt_CV) FmtPercent(num float64, v uint64) string {
  203. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  204. l := len(s) + 3
  205. b := make([]byte, 0, l)
  206. for i := len(s) - 1; i >= 0; i-- {
  207. if s[i] == '.' {
  208. b = append(b, pt.decimal[0])
  209. continue
  210. }
  211. b = append(b, s[i])
  212. }
  213. if num < 0 {
  214. b = append(b, pt.minus[0])
  215. }
  216. // reverse
  217. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  218. b[i], b[j] = b[j], b[i]
  219. }
  220. b = append(b, pt.percent...)
  221. return string(b)
  222. }
  223. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'pt_CV'
  224. func (pt *pt_CV) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  225. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  226. symbol := pt.currencies[currency]
  227. l := len(s) + len(symbol) + 2 + 1*len(s[:len(s)-int(v)-1])/3
  228. count := 0
  229. inWhole := v == 0
  230. b := make([]byte, 0, l)
  231. for i := len(s) - 1; i >= 0; i-- {
  232. if s[i] == '.' {
  233. b = append(b, pt.decimal[0])
  234. inWhole = true
  235. continue
  236. }
  237. if inWhole {
  238. if count == 3 {
  239. b = append(b, pt.group[0])
  240. count = 1
  241. } else {
  242. count++
  243. }
  244. }
  245. b = append(b, s[i])
  246. }
  247. for j := len(symbol) - 1; j >= 0; j-- {
  248. b = append(b, symbol[j])
  249. }
  250. if num < 0 {
  251. b = append(b, pt.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. if int(v) < 2 {
  258. if v == 0 {
  259. b = append(b, pt.decimal...)
  260. }
  261. for i := 0; i < 2-int(v); i++ {
  262. b = append(b, '0')
  263. }
  264. }
  265. return string(b)
  266. }
  267. // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'pt_CV'
  268. // in accounting notation.
  269. func (pt *pt_CV) FmtAccounting(num float64, v uint64, currency currency.Type) string {
  270. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  271. symbol := pt.currencies[currency]
  272. l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
  273. count := 0
  274. inWhole := v == 0
  275. b := make([]byte, 0, l)
  276. for i := len(s) - 1; i >= 0; i-- {
  277. if s[i] == '.' {
  278. b = append(b, pt.decimal[0])
  279. inWhole = true
  280. continue
  281. }
  282. if inWhole {
  283. if count == 3 {
  284. b = append(b, pt.group[0])
  285. count = 1
  286. } else {
  287. count++
  288. }
  289. }
  290. b = append(b, s[i])
  291. }
  292. if num < 0 {
  293. for j := len(symbol) - 1; j >= 0; j-- {
  294. b = append(b, symbol[j])
  295. }
  296. b = append(b, pt.currencyNegativePrefix[0])
  297. } else {
  298. for j := len(symbol) - 1; j >= 0; j-- {
  299. b = append(b, symbol[j])
  300. }
  301. }
  302. // reverse
  303. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  304. b[i], b[j] = b[j], b[i]
  305. }
  306. if int(v) < 2 {
  307. if v == 0 {
  308. b = append(b, pt.decimal...)
  309. }
  310. for i := 0; i < 2-int(v); i++ {
  311. b = append(b, '0')
  312. }
  313. }
  314. if num < 0 {
  315. b = append(b, pt.currencyNegativeSuffix...)
  316. }
  317. return string(b)
  318. }
  319. // FmtDateShort returns the short date representation of 't' for 'pt_CV'
  320. func (pt *pt_CV) FmtDateShort(t time.Time) string {
  321. b := make([]byte, 0, 32)
  322. if t.Day() < 10 {
  323. b = append(b, '0')
  324. }
  325. b = strconv.AppendInt(b, int64(t.Day()), 10)
  326. b = append(b, []byte{0x2f}...)
  327. if t.Month() < 10 {
  328. b = append(b, '0')
  329. }
  330. b = strconv.AppendInt(b, int64(t.Month()), 10)
  331. b = append(b, []byte{0x2f}...)
  332. if t.Year() > 9 {
  333. b = append(b, strconv.Itoa(t.Year())[2:]...)
  334. } else {
  335. b = append(b, strconv.Itoa(t.Year())[1:]...)
  336. }
  337. return string(b)
  338. }
  339. // FmtDateMedium returns the medium date representation of 't' for 'pt_CV'
  340. func (pt *pt_CV) FmtDateMedium(t time.Time) string {
  341. b := make([]byte, 0, 32)
  342. b = strconv.AppendInt(b, int64(t.Day()), 10)
  343. b = append(b, []byte{}...)
  344. b = append(b, []byte{0x27, 0x64, 0x65, 0x27, 0x20}...)
  345. b = append(b, pt.monthsAbbreviated[t.Month()]...)
  346. b = append(b, []byte{}...)
  347. b = append(b, []byte{0x27, 0x64, 0x65, 0x27, 0x20}...)
  348. b = strconv.AppendInt(b, int64(t.Year()), 10)
  349. return string(b)
  350. }
  351. // FmtDateLong returns the long date representation of 't' for 'pt_CV'
  352. func (pt *pt_CV) FmtDateLong(t time.Time) string {
  353. b := make([]byte, 0, 32)
  354. b = strconv.AppendInt(b, int64(t.Day()), 10)
  355. b = append(b, []byte{}...)
  356. b = append(b, []byte{0x27, 0x64, 0x65, 0x27, 0x20}...)
  357. b = append(b, pt.monthsWide[t.Month()]...)
  358. b = append(b, []byte{}...)
  359. b = append(b, []byte{0x27, 0x64, 0x65, 0x27, 0x20}...)
  360. b = strconv.AppendInt(b, int64(t.Year()), 10)
  361. return string(b)
  362. }
  363. // FmtDateFull returns the full date representation of 't' for 'pt_CV'
  364. func (pt *pt_CV) FmtDateFull(t time.Time) string {
  365. b := make([]byte, 0, 32)
  366. b = append(b, pt.daysWide[t.Weekday()]...)
  367. b = append(b, []byte{0x2c, 0x20}...)
  368. b = strconv.AppendInt(b, int64(t.Day()), 10)
  369. b = append(b, []byte{}...)
  370. b = append(b, []byte{0x27, 0x64, 0x65, 0x27, 0x20}...)
  371. b = append(b, pt.monthsWide[t.Month()]...)
  372. b = append(b, []byte{}...)
  373. b = append(b, []byte{0x27, 0x64, 0x65, 0x27, 0x20}...)
  374. b = strconv.AppendInt(b, int64(t.Year()), 10)
  375. return string(b)
  376. }
  377. // FmtTimeShort returns the short time representation of 't' for 'pt_CV'
  378. func (pt *pt_CV) FmtTimeShort(t time.Time) string {
  379. b := make([]byte, 0, 32)
  380. if t.Hour() < 10 {
  381. b = append(b, '0')
  382. }
  383. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  384. b = append(b, pt.timeSeparator...)
  385. if t.Minute() < 10 {
  386. b = append(b, '0')
  387. }
  388. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  389. return string(b)
  390. }
  391. // FmtTimeMedium returns the medium time representation of 't' for 'pt_CV'
  392. func (pt *pt_CV) FmtTimeMedium(t time.Time) string {
  393. b := make([]byte, 0, 32)
  394. if t.Hour() < 10 {
  395. b = append(b, '0')
  396. }
  397. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  398. b = append(b, pt.timeSeparator...)
  399. if t.Minute() < 10 {
  400. b = append(b, '0')
  401. }
  402. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  403. b = append(b, pt.timeSeparator...)
  404. if t.Second() < 10 {
  405. b = append(b, '0')
  406. }
  407. b = strconv.AppendInt(b, int64(t.Second()), 10)
  408. return string(b)
  409. }
  410. // FmtTimeLong returns the long time representation of 't' for 'pt_CV'
  411. func (pt *pt_CV) FmtTimeLong(t time.Time) string {
  412. b := make([]byte, 0, 32)
  413. if t.Hour() < 10 {
  414. b = append(b, '0')
  415. }
  416. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  417. b = append(b, pt.timeSeparator...)
  418. if t.Minute() < 10 {
  419. b = append(b, '0')
  420. }
  421. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  422. b = append(b, pt.timeSeparator...)
  423. if t.Second() < 10 {
  424. b = append(b, '0')
  425. }
  426. b = strconv.AppendInt(b, int64(t.Second()), 10)
  427. b = append(b, []byte{0x20}...)
  428. tz, _ := t.Zone()
  429. b = append(b, tz...)
  430. return string(b)
  431. }
  432. // FmtTimeFull returns the full time representation of 't' for 'pt_CV'
  433. func (pt *pt_CV) FmtTimeFull(t time.Time) string {
  434. b := make([]byte, 0, 32)
  435. if t.Hour() < 10 {
  436. b = append(b, '0')
  437. }
  438. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  439. b = append(b, pt.timeSeparator...)
  440. if t.Minute() < 10 {
  441. b = append(b, '0')
  442. }
  443. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  444. b = append(b, pt.timeSeparator...)
  445. if t.Second() < 10 {
  446. b = append(b, '0')
  447. }
  448. b = strconv.AppendInt(b, int64(t.Second()), 10)
  449. b = append(b, []byte{0x20}...)
  450. tz, _ := t.Zone()
  451. if btz, ok := pt.timezones[tz]; ok {
  452. b = append(b, btz...)
  453. } else {
  454. b = append(b, tz...)
  455. }
  456. return string(b)
  457. }