...

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

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

     1  package eu
     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 eu 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  	percentPrefix          string
    22  	perMille               string
    23  	timeSeparator          string
    24  	inifinity              string
    25  	currencies             []string // idx = enum of currency code
    26  	currencyPositiveSuffix string
    27  	currencyNegativePrefix string
    28  	currencyNegativeSuffix string
    29  	monthsAbbreviated      []string
    30  	monthsNarrow           []string
    31  	monthsWide             []string
    32  	daysAbbreviated        []string
    33  	daysNarrow             []string
    34  	daysShort              []string
    35  	daysWide               []string
    36  	periodsAbbreviated     []string
    37  	periodsNarrow          []string
    38  	periodsShort           []string
    39  	periodsWide            []string
    40  	erasAbbreviated        []string
    41  	erasNarrow             []string
    42  	erasWide               []string
    43  	timezones              map[string]string
    44  }
    45  
    46  // New returns a new instance of translator for the 'eu' locale
    47  func New() locales.Translator {
    48  	return &eu{
    49  		locale:                 "eu",
    50  		pluralsCardinal:        []locales.PluralRule{2, 6},
    51  		pluralsOrdinal:         []locales.PluralRule{6},
    52  		pluralsRange:           []locales.PluralRule{6},
    53  		decimal:                ",",
    54  		group:                  ".",
    55  		minus:                  "−",
    56  		percent:                "%",
    57  		perMille:               "‰",
    58  		timeSeparator:          ":",
    59  		inifinity:              "∞",
    60  		currencies:             []string{"ADP", "AED", "AFA", "AFN", "ALK", "ALL", "AMD", "ANG", "AOA", "AOK", "AON", "AOR", "ARA", "ARL", "ARM", "ARP", "ARS", "ATS", "A$", "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", "R$", "BRN", "BRR", "BRZ", "BSD", "BTN", "BUK", "BWP", "BYB", "BYN", "BYR", "BZD", "CA$", "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", "₧", "ETB", "€", "FIM", "FJD", "FKP", "FRF", "£", "GEK", "GEL", "GHC", "GHS", "GIP", "GMD", "GNF", "GNS", "GQE", "GRD", "GTQ", "GWE", "GWP", "GYD", "HK$", "HNL", "HRD", "HRK", "HTG", "HUF", "IDR", "IEP", "ILP", "ILR", "₪", "₹", "IQD", "IRR", "ISJ", "ISK", "ITL", "JMD", "JOD", "JP¥", "KES", "KGS", "KHR", "KMF", "KPW", "KRH", "KRO", "₩", "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", "MX$", "MXP", "MXV", "MYR", "MZE", "MZM", "MZN", "NAD", "NGN", "NIC", "NIO", "NLG", "NOK", "NPR", "NZ$", "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", "฿", "TJR", "TJS", "TMM", "TMT", "TND", "TOP", "TPE", "TRL", "TRY", "TTD", "NT$", "TZS", "UAH", "UAK", "UGS", "UGX", "US$", "USN", "USS", "UYI", "UYP", "UYU", "UYW", "UZS", "VEB", "VEF", "VES", "₫", "VNN", "VUV", "WST", "FCFA", "XAG", "XAU", "XBA", "XBB", "XBC", "XBD", "EC$", "XDR", "XEU", "XFO", "XFU", "CFA", "XPD", "CFPF", "XPT", "XRE", "XSU", "XTS", "XUA", "XXX", "YDD", "YER", "YUD", "YUM", "YUN", "YUR", "ZAL", "ZAR", "ZMK", "ZMW", "ZRN", "ZRZ", "ZWD", "ZWL", "ZWR"},
    61  		percentPrefix:          " ",
    62  		currencyPositiveSuffix: " ",
    63  		currencyNegativePrefix: "(",
    64  		currencyNegativeSuffix: " )",
    65  		monthsAbbreviated:      []string{"", "urt.", "ots.", "mar.", "api.", "mai.", "eka.", "uzt.", "abu.", "ira.", "urr.", "aza.", "abe."},
    66  		monthsNarrow:           []string{"", "U", "O", "M", "A", "M", "E", "U", "A", "I", "U", "A", "A"},
    67  		monthsWide:             []string{"", "urtarrila", "otsaila", "martxoa", "apirila", "maiatza", "ekaina", "uztaila", "abuztua", "iraila", "urria", "azaroa", "abendua"},
    68  		daysAbbreviated:        []string{"ig.", "al.", "ar.", "az.", "og.", "or.", "lr."},
    69  		daysNarrow:             []string{"I", "A", "A", "A", "O", "O", "L"},
    70  		daysShort:              []string{"ig.", "al.", "ar.", "az.", "og.", "or.", "lr."},
    71  		daysWide:               []string{"igandea", "astelehena", "asteartea", "asteazkena", "osteguna", "ostirala", "larunbata"},
    72  		periodsAbbreviated:     []string{"AM", "PM"},
    73  		periodsNarrow:          []string{"g", "a"},
    74  		periodsWide:            []string{"AM", "PM"},
    75  		erasAbbreviated:        []string{"K.a.", "K.o."},
    76  		erasNarrow:             []string{"", ""},
    77  		erasWide:               []string{"K.a.", "Kristo ondoren"},
    78  		timezones:              map[string]string{"ACDT": "Australiako erdialdeko udako ordua", "ACST": "Australiako erdialdeko ordu estandarra", "ACWDT": "Australiako erdi-mendebaldeko udako ordua", "ACWST": "Australiako erdi-mendebaldeko ordu estandarra", "ADT": "Ipar Amerikako Atlantikoko udako ordua", "AEDT": "Australiako ekialdeko udako ordua", "AEST": "Australiako ekialdeko ordu estandarra", "AKDT": "Alaskako udako ordua", "AKST": "Alaskako ordu estandarra", "ARST": "Argentinako udako ordua", "ART": "Argentinako ordu estandarra", "AST": "Ipar Amerikako Atlantikoko ordu estandarra", "AWDT": "Australiako mendebaldeko udako ordua", "AWST": "Australiako mendebaldeko ordu estandarra", "BOT": "Boliviako ordua", "BT": "Bhutango ordua", "CAT": "Afrikako erdialdeko ordua", "CDT": "Ipar Amerikako erdialdeko udako ordua", "CHADT": "Chathamgo udako ordua", "CHAST": "Chathamgo ordu estandarra", "CLST": "Txileko udako ordua", "CLT": "Txileko ordu estandarra", "COST": "Kolonbiako udako ordua", "COT": "Kolonbiako ordu estandarra", "CST": "Ipar Amerikako erdialdeko ordu estandarra", "ChST": "Chamorroko ordu estandarra", "EAT": "Afrikako ekialdeko ordua", "ECT": "Ekuadorreko ordua", "EDT": "Ipar Amerikako ekialdeko udako ordua", "EST": "Ipar Amerikako ekialdeko ordu estandarra", "GFT": "Guyana Frantseseko ordua", "GMT": "Greenwichko meridianoaren ordua", "GST": "Golkoko ordu estandarra", "GYT": "Guyanako ordua", "HADT": "Hawaii-Aleutiar uharteetako udako ordua", "HAST": "Hawaii-Aleutiar uharteetako ordu estandarra", "HAT": "Ternuako udako ordua", "HECU": "Kubako udako ordua", "HEEG": "Groenlandiako ekialdeko udako ordua", "HENOMX": "Mexikoko ipar-ekialdeko udako ordua", "HEOG": "Groenlandiako mendebaldeko udako ordua", "HEPM": "Saint-Pierre eta Mikeluneko udako ordua", "HEPMX": "Mexikoko Pazifikoko udako ordua", "HKST": "Hong Kongo udako ordua", "HKT": "Hong Kongo ordu estandarra", "HNCU": "Kubako ordu estandarra", "HNEG": "Groenlandiako ekialdeko ordu estandarra", "HNNOMX": "Mexikoko ipar-ekialdeko ordu estandarra", "HNOG": "Groenlandiako mendebaldeko ordu estandarra", "HNPM": "Saint-Pierre eta Mikeluneko ordu estandarra", "HNPMX": "Mexikoko Pazifikoko ordu estandarra", "HNT": "Ternuako ordu estandarra", "IST": "Indiako ordua", "JDT": "Japoniako udako ordua", "JST": "Japoniako ordu estandarra", "LHDT": "Lord Howeko udako ordua", "LHST": "Lord Howeko ordu estandarra", "MDT": "Ipar Amerikako mendialdeko udako ordua", "MESZ": "Europako erdialdeko udako ordua", "MEZ": "Europako erdialdeko ordu estandarra", "MST": "Ipar Amerikako mendialdeko ordu estandarra", "MYT": "Malaysiako ordua", "NZDT": "Zeelanda Berriko udako ordua", "NZST": "Zeelanda Berriko ordu estandarra", "OESZ": "Europako ekialdeko udako ordua", "OEZ": "Europako ekialdeko ordu estandarra", "PDT": "Ipar Amerikako Pazifikoko udako ordua", "PST": "Ipar Amerikako Pazifikoko ordu estandarra", "SAST": "Afrikako hegoaldeko ordua", "SGT": "Singapurreko ordu estandarra", "SRT": "Surinamgo ordua", "TMST": "Turkmenistango udako ordua", "TMT": "Turkmenistango ordu estandarra", "UYST": "Uruguaiko udako ordua", "UYT": "Uruguaiko ordu estandarra", "VET": "Venezuelako ordua", "WARST": "Argentina mendebaldeko udako ordua", "WART": "Argentina mendebaldeko ordu estandarra", "WAST": "Afrikako mendebaldeko udako ordua", "WAT": "Afrikako mendebaldeko ordu estandarra", "WESZ": "Europako mendebaldeko udako ordua", "WEZ": "Europako mendebaldeko ordu estandarra", "WIB": "Indonesiako mendebaldeko ordua", "WIT": "Indonesiako ekialdeko ordua", "WITA": "Indonesiako erdialdeko ordua", "∅∅∅": "Azoreetako udako ordua"},
    79  	}
    80  }
    81  
    82  // Locale returns the current translators string locale
    83  func (eu *eu) Locale() string {
    84  	return eu.locale
    85  }
    86  
    87  // PluralsCardinal returns the list of cardinal plural rules associated with 'eu'
    88  func (eu *eu) PluralsCardinal() []locales.PluralRule {
    89  	return eu.pluralsCardinal
    90  }
    91  
    92  // PluralsOrdinal returns the list of ordinal plural rules associated with 'eu'
    93  func (eu *eu) PluralsOrdinal() []locales.PluralRule {
    94  	return eu.pluralsOrdinal
    95  }
    96  
    97  // PluralsRange returns the list of range plural rules associated with 'eu'
    98  func (eu *eu) PluralsRange() []locales.PluralRule {
    99  	return eu.pluralsRange
   100  }
   101  
   102  // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'eu'
   103  func (eu *eu) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
   104  
   105  	n := math.Abs(num)
   106  
   107  	if n == 1 {
   108  		return locales.PluralRuleOne
   109  	}
   110  
   111  	return locales.PluralRuleOther
   112  }
   113  
   114  // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'eu'
   115  func (eu *eu) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
   116  	return locales.PluralRuleOther
   117  }
   118  
   119  // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'eu'
   120  func (eu *eu) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
   121  	return locales.PluralRuleOther
   122  }
   123  
   124  // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
   125  func (eu *eu) MonthAbbreviated(month time.Month) string {
   126  	return eu.monthsAbbreviated[month]
   127  }
   128  
   129  // MonthsAbbreviated returns the locales abbreviated months
   130  func (eu *eu) MonthsAbbreviated() []string {
   131  	return eu.monthsAbbreviated[1:]
   132  }
   133  
   134  // MonthNarrow returns the locales narrow month given the 'month' provided
   135  func (eu *eu) MonthNarrow(month time.Month) string {
   136  	return eu.monthsNarrow[month]
   137  }
   138  
   139  // MonthsNarrow returns the locales narrow months
   140  func (eu *eu) MonthsNarrow() []string {
   141  	return eu.monthsNarrow[1:]
   142  }
   143  
   144  // MonthWide returns the locales wide month given the 'month' provided
   145  func (eu *eu) MonthWide(month time.Month) string {
   146  	return eu.monthsWide[month]
   147  }
   148  
   149  // MonthsWide returns the locales wide months
   150  func (eu *eu) MonthsWide() []string {
   151  	return eu.monthsWide[1:]
   152  }
   153  
   154  // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
   155  func (eu *eu) WeekdayAbbreviated(weekday time.Weekday) string {
   156  	return eu.daysAbbreviated[weekday]
   157  }
   158  
   159  // WeekdaysAbbreviated returns the locales abbreviated weekdays
   160  func (eu *eu) WeekdaysAbbreviated() []string {
   161  	return eu.daysAbbreviated
   162  }
   163  
   164  // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
   165  func (eu *eu) WeekdayNarrow(weekday time.Weekday) string {
   166  	return eu.daysNarrow[weekday]
   167  }
   168  
   169  // WeekdaysNarrow returns the locales narrow weekdays
   170  func (eu *eu) WeekdaysNarrow() []string {
   171  	return eu.daysNarrow
   172  }
   173  
   174  // WeekdayShort returns the locales short weekday given the 'weekday' provided
   175  func (eu *eu) WeekdayShort(weekday time.Weekday) string {
   176  	return eu.daysShort[weekday]
   177  }
   178  
   179  // WeekdaysShort returns the locales short weekdays
   180  func (eu *eu) WeekdaysShort() []string {
   181  	return eu.daysShort
   182  }
   183  
   184  // WeekdayWide returns the locales wide weekday given the 'weekday' provided
   185  func (eu *eu) WeekdayWide(weekday time.Weekday) string {
   186  	return eu.daysWide[weekday]
   187  }
   188  
   189  // WeekdaysWide returns the locales wide weekdays
   190  func (eu *eu) WeekdaysWide() []string {
   191  	return eu.daysWide
   192  }
   193  
   194  // Decimal returns the decimal point of number
   195  func (eu *eu) Decimal() string {
   196  	return eu.decimal
   197  }
   198  
   199  // Group returns the group of number
   200  func (eu *eu) Group() string {
   201  	return eu.group
   202  }
   203  
   204  // Group returns the minus sign of number
   205  func (eu *eu) Minus() string {
   206  	return eu.minus
   207  }
   208  
   209  // FmtNumber returns 'num' with digits/precision of 'v' for 'eu' and handles both Whole and Real numbers based on 'v'
   210  func (eu *eu) FmtNumber(num float64, v uint64) string {
   211  
   212  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   213  	l := len(s) + 4 + 1*len(s[:len(s)-int(v)-1])/3
   214  	count := 0
   215  	inWhole := v == 0
   216  	b := make([]byte, 0, l)
   217  
   218  	for i := len(s) - 1; i >= 0; i-- {
   219  
   220  		if s[i] == '.' {
   221  			b = append(b, eu.decimal[0])
   222  			inWhole = true
   223  			continue
   224  		}
   225  
   226  		if inWhole {
   227  			if count == 3 {
   228  				b = append(b, eu.group[0])
   229  				count = 1
   230  			} else {
   231  				count++
   232  			}
   233  		}
   234  
   235  		b = append(b, s[i])
   236  	}
   237  
   238  	if num < 0 {
   239  		for j := len(eu.minus) - 1; j >= 0; j-- {
   240  			b = append(b, eu.minus[j])
   241  		}
   242  	}
   243  
   244  	// reverse
   245  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   246  		b[i], b[j] = b[j], b[i]
   247  	}
   248  
   249  	return string(b)
   250  }
   251  
   252  // FmtPercent returns 'num' with digits/precision of 'v' for 'eu' and handles both Whole and Real numbers based on 'v'
   253  // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
   254  func (eu *eu) FmtPercent(num float64, v uint64) string {
   255  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   256  	l := len(s) + 7 + 1*len(s[:len(s)-int(v)-1])/3
   257  	count := 0
   258  	inWhole := v == 0
   259  	b := make([]byte, 0, l)
   260  
   261  	for i := len(s) - 1; i >= 0; i-- {
   262  
   263  		if s[i] == '.' {
   264  			b = append(b, eu.decimal[0])
   265  			inWhole = true
   266  
   267  			continue
   268  		}
   269  
   270  		if inWhole {
   271  			if count == 3 {
   272  				b = append(b, eu.group[0])
   273  				count = 1
   274  			} else {
   275  				count++
   276  			}
   277  		}
   278  
   279  		b = append(b, s[i])
   280  	}
   281  
   282  	if num < 0 {
   283  		for j := len(eu.minus) - 1; j >= 0; j-- {
   284  			b = append(b, eu.minus[j])
   285  		}
   286  	}
   287  
   288  	for j := len(eu.percentPrefix) - 1; j >= 0; j-- {
   289  		b = append(b, eu.percentPrefix[j])
   290  	}
   291  
   292  	b = append(b, eu.percent[0])
   293  
   294  	// reverse
   295  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   296  		b[i], b[j] = b[j], b[i]
   297  	}
   298  
   299  	return string(b)
   300  }
   301  
   302  // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'eu'
   303  func (eu *eu) FmtCurrency(num float64, v uint64, currency currency.Type) string {
   304  
   305  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   306  	symbol := eu.currencies[currency]
   307  	l := len(s) + len(symbol) + 6 + 1*len(s[:len(s)-int(v)-1])/3
   308  	count := 0
   309  	inWhole := v == 0
   310  	b := make([]byte, 0, l)
   311  
   312  	for i := len(s) - 1; i >= 0; i-- {
   313  
   314  		if s[i] == '.' {
   315  			b = append(b, eu.decimal[0])
   316  			inWhole = true
   317  			continue
   318  		}
   319  
   320  		if inWhole {
   321  			if count == 3 {
   322  				b = append(b, eu.group[0])
   323  				count = 1
   324  			} else {
   325  				count++
   326  			}
   327  		}
   328  
   329  		b = append(b, s[i])
   330  	}
   331  
   332  	if num < 0 {
   333  		for j := len(eu.minus) - 1; j >= 0; j-- {
   334  			b = append(b, eu.minus[j])
   335  		}
   336  	}
   337  
   338  	// reverse
   339  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   340  		b[i], b[j] = b[j], b[i]
   341  	}
   342  
   343  	if int(v) < 2 {
   344  
   345  		if v == 0 {
   346  			b = append(b, eu.decimal...)
   347  		}
   348  
   349  		for i := 0; i < 2-int(v); i++ {
   350  			b = append(b, '0')
   351  		}
   352  	}
   353  
   354  	b = append(b, eu.currencyPositiveSuffix...)
   355  
   356  	b = append(b, symbol...)
   357  
   358  	return string(b)
   359  }
   360  
   361  // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'eu'
   362  // in accounting notation.
   363  func (eu *eu) FmtAccounting(num float64, v uint64, currency currency.Type) string {
   364  
   365  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   366  	symbol := eu.currencies[currency]
   367  	l := len(s) + len(symbol) + 8 + 1*len(s[:len(s)-int(v)-1])/3
   368  	count := 0
   369  	inWhole := v == 0
   370  	b := make([]byte, 0, l)
   371  
   372  	for i := len(s) - 1; i >= 0; i-- {
   373  
   374  		if s[i] == '.' {
   375  			b = append(b, eu.decimal[0])
   376  			inWhole = true
   377  			continue
   378  		}
   379  
   380  		if inWhole {
   381  			if count == 3 {
   382  				b = append(b, eu.group[0])
   383  				count = 1
   384  			} else {
   385  				count++
   386  			}
   387  		}
   388  
   389  		b = append(b, s[i])
   390  	}
   391  
   392  	if num < 0 {
   393  
   394  		b = append(b, eu.currencyNegativePrefix[0])
   395  
   396  	}
   397  
   398  	// reverse
   399  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   400  		b[i], b[j] = b[j], b[i]
   401  	}
   402  
   403  	if int(v) < 2 {
   404  
   405  		if v == 0 {
   406  			b = append(b, eu.decimal...)
   407  		}
   408  
   409  		for i := 0; i < 2-int(v); i++ {
   410  			b = append(b, '0')
   411  		}
   412  	}
   413  
   414  	if num < 0 {
   415  		b = append(b, eu.currencyNegativeSuffix...)
   416  		b = append(b, symbol...)
   417  	} else {
   418  
   419  		b = append(b, eu.currencyPositiveSuffix...)
   420  		b = append(b, symbol...)
   421  	}
   422  
   423  	return string(b)
   424  }
   425  
   426  // FmtDateShort returns the short date representation of 't' for 'eu'
   427  func (eu *eu) FmtDateShort(t time.Time) string {
   428  
   429  	b := make([]byte, 0, 32)
   430  
   431  	if t.Year() > 9 {
   432  		b = append(b, strconv.Itoa(t.Year())[2:]...)
   433  	} else {
   434  		b = append(b, strconv.Itoa(t.Year())[1:]...)
   435  	}
   436  
   437  	b = append(b, []byte{0x2f}...)
   438  	b = strconv.AppendInt(b, int64(t.Month()), 10)
   439  	b = append(b, []byte{0x2f}...)
   440  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   441  
   442  	return string(b)
   443  }
   444  
   445  // FmtDateMedium returns the medium date representation of 't' for 'eu'
   446  func (eu *eu) FmtDateMedium(t time.Time) string {
   447  
   448  	b := make([]byte, 0, 32)
   449  
   450  	if t.Year() > 0 {
   451  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   452  	} else {
   453  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   454  	}
   455  
   456  	b = append(b, []byte{0x28, 0x65}...)
   457  	b = append(b, []byte{0x29, 0x6b, 0x6f}...)
   458  	b = append(b, []byte{0x20}...)
   459  	b = append(b, eu.monthsAbbreviated[t.Month()]...)
   460  	b = append(b, []byte{0x20}...)
   461  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   462  	b = append(b, []byte{0x28, 0x61}...)
   463  	b = append(b, []byte{0x29}...)
   464  
   465  	return string(b)
   466  }
   467  
   468  // FmtDateLong returns the long date representation of 't' for 'eu'
   469  func (eu *eu) FmtDateLong(t time.Time) string {
   470  
   471  	b := make([]byte, 0, 32)
   472  
   473  	if t.Year() > 0 {
   474  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   475  	} else {
   476  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   477  	}
   478  
   479  	b = append(b, []byte{0x28, 0x65}...)
   480  	b = append(b, []byte{0x29, 0x6b, 0x6f}...)
   481  	b = append(b, []byte{0x20}...)
   482  	b = append(b, eu.monthsWide[t.Month()]...)
   483  	b = append(b, []byte{0x72, 0x65, 0x6e}...)
   484  	b = append(b, []byte{0x20}...)
   485  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   486  	b = append(b, []byte{0x28, 0x61}...)
   487  	b = append(b, []byte{0x29}...)
   488  
   489  	return string(b)
   490  }
   491  
   492  // FmtDateFull returns the full date representation of 't' for 'eu'
   493  func (eu *eu) FmtDateFull(t time.Time) string {
   494  
   495  	b := make([]byte, 0, 32)
   496  
   497  	if t.Year() > 0 {
   498  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   499  	} else {
   500  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   501  	}
   502  
   503  	b = append(b, []byte{0x28, 0x65}...)
   504  	b = append(b, []byte{0x29, 0x6b, 0x6f}...)
   505  	b = append(b, []byte{0x20}...)
   506  	b = append(b, eu.monthsWide[t.Month()]...)
   507  	b = append(b, []byte{0x72, 0x65, 0x6e}...)
   508  	b = append(b, []byte{0x20}...)
   509  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   510  	b = append(b, []byte{0x28, 0x61}...)
   511  	b = append(b, []byte{0x29, 0x2c, 0x20}...)
   512  	b = append(b, eu.daysWide[t.Weekday()]...)
   513  
   514  	return string(b)
   515  }
   516  
   517  // FmtTimeShort returns the short time representation of 't' for 'eu'
   518  func (eu *eu) FmtTimeShort(t time.Time) string {
   519  
   520  	b := make([]byte, 0, 32)
   521  
   522  	if t.Hour() < 10 {
   523  		b = append(b, '0')
   524  	}
   525  
   526  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   527  	b = append(b, eu.timeSeparator...)
   528  
   529  	if t.Minute() < 10 {
   530  		b = append(b, '0')
   531  	}
   532  
   533  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   534  
   535  	return string(b)
   536  }
   537  
   538  // FmtTimeMedium returns the medium time representation of 't' for 'eu'
   539  func (eu *eu) FmtTimeMedium(t time.Time) string {
   540  
   541  	b := make([]byte, 0, 32)
   542  
   543  	if t.Hour() < 10 {
   544  		b = append(b, '0')
   545  	}
   546  
   547  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   548  	b = append(b, eu.timeSeparator...)
   549  
   550  	if t.Minute() < 10 {
   551  		b = append(b, '0')
   552  	}
   553  
   554  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   555  	b = append(b, eu.timeSeparator...)
   556  
   557  	if t.Second() < 10 {
   558  		b = append(b, '0')
   559  	}
   560  
   561  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   562  
   563  	return string(b)
   564  }
   565  
   566  // FmtTimeLong returns the long time representation of 't' for 'eu'
   567  func (eu *eu) FmtTimeLong(t time.Time) string {
   568  
   569  	b := make([]byte, 0, 32)
   570  
   571  	if t.Hour() < 10 {
   572  		b = append(b, '0')
   573  	}
   574  
   575  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   576  	b = append(b, eu.timeSeparator...)
   577  
   578  	if t.Minute() < 10 {
   579  		b = append(b, '0')
   580  	}
   581  
   582  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   583  	b = append(b, eu.timeSeparator...)
   584  
   585  	if t.Second() < 10 {
   586  		b = append(b, '0')
   587  	}
   588  
   589  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   590  	b = append(b, []byte{0x20, 0x28}...)
   591  
   592  	tz, _ := t.Zone()
   593  	b = append(b, tz...)
   594  
   595  	b = append(b, []byte{0x29}...)
   596  
   597  	return string(b)
   598  }
   599  
   600  // FmtTimeFull returns the full time representation of 't' for 'eu'
   601  func (eu *eu) FmtTimeFull(t time.Time) string {
   602  
   603  	b := make([]byte, 0, 32)
   604  
   605  	if t.Hour() < 10 {
   606  		b = append(b, '0')
   607  	}
   608  
   609  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   610  	b = append(b, eu.timeSeparator...)
   611  
   612  	if t.Minute() < 10 {
   613  		b = append(b, '0')
   614  	}
   615  
   616  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   617  	b = append(b, eu.timeSeparator...)
   618  
   619  	if t.Second() < 10 {
   620  		b = append(b, '0')
   621  	}
   622  
   623  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   624  	b = append(b, []byte{0x20, 0x28}...)
   625  
   626  	tz, _ := t.Zone()
   627  
   628  	if btz, ok := eu.timezones[tz]; ok {
   629  		b = append(b, btz...)
   630  	} else {
   631  		b = append(b, tz...)
   632  	}
   633  
   634  	b = append(b, []byte{0x29}...)
   635  
   636  	return string(b)
   637  }
   638  

View as plain text