...

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

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

     1  package ewo_CM
     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 ewo_CM 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  	perMille               string
    22  	timeSeparator          string
    23  	inifinity              string
    24  	currencies             []string // idx = enum of currency code
    25  	currencyPositiveSuffix string
    26  	currencyNegativeSuffix string
    27  	monthsAbbreviated      []string
    28  	monthsNarrow           []string
    29  	monthsWide             []string
    30  	daysAbbreviated        []string
    31  	daysNarrow             []string
    32  	daysShort              []string
    33  	daysWide               []string
    34  	periodsAbbreviated     []string
    35  	periodsNarrow          []string
    36  	periodsShort           []string
    37  	periodsWide            []string
    38  	erasAbbreviated        []string
    39  	erasNarrow             []string
    40  	erasWide               []string
    41  	timezones              map[string]string
    42  }
    43  
    44  // New returns a new instance of translator for the 'ewo_CM' locale
    45  func New() locales.Translator {
    46  	return &ewo_CM{
    47  		locale:                 "ewo_CM",
    48  		pluralsCardinal:        nil,
    49  		pluralsOrdinal:         nil,
    50  		pluralsRange:           nil,
    51  		decimal:                ",",
    52  		group:                  " ",
    53  		timeSeparator:          ":",
    54  		currencies:             []string{"ADP", "AED", "AFA", "AFN", "ALK", "ALL", "AMD", "ANG", "AOA", "AOK", "AON", "AOR", "ARA", "ARL", "ARM", "ARP", "ARS", "ATS", "AUD", "AWG", "AZM", "AZN", "BAD", "BAM", "BAN", "BBD", "BDT", "BEC", "BEF", "BEL", "BGL", "BGM", "BGN", "BGO", "BHD", "BIF", "BMD", "BND", "BOB", "BOL", "BOP", "BOV", "BRB", "BRC", "BRE", "BRL", "BRN", "BRR", "BRZ", "BSD", "BTN", "BUK", "BWP", "BYB", "BYN", "BYR", "BZD", "CAD", "CDF", "CHE", "CHF", "CHW", "CLE", "CLF", "CLP", "CNH", "CNX", "CNY", "COP", "COU", "CRC", "CSD", "CSK", "CUC", "CUP", "CVE", "CYP", "CZK", "DDM", "DEM", "DJF", "DKK", "DOP", "DZD", "ECS", "ECV", "EEK", "EGP", "ERN", "ESA", "ESB", "ESP", "ETB", "EUR", "FIM", "FJD", "FKP", "FRF", "GBP", "GEK", "GEL", "GHC", "GHS", "GIP", "GMD", "GNF", "GNS", "GQE", "GRD", "GTQ", "GWE", "GWP", "GYD", "HKD", "HNL", "HRD", "HRK", "HTG", "HUF", "IDR", "IEP", "ILP", "ILR", "ILS", "INR", "IQD", "IRR", "ISJ", "ISK", "ITL", "JMD", "JOD", "JPY", "KES", "KGS", "KHR", "KMF", "KPW", "KRH", "KRO", "KRW", "KWD", "KYD", "KZT", "LAK", "LBP", "LKR", "LRD", "LSL", "LTL", "LTT", "LUC", "LUF", "LUL", "LVL", "LVR", "LYD", "MAD", "MAF", "MCF", "MDC", "MDL", "MGA", "MGF", "MKD", "MKN", "MLF", "MMK", "MNT", "MOP", "MRO", "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"},
    55  		currencyPositiveSuffix: " ",
    56  		currencyNegativeSuffix: " ",
    57  		monthsAbbreviated:      []string{"", "ngo", "ngb", "ngl", "ngn", "ngt", "ngs", "ngz", "ngm", "nge", "nga", "ngad", "ngab"},
    58  		monthsNarrow:           []string{"", "o", "b", "l", "n", "t", "s", "z", "m", "e", "a", "d", "b"},
    59  		monthsWide:             []string{"", "ngɔn osú", "ngɔn bɛ̌", "ngɔn lála", "ngɔn nyina", "ngɔn tána", "ngɔn saməna", "ngɔn zamgbála", "ngɔn mwom", "ngɔn ebulú", "ngɔn awóm", "ngɔn awóm ai dziá", "ngɔn awóm ai bɛ̌"},
    60  		daysAbbreviated:        []string{"sɔ́n", "mɔ́n", "smb", "sml", "smn", "fúl", "sér"},
    61  		daysNarrow:             []string{"s", "m", "s", "s", "s", "f", "s"},
    62  		daysWide:               []string{"sɔ́ndɔ", "mɔ́ndi", "sɔ́ndɔ məlú mə́bɛ̌", "sɔ́ndɔ məlú mə́lɛ́", "sɔ́ndɔ məlú mə́nyi", "fúladé", "séradé"},
    63  		periodsAbbreviated:     []string{"kíkíríg", "ngəgógəle"},
    64  		periodsWide:            []string{"kíkíríg", "ngəgógəle"},
    65  		erasAbbreviated:        []string{"oyk", "ayk"},
    66  		erasNarrow:             []string{"", ""},
    67  		erasWide:               []string{"osúsúa Yésus kiri", "ámvus Yésus Kirís"},
    68  		timezones:              map[string]string{"ACDT": "ACDT", "ACST": "ACST", "ACWDT": "ACWDT", "ACWST": "ACWST", "ADT": "ADT", "AEDT": "AEDT", "AEST": "AEST", "AKDT": "AKDT", "AKST": "AKST", "ARST": "ARST", "ART": "ART", "AST": "AST", "AWDT": "AWDT", "AWST": "AWST", "BOT": "BOT", "BT": "BT", "CAT": "CAT", "CDT": "CDT", "CHADT": "CHADT", "CHAST": "CHAST", "CLST": "CLST", "CLT": "CLT", "COST": "COST", "COT": "COT", "CST": "CST", "ChST": "ChST", "EAT": "EAT", "ECT": "ECT", "EDT": "EDT", "EST": "EST", "GFT": "GFT", "GMT": "GMT", "GST": "GST", "GYT": "GYT", "HADT": "HADT", "HAST": "HAST", "HAT": "HAT", "HECU": "HECU", "HEEG": "HEEG", "HENOMX": "HENOMX", "HEOG": "HEOG", "HEPM": "HEPM", "HEPMX": "HEPMX", "HKST": "HKST", "HKT": "HKT", "HNCU": "HNCU", "HNEG": "HNEG", "HNNOMX": "HNNOMX", "HNOG": "HNOG", "HNPM": "HNPM", "HNPMX": "HNPMX", "HNT": "HNT", "IST": "IST", "JDT": "JDT", "JST": "JST", "LHDT": "LHDT", "LHST": "LHST", "MDT": "MDT", "MESZ": "MESZ", "MEZ": "MEZ", "MST": "MST", "MYT": "MYT", "NZDT": "NZDT", "NZST": "NZST", "OESZ": "OESZ", "OEZ": "OEZ", "PDT": "PDT", "PST": "PST", "SAST": "SAST", "SGT": "SGT", "SRT": "SRT", "TMST": "TMST", "TMT": "TMT", "UYST": "UYST", "UYT": "UYT", "VET": "VET", "WARST": "WARST", "WART": "WART", "WAST": "WAST", "WAT": "WAT", "WESZ": "WESZ", "WEZ": "WEZ", "WIB": "WIB", "WIT": "WIT", "WITA": "WITA", "∅∅∅": "∅∅∅"},
    69  	}
    70  }
    71  
    72  // Locale returns the current translators string locale
    73  func (ewo *ewo_CM) Locale() string {
    74  	return ewo.locale
    75  }
    76  
    77  // PluralsCardinal returns the list of cardinal plural rules associated with 'ewo_CM'
    78  func (ewo *ewo_CM) PluralsCardinal() []locales.PluralRule {
    79  	return ewo.pluralsCardinal
    80  }
    81  
    82  // PluralsOrdinal returns the list of ordinal plural rules associated with 'ewo_CM'
    83  func (ewo *ewo_CM) PluralsOrdinal() []locales.PluralRule {
    84  	return ewo.pluralsOrdinal
    85  }
    86  
    87  // PluralsRange returns the list of range plural rules associated with 'ewo_CM'
    88  func (ewo *ewo_CM) PluralsRange() []locales.PluralRule {
    89  	return ewo.pluralsRange
    90  }
    91  
    92  // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'ewo_CM'
    93  func (ewo *ewo_CM) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
    94  	return locales.PluralRuleUnknown
    95  }
    96  
    97  // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'ewo_CM'
    98  func (ewo *ewo_CM) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
    99  	return locales.PluralRuleUnknown
   100  }
   101  
   102  // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'ewo_CM'
   103  func (ewo *ewo_CM) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
   104  	return locales.PluralRuleUnknown
   105  }
   106  
   107  // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
   108  func (ewo *ewo_CM) MonthAbbreviated(month time.Month) string {
   109  	return ewo.monthsAbbreviated[month]
   110  }
   111  
   112  // MonthsAbbreviated returns the locales abbreviated months
   113  func (ewo *ewo_CM) MonthsAbbreviated() []string {
   114  	return ewo.monthsAbbreviated[1:]
   115  }
   116  
   117  // MonthNarrow returns the locales narrow month given the 'month' provided
   118  func (ewo *ewo_CM) MonthNarrow(month time.Month) string {
   119  	return ewo.monthsNarrow[month]
   120  }
   121  
   122  // MonthsNarrow returns the locales narrow months
   123  func (ewo *ewo_CM) MonthsNarrow() []string {
   124  	return ewo.monthsNarrow[1:]
   125  }
   126  
   127  // MonthWide returns the locales wide month given the 'month' provided
   128  func (ewo *ewo_CM) MonthWide(month time.Month) string {
   129  	return ewo.monthsWide[month]
   130  }
   131  
   132  // MonthsWide returns the locales wide months
   133  func (ewo *ewo_CM) MonthsWide() []string {
   134  	return ewo.monthsWide[1:]
   135  }
   136  
   137  // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
   138  func (ewo *ewo_CM) WeekdayAbbreviated(weekday time.Weekday) string {
   139  	return ewo.daysAbbreviated[weekday]
   140  }
   141  
   142  // WeekdaysAbbreviated returns the locales abbreviated weekdays
   143  func (ewo *ewo_CM) WeekdaysAbbreviated() []string {
   144  	return ewo.daysAbbreviated
   145  }
   146  
   147  // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
   148  func (ewo *ewo_CM) WeekdayNarrow(weekday time.Weekday) string {
   149  	return ewo.daysNarrow[weekday]
   150  }
   151  
   152  // WeekdaysNarrow returns the locales narrow weekdays
   153  func (ewo *ewo_CM) WeekdaysNarrow() []string {
   154  	return ewo.daysNarrow
   155  }
   156  
   157  // WeekdayShort returns the locales short weekday given the 'weekday' provided
   158  func (ewo *ewo_CM) WeekdayShort(weekday time.Weekday) string {
   159  	return ewo.daysShort[weekday]
   160  }
   161  
   162  // WeekdaysShort returns the locales short weekdays
   163  func (ewo *ewo_CM) WeekdaysShort() []string {
   164  	return ewo.daysShort
   165  }
   166  
   167  // WeekdayWide returns the locales wide weekday given the 'weekday' provided
   168  func (ewo *ewo_CM) WeekdayWide(weekday time.Weekday) string {
   169  	return ewo.daysWide[weekday]
   170  }
   171  
   172  // WeekdaysWide returns the locales wide weekdays
   173  func (ewo *ewo_CM) WeekdaysWide() []string {
   174  	return ewo.daysWide
   175  }
   176  
   177  // Decimal returns the decimal point of number
   178  func (ewo *ewo_CM) Decimal() string {
   179  	return ewo.decimal
   180  }
   181  
   182  // Group returns the group of number
   183  func (ewo *ewo_CM) Group() string {
   184  	return ewo.group
   185  }
   186  
   187  // Group returns the minus sign of number
   188  func (ewo *ewo_CM) Minus() string {
   189  	return ewo.minus
   190  }
   191  
   192  // FmtNumber returns 'num' with digits/precision of 'v' for 'ewo_CM' and handles both Whole and Real numbers based on 'v'
   193  func (ewo *ewo_CM) FmtNumber(num float64, v uint64) string {
   194  
   195  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   196  	l := len(s) + 1 + 2*len(s[:len(s)-int(v)-1])/3
   197  	count := 0
   198  	inWhole := v == 0
   199  	b := make([]byte, 0, l)
   200  
   201  	for i := len(s) - 1; i >= 0; i-- {
   202  
   203  		if s[i] == '.' {
   204  			b = append(b, ewo.decimal[0])
   205  			inWhole = true
   206  			continue
   207  		}
   208  
   209  		if inWhole {
   210  			if count == 3 {
   211  				for j := len(ewo.group) - 1; j >= 0; j-- {
   212  					b = append(b, ewo.group[j])
   213  				}
   214  				count = 1
   215  			} else {
   216  				count++
   217  			}
   218  		}
   219  
   220  		b = append(b, s[i])
   221  	}
   222  
   223  	if num < 0 {
   224  		b = append(b, ewo.minus[0])
   225  	}
   226  
   227  	// reverse
   228  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   229  		b[i], b[j] = b[j], b[i]
   230  	}
   231  
   232  	return string(b)
   233  }
   234  
   235  // FmtPercent returns 'num' with digits/precision of 'v' for 'ewo_CM' and handles both Whole and Real numbers based on 'v'
   236  // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
   237  func (ewo *ewo_CM) FmtPercent(num float64, v uint64) string {
   238  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   239  	l := len(s) + 1
   240  	b := make([]byte, 0, l)
   241  
   242  	for i := len(s) - 1; i >= 0; i-- {
   243  
   244  		if s[i] == '.' {
   245  			b = append(b, ewo.decimal[0])
   246  			continue
   247  		}
   248  
   249  		b = append(b, s[i])
   250  	}
   251  
   252  	if num < 0 {
   253  		b = append(b, ewo.minus[0])
   254  	}
   255  
   256  	// reverse
   257  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   258  		b[i], b[j] = b[j], b[i]
   259  	}
   260  
   261  	b = append(b, ewo.percent...)
   262  
   263  	return string(b)
   264  }
   265  
   266  // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'ewo_CM'
   267  func (ewo *ewo_CM) FmtCurrency(num float64, v uint64, currency currency.Type) string {
   268  
   269  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   270  	symbol := ewo.currencies[currency]
   271  	l := len(s) + len(symbol) + 3 + 2*len(s[:len(s)-int(v)-1])/3
   272  	count := 0
   273  	inWhole := v == 0
   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, ewo.decimal[0])
   280  			inWhole = true
   281  			continue
   282  		}
   283  
   284  		if inWhole {
   285  			if count == 3 {
   286  				for j := len(ewo.group) - 1; j >= 0; j-- {
   287  					b = append(b, ewo.group[j])
   288  				}
   289  				count = 1
   290  			} else {
   291  				count++
   292  			}
   293  		}
   294  
   295  		b = append(b, s[i])
   296  	}
   297  
   298  	if num < 0 {
   299  		b = append(b, ewo.minus[0])
   300  	}
   301  
   302  	// reverse
   303  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   304  		b[i], b[j] = b[j], b[i]
   305  	}
   306  
   307  	if int(v) < 2 {
   308  
   309  		if v == 0 {
   310  			b = append(b, ewo.decimal...)
   311  		}
   312  
   313  		for i := 0; i < 2-int(v); i++ {
   314  			b = append(b, '0')
   315  		}
   316  	}
   317  
   318  	b = append(b, ewo.currencyPositiveSuffix...)
   319  
   320  	b = append(b, symbol...)
   321  
   322  	return string(b)
   323  }
   324  
   325  // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ewo_CM'
   326  // in accounting notation.
   327  func (ewo *ewo_CM) FmtAccounting(num float64, v uint64, currency currency.Type) string {
   328  
   329  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   330  	symbol := ewo.currencies[currency]
   331  	l := len(s) + len(symbol) + 3 + 2*len(s[:len(s)-int(v)-1])/3
   332  	count := 0
   333  	inWhole := v == 0
   334  	b := make([]byte, 0, l)
   335  
   336  	for i := len(s) - 1; i >= 0; i-- {
   337  
   338  		if s[i] == '.' {
   339  			b = append(b, ewo.decimal[0])
   340  			inWhole = true
   341  			continue
   342  		}
   343  
   344  		if inWhole {
   345  			if count == 3 {
   346  				for j := len(ewo.group) - 1; j >= 0; j-- {
   347  					b = append(b, ewo.group[j])
   348  				}
   349  				count = 1
   350  			} else {
   351  				count++
   352  			}
   353  		}
   354  
   355  		b = append(b, s[i])
   356  	}
   357  
   358  	if num < 0 {
   359  
   360  		b = append(b, ewo.minus[0])
   361  
   362  	}
   363  
   364  	// reverse
   365  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   366  		b[i], b[j] = b[j], b[i]
   367  	}
   368  
   369  	if int(v) < 2 {
   370  
   371  		if v == 0 {
   372  			b = append(b, ewo.decimal...)
   373  		}
   374  
   375  		for i := 0; i < 2-int(v); i++ {
   376  			b = append(b, '0')
   377  		}
   378  	}
   379  
   380  	if num < 0 {
   381  		b = append(b, ewo.currencyNegativeSuffix...)
   382  		b = append(b, symbol...)
   383  	} else {
   384  
   385  		b = append(b, ewo.currencyPositiveSuffix...)
   386  		b = append(b, symbol...)
   387  	}
   388  
   389  	return string(b)
   390  }
   391  
   392  // FmtDateShort returns the short date representation of 't' for 'ewo_CM'
   393  func (ewo *ewo_CM) FmtDateShort(t time.Time) string {
   394  
   395  	b := make([]byte, 0, 32)
   396  
   397  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   398  	b = append(b, []byte{0x2f}...)
   399  	b = strconv.AppendInt(b, int64(t.Month()), 10)
   400  	b = append(b, []byte{0x2f}...)
   401  
   402  	if t.Year() > 0 {
   403  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   404  	} else {
   405  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   406  	}
   407  
   408  	return string(b)
   409  }
   410  
   411  // FmtDateMedium returns the medium date representation of 't' for 'ewo_CM'
   412  func (ewo *ewo_CM) FmtDateMedium(t time.Time) string {
   413  
   414  	b := make([]byte, 0, 32)
   415  
   416  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   417  	b = append(b, []byte{0x20}...)
   418  	b = append(b, ewo.monthsAbbreviated[t.Month()]...)
   419  	b = append(b, []byte{0x20}...)
   420  
   421  	if t.Year() > 0 {
   422  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   423  	} else {
   424  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   425  	}
   426  
   427  	return string(b)
   428  }
   429  
   430  // FmtDateLong returns the long date representation of 't' for 'ewo_CM'
   431  func (ewo *ewo_CM) FmtDateLong(t time.Time) string {
   432  
   433  	b := make([]byte, 0, 32)
   434  
   435  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   436  	b = append(b, []byte{0x20}...)
   437  	b = append(b, ewo.monthsWide[t.Month()]...)
   438  	b = append(b, []byte{0x20}...)
   439  
   440  	if t.Year() > 0 {
   441  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   442  	} else {
   443  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   444  	}
   445  
   446  	return string(b)
   447  }
   448  
   449  // FmtDateFull returns the full date representation of 't' for 'ewo_CM'
   450  func (ewo *ewo_CM) FmtDateFull(t time.Time) string {
   451  
   452  	b := make([]byte, 0, 32)
   453  
   454  	b = append(b, ewo.daysWide[t.Weekday()]...)
   455  	b = append(b, []byte{0x20}...)
   456  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   457  	b = append(b, []byte{0x20}...)
   458  	b = append(b, ewo.monthsWide[t.Month()]...)
   459  	b = append(b, []byte{0x20}...)
   460  
   461  	if t.Year() > 0 {
   462  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   463  	} else {
   464  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   465  	}
   466  
   467  	return string(b)
   468  }
   469  
   470  // FmtTimeShort returns the short time representation of 't' for 'ewo_CM'
   471  func (ewo *ewo_CM) FmtTimeShort(t time.Time) string {
   472  
   473  	b := make([]byte, 0, 32)
   474  
   475  	if t.Hour() < 10 {
   476  		b = append(b, '0')
   477  	}
   478  
   479  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   480  	b = append(b, ewo.timeSeparator...)
   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 'ewo_CM'
   492  func (ewo *ewo_CM) 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, ewo.timeSeparator...)
   502  
   503  	if t.Minute() < 10 {
   504  		b = append(b, '0')
   505  	}
   506  
   507  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   508  	b = append(b, ewo.timeSeparator...)
   509  
   510  	if t.Second() < 10 {
   511  		b = append(b, '0')
   512  	}
   513  
   514  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   515  
   516  	return string(b)
   517  }
   518  
   519  // FmtTimeLong returns the long time representation of 't' for 'ewo_CM'
   520  func (ewo *ewo_CM) FmtTimeLong(t time.Time) string {
   521  
   522  	b := make([]byte, 0, 32)
   523  
   524  	if t.Hour() < 10 {
   525  		b = append(b, '0')
   526  	}
   527  
   528  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   529  	b = append(b, ewo.timeSeparator...)
   530  
   531  	if t.Minute() < 10 {
   532  		b = append(b, '0')
   533  	}
   534  
   535  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   536  	b = append(b, ewo.timeSeparator...)
   537  
   538  	if t.Second() < 10 {
   539  		b = append(b, '0')
   540  	}
   541  
   542  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   543  	b = append(b, []byte{0x20}...)
   544  
   545  	tz, _ := t.Zone()
   546  	b = append(b, tz...)
   547  
   548  	return string(b)
   549  }
   550  
   551  // FmtTimeFull returns the full time representation of 't' for 'ewo_CM'
   552  func (ewo *ewo_CM) FmtTimeFull(t time.Time) string {
   553  
   554  	b := make([]byte, 0, 32)
   555  
   556  	if t.Hour() < 10 {
   557  		b = append(b, '0')
   558  	}
   559  
   560  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   561  	b = append(b, ewo.timeSeparator...)
   562  
   563  	if t.Minute() < 10 {
   564  		b = append(b, '0')
   565  	}
   566  
   567  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   568  	b = append(b, ewo.timeSeparator...)
   569  
   570  	if t.Second() < 10 {
   571  		b = append(b, '0')
   572  	}
   573  
   574  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   575  	b = append(b, []byte{0x20}...)
   576  
   577  	tz, _ := t.Zone()
   578  
   579  	if btz, ok := ewo.timezones[tz]; ok {
   580  		b = append(b, btz...)
   581  	} else {
   582  		b = append(b, tz...)
   583  	}
   584  
   585  	return string(b)
   586  }
   587  

View as plain text