fr_CA.go 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571
  1. package fr_CA
  2. import (
  3. "math"
  4. "strconv"
  5. "time"
  6. "github.com/go-playground/locales"
  7. "github.com/go-playground/locales/currency"
  8. )
  9. type fr_CA 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 'fr_CA' locale
  42. func New() locales.Translator {
  43. return &fr_CA{
  44. locale: "fr_CA",
  45. pluralsCardinal: []locales.PluralRule{2, 6},
  46. pluralsOrdinal: []locales.PluralRule{2, 6},
  47. pluralsRange: []locales.PluralRule{2, 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 ", "$\u00a0AU", "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", "$", "CDF ", "CHE ", "CHF ", "CHW ", "CLE ", "CLF ", "CLP", "CNX ", "CN¥", "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 ", "£", "GEK ", "GEL ", "GHC ", "GHS ", "GIP", "GMD ", "GNF ", "GNS ", "GQE ", "GRD ", "GTQ ", "GWE ", "GWP ", "GYD ", "$\u00a0HK", "HNL ", "HRD ", "HRK ", "HTG ", "HUF ", "IDR ", "IEP ", "ILP ", "ILR ", "ILS", "INR ", "IQD ", "IRR ", "ISJ ", "ISK ", "ITL ", "JMD ", "JOD ", "¥", "KES ", "KGS ", "KHR ", "CF", "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 ", "C$", "NLG ", "NOK ", "NPR ", "$\u00a0NZ", "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 ", "$\u00a0SG", "SHP ", "SIT ", "SKK ", "SLL ", "SOS ", "SRD", "SRG ", "SSP ", "STD ", "SUR ", "SVC ", "SYP ", "SZL ", "THB ", "TJR ", "TJS ", "TMM ", "TMT ", "TND ", "TOP ", "TPE ", "TRL ", "TL", "TTD", "TWD ", "TZS ", "UAH ", "UAK ", "UGS ", "UGX ", "$\u00a0US", "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 ", "ZK", "ZRN ", "ZRZ ", "ZWD ", "ZWL ", "ZWR "},
  56. percentSuffix: " ",
  57. currencyPositiveSuffix: " mn ",
  58. currencyNegativeSuffix: " mn ",
  59. monthsAbbreviated: []string{"", "janv.", "févr.", "mars", "avr.", "mai", "juin", "juil.", "août", "sept.", "oct.", "nov.", "déc."},
  60. monthsNarrow: []string{"", "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"},
  61. monthsWide: []string{"", "janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre"},
  62. daysAbbreviated: []string{"dim.", "lun.", "mar.", "mer.", "jeu.", "ven.", "sam."},
  63. daysNarrow: []string{"D", "L", "M", "M", "J", "V", "S"},
  64. daysShort: []string{"di", "lu", "ma", "me", "je", "ve", "sa"},
  65. daysWide: []string{"dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"},
  66. periodsAbbreviated: []string{"", ""},
  67. periodsNarrow: []string{"a", "p"},
  68. periodsWide: []string{"", ""},
  69. erasAbbreviated: []string{"av. J.-C.", "ap. J.-C."},
  70. erasNarrow: []string{"av. J.-C.", "ap. J.-C."},
  71. erasWide: []string{"avant Jésus-Christ", "après Jésus-Christ"},
  72. timezones: map[string]string{"MDT": "heure avancée des Rocheuses", "ACWST": "heure normale du centre-ouest de l’Australie", "EDT": "heure avancée de l’Est", "GFT": "heure de Guyane française", "ARST": "heure avancée de l’Argentine", "MYT": "heure de la Malaisie", "JDT": "heure avancée du Japon", "PST": "heure normale du Pacifique", "MESZ": "heure avancée d’Europe centrale", "MST": "heure normale des Rocheuses", "WIT": "heure de l’Est indonésien", "IST": "heure de l’Inde", "AWST": "heure normale de l’Ouest de l’Australie", "HKT": "heure normale de Hong Kong", "OEZ": "heure normale d’Europe de l’Est", "AWDT": "heure avancée de l’Ouest de l’Australie", "LHDT": "heure avancée de Lord Howe", "CHADT": "heure avancée des Îles Chatham", "COST": "heure avancée de Colombie", "ECT": "heure de l’Équateur", "WAT": "heure normale d’Afrique de l’Ouest", "HADT": "heure avancée d’Hawaï-Aléoutiennes", "WART": "heure normale de l’Ouest argentin", "BT": "heure du Bhoutan", "ART": "heure normale d’Argentine", "JST": "heure normale du Japon", "SRT": "heure du Suriname", "NZDT": "heure avancée de la Nouvelle-Zélande", "OESZ": "heure avancée d’Europe de l’Est", "HKST": "heure avancée de Hong Kong", "AKDT": "heure avancée de l’Alaska", "TMST": "heure avancée du Turkménistan", "EAT": "Heure d’Afrique orientale", "MEZ": "heure normale d’Europe centrale", "CHAST": "heure normale des Îles Chatham", "WEZ": "heure normale d’Europe de l’Ouest", "HAST": "heure normale d’Hawaï-Aléoutiennes", "CST": "heure normale du Centre", "BOT": "heure de Bolivie", "WAST": "heure avancée d’Afrique de l’Ouest", "GMT": "heure moyenne de Greenwich", "VET": "heure du Venezuela", "AST": "heure normale de l’Atlantique", "HNT": "heure normale de Terre-Neuve", "TMT": "heure normale du Turkménistan", "AEDT": "heure avancée de l’Est de l’Australie", "CAT": "heure d’Afrique centrale", "SAST": "heure normale d’Afrique du Sud", "WITA": "heure du Centre indonésien", "UYST": "heure avancée de l’Uruguay", "CDT": "heure avancée du Centre", "ACWDT": "heure avancée du centre-ouest de l’Australie", "AEST": "heure normale de l’Est de l’Australie", "HAT": "heure avancée de Terre-Neuve", "GYT": "heure du Guyana", "AKST": "heure normale de l’Alaska", "PDT": "heure avancée du Pacifique", "WESZ": "heure avancée d’Europe de l’Ouest", "∅∅∅": "heure avancée de Brasilia", "ADT": "heure avancée de l’Atlantique", "UYT": "heure normale de l’Uruguay", "LHST": "heure normale de Lord Howe", "NZST": "heure normale de la Nouvelle-Zélande", "COT": "heure normale de Colombie", "SGT": "heure de Singapour", "WARST": "heure avancée de l’Ouest argentin", "WIB": "heure de l’Ouest indonésien", "ACST": "heure normale du centre de l’Australie", "ACDT": "heure avancée du centre de l’Australie", "CLT": "heure normale du Chili", "CLST": "heure avancée du Chili", "ChST": "heure des Chamorro", "EST": "heure normale de l’Est"},
  73. }
  74. }
  75. // Locale returns the current translators string locale
  76. func (fr *fr_CA) Locale() string {
  77. return fr.locale
  78. }
  79. // PluralsCardinal returns the list of cardinal plural rules associated with 'fr_CA'
  80. func (fr *fr_CA) PluralsCardinal() []locales.PluralRule {
  81. return fr.pluralsCardinal
  82. }
  83. // PluralsOrdinal returns the list of ordinal plural rules associated with 'fr_CA'
  84. func (fr *fr_CA) PluralsOrdinal() []locales.PluralRule {
  85. return fr.pluralsOrdinal
  86. }
  87. // PluralsRange returns the list of range plural rules associated with 'fr_CA'
  88. func (fr *fr_CA) PluralsRange() []locales.PluralRule {
  89. return fr.pluralsRange
  90. }
  91. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'fr_CA'
  92. func (fr *fr_CA) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
  93. n := math.Abs(num)
  94. i := int64(n)
  95. if i == 0 || i == 1 {
  96. return locales.PluralRuleOne
  97. }
  98. return locales.PluralRuleOther
  99. }
  100. // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'fr_CA'
  101. func (fr *fr_CA) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
  102. n := math.Abs(num)
  103. if n == 1 {
  104. return locales.PluralRuleOne
  105. }
  106. return locales.PluralRuleOther
  107. }
  108. // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'fr_CA'
  109. func (fr *fr_CA) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
  110. start := fr.CardinalPluralRule(num1, v1)
  111. end := fr.CardinalPluralRule(num2, v2)
  112. if start == locales.PluralRuleOne && end == locales.PluralRuleOne {
  113. return locales.PluralRuleOne
  114. } else if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
  115. return locales.PluralRuleOther
  116. }
  117. return locales.PluralRuleOther
  118. }
  119. // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
  120. func (fr *fr_CA) MonthAbbreviated(month time.Month) string {
  121. return fr.monthsAbbreviated[month]
  122. }
  123. // MonthsAbbreviated returns the locales abbreviated months
  124. func (fr *fr_CA) MonthsAbbreviated() []string {
  125. return fr.monthsAbbreviated[1:]
  126. }
  127. // MonthNarrow returns the locales narrow month given the 'month' provided
  128. func (fr *fr_CA) MonthNarrow(month time.Month) string {
  129. return fr.monthsNarrow[month]
  130. }
  131. // MonthsNarrow returns the locales narrow months
  132. func (fr *fr_CA) MonthsNarrow() []string {
  133. return fr.monthsNarrow[1:]
  134. }
  135. // MonthWide returns the locales wide month given the 'month' provided
  136. func (fr *fr_CA) MonthWide(month time.Month) string {
  137. return fr.monthsWide[month]
  138. }
  139. // MonthsWide returns the locales wide months
  140. func (fr *fr_CA) MonthsWide() []string {
  141. return fr.monthsWide[1:]
  142. }
  143. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  144. func (fr *fr_CA) WeekdayAbbreviated(weekday time.Weekday) string {
  145. return fr.daysAbbreviated[weekday]
  146. }
  147. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  148. func (fr *fr_CA) WeekdaysAbbreviated() []string {
  149. return fr.daysAbbreviated
  150. }
  151. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  152. func (fr *fr_CA) WeekdayNarrow(weekday time.Weekday) string {
  153. return fr.daysNarrow[weekday]
  154. }
  155. // WeekdaysNarrow returns the locales narrow weekdays
  156. func (fr *fr_CA) WeekdaysNarrow() []string {
  157. return fr.daysNarrow
  158. }
  159. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  160. func (fr *fr_CA) WeekdayShort(weekday time.Weekday) string {
  161. return fr.daysShort[weekday]
  162. }
  163. // WeekdaysShort returns the locales short weekdays
  164. func (fr *fr_CA) WeekdaysShort() []string {
  165. return fr.daysShort
  166. }
  167. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  168. func (fr *fr_CA) WeekdayWide(weekday time.Weekday) string {
  169. return fr.daysWide[weekday]
  170. }
  171. // WeekdaysWide returns the locales wide weekdays
  172. func (fr *fr_CA) WeekdaysWide() []string {
  173. return fr.daysWide
  174. }
  175. // FmtNumber returns 'num' with digits/precision of 'v' for 'fr_CA' and handles both Whole and Real numbers based on 'v'
  176. func (fr *fr_CA) FmtNumber(num float64, v uint64) string {
  177. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  178. l := len(s) + 8 + 2*len(s[:len(s)-int(v)-1])/3
  179. count := 0
  180. inWhole := v == 0
  181. b := make([]byte, 0, l)
  182. for i := len(s) - 1; i >= 0; i-- {
  183. if s[i] == '.' {
  184. for j := len(fr.decimal) - 1; j >= 0; j-- {
  185. b = append(b, fr.decimal[j])
  186. }
  187. inWhole = true
  188. continue
  189. }
  190. if inWhole {
  191. if count == 3 {
  192. for j := len(fr.group) - 1; j >= 0; j-- {
  193. b = append(b, fr.group[j])
  194. }
  195. count = 1
  196. } else {
  197. count++
  198. }
  199. }
  200. b = append(b, s[i])
  201. }
  202. if num < 0 {
  203. for j := len(fr.minus) - 1; j >= 0; j-- {
  204. b = append(b, fr.minus[j])
  205. }
  206. }
  207. // reverse
  208. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  209. b[i], b[j] = b[j], b[i]
  210. }
  211. return string(b)
  212. }
  213. // FmtPercent returns 'num' with digits/precision of 'v' for 'fr_CA' and handles both Whole and Real numbers based on 'v'
  214. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
  215. func (fr *fr_CA) FmtPercent(num float64, v uint64) string {
  216. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  217. l := len(s) + 12
  218. b := make([]byte, 0, l)
  219. for i := len(s) - 1; i >= 0; i-- {
  220. if s[i] == '.' {
  221. for j := len(fr.decimal) - 1; j >= 0; j-- {
  222. b = append(b, fr.decimal[j])
  223. }
  224. continue
  225. }
  226. b = append(b, s[i])
  227. }
  228. if num < 0 {
  229. for j := len(fr.minus) - 1; j >= 0; j-- {
  230. b = append(b, fr.minus[j])
  231. }
  232. }
  233. // reverse
  234. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  235. b[i], b[j] = b[j], b[i]
  236. }
  237. b = append(b, fr.percentSuffix...)
  238. b = append(b, fr.percent...)
  239. return string(b)
  240. }
  241. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'fr_CA'
  242. func (fr *fr_CA) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  243. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  244. symbol := fr.currencies[currency]
  245. l := len(s) + len(symbol) + 14
  246. b := make([]byte, 0, l)
  247. for i := len(s) - 1; i >= 0; i-- {
  248. if s[i] == '.' {
  249. for j := len(fr.decimal) - 1; j >= 0; j-- {
  250. b = append(b, fr.decimal[j])
  251. }
  252. continue
  253. }
  254. b = append(b, s[i])
  255. }
  256. if num < 0 {
  257. for j := len(fr.minus) - 1; j >= 0; j-- {
  258. b = append(b, fr.minus[j])
  259. }
  260. }
  261. // reverse
  262. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  263. b[i], b[j] = b[j], b[i]
  264. }
  265. b = append(b, fr.currencyPositiveSuffix...)
  266. b = append(b, symbol...)
  267. return string(b)
  268. }
  269. // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_CA'
  270. // in accounting notation.
  271. func (fr *fr_CA) FmtAccounting(num float64, v uint64, currency currency.Type) string {
  272. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  273. symbol := fr.currencies[currency]
  274. l := len(s) + len(symbol) + 14
  275. b := make([]byte, 0, l)
  276. for i := len(s) - 1; i >= 0; i-- {
  277. if s[i] == '.' {
  278. for j := len(fr.decimal) - 1; j >= 0; j-- {
  279. b = append(b, fr.decimal[j])
  280. }
  281. continue
  282. }
  283. b = append(b, s[i])
  284. }
  285. if num < 0 {
  286. for j := len(fr.minus) - 1; j >= 0; j-- {
  287. b = append(b, fr.minus[j])
  288. }
  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 num < 0 {
  295. b = append(b, fr.currencyNegativeSuffix...)
  296. b = append(b, symbol...)
  297. } else {
  298. b = append(b, fr.currencyPositiveSuffix...)
  299. b = append(b, symbol...)
  300. }
  301. return string(b)
  302. }
  303. // FmtDateShort returns the short date representation of 't' for 'fr_CA'
  304. func (fr *fr_CA) FmtDateShort(t time.Time) string {
  305. b := make([]byte, 0, 32)
  306. if t.Year() > 9 {
  307. b = append(b, strconv.Itoa(t.Year())[2:]...)
  308. } else {
  309. b = append(b, strconv.Itoa(t.Year())[1:]...)
  310. }
  311. b = append(b, []byte{0x2d}...)
  312. if t.Month() < 10 {
  313. b = append(b, '0')
  314. }
  315. b = strconv.AppendInt(b, int64(t.Month()), 10)
  316. b = append(b, []byte{0x2d}...)
  317. if t.Day() < 10 {
  318. b = append(b, '0')
  319. }
  320. b = strconv.AppendInt(b, int64(t.Day()), 10)
  321. return string(b)
  322. }
  323. // FmtDateMedium returns the medium date representation of 't' for 'fr_CA'
  324. func (fr *fr_CA) FmtDateMedium(t time.Time) string {
  325. b := make([]byte, 0, 32)
  326. b = strconv.AppendInt(b, int64(t.Day()), 10)
  327. b = append(b, []byte{0x20}...)
  328. b = append(b, fr.monthsAbbreviated[t.Month()]...)
  329. b = append(b, []byte{0x20}...)
  330. b = strconv.AppendInt(b, int64(t.Year()), 10)
  331. return string(b)
  332. }
  333. // FmtDateLong returns the long date representation of 't' for 'fr_CA'
  334. func (fr *fr_CA) FmtDateLong(t time.Time) string {
  335. b := make([]byte, 0, 32)
  336. b = strconv.AppendInt(b, int64(t.Day()), 10)
  337. b = append(b, []byte{0x20}...)
  338. b = append(b, fr.monthsWide[t.Month()]...)
  339. b = append(b, []byte{0x20}...)
  340. b = strconv.AppendInt(b, int64(t.Year()), 10)
  341. return string(b)
  342. }
  343. // FmtDateFull returns the full date representation of 't' for 'fr_CA'
  344. func (fr *fr_CA) FmtDateFull(t time.Time) string {
  345. b := make([]byte, 0, 32)
  346. b = append(b, fr.daysWide[t.Weekday()]...)
  347. b = append(b, []byte{0x20}...)
  348. b = strconv.AppendInt(b, int64(t.Day()), 10)
  349. b = append(b, []byte{0x20}...)
  350. b = append(b, fr.monthsWide[t.Month()]...)
  351. b = append(b, []byte{0x20}...)
  352. b = strconv.AppendInt(b, int64(t.Year()), 10)
  353. return string(b)
  354. }
  355. // FmtTimeShort returns the short time representation of 't' for 'fr_CA'
  356. func (fr *fr_CA) FmtTimeShort(t time.Time) string {
  357. b := make([]byte, 0, 32)
  358. if t.Hour() < 10 {
  359. b = append(b, '0')
  360. }
  361. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  362. b = append(b, fr.timeSeparator...)
  363. if t.Minute() < 10 {
  364. b = append(b, '0')
  365. }
  366. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  367. return string(b)
  368. }
  369. // FmtTimeMedium returns the medium time representation of 't' for 'fr_CA'
  370. func (fr *fr_CA) FmtTimeMedium(t time.Time) string {
  371. b := make([]byte, 0, 32)
  372. if t.Hour() < 10 {
  373. b = append(b, '0')
  374. }
  375. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  376. b = append(b, fr.timeSeparator...)
  377. if t.Minute() < 10 {
  378. b = append(b, '0')
  379. }
  380. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  381. b = append(b, fr.timeSeparator...)
  382. if t.Second() < 10 {
  383. b = append(b, '0')
  384. }
  385. b = strconv.AppendInt(b, int64(t.Second()), 10)
  386. return string(b)
  387. }
  388. // FmtTimeLong returns the long time representation of 't' for 'fr_CA'
  389. func (fr *fr_CA) FmtTimeLong(t time.Time) string {
  390. b := make([]byte, 0, 32)
  391. if t.Hour() < 10 {
  392. b = append(b, '0')
  393. }
  394. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  395. b = append(b, fr.timeSeparator...)
  396. if t.Minute() < 10 {
  397. b = append(b, '0')
  398. }
  399. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  400. b = append(b, fr.timeSeparator...)
  401. if t.Second() < 10 {
  402. b = append(b, '0')
  403. }
  404. b = strconv.AppendInt(b, int64(t.Second()), 10)
  405. b = append(b, []byte{0x20}...)
  406. tz, _ := t.Zone()
  407. b = append(b, tz...)
  408. return string(b)
  409. }
  410. // FmtTimeFull returns the full time representation of 't' for 'fr_CA'
  411. func (fr *fr_CA) FmtTimeFull(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, fr.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, fr.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. if btz, ok := fr.timezones[tz]; ok {
  430. b = append(b, btz...)
  431. } else {
  432. b = append(b, tz...)
  433. }
  434. return string(b)
  435. }