...

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

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

     1  package es_MX
     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_MX 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 'es_MX' locale
    46  func New() locales.Translator {
    47  	return &es_MX{
    48  		locale:                 "es_MX",
    49  		pluralsCardinal:        []locales.PluralRule{2, 6},
    50  		pluralsOrdinal:         []locales.PluralRule{6},
    51  		pluralsRange:           []locales.PluralRule{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", "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", "p.", "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", "£", "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", "MRU", "UM", "MTL", "MTP", "MUR", "MVP", "MVR", "MWK", "$", "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", "lei", "RSD", "RUB", "RUR", "RWF", "SAR", "SBD", "SCR", "SDD", "SDG", "SDP", "SEK", "SGD", "SHP", "SIT", "SKK", "SLL", "SOS", "SRD", "SRG", "£", "STD", "STN", "SUR", "SVC", "£", "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", "Bs", "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"},
    60  		percentSuffix:          " ",
    61  		currencyPositiveSuffix: " k",
    62  		currencyNegativeSuffix: " k",
    63  		monthsAbbreviated:      []string{"", "ene.", "feb.", "mar.", "abr.", "may.", "jun.", "jul.", "ago.", "sep.", "oct.", "nov.", "dic."},
    64  		monthsNarrow:           []string{"", "E", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"},
    65  		monthsWide:             []string{"", "enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"},
    66  		daysAbbreviated:        []string{"dom.", "lun.", "mar.", "mié.", "jue.", "vie.", "sáb."},
    67  		daysNarrow:             []string{"D", "L", "M", "M", "J", "V", "S"},
    68  		daysShort:              []string{"DO", "LU", "MA", "MI", "JU", "VI", "SA"},
    69  		daysWide:               []string{"domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado"},
    70  		periodsAbbreviated:     []string{"a.\u00a0m.", "p.\u00a0m."},
    71  		periodsNarrow:          []string{"", ""},
    72  		periodsWide:            []string{"a.\u00a0m.", "p.\u00a0m."},
    73  		erasAbbreviated:        []string{"a. C.", "d. C."},
    74  		erasNarrow:             []string{"", ""},
    75  		erasWide:               []string{"antes de Cristo", "después de Cristo"},
    76  		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 oriental", "OEZ": "hora estándar de Europa oriental", "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 occidental", "WEZ": "hora estándar de Europa occidental", "WIB": "hora de Indonesia occidental", "WIT": "hora de Indonesia oriental", "WITA": "hora de Indonesia central", "∅∅∅": "hora de verano de Brasilia"},
    77  	}
    78  }
    79  
    80  // Locale returns the current translators string locale
    81  func (es *es_MX) Locale() string {
    82  	return es.locale
    83  }
    84  
    85  // PluralsCardinal returns the list of cardinal plural rules associated with 'es_MX'
    86  func (es *es_MX) PluralsCardinal() []locales.PluralRule {
    87  	return es.pluralsCardinal
    88  }
    89  
    90  // PluralsOrdinal returns the list of ordinal plural rules associated with 'es_MX'
    91  func (es *es_MX) PluralsOrdinal() []locales.PluralRule {
    92  	return es.pluralsOrdinal
    93  }
    94  
    95  // PluralsRange returns the list of range plural rules associated with 'es_MX'
    96  func (es *es_MX) PluralsRange() []locales.PluralRule {
    97  	return es.pluralsRange
    98  }
    99  
   100  // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'es_MX'
   101  func (es *es_MX) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
   102  
   103  	n := math.Abs(num)
   104  
   105  	if n == 1 {
   106  		return locales.PluralRuleOne
   107  	}
   108  
   109  	return locales.PluralRuleOther
   110  }
   111  
   112  // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'es_MX'
   113  func (es *es_MX) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
   114  	return locales.PluralRuleOther
   115  }
   116  
   117  // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'es_MX'
   118  func (es *es_MX) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
   119  	return locales.PluralRuleOther
   120  }
   121  
   122  // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
   123  func (es *es_MX) MonthAbbreviated(month time.Month) string {
   124  	return es.monthsAbbreviated[month]
   125  }
   126  
   127  // MonthsAbbreviated returns the locales abbreviated months
   128  func (es *es_MX) MonthsAbbreviated() []string {
   129  	return es.monthsAbbreviated[1:]
   130  }
   131  
   132  // MonthNarrow returns the locales narrow month given the 'month' provided
   133  func (es *es_MX) MonthNarrow(month time.Month) string {
   134  	return es.monthsNarrow[month]
   135  }
   136  
   137  // MonthsNarrow returns the locales narrow months
   138  func (es *es_MX) MonthsNarrow() []string {
   139  	return es.monthsNarrow[1:]
   140  }
   141  
   142  // MonthWide returns the locales wide month given the 'month' provided
   143  func (es *es_MX) MonthWide(month time.Month) string {
   144  	return es.monthsWide[month]
   145  }
   146  
   147  // MonthsWide returns the locales wide months
   148  func (es *es_MX) MonthsWide() []string {
   149  	return es.monthsWide[1:]
   150  }
   151  
   152  // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
   153  func (es *es_MX) WeekdayAbbreviated(weekday time.Weekday) string {
   154  	return es.daysAbbreviated[weekday]
   155  }
   156  
   157  // WeekdaysAbbreviated returns the locales abbreviated weekdays
   158  func (es *es_MX) WeekdaysAbbreviated() []string {
   159  	return es.daysAbbreviated
   160  }
   161  
   162  // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
   163  func (es *es_MX) WeekdayNarrow(weekday time.Weekday) string {
   164  	return es.daysNarrow[weekday]
   165  }
   166  
   167  // WeekdaysNarrow returns the locales narrow weekdays
   168  func (es *es_MX) WeekdaysNarrow() []string {
   169  	return es.daysNarrow
   170  }
   171  
   172  // WeekdayShort returns the locales short weekday given the 'weekday' provided
   173  func (es *es_MX) WeekdayShort(weekday time.Weekday) string {
   174  	return es.daysShort[weekday]
   175  }
   176  
   177  // WeekdaysShort returns the locales short weekdays
   178  func (es *es_MX) WeekdaysShort() []string {
   179  	return es.daysShort
   180  }
   181  
   182  // WeekdayWide returns the locales wide weekday given the 'weekday' provided
   183  func (es *es_MX) WeekdayWide(weekday time.Weekday) string {
   184  	return es.daysWide[weekday]
   185  }
   186  
   187  // WeekdaysWide returns the locales wide weekdays
   188  func (es *es_MX) WeekdaysWide() []string {
   189  	return es.daysWide
   190  }
   191  
   192  // Decimal returns the decimal point of number
   193  func (es *es_MX) Decimal() string {
   194  	return es.decimal
   195  }
   196  
   197  // Group returns the group of number
   198  func (es *es_MX) Group() string {
   199  	return es.group
   200  }
   201  
   202  // Group returns the minus sign of number
   203  func (es *es_MX) Minus() string {
   204  	return es.minus
   205  }
   206  
   207  // FmtNumber returns 'num' with digits/precision of 'v' for 'es_MX' and handles both Whole and Real numbers based on 'v'
   208  func (es *es_MX) FmtNumber(num float64, v uint64) string {
   209  
   210  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   211  	l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
   212  	count := 0
   213  	inWhole := v == 0
   214  	b := make([]byte, 0, l)
   215  
   216  	for i := len(s) - 1; i >= 0; i-- {
   217  
   218  		if s[i] == '.' {
   219  			b = append(b, es.decimal[0])
   220  			inWhole = true
   221  			continue
   222  		}
   223  
   224  		if inWhole {
   225  			if count == 3 {
   226  				b = append(b, es.group[0])
   227  				count = 1
   228  			} else {
   229  				count++
   230  			}
   231  		}
   232  
   233  		b = append(b, s[i])
   234  	}
   235  
   236  	if num < 0 {
   237  		b = append(b, es.minus[0])
   238  	}
   239  
   240  	// reverse
   241  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   242  		b[i], b[j] = b[j], b[i]
   243  	}
   244  
   245  	return string(b)
   246  }
   247  
   248  // FmtPercent returns 'num' with digits/precision of 'v' for 'es_MX' and handles both Whole and Real numbers based on 'v'
   249  // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
   250  func (es *es_MX) FmtPercent(num float64, v uint64) string {
   251  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   252  	l := len(s) + 5
   253  	b := make([]byte, 0, l)
   254  
   255  	for i := len(s) - 1; i >= 0; i-- {
   256  
   257  		if s[i] == '.' {
   258  			b = append(b, es.decimal[0])
   259  			continue
   260  		}
   261  
   262  		b = append(b, s[i])
   263  	}
   264  
   265  	if num < 0 {
   266  		b = append(b, es.minus[0])
   267  	}
   268  
   269  	// reverse
   270  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   271  		b[i], b[j] = b[j], b[i]
   272  	}
   273  
   274  	b = append(b, es.percentSuffix...)
   275  
   276  	b = append(b, es.percent...)
   277  
   278  	return string(b)
   279  }
   280  
   281  // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'es_MX'
   282  func (es *es_MX) FmtCurrency(num float64, v uint64, currency currency.Type) string {
   283  
   284  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   285  	symbol := es.currencies[currency]
   286  	l := len(s) + len(symbol) + 5
   287  
   288  	b := make([]byte, 0, l)
   289  
   290  	for i := len(s) - 1; i >= 0; i-- {
   291  
   292  		if s[i] == '.' {
   293  			b = append(b, es.decimal[0])
   294  			continue
   295  		}
   296  
   297  		b = append(b, s[i])
   298  	}
   299  
   300  	if num < 0 {
   301  		b = append(b, es.minus[0])
   302  	}
   303  
   304  	// reverse
   305  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   306  		b[i], b[j] = b[j], b[i]
   307  	}
   308  
   309  	b = append(b, es.currencyPositiveSuffix...)
   310  
   311  	b = append(b, symbol...)
   312  
   313  	return string(b)
   314  }
   315  
   316  // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'es_MX'
   317  // in accounting notation.
   318  func (es *es_MX) FmtAccounting(num float64, v uint64, currency currency.Type) string {
   319  
   320  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   321  	symbol := es.currencies[currency]
   322  	l := len(s) + len(symbol) + 5
   323  
   324  	b := make([]byte, 0, l)
   325  
   326  	for i := len(s) - 1; i >= 0; i-- {
   327  
   328  		if s[i] == '.' {
   329  			b = append(b, es.decimal[0])
   330  			continue
   331  		}
   332  
   333  		b = append(b, s[i])
   334  	}
   335  
   336  	if num < 0 {
   337  
   338  		b = append(b, es.minus[0])
   339  
   340  	}
   341  
   342  	// reverse
   343  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   344  		b[i], b[j] = b[j], b[i]
   345  	}
   346  
   347  	if num < 0 {
   348  		b = append(b, es.currencyNegativeSuffix...)
   349  		b = append(b, symbol...)
   350  	} else {
   351  
   352  		b = append(b, es.currencyPositiveSuffix...)
   353  		b = append(b, symbol...)
   354  	}
   355  
   356  	return string(b)
   357  }
   358  
   359  // FmtDateShort returns the short date representation of 't' for 'es_MX'
   360  func (es *es_MX) FmtDateShort(t time.Time) string {
   361  
   362  	b := make([]byte, 0, 32)
   363  
   364  	if t.Day() < 10 {
   365  		b = append(b, '0')
   366  	}
   367  
   368  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   369  	b = append(b, []byte{0x2f}...)
   370  
   371  	if t.Month() < 10 {
   372  		b = append(b, '0')
   373  	}
   374  
   375  	b = strconv.AppendInt(b, int64(t.Month()), 10)
   376  
   377  	b = append(b, []byte{0x2f}...)
   378  
   379  	if t.Year() > 9 {
   380  		b = append(b, strconv.Itoa(t.Year())[2:]...)
   381  	} else {
   382  		b = append(b, strconv.Itoa(t.Year())[1:]...)
   383  	}
   384  
   385  	return string(b)
   386  }
   387  
   388  // FmtDateMedium returns the medium date representation of 't' for 'es_MX'
   389  func (es *es_MX) FmtDateMedium(t time.Time) string {
   390  
   391  	b := make([]byte, 0, 32)
   392  
   393  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   394  	b = append(b, []byte{0x20}...)
   395  	b = append(b, es.monthsAbbreviated[t.Month()]...)
   396  	b = append(b, []byte{0x20}...)
   397  
   398  	if t.Year() > 0 {
   399  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   400  	} else {
   401  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   402  	}
   403  
   404  	return string(b)
   405  }
   406  
   407  // FmtDateLong returns the long date representation of 't' for 'es_MX'
   408  func (es *es_MX) FmtDateLong(t time.Time) string {
   409  
   410  	b := make([]byte, 0, 32)
   411  
   412  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   413  	b = append(b, []byte{0x20, 0x64, 0x65}...)
   414  	b = append(b, []byte{0x20}...)
   415  	b = append(b, es.monthsWide[t.Month()]...)
   416  	b = append(b, []byte{0x20, 0x64, 0x65}...)
   417  	b = append(b, []byte{0x20}...)
   418  
   419  	if t.Year() > 0 {
   420  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   421  	} else {
   422  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   423  	}
   424  
   425  	return string(b)
   426  }
   427  
   428  // FmtDateFull returns the full date representation of 't' for 'es_MX'
   429  func (es *es_MX) FmtDateFull(t time.Time) string {
   430  
   431  	b := make([]byte, 0, 32)
   432  
   433  	b = append(b, es.daysWide[t.Weekday()]...)
   434  	b = append(b, []byte{0x2c, 0x20}...)
   435  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   436  	b = append(b, []byte{0x20, 0x64, 0x65}...)
   437  	b = append(b, []byte{0x20}...)
   438  	b = append(b, es.monthsWide[t.Month()]...)
   439  	b = append(b, []byte{0x20, 0x64, 0x65}...)
   440  	b = append(b, []byte{0x20}...)
   441  
   442  	if t.Year() > 0 {
   443  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   444  	} else {
   445  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   446  	}
   447  
   448  	return string(b)
   449  }
   450  
   451  // FmtTimeShort returns the short time representation of 't' for 'es_MX'
   452  func (es *es_MX) FmtTimeShort(t time.Time) string {
   453  
   454  	b := make([]byte, 0, 32)
   455  
   456  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   457  	b = append(b, es.timeSeparator...)
   458  
   459  	if t.Minute() < 10 {
   460  		b = append(b, '0')
   461  	}
   462  
   463  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   464  
   465  	return string(b)
   466  }
   467  
   468  // FmtTimeMedium returns the medium time representation of 't' for 'es_MX'
   469  func (es *es_MX) FmtTimeMedium(t time.Time) string {
   470  
   471  	b := make([]byte, 0, 32)
   472  
   473  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   474  	b = append(b, es.timeSeparator...)
   475  
   476  	if t.Minute() < 10 {
   477  		b = append(b, '0')
   478  	}
   479  
   480  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   481  	b = append(b, es.timeSeparator...)
   482  
   483  	if t.Second() < 10 {
   484  		b = append(b, '0')
   485  	}
   486  
   487  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   488  
   489  	return string(b)
   490  }
   491  
   492  // FmtTimeLong returns the long time representation of 't' for 'es_MX'
   493  func (es *es_MX) FmtTimeLong(t time.Time) string {
   494  
   495  	b := make([]byte, 0, 32)
   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  	b = append(b, es.timeSeparator...)
   506  
   507  	if t.Second() < 10 {
   508  		b = append(b, '0')
   509  	}
   510  
   511  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   512  	b = append(b, []byte{0x20}...)
   513  
   514  	tz, _ := t.Zone()
   515  	b = append(b, tz...)
   516  
   517  	return string(b)
   518  }
   519  
   520  // FmtTimeFull returns the full time representation of 't' for 'es_MX'
   521  func (es *es_MX) FmtTimeFull(t time.Time) string {
   522  
   523  	b := make([]byte, 0, 32)
   524  
   525  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   526  	b = append(b, es.timeSeparator...)
   527  
   528  	if t.Minute() < 10 {
   529  		b = append(b, '0')
   530  	}
   531  
   532  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   533  	b = append(b, es.timeSeparator...)
   534  
   535  	if t.Second() < 10 {
   536  		b = append(b, '0')
   537  	}
   538  
   539  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   540  	b = append(b, []byte{0x20}...)
   541  
   542  	tz, _ := t.Zone()
   543  
   544  	if btz, ok := es.timezones[tz]; ok {
   545  		b = append(b, btz...)
   546  	} else {
   547  		b = append(b, tz...)
   548  	}
   549  
   550  	return string(b)
   551  }
   552  

View as plain text