br_FR.go 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623
  1. package br_FR
  2. import (
  3. "math"
  4. "strconv"
  5. "time"
  6. "github.com/go-playground/locales"
  7. "github.com/go-playground/locales/currency"
  8. )
  9. type br_FR 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 'br_FR' locale
  42. func New() locales.Translator {
  43. return &br_FR{
  44. locale: "br_FR",
  45. pluralsCardinal: []locales.PluralRule{2, 3, 4, 5, 6},
  46. pluralsOrdinal: nil,
  47. pluralsRange: nil,
  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", "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", "BYN", "BYR", "BZD", "CAD", "CDF", "CHE", "CHF", "CHW", "CLE", "CLF", "CLP", "CNH", "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", "STN", "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"},
  56. percentSuffix: " ",
  57. currencyPositiveSuffix: " ",
  58. currencyNegativeSuffix: " ",
  59. monthsAbbreviated: []string{"", "Gen.", "Cʼhwe.", "Meur.", "Ebr.", "Mae", "Mezh.", "Goue.", "Eost", "Gwen.", "Here", "Du", "Kzu."},
  60. monthsNarrow: []string{"", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"},
  61. monthsWide: []string{"", "Genver", "Cʼhwevrer", "Meurzh", "Ebrel", "Mae", "Mezheven", "Gouere", "Eost", "Gwengolo", "Here", "Du", "Kerzu"},
  62. daysAbbreviated: []string{"Sul", "Lun", "Meu.", "Mer.", "Yaou", "Gwe.", "Sad."},
  63. daysNarrow: []string{"Su", "L", "Mz", "Mc", "Y", "G", "Sa"},
  64. daysShort: []string{"Sul", "Lun", "Meu.", "Mer.", "Yaou", "Gwe.", "Sad."},
  65. daysWide: []string{"Sul", "Lun", "Meurzh", "Mercʼher", "Yaou", "Gwener", "Sadorn"},
  66. periodsAbbreviated: []string{"A.M.", "G.M."},
  67. periodsNarrow: []string{"am", "gm"},
  68. periodsWide: []string{"A.M.", "G.M."},
  69. erasAbbreviated: []string{"a-raok J.K.", "goude J.K."},
  70. erasNarrow: []string{"a-raok J.K.", "goude J.K."},
  71. erasWide: []string{"a-raok Jezuz-Krist", "goude Jezuz-Krist"},
  72. timezones: map[string]string{"CAT": "eur Kreizafrika", "COT": "eur cʼhoañv Kolombia", "EDT": "eur hañv ar Reter", "ACST": "eur cʼhoañv Kreizaostralia", "LHST": "LHST", "CHADT": "eur hañv Chatham", "PST": "PST", "MDT": "eur hañv ar Menezioù", "WART": "eur cʼhoañv Arcʼhantina ar Cʼhornôg", "PDT": "PDT", "AWDT": "eur hañv Aostralia ar Cʼhornôg", "GFT": "eur Gwiana cʼhall", "NZST": "eur cʼhoañv Zeland-Nevez", "HNOG": "eur cʼhoañv Greunland ar Cʼhornôg", "OEZ": "eur cʼhoañv Europa ar Reter", "ARST": "eur hañv Arcʼhantina", "CST": "CST", "OESZ": "eur hañv Europa ar Reter", "ART": "eur cʼhoañv Arcʼhantina", "AEDT": "eur hañv Aostralia ar Reter", "ACWST": "eur cʼhoañv Kreizaostralia ar Cʼhornôg", "SRT": "eur Surinam", "COST": "eur hañv Kolombia", "∅∅∅": "eur hañv an Amazon", "HADT": "HADT", "SAST": "eur cʼhoañv Suafrika", "EST": "eur cʼhoañv ar Reter", "VET": "eur Venezuela", "HNCU": "eur cʼhoañv Kuba", "HKST": "eur hañv Hong Kong", "HNT": "eur cʼhoañv Newfoundland", "EAT": "eur Afrika ar Reter", "CLST": "eur hañv Chile", "GMT": "Amzer keitat Greenwich (AKG)", "MST": "eur cʼhoañv ar Menezioù", "WEZ": "eur cʼhoañv Europa ar Cʼhornôg", "WESZ": "eur hañv Europa ar Cʼhornôg", "ACWDT": "eur hañv Kreizaostralia ar Cʼhornôg", "TMST": "eur hañv Turkmenistan", "GYT": "eur Guyana", "ChST": "ChST", "BT": "eur Bhoutan", "NZDT": "eur hañv Zeland-Nevez", "AKDT": "eur hañv Alaska", "WITA": "WITA", "TMT": "eur cʼhoañv Turkmenistan", "HAST": "HAST", "HECU": "eur hañv Kuba", "CDT": "CDT", "ECT": "eur Ecuador", "HNPMX": "HNPMX", "HEPMX": "HEPMX", "AST": "AST", "AEST": "eur cʼhoañv Aostralia ar Reter", "AKST": "eur cʼhoañv Alaska", "SGT": "eur cʼhoañv Singapour", "HEOG": "eur hañv Greunland ar Cʼhornôg", "ACDT": "eur hañv Kreizaostralia", "MEZ": "eur cʼhoañv Kreizeuropa", "HENOMX": "eur hañv Gwalarn Mecʼhiko", "WIT": "eur Indonezia ar Reter", "CLT": "eur cʼhoañv Chile", "UYST": "eur hañv Uruguay", "CHAST": "eur cʼhoañv Chatham", "WAST": "eur hañv Afrika ar Cʼhornôg", "HNEG": "eur cʼhoañv Greunland ar Reter", "HEEG": "eur hañv Greunland ar Reter", "HNPM": "eur cʼhoañv Sant-Pêr-ha-Mikelon", "ADT": "ADT", "JST": "eur cʼhoañv Japan", "MYT": "eur Malaysia", "MESZ": "eur hañv Kreizeuropa", "WARST": "eur hañv Arcʼhantina ar Cʼhornôg", "HNNOMX": "eur cʼhoañv Gwalarn Mecʼhiko", "WAT": "eur cʼhoañv Afrika ar Cʼhornôg", "BOT": "eur Bolivia", "JDT": "eur hañv Japan", "HKT": "eur cʼhoañv Hong Kong", "IST": "eur cʼhoañv India", "LHDT": "LHDT", "HAT": "eur hañv Newfoundland", "UYT": "eur cʼhoañv Uruguay", "HEPM": "eur hañv Sant-Pêr-ha-Mikelon", "AWST": "eur cʼhoañv Aostralia ar Cʼhornôg", "WIB": "eur Indonezia ar Cʼhornôg"},
  73. }
  74. }
  75. // Locale returns the current translators string locale
  76. func (br *br_FR) Locale() string {
  77. return br.locale
  78. }
  79. // PluralsCardinal returns the list of cardinal plural rules associated with 'br_FR'
  80. func (br *br_FR) PluralsCardinal() []locales.PluralRule {
  81. return br.pluralsCardinal
  82. }
  83. // PluralsOrdinal returns the list of ordinal plural rules associated with 'br_FR'
  84. func (br *br_FR) PluralsOrdinal() []locales.PluralRule {
  85. return br.pluralsOrdinal
  86. }
  87. // PluralsRange returns the list of range plural rules associated with 'br_FR'
  88. func (br *br_FR) PluralsRange() []locales.PluralRule {
  89. return br.pluralsRange
  90. }
  91. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'br_FR'
  92. func (br *br_FR) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
  93. n := math.Abs(num)
  94. nMod1000000 := math.Mod(n, 1000000)
  95. nMod10 := math.Mod(n, 10)
  96. nMod100 := math.Mod(n, 100)
  97. if nMod10 == 1 && (nMod100 != 11 && nMod100 != 71 && nMod100 != 91) {
  98. return locales.PluralRuleOne
  99. } else if nMod10 == 2 && (nMod100 != 12 && nMod100 != 72 && nMod100 != 92) {
  100. return locales.PluralRuleTwo
  101. } else if nMod10 >= 3 && nMod10 <= 4 && (nMod10 == 9) && (nMod100 < 10 || nMod100 > 19) || (nMod100 < 70 || nMod100 > 79) || (nMod100 < 90 || nMod100 > 99) {
  102. return locales.PluralRuleFew
  103. } else if n != 0 && nMod1000000 == 0 {
  104. return locales.PluralRuleMany
  105. }
  106. return locales.PluralRuleOther
  107. }
  108. // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'br_FR'
  109. func (br *br_FR) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
  110. return locales.PluralRuleUnknown
  111. }
  112. // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'br_FR'
  113. func (br *br_FR) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
  114. return locales.PluralRuleUnknown
  115. }
  116. // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
  117. func (br *br_FR) MonthAbbreviated(month time.Month) string {
  118. return br.monthsAbbreviated[month]
  119. }
  120. // MonthsAbbreviated returns the locales abbreviated months
  121. func (br *br_FR) MonthsAbbreviated() []string {
  122. return br.monthsAbbreviated[1:]
  123. }
  124. // MonthNarrow returns the locales narrow month given the 'month' provided
  125. func (br *br_FR) MonthNarrow(month time.Month) string {
  126. return br.monthsNarrow[month]
  127. }
  128. // MonthsNarrow returns the locales narrow months
  129. func (br *br_FR) MonthsNarrow() []string {
  130. return br.monthsNarrow[1:]
  131. }
  132. // MonthWide returns the locales wide month given the 'month' provided
  133. func (br *br_FR) MonthWide(month time.Month) string {
  134. return br.monthsWide[month]
  135. }
  136. // MonthsWide returns the locales wide months
  137. func (br *br_FR) MonthsWide() []string {
  138. return br.monthsWide[1:]
  139. }
  140. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  141. func (br *br_FR) WeekdayAbbreviated(weekday time.Weekday) string {
  142. return br.daysAbbreviated[weekday]
  143. }
  144. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  145. func (br *br_FR) WeekdaysAbbreviated() []string {
  146. return br.daysAbbreviated
  147. }
  148. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  149. func (br *br_FR) WeekdayNarrow(weekday time.Weekday) string {
  150. return br.daysNarrow[weekday]
  151. }
  152. // WeekdaysNarrow returns the locales narrow weekdays
  153. func (br *br_FR) WeekdaysNarrow() []string {
  154. return br.daysNarrow
  155. }
  156. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  157. func (br *br_FR) WeekdayShort(weekday time.Weekday) string {
  158. return br.daysShort[weekday]
  159. }
  160. // WeekdaysShort returns the locales short weekdays
  161. func (br *br_FR) WeekdaysShort() []string {
  162. return br.daysShort
  163. }
  164. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  165. func (br *br_FR) WeekdayWide(weekday time.Weekday) string {
  166. return br.daysWide[weekday]
  167. }
  168. // WeekdaysWide returns the locales wide weekdays
  169. func (br *br_FR) WeekdaysWide() []string {
  170. return br.daysWide
  171. }
  172. // Decimal returns the decimal point of number
  173. func (br *br_FR) Decimal() string {
  174. return br.decimal
  175. }
  176. // Group returns the group of number
  177. func (br *br_FR) Group() string {
  178. return br.group
  179. }
  180. // Group returns the minus sign of number
  181. func (br *br_FR) Minus() string {
  182. return br.minus
  183. }
  184. // FmtNumber returns 'num' with digits/precision of 'v' for 'br_FR' and handles both Whole and Real numbers based on 'v'
  185. func (br *br_FR) FmtNumber(num float64, v uint64) string {
  186. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  187. l := len(s) + 2 + 2*len(s[:len(s)-int(v)-1])/3
  188. count := 0
  189. inWhole := v == 0
  190. b := make([]byte, 0, l)
  191. for i := len(s) - 1; i >= 0; i-- {
  192. if s[i] == '.' {
  193. b = append(b, br.decimal[0])
  194. inWhole = true
  195. continue
  196. }
  197. if inWhole {
  198. if count == 3 {
  199. for j := len(br.group) - 1; j >= 0; j-- {
  200. b = append(b, br.group[j])
  201. }
  202. count = 1
  203. } else {
  204. count++
  205. }
  206. }
  207. b = append(b, s[i])
  208. }
  209. if num < 0 {
  210. b = append(b, br.minus[0])
  211. }
  212. // reverse
  213. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  214. b[i], b[j] = b[j], b[i]
  215. }
  216. return string(b)
  217. }
  218. // FmtPercent returns 'num' with digits/precision of 'v' for 'br_FR' and handles both Whole and Real numbers based on 'v'
  219. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
  220. func (br *br_FR) FmtPercent(num float64, v uint64) string {
  221. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  222. l := len(s) + 5
  223. b := make([]byte, 0, l)
  224. for i := len(s) - 1; i >= 0; i-- {
  225. if s[i] == '.' {
  226. b = append(b, br.decimal[0])
  227. continue
  228. }
  229. b = append(b, s[i])
  230. }
  231. if num < 0 {
  232. b = append(b, br.minus[0])
  233. }
  234. // reverse
  235. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  236. b[i], b[j] = b[j], b[i]
  237. }
  238. b = append(b, br.percentSuffix...)
  239. b = append(b, br.percent...)
  240. return string(b)
  241. }
  242. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'br_FR'
  243. func (br *br_FR) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  244. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  245. symbol := br.currencies[currency]
  246. l := len(s) + len(symbol) + 4 + 2*len(s[:len(s)-int(v)-1])/3
  247. count := 0
  248. inWhole := v == 0
  249. b := make([]byte, 0, l)
  250. for i := len(s) - 1; i >= 0; i-- {
  251. if s[i] == '.' {
  252. b = append(b, br.decimal[0])
  253. inWhole = true
  254. continue
  255. }
  256. if inWhole {
  257. if count == 3 {
  258. for j := len(br.group) - 1; j >= 0; j-- {
  259. b = append(b, br.group[j])
  260. }
  261. count = 1
  262. } else {
  263. count++
  264. }
  265. }
  266. b = append(b, s[i])
  267. }
  268. if num < 0 {
  269. b = append(b, br.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, br.decimal...)
  278. }
  279. for i := 0; i < 2-int(v); i++ {
  280. b = append(b, '0')
  281. }
  282. }
  283. b = append(b, br.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 'br_FR'
  288. // in accounting notation.
  289. func (br *br_FR) FmtAccounting(num float64, v uint64, currency currency.Type) string {
  290. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  291. symbol := br.currencies[currency]
  292. l := len(s) + len(symbol) + 4 + 2*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, br.decimal[0])
  299. inWhole = true
  300. continue
  301. }
  302. if inWhole {
  303. if count == 3 {
  304. for j := len(br.group) - 1; j >= 0; j-- {
  305. b = append(b, br.group[j])
  306. }
  307. count = 1
  308. } else {
  309. count++
  310. }
  311. }
  312. b = append(b, s[i])
  313. }
  314. if num < 0 {
  315. b = append(b, br.minus[0])
  316. }
  317. // reverse
  318. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  319. b[i], b[j] = b[j], b[i]
  320. }
  321. if int(v) < 2 {
  322. if v == 0 {
  323. b = append(b, br.decimal...)
  324. }
  325. for i := 0; i < 2-int(v); i++ {
  326. b = append(b, '0')
  327. }
  328. }
  329. if num < 0 {
  330. b = append(b, br.currencyNegativeSuffix...)
  331. b = append(b, symbol...)
  332. } else {
  333. b = append(b, br.currencyPositiveSuffix...)
  334. b = append(b, symbol...)
  335. }
  336. return string(b)
  337. }
  338. // FmtDateShort returns the short date representation of 't' for 'br_FR'
  339. func (br *br_FR) FmtDateShort(t time.Time) string {
  340. b := make([]byte, 0, 32)
  341. if t.Year() > 0 {
  342. b = strconv.AppendInt(b, int64(t.Year()), 10)
  343. } else {
  344. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  345. }
  346. b = append(b, []byte{0x2d}...)
  347. if t.Month() < 10 {
  348. b = append(b, '0')
  349. }
  350. b = strconv.AppendInt(b, int64(t.Month()), 10)
  351. b = append(b, []byte{0x2d}...)
  352. if t.Day() < 10 {
  353. b = append(b, '0')
  354. }
  355. b = strconv.AppendInt(b, int64(t.Day()), 10)
  356. return string(b)
  357. }
  358. // FmtDateMedium returns the medium date representation of 't' for 'br_FR'
  359. func (br *br_FR) FmtDateMedium(t time.Time) string {
  360. b := make([]byte, 0, 32)
  361. if t.Year() > 0 {
  362. b = strconv.AppendInt(b, int64(t.Year()), 10)
  363. } else {
  364. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  365. }
  366. b = append(b, []byte{0x20}...)
  367. b = append(b, br.monthsAbbreviated[t.Month()]...)
  368. b = append(b, []byte{0x20}...)
  369. b = strconv.AppendInt(b, int64(t.Day()), 10)
  370. return string(b)
  371. }
  372. // FmtDateLong returns the long date representation of 't' for 'br_FR'
  373. func (br *br_FR) FmtDateLong(t time.Time) string {
  374. b := make([]byte, 0, 32)
  375. if t.Year() > 0 {
  376. b = strconv.AppendInt(b, int64(t.Year()), 10)
  377. } else {
  378. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  379. }
  380. b = append(b, []byte{0x20}...)
  381. b = append(b, br.monthsWide[t.Month()]...)
  382. b = append(b, []byte{0x20}...)
  383. b = strconv.AppendInt(b, int64(t.Day()), 10)
  384. return string(b)
  385. }
  386. // FmtDateFull returns the full date representation of 't' for 'br_FR'
  387. func (br *br_FR) FmtDateFull(t time.Time) string {
  388. b := make([]byte, 0, 32)
  389. if t.Year() > 0 {
  390. b = strconv.AppendInt(b, int64(t.Year()), 10)
  391. } else {
  392. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  393. }
  394. b = append(b, []byte{0x20}...)
  395. b = append(b, br.monthsWide[t.Month()]...)
  396. b = append(b, []byte{0x20}...)
  397. b = strconv.AppendInt(b, int64(t.Day()), 10)
  398. b = append(b, []byte{0x2c, 0x20}...)
  399. b = append(b, br.daysWide[t.Weekday()]...)
  400. return string(b)
  401. }
  402. // FmtTimeShort returns the short time representation of 't' for 'br_FR'
  403. func (br *br_FR) FmtTimeShort(t time.Time) string {
  404. b := make([]byte, 0, 32)
  405. if t.Hour() < 10 {
  406. b = append(b, '0')
  407. }
  408. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  409. b = append(b, br.timeSeparator...)
  410. if t.Minute() < 10 {
  411. b = append(b, '0')
  412. }
  413. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  414. return string(b)
  415. }
  416. // FmtTimeMedium returns the medium time representation of 't' for 'br_FR'
  417. func (br *br_FR) FmtTimeMedium(t time.Time) string {
  418. b := make([]byte, 0, 32)
  419. if t.Hour() < 10 {
  420. b = append(b, '0')
  421. }
  422. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  423. b = append(b, br.timeSeparator...)
  424. if t.Minute() < 10 {
  425. b = append(b, '0')
  426. }
  427. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  428. b = append(b, br.timeSeparator...)
  429. if t.Second() < 10 {
  430. b = append(b, '0')
  431. }
  432. b = strconv.AppendInt(b, int64(t.Second()), 10)
  433. return string(b)
  434. }
  435. // FmtTimeLong returns the long time representation of 't' for 'br_FR'
  436. func (br *br_FR) FmtTimeLong(t time.Time) string {
  437. b := make([]byte, 0, 32)
  438. if t.Hour() < 10 {
  439. b = append(b, '0')
  440. }
  441. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  442. b = append(b, br.timeSeparator...)
  443. if t.Minute() < 10 {
  444. b = append(b, '0')
  445. }
  446. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  447. b = append(b, br.timeSeparator...)
  448. if t.Second() < 10 {
  449. b = append(b, '0')
  450. }
  451. b = strconv.AppendInt(b, int64(t.Second()), 10)
  452. b = append(b, []byte{0x20}...)
  453. tz, _ := t.Zone()
  454. b = append(b, tz...)
  455. return string(b)
  456. }
  457. // FmtTimeFull returns the full time representation of 't' for 'br_FR'
  458. func (br *br_FR) FmtTimeFull(t time.Time) string {
  459. b := make([]byte, 0, 32)
  460. if t.Hour() < 10 {
  461. b = append(b, '0')
  462. }
  463. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  464. b = append(b, br.timeSeparator...)
  465. if t.Minute() < 10 {
  466. b = append(b, '0')
  467. }
  468. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  469. b = append(b, br.timeSeparator...)
  470. if t.Second() < 10 {
  471. b = append(b, '0')
  472. }
  473. b = strconv.AppendInt(b, int64(t.Second()), 10)
  474. b = append(b, []byte{0x20}...)
  475. tz, _ := t.Zone()
  476. if btz, ok := br.timezones[tz]; ok {
  477. b = append(b, btz...)
  478. } else {
  479. b = append(b, tz...)
  480. }
  481. return string(b)
  482. }