fr_CA.go 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595
  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", "Br", "BYR", "BZD", "$", "CDF", "CHE", "CHF", "CHW", "CLE", "CLF", "CLP", "CNH", "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", "STN", "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: " k",
  58. currencyNegativeSuffix: " k",
  59. monthsAbbreviated: []string{"", "janv.", "févr.", "mars", "avr.", "mai", "juin", "juill.", "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{"a.m.", "p.m."},
  67. periodsNarrow: []string{"a", "p"},
  68. periodsWide: []string{"a.m.", "p.m."},
  69. erasAbbreviated: []string{"", ""},
  70. erasNarrow: []string{"", ""},
  71. erasWide: []string{"avant l’ère chrétienne", "de l’ère chrétienne"},
  72. timezones: map[string]string{"HADT": "heure avancée d’Hawaï-Aléoutiennes", "GMT": "heure moyenne de Greenwich", "WEZ": "heure normale d’Europe de l’Ouest", "AWST": "heure normale de l’Ouest de l’Australie", "AST": "heure normale de l’Atlantique", "BOT": "heure de Bolivie", "EST": "heure normale de l’Est", "HAT": "heure avancée de Terre-Neuve", "GYT": "heure du Guyana", "HNCU": "heure normale de Cuba", "CST": "heure normale du Centre", "GFT": "heure de Guyane française", "SGT": "heure de Singapour", "HNEG": "heure normale de l’Est du Groenland", "MEZ": "heure normale d’Europe centrale", "OEZ": "heure normale d’Europe de l’Est", "UYT": "heure normale de l’Uruguay", "WIB": "heure de l’Ouest indonésien", "ACWST": "heure normale du centre-ouest de l’Australie", "HEOG": "heure avancée de l’Ouest du Groenland", "MESZ": "heure avancée d’Europe centrale", "HAST": "heure normale d’Hawaï-Aléoutiennes", "SAST": "heure normale d’Afrique du Sud", "ACDT": "heure avancée du centre de l’Australie", "AWDT": "heure avancée de l’Ouest de l’Australie", "EDT": "heure avancée de l’Est", "HKT": "heure normale de Hong Kong", "WARST": "heure avancée de l’Ouest argentin", "MST": "heure normale de Macao", "WIT": "heure de l’Est indonésien", "COST": "heure avancée de Colombie", "OESZ": "heure avancée d’Europe de l’Est", "NZDT": "heure avancée de la Nouvelle-Zélande", "AKST": "heure normale de l’Alaska", "AEST": "heure normale de l’Est de l’Australie", "BT": "heure du Bhoutan", "COT": "heure normale de Colombie", "UYST": "heure avancée de l’Uruguay", "CHAST": "heure normale des Îles Chatham", "ECT": "heure de l’Équateur", "IST": "heure de l’Inde", "MDT": "heure avancée de Macao", "ChST": "heure des Chamorro", "AKDT": "heure avancée de l’Alaska", "HKST": "heure avancée de Hong Kong", "LHST": "heure normale de Lord Howe", "WART": "heure normale de l’Ouest argentin", "TMT": "heure normale du Turkménistan", "JDT": "heure avancée du Japon", "ACWDT": "heure avancée du centre-ouest de l’Australie", "WAST": "heure avancée d’Afrique de l’Ouest", "LHDT": "heure avancée de Lord Howe", "VET": "heure du Venezuela", "HENOMX": "heure avancée du Nord-Ouest du Mexique", "SRT": "heure du Suriname", "CAT": "heure d’Afrique centrale", "CLST": "heure avancée du Chili", "PST": "heure normale du Pacifique", "WAT": "heure normale d’Afrique de l’Ouest", "ADT": "heure avancée de l’Atlantique", "WESZ": "heure avancée d’Europe de l’Ouest", "MYT": "heure de la Malaisie", "HEEG": "heure avancée de l’Est du Groenland", "HNNOMX": "heure normale du Nord-Ouest du Mexique", "TMST": "heure avancée du Turkménistan", "CDT": "heure avancée du Centre", "CLT": "heure normale du Chili", "PDT": "heure avancée du Pacifique", "JST": "heure normale du Japon", "HEPM": "heure avancée de Saint-Pierre-et-Miquelon", "WITA": "heure du Centre indonésien", "ART": "heure normale d’Argentine", "ARST": "heure avancée de l’Argentine", "∅∅∅": "heure avancée de l’Amazonie", "NZST": "heure normale de la Nouvelle-Zélande", "HNOG": "heure normale de l’Ouest du Groenland", "EAT": "heure d’Afrique orientale", "HEPMX": "heure avancée du Pacifique mexicain", "AEDT": "heure avancée de l’Est de l’Australie", "ACST": "heure normale du centre de l’Australie", "HNT": "heure normale de Terre-Neuve", "HNPM": "heure normale de Saint-Pierre-et-Miquelon", "CHADT": "heure avancée des Îles Chatham", "HECU": "heure avancée de Cuba", "HNPMX": "heure normale du Pacifique mexicain"},
  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. // Decimal returns the decimal point of number
  176. func (fr *fr_CA) Decimal() string {
  177. return fr.decimal
  178. }
  179. // Group returns the group of number
  180. func (fr *fr_CA) Group() string {
  181. return fr.group
  182. }
  183. // Group returns the minus sign of number
  184. func (fr *fr_CA) Minus() string {
  185. return fr.minus
  186. }
  187. // FmtNumber returns 'num' with digits/precision of 'v' for 'fr_CA' and handles both Whole and Real numbers based on 'v'
  188. func (fr *fr_CA) FmtNumber(num float64, v uint64) string {
  189. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  190. l := len(s) + 2 + 2*len(s[:len(s)-int(v)-1])/3
  191. count := 0
  192. inWhole := v == 0
  193. b := make([]byte, 0, l)
  194. for i := len(s) - 1; i >= 0; i-- {
  195. if s[i] == '.' {
  196. b = append(b, fr.decimal[0])
  197. inWhole = true
  198. continue
  199. }
  200. if inWhole {
  201. if count == 3 {
  202. for j := len(fr.group) - 1; j >= 0; j-- {
  203. b = append(b, fr.group[j])
  204. }
  205. count = 1
  206. } else {
  207. count++
  208. }
  209. }
  210. b = append(b, s[i])
  211. }
  212. if num < 0 {
  213. b = append(b, fr.minus[0])
  214. }
  215. // reverse
  216. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  217. b[i], b[j] = b[j], b[i]
  218. }
  219. return string(b)
  220. }
  221. // FmtPercent returns 'num' with digits/precision of 'v' for 'fr_CA' and handles both Whole and Real numbers based on 'v'
  222. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
  223. func (fr *fr_CA) FmtPercent(num float64, v uint64) string {
  224. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  225. l := len(s) + 5
  226. b := make([]byte, 0, l)
  227. for i := len(s) - 1; i >= 0; i-- {
  228. if s[i] == '.' {
  229. b = append(b, fr.decimal[0])
  230. continue
  231. }
  232. b = append(b, s[i])
  233. }
  234. if num < 0 {
  235. b = append(b, fr.minus[0])
  236. }
  237. // reverse
  238. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  239. b[i], b[j] = b[j], b[i]
  240. }
  241. b = append(b, fr.percentSuffix...)
  242. b = append(b, fr.percent...)
  243. return string(b)
  244. }
  245. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'fr_CA'
  246. func (fr *fr_CA) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  247. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  248. symbol := fr.currencies[currency]
  249. l := len(s) + len(symbol) + 5
  250. b := make([]byte, 0, l)
  251. for i := len(s) - 1; i >= 0; i-- {
  252. if s[i] == '.' {
  253. b = append(b, fr.decimal[0])
  254. continue
  255. }
  256. b = append(b, s[i])
  257. }
  258. if num < 0 {
  259. b = append(b, fr.minus[0])
  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) + 5
  275. b := make([]byte, 0, l)
  276. for i := len(s) - 1; i >= 0; i-- {
  277. if s[i] == '.' {
  278. b = append(b, fr.decimal[0])
  279. continue
  280. }
  281. b = append(b, s[i])
  282. }
  283. if num < 0 {
  284. b = append(b, fr.minus[0])
  285. }
  286. // reverse
  287. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  288. b[i], b[j] = b[j], b[i]
  289. }
  290. if num < 0 {
  291. b = append(b, fr.currencyNegativeSuffix...)
  292. b = append(b, symbol...)
  293. } else {
  294. b = append(b, fr.currencyPositiveSuffix...)
  295. b = append(b, symbol...)
  296. }
  297. return string(b)
  298. }
  299. // FmtDateShort returns the short date representation of 't' for 'fr_CA'
  300. func (fr *fr_CA) FmtDateShort(t time.Time) string {
  301. b := make([]byte, 0, 32)
  302. if t.Year() > 9 {
  303. b = append(b, strconv.Itoa(t.Year())[2:]...)
  304. } else {
  305. b = append(b, strconv.Itoa(t.Year())[1:]...)
  306. }
  307. b = append(b, []byte{0x2d}...)
  308. if t.Month() < 10 {
  309. b = append(b, '0')
  310. }
  311. b = strconv.AppendInt(b, int64(t.Month()), 10)
  312. b = append(b, []byte{0x2d}...)
  313. if t.Day() < 10 {
  314. b = append(b, '0')
  315. }
  316. b = strconv.AppendInt(b, int64(t.Day()), 10)
  317. return string(b)
  318. }
  319. // FmtDateMedium returns the medium date representation of 't' for 'fr_CA'
  320. func (fr *fr_CA) FmtDateMedium(t time.Time) string {
  321. b := make([]byte, 0, 32)
  322. b = strconv.AppendInt(b, int64(t.Day()), 10)
  323. b = append(b, []byte{0x20}...)
  324. b = append(b, fr.monthsAbbreviated[t.Month()]...)
  325. b = append(b, []byte{0x20}...)
  326. if t.Year() > 0 {
  327. b = strconv.AppendInt(b, int64(t.Year()), 10)
  328. } else {
  329. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  330. }
  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. if t.Year() > 0 {
  341. b = strconv.AppendInt(b, int64(t.Year()), 10)
  342. } else {
  343. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  344. }
  345. return string(b)
  346. }
  347. // FmtDateFull returns the full date representation of 't' for 'fr_CA'
  348. func (fr *fr_CA) FmtDateFull(t time.Time) string {
  349. b := make([]byte, 0, 32)
  350. b = append(b, fr.daysWide[t.Weekday()]...)
  351. b = append(b, []byte{0x20}...)
  352. b = strconv.AppendInt(b, int64(t.Day()), 10)
  353. b = append(b, []byte{0x20}...)
  354. b = append(b, fr.monthsWide[t.Month()]...)
  355. b = append(b, []byte{0x20}...)
  356. if t.Year() > 0 {
  357. b = strconv.AppendInt(b, int64(t.Year()), 10)
  358. } else {
  359. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  360. }
  361. return string(b)
  362. }
  363. // FmtTimeShort returns the short time representation of 't' for 'fr_CA'
  364. func (fr *fr_CA) FmtTimeShort(t time.Time) string {
  365. b := make([]byte, 0, 32)
  366. if t.Hour() < 10 {
  367. b = append(b, '0')
  368. }
  369. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  370. b = append(b, []byte{0x20, 0x68}...)
  371. b = append(b, []byte{0x20}...)
  372. if t.Minute() < 10 {
  373. b = append(b, '0')
  374. }
  375. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  376. return string(b)
  377. }
  378. // FmtTimeMedium returns the medium time representation of 't' for 'fr_CA'
  379. func (fr *fr_CA) FmtTimeMedium(t time.Time) string {
  380. b := make([]byte, 0, 32)
  381. if t.Hour() < 10 {
  382. b = append(b, '0')
  383. }
  384. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  385. b = append(b, []byte{0x20, 0x68}...)
  386. b = append(b, []byte{0x20}...)
  387. if t.Minute() < 10 {
  388. b = append(b, '0')
  389. }
  390. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  391. b = append(b, []byte{0x20, 0x6d, 0x69, 0x6e}...)
  392. b = append(b, []byte{0x20}...)
  393. if t.Second() < 10 {
  394. b = append(b, '0')
  395. }
  396. b = strconv.AppendInt(b, int64(t.Second()), 10)
  397. b = append(b, []byte{0x20, 0x73}...)
  398. return string(b)
  399. }
  400. // FmtTimeLong returns the long time representation of 't' for 'fr_CA'
  401. func (fr *fr_CA) FmtTimeLong(t time.Time) string {
  402. b := make([]byte, 0, 32)
  403. if t.Hour() < 10 {
  404. b = append(b, '0')
  405. }
  406. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  407. b = append(b, []byte{0x20, 0x68}...)
  408. b = append(b, []byte{0x20}...)
  409. if t.Minute() < 10 {
  410. b = append(b, '0')
  411. }
  412. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  413. b = append(b, []byte{0x20, 0x6d, 0x69, 0x6e}...)
  414. b = append(b, []byte{0x20}...)
  415. if t.Second() < 10 {
  416. b = append(b, '0')
  417. }
  418. b = strconv.AppendInt(b, int64(t.Second()), 10)
  419. b = append(b, []byte{0x20, 0x73}...)
  420. b = append(b, []byte{0x20}...)
  421. tz, _ := t.Zone()
  422. b = append(b, tz...)
  423. return string(b)
  424. }
  425. // FmtTimeFull returns the full time representation of 't' for 'fr_CA'
  426. func (fr *fr_CA) FmtTimeFull(t time.Time) string {
  427. b := make([]byte, 0, 32)
  428. if t.Hour() < 10 {
  429. b = append(b, '0')
  430. }
  431. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  432. b = append(b, []byte{0x20, 0x68}...)
  433. b = append(b, []byte{0x20}...)
  434. if t.Minute() < 10 {
  435. b = append(b, '0')
  436. }
  437. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  438. b = append(b, []byte{0x20, 0x6d, 0x69, 0x6e}...)
  439. b = append(b, []byte{0x20}...)
  440. if t.Second() < 10 {
  441. b = append(b, '0')
  442. }
  443. b = strconv.AppendInt(b, int64(t.Second()), 10)
  444. b = append(b, []byte{0x20, 0x73}...)
  445. b = append(b, []byte{0x20}...)
  446. tz, _ := t.Zone()
  447. if btz, ok := fr.timezones[tz]; ok {
  448. b = append(b, btz...)
  449. } else {
  450. b = append(b, tz...)
  451. }
  452. return string(b)
  453. }