...

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

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

     1  package es_CR
     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 es_CR 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  	monthsAbbreviated  []string
    27  	monthsNarrow       []string
    28  	monthsWide         []string
    29  	daysAbbreviated    []string
    30  	daysNarrow         []string
    31  	daysShort          []string
    32  	daysWide           []string
    33  	periodsAbbreviated []string
    34  	periodsNarrow      []string
    35  	periodsShort       []string
    36  	periodsWide        []string
    37  	erasAbbreviated    []string
    38  	erasNarrow         []string
    39  	erasWide           []string
    40  	timezones          map[string]string
    41  }
    42  
    43  // New returns a new instance of translator for the 'es_CR' locale
    44  func New() locales.Translator {
    45  	return &es_CR{
    46  		locale:             "es_CR",
    47  		pluralsCardinal:    []locales.PluralRule{2, 6},
    48  		pluralsOrdinal:     []locales.PluralRule{6},
    49  		pluralsRange:       []locales.PluralRule{6},
    50  		decimal:            ",",
    51  		group:              " ",
    52  		minus:              "-",
    53  		percent:            "%",
    54  		perMille:           "‰",
    55  		timeSeparator:      ":",
    56  		inifinity:          "∞",
    57  		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", "₡", "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", "MRU", "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", "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", "ZMW", "ZRN", "ZRZ", "ZWD", "ZWL", "ZWR"},
    58  		percentSuffix:      " ",
    59  		monthsAbbreviated:  []string{"", "ene.", "feb.", "mar.", "abr.", "may.", "jun.", "jul.", "ago.", "sep.", "oct.", "nov.", "dic."},
    60  		monthsNarrow:       []string{"", "E", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"},
    61  		monthsWide:         []string{"", "enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"},
    62  		daysAbbreviated:    []string{"dom.", "lun.", "mar.", "mié.", "jue.", "vie.", "sáb."},
    63  		daysNarrow:         []string{"d", "l", "m", "m", "j", "v", "s"},
    64  		daysShort:          []string{"DO", "LU", "MA", "MI", "JU", "VI", "SA"},
    65  		daysWide:           []string{"domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado"},
    66  		periodsAbbreviated: []string{"a.\u00a0m.", "p.\u00a0m."},
    67  		periodsNarrow:      []string{"a.\u00a0m.", "p.\u00a0m."},
    68  		periodsWide:        []string{"a.\u00a0m.", "p.\u00a0m."},
    69  		erasAbbreviated:    []string{"a. C.", "d. C."},
    70  		erasNarrow:         []string{"", ""},
    71  		erasWide:           []string{"antes de Cristo", "después de Cristo"},
    72  		timezones:          map[string]string{"ACDT": "hora de verano de Australia central", "ACST": "hora estándar de Australia central", "ACWDT": "hora de verano de Australia centroccidental", "ACWST": "hora estándar de Australia centroccidental", "ADT": "hora de verano del Atlántico", "AEDT": "hora de verano de Australia oriental", "AEST": "hora estándar de Australia oriental", "AKDT": "hora de verano de Alaska", "AKST": "hora estándar de Alaska", "ARST": "hora de verano de Argentina", "ART": "hora estándar de Argentina", "AST": "hora estándar del Atlántico", "AWDT": "hora de verano de Australia occidental", "AWST": "hora estándar de Australia occidental", "BOT": "hora de Bolivia", "BT": "hora de Bután", "CAT": "hora de África central", "CDT": "hora de verano central", "CHADT": "hora de verano de Chatham", "CHAST": "hora estándar de Chatham", "CLST": "hora de verano de Chile", "CLT": "hora estándar de Chile", "COST": "hora de verano de Colombia", "COT": "hora estándar de Colombia", "CST": "hora estándar central", "ChST": "hora estándar de Chamorro", "EAT": "hora de África oriental", "ECT": "hora de Ecuador", "EDT": "hora de verano oriental", "EST": "hora estándar oriental", "GFT": "hora de la Guayana Francesa", "GMT": "hora del meridiano de Greenwich", "GST": "hora estándar del Golfo", "GYT": "hora de Guyana", "HADT": "hora de verano de Hawái-Aleutianas", "HAST": "hora estándar de Hawái-Aleutianas", "HAT": "hora de verano de Terranova", "HECU": "hora de verano de Cuba", "HEEG": "hora de verano de Groenlandia oriental", "HENOMX": "hora de verano del noroeste de México", "HEOG": "hora de verano de Groenlandia occidental", "HEPM": "hora de verano de San Pedro y Miquelón", "HEPMX": "hora de verano del Pacífico de México", "HKST": "hora de verano de Hong Kong", "HKT": "hora estándar de Hong Kong", "HNCU": "hora estándar de Cuba", "HNEG": "hora estándar de Groenlandia oriental", "HNNOMX": "hora estándar del noroeste de México", "HNOG": "hora estándar de Groenlandia occidental", "HNPM": "hora estándar de San Pedro y Miquelón", "HNPMX": "hora estándar del Pacífico de México", "HNT": "hora estándar de Terranova", "IST": "hora de India", "JDT": "hora de verano de Japón", "JST": "hora estándar de Japón", "LHDT": "hora de verano de Lord Howe", "LHST": "hora estándar de Lord Howe", "MDT": "hora de verano de la montaña", "MESZ": "hora de verano de Europa central", "MEZ": "hora estándar de Europa central", "MST": "hora estándar de la montaña", "MYT": "hora de Malasia", "NZDT": "hora de verano de Nueva Zelanda", "NZST": "hora estándar de Nueva Zelanda", "OESZ": "hora de verano de Europa del Este", "OEZ": "hora estándar de Europa del Este", "PDT": "hora de verano del Pacífico", "PST": "hora estándar del Pacífico", "SAST": "hora de Sudáfrica", "SGT": "hora de Singapur", "SRT": "hora de Surinam", "TMST": "hora de verano de Turkmenistán", "TMT": "hora estándar de Turkmenistán", "UYST": "hora de verano de Uruguay", "UYT": "hora estándar de Uruguay", "VET": "hora de Venezuela", "WARST": "hora de verano de Argentina occidental", "WART": "hora estándar de Argentina occidental", "WAST": "hora de verano de África occidental", "WAT": "hora estándar de África occidental", "WESZ": "hora de verano de Europa del Oeste", "WEZ": "hora estándar de Europa del Oeste", "WIB": "hora de Indonesia occidental", "WIT": "hora de Indonesia oriental", "WITA": "hora de Indonesia central", "∅∅∅": "hora de verano de Perú"},
    73  	}
    74  }
    75  
    76  // Locale returns the current translators string locale
    77  func (es *es_CR) Locale() string {
    78  	return es.locale
    79  }
    80  
    81  // PluralsCardinal returns the list of cardinal plural rules associated with 'es_CR'
    82  func (es *es_CR) PluralsCardinal() []locales.PluralRule {
    83  	return es.pluralsCardinal
    84  }
    85  
    86  // PluralsOrdinal returns the list of ordinal plural rules associated with 'es_CR'
    87  func (es *es_CR) PluralsOrdinal() []locales.PluralRule {
    88  	return es.pluralsOrdinal
    89  }
    90  
    91  // PluralsRange returns the list of range plural rules associated with 'es_CR'
    92  func (es *es_CR) PluralsRange() []locales.PluralRule {
    93  	return es.pluralsRange
    94  }
    95  
    96  // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'es_CR'
    97  func (es *es_CR) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
    98  
    99  	n := math.Abs(num)
   100  
   101  	if n == 1 {
   102  		return locales.PluralRuleOne
   103  	}
   104  
   105  	return locales.PluralRuleOther
   106  }
   107  
   108  // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'es_CR'
   109  func (es *es_CR) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
   110  	return locales.PluralRuleOther
   111  }
   112  
   113  // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'es_CR'
   114  func (es *es_CR) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
   115  	return locales.PluralRuleOther
   116  }
   117  
   118  // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
   119  func (es *es_CR) MonthAbbreviated(month time.Month) string {
   120  	return es.monthsAbbreviated[month]
   121  }
   122  
   123  // MonthsAbbreviated returns the locales abbreviated months
   124  func (es *es_CR) MonthsAbbreviated() []string {
   125  	return es.monthsAbbreviated[1:]
   126  }
   127  
   128  // MonthNarrow returns the locales narrow month given the 'month' provided
   129  func (es *es_CR) MonthNarrow(month time.Month) string {
   130  	return es.monthsNarrow[month]
   131  }
   132  
   133  // MonthsNarrow returns the locales narrow months
   134  func (es *es_CR) MonthsNarrow() []string {
   135  	return es.monthsNarrow[1:]
   136  }
   137  
   138  // MonthWide returns the locales wide month given the 'month' provided
   139  func (es *es_CR) MonthWide(month time.Month) string {
   140  	return es.monthsWide[month]
   141  }
   142  
   143  // MonthsWide returns the locales wide months
   144  func (es *es_CR) MonthsWide() []string {
   145  	return es.monthsWide[1:]
   146  }
   147  
   148  // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
   149  func (es *es_CR) WeekdayAbbreviated(weekday time.Weekday) string {
   150  	return es.daysAbbreviated[weekday]
   151  }
   152  
   153  // WeekdaysAbbreviated returns the locales abbreviated weekdays
   154  func (es *es_CR) WeekdaysAbbreviated() []string {
   155  	return es.daysAbbreviated
   156  }
   157  
   158  // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
   159  func (es *es_CR) WeekdayNarrow(weekday time.Weekday) string {
   160  	return es.daysNarrow[weekday]
   161  }
   162  
   163  // WeekdaysNarrow returns the locales narrow weekdays
   164  func (es *es_CR) WeekdaysNarrow() []string {
   165  	return es.daysNarrow
   166  }
   167  
   168  // WeekdayShort returns the locales short weekday given the 'weekday' provided
   169  func (es *es_CR) WeekdayShort(weekday time.Weekday) string {
   170  	return es.daysShort[weekday]
   171  }
   172  
   173  // WeekdaysShort returns the locales short weekdays
   174  func (es *es_CR) WeekdaysShort() []string {
   175  	return es.daysShort
   176  }
   177  
   178  // WeekdayWide returns the locales wide weekday given the 'weekday' provided
   179  func (es *es_CR) WeekdayWide(weekday time.Weekday) string {
   180  	return es.daysWide[weekday]
   181  }
   182  
   183  // WeekdaysWide returns the locales wide weekdays
   184  func (es *es_CR) WeekdaysWide() []string {
   185  	return es.daysWide
   186  }
   187  
   188  // Decimal returns the decimal point of number
   189  func (es *es_CR) Decimal() string {
   190  	return es.decimal
   191  }
   192  
   193  // Group returns the group of number
   194  func (es *es_CR) Group() string {
   195  	return es.group
   196  }
   197  
   198  // Group returns the minus sign of number
   199  func (es *es_CR) Minus() string {
   200  	return es.minus
   201  }
   202  
   203  // FmtNumber returns 'num' with digits/precision of 'v' for 'es_CR' and handles both Whole and Real numbers based on 'v'
   204  func (es *es_CR) FmtNumber(num float64, v uint64) string {
   205  
   206  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   207  	l := len(s) + 2 + 2*len(s[:len(s)-int(v)-1])/3
   208  	count := 0
   209  	inWhole := v == 0
   210  	b := make([]byte, 0, l)
   211  
   212  	for i := len(s) - 1; i >= 0; i-- {
   213  
   214  		if s[i] == '.' {
   215  			b = append(b, es.decimal[0])
   216  			inWhole = true
   217  			continue
   218  		}
   219  
   220  		if inWhole {
   221  			if count == 3 {
   222  				for j := len(es.group) - 1; j >= 0; j-- {
   223  					b = append(b, es.group[j])
   224  				}
   225  				count = 1
   226  			} else {
   227  				count++
   228  			}
   229  		}
   230  
   231  		b = append(b, s[i])
   232  	}
   233  
   234  	if num < 0 {
   235  		b = append(b, es.minus[0])
   236  	}
   237  
   238  	// reverse
   239  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   240  		b[i], b[j] = b[j], b[i]
   241  	}
   242  
   243  	return string(b)
   244  }
   245  
   246  // FmtPercent returns 'num' with digits/precision of 'v' for 'es_CR' and handles both Whole and Real numbers based on 'v'
   247  // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
   248  func (es *es_CR) FmtPercent(num float64, v uint64) string {
   249  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   250  	l := len(s) + 5
   251  	b := make([]byte, 0, l)
   252  
   253  	for i := len(s) - 1; i >= 0; i-- {
   254  
   255  		if s[i] == '.' {
   256  			b = append(b, es.decimal[0])
   257  			continue
   258  		}
   259  
   260  		b = append(b, s[i])
   261  	}
   262  
   263  	if num < 0 {
   264  		b = append(b, es.minus[0])
   265  	}
   266  
   267  	// reverse
   268  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   269  		b[i], b[j] = b[j], b[i]
   270  	}
   271  
   272  	b = append(b, es.percentSuffix...)
   273  
   274  	b = append(b, es.percent...)
   275  
   276  	return string(b)
   277  }
   278  
   279  // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'es_CR'
   280  func (es *es_CR) FmtCurrency(num float64, v uint64, currency currency.Type) string {
   281  
   282  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   283  	symbol := es.currencies[currency]
   284  	l := len(s) + len(symbol) + 2 + 2*len(s[:len(s)-int(v)-1])/3
   285  	count := 0
   286  	inWhole := v == 0
   287  	b := make([]byte, 0, l)
   288  
   289  	for i := len(s) - 1; i >= 0; i-- {
   290  
   291  		if s[i] == '.' {
   292  			b = append(b, es.decimal[0])
   293  			inWhole = true
   294  			continue
   295  		}
   296  
   297  		if inWhole {
   298  			if count == 3 {
   299  				for j := len(es.group) - 1; j >= 0; j-- {
   300  					b = append(b, es.group[j])
   301  				}
   302  				count = 1
   303  			} else {
   304  				count++
   305  			}
   306  		}
   307  
   308  		b = append(b, s[i])
   309  	}
   310  
   311  	for j := len(symbol) - 1; j >= 0; j-- {
   312  		b = append(b, symbol[j])
   313  	}
   314  
   315  	if num < 0 {
   316  		b = append(b, es.minus[0])
   317  	}
   318  
   319  	// reverse
   320  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   321  		b[i], b[j] = b[j], b[i]
   322  	}
   323  
   324  	if int(v) < 2 {
   325  
   326  		if v == 0 {
   327  			b = append(b, es.decimal...)
   328  		}
   329  
   330  		for i := 0; i < 2-int(v); i++ {
   331  			b = append(b, '0')
   332  		}
   333  	}
   334  
   335  	return string(b)
   336  }
   337  
   338  // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'es_CR'
   339  // in accounting notation.
   340  func (es *es_CR) FmtAccounting(num float64, v uint64, currency currency.Type) string {
   341  
   342  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   343  	symbol := es.currencies[currency]
   344  	l := len(s) + len(symbol) + 2 + 2*len(s[:len(s)-int(v)-1])/3
   345  	count := 0
   346  	inWhole := v == 0
   347  	b := make([]byte, 0, l)
   348  
   349  	for i := len(s) - 1; i >= 0; i-- {
   350  
   351  		if s[i] == '.' {
   352  			b = append(b, es.decimal[0])
   353  			inWhole = true
   354  			continue
   355  		}
   356  
   357  		if inWhole {
   358  			if count == 3 {
   359  				for j := len(es.group) - 1; j >= 0; j-- {
   360  					b = append(b, es.group[j])
   361  				}
   362  				count = 1
   363  			} else {
   364  				count++
   365  			}
   366  		}
   367  
   368  		b = append(b, s[i])
   369  	}
   370  
   371  	if num < 0 {
   372  
   373  		for j := len(symbol) - 1; j >= 0; j-- {
   374  			b = append(b, symbol[j])
   375  		}
   376  
   377  		b = append(b, es.minus[0])
   378  
   379  	} else {
   380  
   381  		for j := len(symbol) - 1; j >= 0; j-- {
   382  			b = append(b, symbol[j])
   383  		}
   384  
   385  	}
   386  
   387  	// reverse
   388  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   389  		b[i], b[j] = b[j], b[i]
   390  	}
   391  
   392  	if int(v) < 2 {
   393  
   394  		if v == 0 {
   395  			b = append(b, es.decimal...)
   396  		}
   397  
   398  		for i := 0; i < 2-int(v); i++ {
   399  			b = append(b, '0')
   400  		}
   401  	}
   402  
   403  	return string(b)
   404  }
   405  
   406  // FmtDateShort returns the short date representation of 't' for 'es_CR'
   407  func (es *es_CR) FmtDateShort(t time.Time) string {
   408  
   409  	b := make([]byte, 0, 32)
   410  
   411  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   412  	b = append(b, []byte{0x2f}...)
   413  	b = strconv.AppendInt(b, int64(t.Month()), 10)
   414  	b = append(b, []byte{0x2f}...)
   415  
   416  	if t.Year() > 9 {
   417  		b = append(b, strconv.Itoa(t.Year())[2:]...)
   418  	} else {
   419  		b = append(b, strconv.Itoa(t.Year())[1:]...)
   420  	}
   421  
   422  	return string(b)
   423  }
   424  
   425  // FmtDateMedium returns the medium date representation of 't' for 'es_CR'
   426  func (es *es_CR) FmtDateMedium(t time.Time) string {
   427  
   428  	b := make([]byte, 0, 32)
   429  
   430  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   431  	b = append(b, []byte{0x20}...)
   432  	b = append(b, es.monthsAbbreviated[t.Month()]...)
   433  	b = append(b, []byte{0x20}...)
   434  
   435  	if t.Year() > 0 {
   436  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   437  	} else {
   438  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   439  	}
   440  
   441  	return string(b)
   442  }
   443  
   444  // FmtDateLong returns the long date representation of 't' for 'es_CR'
   445  func (es *es_CR) FmtDateLong(t time.Time) string {
   446  
   447  	b := make([]byte, 0, 32)
   448  
   449  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   450  	b = append(b, []byte{0x20, 0x64, 0x65}...)
   451  	b = append(b, []byte{0x20}...)
   452  	b = append(b, es.monthsWide[t.Month()]...)
   453  	b = append(b, []byte{0x20, 0x64, 0x65}...)
   454  	b = append(b, []byte{0x20}...)
   455  
   456  	if t.Year() > 0 {
   457  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   458  	} else {
   459  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   460  	}
   461  
   462  	return string(b)
   463  }
   464  
   465  // FmtDateFull returns the full date representation of 't' for 'es_CR'
   466  func (es *es_CR) FmtDateFull(t time.Time) string {
   467  
   468  	b := make([]byte, 0, 32)
   469  
   470  	b = append(b, es.daysWide[t.Weekday()]...)
   471  	b = append(b, []byte{0x2c, 0x20}...)
   472  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   473  	b = append(b, []byte{0x20, 0x64, 0x65}...)
   474  	b = append(b, []byte{0x20}...)
   475  	b = append(b, es.monthsWide[t.Month()]...)
   476  	b = append(b, []byte{0x20, 0x64, 0x65}...)
   477  	b = append(b, []byte{0x20}...)
   478  
   479  	if t.Year() > 0 {
   480  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   481  	} else {
   482  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   483  	}
   484  
   485  	return string(b)
   486  }
   487  
   488  // FmtTimeShort returns the short time representation of 't' for 'es_CR'
   489  func (es *es_CR) FmtTimeShort(t time.Time) string {
   490  
   491  	b := make([]byte, 0, 32)
   492  
   493  	if t.Hour() < 10 {
   494  		b = append(b, '0')
   495  	}
   496  
   497  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   498  	b = append(b, es.timeSeparator...)
   499  
   500  	if t.Minute() < 10 {
   501  		b = append(b, '0')
   502  	}
   503  
   504  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   505  
   506  	return string(b)
   507  }
   508  
   509  // FmtTimeMedium returns the medium time representation of 't' for 'es_CR'
   510  func (es *es_CR) FmtTimeMedium(t time.Time) string {
   511  
   512  	b := make([]byte, 0, 32)
   513  
   514  	if t.Hour() < 10 {
   515  		b = append(b, '0')
   516  	}
   517  
   518  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   519  	b = append(b, es.timeSeparator...)
   520  
   521  	if t.Minute() < 10 {
   522  		b = append(b, '0')
   523  	}
   524  
   525  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   526  	b = append(b, es.timeSeparator...)
   527  
   528  	if t.Second() < 10 {
   529  		b = append(b, '0')
   530  	}
   531  
   532  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   533  
   534  	return string(b)
   535  }
   536  
   537  // FmtTimeLong returns the long time representation of 't' for 'es_CR'
   538  func (es *es_CR) FmtTimeLong(t time.Time) string {
   539  
   540  	b := make([]byte, 0, 32)
   541  
   542  	if t.Hour() < 10 {
   543  		b = append(b, '0')
   544  	}
   545  
   546  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   547  	b = append(b, es.timeSeparator...)
   548  
   549  	if t.Minute() < 10 {
   550  		b = append(b, '0')
   551  	}
   552  
   553  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   554  	b = append(b, es.timeSeparator...)
   555  
   556  	if t.Second() < 10 {
   557  		b = append(b, '0')
   558  	}
   559  
   560  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   561  	b = append(b, []byte{0x20}...)
   562  
   563  	tz, _ := t.Zone()
   564  	b = append(b, tz...)
   565  
   566  	return string(b)
   567  }
   568  
   569  // FmtTimeFull returns the full time representation of 't' for 'es_CR'
   570  func (es *es_CR) FmtTimeFull(t time.Time) string {
   571  
   572  	b := make([]byte, 0, 32)
   573  
   574  	if t.Hour() < 10 {
   575  		b = append(b, '0')
   576  	}
   577  
   578  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   579  	b = append(b, es.timeSeparator...)
   580  
   581  	if t.Minute() < 10 {
   582  		b = append(b, '0')
   583  	}
   584  
   585  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   586  	b = append(b, es.timeSeparator...)
   587  
   588  	if t.Second() < 10 {
   589  		b = append(b, '0')
   590  	}
   591  
   592  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   593  	b = append(b, []byte{0x20}...)
   594  
   595  	tz, _ := t.Zone()
   596  
   597  	if btz, ok := es.timezones[tz]; ok {
   598  		b = append(b, btz...)
   599  	} else {
   600  		b = append(b, tz...)
   601  	}
   602  
   603  	return string(b)
   604  }
   605  

View as plain text