...

Source file src/github.com/go-playground/locales/fr_CA/fr_CA.go

Documentation: github.com/go-playground/locales/fr_CA

     1  package fr_CA
     2  
     3  import (
     4  	"math"
     5  	"strconv"
     6  	"time"
     7  
     8  	"github.com/go-playground/locales"
     9  	"github.com/go-playground/locales/currency"
    10  )
    11  
    12  type fr_CA struct {
    13  	locale                 string
    14  	pluralsCardinal        []locales.PluralRule
    15  	pluralsOrdinal         []locales.PluralRule
    16  	pluralsRange           []locales.PluralRule
    17  	decimal                string
    18  	group                  string
    19  	minus                  string
    20  	percent                string
    21  	percentSuffix          string
    22  	perMille               string
    23  	timeSeparator          string
    24  	inifinity              string
    25  	currencies             []string // idx = enum of currency code
    26  	currencyPositiveSuffix string
    27  	currencyNegativeSuffix string
    28  	monthsAbbreviated      []string
    29  	monthsNarrow           []string
    30  	monthsWide             []string
    31  	daysAbbreviated        []string
    32  	daysNarrow             []string
    33  	daysShort              []string
    34  	daysWide               []string
    35  	periodsAbbreviated     []string
    36  	periodsNarrow          []string
    37  	periodsShort           []string
    38  	periodsWide            []string
    39  	erasAbbreviated        []string
    40  	erasNarrow             []string
    41  	erasWide               []string
    42  	timezones              map[string]string
    43  }
    44  
    45  // New returns a new instance of translator for the 'fr_CA' locale
    46  func New() locales.Translator {
    47  	return &fr_CA{
    48  		locale:                 "fr_CA",
    49  		pluralsCardinal:        []locales.PluralRule{2, 6},
    50  		pluralsOrdinal:         []locales.PluralRule{2, 6},
    51  		pluralsRange:           []locales.PluralRule{2, 6},
    52  		decimal:                ",",
    53  		group:                  " ",
    54  		minus:                  "-",
    55  		percent:                "%",
    56  		perMille:               "‰",
    57  		timeSeparator:          ":",
    58  		inifinity:              "∞",
    59  		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", "MRU", "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", "UYW", "UZS", "VEB", "VEF", "VES", "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"},
    60  		percentSuffix:          " ",
    61  		currencyPositiveSuffix: " k",
    62  		currencyNegativeSuffix: " k",
    63  		monthsAbbreviated:      []string{"", "janv.", "févr.", "mars", "avr.", "mai", "juin", "juill.", "août", "sept.", "oct.", "nov.", "déc."},
    64  		monthsNarrow:           []string{"", "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"},
    65  		monthsWide:             []string{"", "janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre"},
    66  		daysAbbreviated:        []string{"dim.", "lun.", "mar.", "mer.", "jeu.", "ven.", "sam."},
    67  		daysNarrow:             []string{"D", "L", "M", "M", "J", "V", "S"},
    68  		daysShort:              []string{"di", "lu", "ma", "me", "je", "ve", "sa"},
    69  		daysWide:               []string{"dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"},
    70  		periodsAbbreviated:     []string{"a.m.", "p.m."},
    71  		periodsNarrow:          []string{"a", "p"},
    72  		periodsWide:            []string{"a.m.", "p.m."},
    73  		erasAbbreviated:        []string{"", ""},
    74  		erasNarrow:             []string{"", ""},
    75  		erasWide:               []string{"avant l’ère chrétienne", "de l’ère chrétienne"},
    76  		timezones:              map[string]string{"ACDT": "heure avancée du centre de l’Australie", "ACST": "heure normale du centre de l’Australie", "ACWDT": "heure avancée du centre-ouest de l’Australie", "ACWST": "heure normale du centre-ouest de l’Australie", "ADT": "heure avancée de l’Atlantique", "AEDT": "heure avancée de l’Est de l’Australie", "AEST": "heure normale de l’Est de l’Australie", "AKDT": "heure avancée de l’Alaska", "AKST": "heure normale de l’Alaska", "ARST": "heure avancée de l’Argentine", "ART": "heure normale d’Argentine", "AST": "heure normale de l’Atlantique", "AWDT": "heure avancée de l’Ouest de l’Australie", "AWST": "heure normale de l’Ouest de l’Australie", "BOT": "heure de Bolivie", "BT": "heure du Bhoutan", "CAT": "heure d’Afrique centrale", "CDT": "heure avancée du Centre", "CHADT": "heure avancée des Îles Chatham", "CHAST": "heure normale des Îles Chatham", "CLST": "heure avancée du Chili", "CLT": "heure normale du Chili", "COST": "heure avancée de Colombie", "COT": "heure normale de Colombie", "CST": "heure normale du Centre", "ChST": "heure des Chamorro", "EAT": "heure d’Afrique orientale", "ECT": "heure de l’Équateur", "EDT": "heure avancée de l’Est", "EST": "heure normale de l’Est", "GFT": "heure de Guyane française", "GMT": "heure moyenne de Greenwich", "GST": "heure du Golfe", "GYT": "heure du Guyana", "HADT": "heure avancée d’Hawaï-Aléoutiennes", "HAST": "heure normale d’Hawaï-Aléoutiennes", "HAT": "heure avancée de Terre-Neuve", "HECU": "heure avancée de Cuba", "HEEG": "heure avancée de l’Est du Groenland", "HENOMX": "heure avancée du Nord-Ouest du Mexique", "HEOG": "heure avancée de l’Ouest du Groenland", "HEPM": "heure avancée de Saint-Pierre-et-Miquelon", "HEPMX": "heure avancée du Pacifique mexicain", "HKST": "heure avancée de Hong Kong", "HKT": "heure normale de Hong Kong", "HNCU": "heure normale de Cuba", "HNEG": "heure normale de l’Est du Groenland", "HNNOMX": "heure normale du Nord-Ouest du Mexique", "HNOG": "heure normale de l’Ouest du Groenland", "HNPM": "heure normale de Saint-Pierre-et-Miquelon", "HNPMX": "heure normale du Pacifique mexicain", "HNT": "heure normale de Terre-Neuve", "IST": "heure de l’Inde", "JDT": "heure avancée du Japon", "JST": "heure normale du Japon", "LHDT": "heure avancée de Lord Howe", "LHST": "heure normale de Lord Howe", "MDT": "heure avancée des Rocheuses", "MESZ": "heure avancée d’Europe centrale", "MEZ": "heure normale d’Europe centrale", "MST": "heure normale des Rocheuses", "MYT": "heure de la Malaisie", "NZDT": "heure avancée de la Nouvelle-Zélande", "NZST": "heure normale de la Nouvelle-Zélande", "OESZ": "heure avancée d’Europe de l’Est", "OEZ": "heure normale d’Europe de l’Est", "PDT": "heure avancée du Pacifique", "PST": "heure normale du Pacifique", "SAST": "heure normale d’Afrique du Sud", "SGT": "heure de Singapour", "SRT": "heure du Suriname", "TMST": "heure avancée du Turkménistan", "TMT": "heure normale du Turkménistan", "UYST": "heure avancée de l’Uruguay", "UYT": "heure normale de l’Uruguay", "VET": "heure du Venezuela", "WARST": "heure avancée de l’Ouest argentin", "WART": "heure normale de l’Ouest argentin", "WAST": "heure avancée d’Afrique de l’Ouest", "WAT": "heure normale d’Afrique de l’Ouest", "WESZ": "heure avancée d’Europe de l’Ouest", "WEZ": "heure normale d’Europe de l’Ouest", "WIB": "heure de l’Ouest indonésien", "WIT": "heure de l’Est indonésien", "WITA": "heure du Centre indonésien", "∅∅∅": "heure avancée de Brasilia"},
    77  	}
    78  }
    79  
    80  // Locale returns the current translators string locale
    81  func (fr *fr_CA) Locale() string {
    82  	return fr.locale
    83  }
    84  
    85  // PluralsCardinal returns the list of cardinal plural rules associated with 'fr_CA'
    86  func (fr *fr_CA) PluralsCardinal() []locales.PluralRule {
    87  	return fr.pluralsCardinal
    88  }
    89  
    90  // PluralsOrdinal returns the list of ordinal plural rules associated with 'fr_CA'
    91  func (fr *fr_CA) PluralsOrdinal() []locales.PluralRule {
    92  	return fr.pluralsOrdinal
    93  }
    94  
    95  // PluralsRange returns the list of range plural rules associated with 'fr_CA'
    96  func (fr *fr_CA) PluralsRange() []locales.PluralRule {
    97  	return fr.pluralsRange
    98  }
    99  
   100  // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'fr_CA'
   101  func (fr *fr_CA) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
   102  
   103  	n := math.Abs(num)
   104  	i := int64(n)
   105  
   106  	if i == 0 || i == 1 {
   107  		return locales.PluralRuleOne
   108  	}
   109  
   110  	return locales.PluralRuleOther
   111  }
   112  
   113  // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'fr_CA'
   114  func (fr *fr_CA) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
   115  
   116  	n := math.Abs(num)
   117  
   118  	if n == 1 {
   119  		return locales.PluralRuleOne
   120  	}
   121  
   122  	return locales.PluralRuleOther
   123  }
   124  
   125  // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'fr_CA'
   126  func (fr *fr_CA) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
   127  
   128  	start := fr.CardinalPluralRule(num1, v1)
   129  	end := fr.CardinalPluralRule(num2, v2)
   130  
   131  	if start == locales.PluralRuleOne && end == locales.PluralRuleOne {
   132  		return locales.PluralRuleOne
   133  	} else if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
   134  		return locales.PluralRuleOther
   135  	}
   136  
   137  	return locales.PluralRuleOther
   138  
   139  }
   140  
   141  // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
   142  func (fr *fr_CA) MonthAbbreviated(month time.Month) string {
   143  	return fr.monthsAbbreviated[month]
   144  }
   145  
   146  // MonthsAbbreviated returns the locales abbreviated months
   147  func (fr *fr_CA) MonthsAbbreviated() []string {
   148  	return fr.monthsAbbreviated[1:]
   149  }
   150  
   151  // MonthNarrow returns the locales narrow month given the 'month' provided
   152  func (fr *fr_CA) MonthNarrow(month time.Month) string {
   153  	return fr.monthsNarrow[month]
   154  }
   155  
   156  // MonthsNarrow returns the locales narrow months
   157  func (fr *fr_CA) MonthsNarrow() []string {
   158  	return fr.monthsNarrow[1:]
   159  }
   160  
   161  // MonthWide returns the locales wide month given the 'month' provided
   162  func (fr *fr_CA) MonthWide(month time.Month) string {
   163  	return fr.monthsWide[month]
   164  }
   165  
   166  // MonthsWide returns the locales wide months
   167  func (fr *fr_CA) MonthsWide() []string {
   168  	return fr.monthsWide[1:]
   169  }
   170  
   171  // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
   172  func (fr *fr_CA) WeekdayAbbreviated(weekday time.Weekday) string {
   173  	return fr.daysAbbreviated[weekday]
   174  }
   175  
   176  // WeekdaysAbbreviated returns the locales abbreviated weekdays
   177  func (fr *fr_CA) WeekdaysAbbreviated() []string {
   178  	return fr.daysAbbreviated
   179  }
   180  
   181  // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
   182  func (fr *fr_CA) WeekdayNarrow(weekday time.Weekday) string {
   183  	return fr.daysNarrow[weekday]
   184  }
   185  
   186  // WeekdaysNarrow returns the locales narrow weekdays
   187  func (fr *fr_CA) WeekdaysNarrow() []string {
   188  	return fr.daysNarrow
   189  }
   190  
   191  // WeekdayShort returns the locales short weekday given the 'weekday' provided
   192  func (fr *fr_CA) WeekdayShort(weekday time.Weekday) string {
   193  	return fr.daysShort[weekday]
   194  }
   195  
   196  // WeekdaysShort returns the locales short weekdays
   197  func (fr *fr_CA) WeekdaysShort() []string {
   198  	return fr.daysShort
   199  }
   200  
   201  // WeekdayWide returns the locales wide weekday given the 'weekday' provided
   202  func (fr *fr_CA) WeekdayWide(weekday time.Weekday) string {
   203  	return fr.daysWide[weekday]
   204  }
   205  
   206  // WeekdaysWide returns the locales wide weekdays
   207  func (fr *fr_CA) WeekdaysWide() []string {
   208  	return fr.daysWide
   209  }
   210  
   211  // Decimal returns the decimal point of number
   212  func (fr *fr_CA) Decimal() string {
   213  	return fr.decimal
   214  }
   215  
   216  // Group returns the group of number
   217  func (fr *fr_CA) Group() string {
   218  	return fr.group
   219  }
   220  
   221  // Group returns the minus sign of number
   222  func (fr *fr_CA) Minus() string {
   223  	return fr.minus
   224  }
   225  
   226  // FmtNumber returns 'num' with digits/precision of 'v' for 'fr_CA' and handles both Whole and Real numbers based on 'v'
   227  func (fr *fr_CA) FmtNumber(num float64, v uint64) string {
   228  
   229  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   230  	l := len(s) + 2 + 2*len(s[:len(s)-int(v)-1])/3
   231  	count := 0
   232  	inWhole := v == 0
   233  	b := make([]byte, 0, l)
   234  
   235  	for i := len(s) - 1; i >= 0; i-- {
   236  
   237  		if s[i] == '.' {
   238  			b = append(b, fr.decimal[0])
   239  			inWhole = true
   240  			continue
   241  		}
   242  
   243  		if inWhole {
   244  			if count == 3 {
   245  				for j := len(fr.group) - 1; j >= 0; j-- {
   246  					b = append(b, fr.group[j])
   247  				}
   248  				count = 1
   249  			} else {
   250  				count++
   251  			}
   252  		}
   253  
   254  		b = append(b, s[i])
   255  	}
   256  
   257  	if num < 0 {
   258  		b = append(b, fr.minus[0])
   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  
   266  	return string(b)
   267  }
   268  
   269  // FmtPercent returns 'num' with digits/precision of 'v' for 'fr_CA' and handles both Whole and Real numbers based on 'v'
   270  // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
   271  func (fr *fr_CA) FmtPercent(num float64, v uint64) string {
   272  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   273  	l := len(s) + 5
   274  	b := make([]byte, 0, l)
   275  
   276  	for i := len(s) - 1; i >= 0; i-- {
   277  
   278  		if s[i] == '.' {
   279  			b = append(b, fr.decimal[0])
   280  			continue
   281  		}
   282  
   283  		b = append(b, s[i])
   284  	}
   285  
   286  	if num < 0 {
   287  		b = append(b, fr.minus[0])
   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  
   295  	b = append(b, fr.percentSuffix...)
   296  
   297  	b = append(b, fr.percent...)
   298  
   299  	return string(b)
   300  }
   301  
   302  // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'fr_CA'
   303  func (fr *fr_CA) FmtCurrency(num float64, v uint64, currency currency.Type) string {
   304  
   305  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   306  	symbol := fr.currencies[currency]
   307  	l := len(s) + len(symbol) + 5
   308  
   309  	b := make([]byte, 0, l)
   310  
   311  	for i := len(s) - 1; i >= 0; i-- {
   312  
   313  		if s[i] == '.' {
   314  			b = append(b, fr.decimal[0])
   315  			continue
   316  		}
   317  
   318  		b = append(b, s[i])
   319  	}
   320  
   321  	if num < 0 {
   322  		b = append(b, fr.minus[0])
   323  	}
   324  
   325  	// reverse
   326  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   327  		b[i], b[j] = b[j], b[i]
   328  	}
   329  
   330  	b = append(b, fr.currencyPositiveSuffix...)
   331  
   332  	b = append(b, symbol...)
   333  
   334  	return string(b)
   335  }
   336  
   337  // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_CA'
   338  // in accounting notation.
   339  func (fr *fr_CA) FmtAccounting(num float64, v uint64, currency currency.Type) string {
   340  
   341  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   342  	symbol := fr.currencies[currency]
   343  	l := len(s) + len(symbol) + 5
   344  
   345  	b := make([]byte, 0, l)
   346  
   347  	for i := len(s) - 1; i >= 0; i-- {
   348  
   349  		if s[i] == '.' {
   350  			b = append(b, fr.decimal[0])
   351  			continue
   352  		}
   353  
   354  		b = append(b, s[i])
   355  	}
   356  
   357  	if num < 0 {
   358  
   359  		b = append(b, fr.minus[0])
   360  
   361  	}
   362  
   363  	// reverse
   364  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   365  		b[i], b[j] = b[j], b[i]
   366  	}
   367  
   368  	if num < 0 {
   369  		b = append(b, fr.currencyNegativeSuffix...)
   370  		b = append(b, symbol...)
   371  	} else {
   372  
   373  		b = append(b, fr.currencyPositiveSuffix...)
   374  		b = append(b, symbol...)
   375  	}
   376  
   377  	return string(b)
   378  }
   379  
   380  // FmtDateShort returns the short date representation of 't' for 'fr_CA'
   381  func (fr *fr_CA) FmtDateShort(t time.Time) string {
   382  
   383  	b := make([]byte, 0, 32)
   384  
   385  	if t.Year() > 0 {
   386  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   387  	} else {
   388  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   389  	}
   390  
   391  	b = append(b, []byte{0x2d}...)
   392  
   393  	if t.Month() < 10 {
   394  		b = append(b, '0')
   395  	}
   396  
   397  	b = strconv.AppendInt(b, int64(t.Month()), 10)
   398  
   399  	b = append(b, []byte{0x2d}...)
   400  
   401  	if t.Day() < 10 {
   402  		b = append(b, '0')
   403  	}
   404  
   405  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   406  
   407  	return string(b)
   408  }
   409  
   410  // FmtDateMedium returns the medium date representation of 't' for 'fr_CA'
   411  func (fr *fr_CA) FmtDateMedium(t time.Time) string {
   412  
   413  	b := make([]byte, 0, 32)
   414  
   415  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   416  	b = append(b, []byte{0x20}...)
   417  	b = append(b, fr.monthsAbbreviated[t.Month()]...)
   418  	b = append(b, []byte{0x20}...)
   419  
   420  	if t.Year() > 0 {
   421  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   422  	} else {
   423  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   424  	}
   425  
   426  	return string(b)
   427  }
   428  
   429  // FmtDateLong returns the long date representation of 't' for 'fr_CA'
   430  func (fr *fr_CA) FmtDateLong(t time.Time) string {
   431  
   432  	b := make([]byte, 0, 32)
   433  
   434  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   435  	b = append(b, []byte{0x20}...)
   436  	b = append(b, fr.monthsWide[t.Month()]...)
   437  	b = append(b, []byte{0x20}...)
   438  
   439  	if t.Year() > 0 {
   440  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   441  	} else {
   442  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   443  	}
   444  
   445  	return string(b)
   446  }
   447  
   448  // FmtDateFull returns the full date representation of 't' for 'fr_CA'
   449  func (fr *fr_CA) FmtDateFull(t time.Time) string {
   450  
   451  	b := make([]byte, 0, 32)
   452  
   453  	b = append(b, fr.daysWide[t.Weekday()]...)
   454  	b = append(b, []byte{0x20}...)
   455  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   456  	b = append(b, []byte{0x20}...)
   457  	b = append(b, fr.monthsWide[t.Month()]...)
   458  	b = append(b, []byte{0x20}...)
   459  
   460  	if t.Year() > 0 {
   461  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   462  	} else {
   463  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   464  	}
   465  
   466  	return string(b)
   467  }
   468  
   469  // FmtTimeShort returns the short time representation of 't' for 'fr_CA'
   470  func (fr *fr_CA) FmtTimeShort(t time.Time) string {
   471  
   472  	b := make([]byte, 0, 32)
   473  
   474  	if t.Hour() < 10 {
   475  		b = append(b, '0')
   476  	}
   477  
   478  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   479  	b = append(b, []byte{0x20, 0x68}...)
   480  	b = append(b, []byte{0x20}...)
   481  
   482  	if t.Minute() < 10 {
   483  		b = append(b, '0')
   484  	}
   485  
   486  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   487  
   488  	return string(b)
   489  }
   490  
   491  // FmtTimeMedium returns the medium time representation of 't' for 'fr_CA'
   492  func (fr *fr_CA) FmtTimeMedium(t time.Time) string {
   493  
   494  	b := make([]byte, 0, 32)
   495  
   496  	if t.Hour() < 10 {
   497  		b = append(b, '0')
   498  	}
   499  
   500  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   501  	b = append(b, []byte{0x20, 0x68}...)
   502  	b = append(b, []byte{0x20}...)
   503  
   504  	if t.Minute() < 10 {
   505  		b = append(b, '0')
   506  	}
   507  
   508  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   509  	b = append(b, []byte{0x20, 0x6d, 0x69, 0x6e}...)
   510  	b = append(b, []byte{0x20}...)
   511  
   512  	if t.Second() < 10 {
   513  		b = append(b, '0')
   514  	}
   515  
   516  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   517  	b = append(b, []byte{0x20, 0x73}...)
   518  
   519  	return string(b)
   520  }
   521  
   522  // FmtTimeLong returns the long time representation of 't' for 'fr_CA'
   523  func (fr *fr_CA) FmtTimeLong(t time.Time) string {
   524  
   525  	b := make([]byte, 0, 32)
   526  
   527  	if t.Hour() < 10 {
   528  		b = append(b, '0')
   529  	}
   530  
   531  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   532  	b = append(b, []byte{0x20, 0x68}...)
   533  	b = append(b, []byte{0x20}...)
   534  
   535  	if t.Minute() < 10 {
   536  		b = append(b, '0')
   537  	}
   538  
   539  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   540  	b = append(b, []byte{0x20, 0x6d, 0x69, 0x6e}...)
   541  	b = append(b, []byte{0x20}...)
   542  
   543  	if t.Second() < 10 {
   544  		b = append(b, '0')
   545  	}
   546  
   547  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   548  	b = append(b, []byte{0x20, 0x73}...)
   549  	b = append(b, []byte{0x20}...)
   550  
   551  	tz, _ := t.Zone()
   552  	b = append(b, tz...)
   553  
   554  	return string(b)
   555  }
   556  
   557  // FmtTimeFull returns the full time representation of 't' for 'fr_CA'
   558  func (fr *fr_CA) FmtTimeFull(t time.Time) string {
   559  
   560  	b := make([]byte, 0, 32)
   561  
   562  	if t.Hour() < 10 {
   563  		b = append(b, '0')
   564  	}
   565  
   566  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   567  	b = append(b, []byte{0x20, 0x68}...)
   568  	b = append(b, []byte{0x20}...)
   569  
   570  	if t.Minute() < 10 {
   571  		b = append(b, '0')
   572  	}
   573  
   574  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   575  	b = append(b, []byte{0x20, 0x6d, 0x69, 0x6e}...)
   576  	b = append(b, []byte{0x20}...)
   577  
   578  	if t.Second() < 10 {
   579  		b = append(b, '0')
   580  	}
   581  
   582  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   583  	b = append(b, []byte{0x20, 0x73}...)
   584  	b = append(b, []byte{0x20}...)
   585  
   586  	tz, _ := t.Zone()
   587  
   588  	if btz, ok := fr.timezones[tz]; ok {
   589  		b = append(b, btz...)
   590  	} else {
   591  		b = append(b, tz...)
   592  	}
   593  
   594  	return string(b)
   595  }
   596  

View as plain text