...

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

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

     1  package bas_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 bas_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  	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 'bas_CM' locale
    46  func New() locales.Translator {
    47  	return &bas_CM{
    48  		locale:                 "bas_CM",
    49  		pluralsCardinal:        nil,
    50  		pluralsOrdinal:         nil,
    51  		pluralsRange:           nil,
    52  		decimal:                ",",
    53  		group:                  " ",
    54  		timeSeparator:          ":",
    55  		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"},
    56  		percentSuffix:          " ",
    57  		currencyPositiveSuffix: " ",
    58  		currencyNegativeSuffix: " ",
    59  		monthsAbbreviated:      []string{"", "kɔn", "mac", "mat", "mto", "mpu", "hil", "nje", "hik", "dip", "bio", "may", "liɓ"},
    60  		monthsNarrow:           []string{"", "k", "m", "m", "m", "m", "h", "n", "h", "d", "b", "m", "l"},
    61  		monthsWide:             []string{"", "Kɔndɔŋ", "Màcɛ̂l", "Màtùmb", "Màtop", "M̀puyɛ", "Hìlòndɛ̀", "Njèbà", "Hìkaŋ", "Dìpɔ̀s", "Bìòôm", "Màyɛsèp", "Lìbuy li ńyèe"},
    62  		daysAbbreviated:        []string{"nɔy", "nja", "uum", "ŋge", "mbɔ", "kɔɔ", "jon"},
    63  		daysNarrow:             []string{"n", "n", "u", "ŋ", "m", "k", "j"},
    64  		daysWide:               []string{"ŋgwà nɔ̂y", "ŋgwà njaŋgumba", "ŋgwà ûm", "ŋgwà ŋgê", "ŋgwà mbɔk", "ŋgwà kɔɔ", "ŋgwà jôn"},
    65  		periodsAbbreviated:     []string{"I bikɛ̂glà", "I ɓugajɔp"},
    66  		periodsWide:            []string{"I bikɛ̂glà", "I ɓugajɔp"},
    67  		erasAbbreviated:        []string{"b.Y.K", "m.Y.K"},
    68  		erasNarrow:             []string{"", ""},
    69  		erasWide:               []string{"bisū bi Yesù Krǐstò", "i mbūs Yesù Krǐstò"},
    70  		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", "∅∅∅": "∅∅∅"},
    71  	}
    72  }
    73  
    74  // Locale returns the current translators string locale
    75  func (bas *bas_CM) Locale() string {
    76  	return bas.locale
    77  }
    78  
    79  // PluralsCardinal returns the list of cardinal plural rules associated with 'bas_CM'
    80  func (bas *bas_CM) PluralsCardinal() []locales.PluralRule {
    81  	return bas.pluralsCardinal
    82  }
    83  
    84  // PluralsOrdinal returns the list of ordinal plural rules associated with 'bas_CM'
    85  func (bas *bas_CM) PluralsOrdinal() []locales.PluralRule {
    86  	return bas.pluralsOrdinal
    87  }
    88  
    89  // PluralsRange returns the list of range plural rules associated with 'bas_CM'
    90  func (bas *bas_CM) PluralsRange() []locales.PluralRule {
    91  	return bas.pluralsRange
    92  }
    93  
    94  // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'bas_CM'
    95  func (bas *bas_CM) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
    96  	return locales.PluralRuleUnknown
    97  }
    98  
    99  // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'bas_CM'
   100  func (bas *bas_CM) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
   101  	return locales.PluralRuleUnknown
   102  }
   103  
   104  // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'bas_CM'
   105  func (bas *bas_CM) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
   106  	return locales.PluralRuleUnknown
   107  }
   108  
   109  // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
   110  func (bas *bas_CM) MonthAbbreviated(month time.Month) string {
   111  	return bas.monthsAbbreviated[month]
   112  }
   113  
   114  // MonthsAbbreviated returns the locales abbreviated months
   115  func (bas *bas_CM) MonthsAbbreviated() []string {
   116  	return bas.monthsAbbreviated[1:]
   117  }
   118  
   119  // MonthNarrow returns the locales narrow month given the 'month' provided
   120  func (bas *bas_CM) MonthNarrow(month time.Month) string {
   121  	return bas.monthsNarrow[month]
   122  }
   123  
   124  // MonthsNarrow returns the locales narrow months
   125  func (bas *bas_CM) MonthsNarrow() []string {
   126  	return bas.monthsNarrow[1:]
   127  }
   128  
   129  // MonthWide returns the locales wide month given the 'month' provided
   130  func (bas *bas_CM) MonthWide(month time.Month) string {
   131  	return bas.monthsWide[month]
   132  }
   133  
   134  // MonthsWide returns the locales wide months
   135  func (bas *bas_CM) MonthsWide() []string {
   136  	return bas.monthsWide[1:]
   137  }
   138  
   139  // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
   140  func (bas *bas_CM) WeekdayAbbreviated(weekday time.Weekday) string {
   141  	return bas.daysAbbreviated[weekday]
   142  }
   143  
   144  // WeekdaysAbbreviated returns the locales abbreviated weekdays
   145  func (bas *bas_CM) WeekdaysAbbreviated() []string {
   146  	return bas.daysAbbreviated
   147  }
   148  
   149  // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
   150  func (bas *bas_CM) WeekdayNarrow(weekday time.Weekday) string {
   151  	return bas.daysNarrow[weekday]
   152  }
   153  
   154  // WeekdaysNarrow returns the locales narrow weekdays
   155  func (bas *bas_CM) WeekdaysNarrow() []string {
   156  	return bas.daysNarrow
   157  }
   158  
   159  // WeekdayShort returns the locales short weekday given the 'weekday' provided
   160  func (bas *bas_CM) WeekdayShort(weekday time.Weekday) string {
   161  	return bas.daysShort[weekday]
   162  }
   163  
   164  // WeekdaysShort returns the locales short weekdays
   165  func (bas *bas_CM) WeekdaysShort() []string {
   166  	return bas.daysShort
   167  }
   168  
   169  // WeekdayWide returns the locales wide weekday given the 'weekday' provided
   170  func (bas *bas_CM) WeekdayWide(weekday time.Weekday) string {
   171  	return bas.daysWide[weekday]
   172  }
   173  
   174  // WeekdaysWide returns the locales wide weekdays
   175  func (bas *bas_CM) WeekdaysWide() []string {
   176  	return bas.daysWide
   177  }
   178  
   179  // Decimal returns the decimal point of number
   180  func (bas *bas_CM) Decimal() string {
   181  	return bas.decimal
   182  }
   183  
   184  // Group returns the group of number
   185  func (bas *bas_CM) Group() string {
   186  	return bas.group
   187  }
   188  
   189  // Group returns the minus sign of number
   190  func (bas *bas_CM) Minus() string {
   191  	return bas.minus
   192  }
   193  
   194  // FmtNumber returns 'num' with digits/precision of 'v' for 'bas_CM' and handles both Whole and Real numbers based on 'v'
   195  func (bas *bas_CM) FmtNumber(num float64, v uint64) string {
   196  
   197  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   198  	l := len(s) + 1 + 2*len(s[:len(s)-int(v)-1])/3
   199  	count := 0
   200  	inWhole := v == 0
   201  	b := make([]byte, 0, l)
   202  
   203  	for i := len(s) - 1; i >= 0; i-- {
   204  
   205  		if s[i] == '.' {
   206  			b = append(b, bas.decimal[0])
   207  			inWhole = true
   208  			continue
   209  		}
   210  
   211  		if inWhole {
   212  			if count == 3 {
   213  				for j := len(bas.group) - 1; j >= 0; j-- {
   214  					b = append(b, bas.group[j])
   215  				}
   216  				count = 1
   217  			} else {
   218  				count++
   219  			}
   220  		}
   221  
   222  		b = append(b, s[i])
   223  	}
   224  
   225  	if num < 0 {
   226  		b = append(b, bas.minus[0])
   227  	}
   228  
   229  	// reverse
   230  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   231  		b[i], b[j] = b[j], b[i]
   232  	}
   233  
   234  	return string(b)
   235  }
   236  
   237  // FmtPercent returns 'num' with digits/precision of 'v' for 'bas_CM' and handles both Whole and Real numbers based on 'v'
   238  // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
   239  func (bas *bas_CM) FmtPercent(num float64, v uint64) string {
   240  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   241  	l := len(s) + 3
   242  	b := make([]byte, 0, l)
   243  
   244  	for i := len(s) - 1; i >= 0; i-- {
   245  
   246  		if s[i] == '.' {
   247  			b = append(b, bas.decimal[0])
   248  			continue
   249  		}
   250  
   251  		b = append(b, s[i])
   252  	}
   253  
   254  	if num < 0 {
   255  		b = append(b, bas.minus[0])
   256  	}
   257  
   258  	// reverse
   259  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   260  		b[i], b[j] = b[j], b[i]
   261  	}
   262  
   263  	b = append(b, bas.percentSuffix...)
   264  
   265  	b = append(b, bas.percent...)
   266  
   267  	return string(b)
   268  }
   269  
   270  // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'bas_CM'
   271  func (bas *bas_CM) FmtCurrency(num float64, v uint64, currency currency.Type) string {
   272  
   273  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   274  	symbol := bas.currencies[currency]
   275  	l := len(s) + len(symbol) + 3 + 2*len(s[:len(s)-int(v)-1])/3
   276  	count := 0
   277  	inWhole := v == 0
   278  	b := make([]byte, 0, l)
   279  
   280  	for i := len(s) - 1; i >= 0; i-- {
   281  
   282  		if s[i] == '.' {
   283  			b = append(b, bas.decimal[0])
   284  			inWhole = true
   285  			continue
   286  		}
   287  
   288  		if inWhole {
   289  			if count == 3 {
   290  				for j := len(bas.group) - 1; j >= 0; j-- {
   291  					b = append(b, bas.group[j])
   292  				}
   293  				count = 1
   294  			} else {
   295  				count++
   296  			}
   297  		}
   298  
   299  		b = append(b, s[i])
   300  	}
   301  
   302  	if num < 0 {
   303  		b = append(b, bas.minus[0])
   304  	}
   305  
   306  	// reverse
   307  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   308  		b[i], b[j] = b[j], b[i]
   309  	}
   310  
   311  	if int(v) < 2 {
   312  
   313  		if v == 0 {
   314  			b = append(b, bas.decimal...)
   315  		}
   316  
   317  		for i := 0; i < 2-int(v); i++ {
   318  			b = append(b, '0')
   319  		}
   320  	}
   321  
   322  	b = append(b, bas.currencyPositiveSuffix...)
   323  
   324  	b = append(b, symbol...)
   325  
   326  	return string(b)
   327  }
   328  
   329  // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'bas_CM'
   330  // in accounting notation.
   331  func (bas *bas_CM) FmtAccounting(num float64, v uint64, currency currency.Type) string {
   332  
   333  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   334  	symbol := bas.currencies[currency]
   335  	l := len(s) + len(symbol) + 3 + 2*len(s[:len(s)-int(v)-1])/3
   336  	count := 0
   337  	inWhole := v == 0
   338  	b := make([]byte, 0, l)
   339  
   340  	for i := len(s) - 1; i >= 0; i-- {
   341  
   342  		if s[i] == '.' {
   343  			b = append(b, bas.decimal[0])
   344  			inWhole = true
   345  			continue
   346  		}
   347  
   348  		if inWhole {
   349  			if count == 3 {
   350  				for j := len(bas.group) - 1; j >= 0; j-- {
   351  					b = append(b, bas.group[j])
   352  				}
   353  				count = 1
   354  			} else {
   355  				count++
   356  			}
   357  		}
   358  
   359  		b = append(b, s[i])
   360  	}
   361  
   362  	if num < 0 {
   363  
   364  		b = append(b, bas.minus[0])
   365  
   366  	}
   367  
   368  	// reverse
   369  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   370  		b[i], b[j] = b[j], b[i]
   371  	}
   372  
   373  	if int(v) < 2 {
   374  
   375  		if v == 0 {
   376  			b = append(b, bas.decimal...)
   377  		}
   378  
   379  		for i := 0; i < 2-int(v); i++ {
   380  			b = append(b, '0')
   381  		}
   382  	}
   383  
   384  	if num < 0 {
   385  		b = append(b, bas.currencyNegativeSuffix...)
   386  		b = append(b, symbol...)
   387  	} else {
   388  
   389  		b = append(b, bas.currencyPositiveSuffix...)
   390  		b = append(b, symbol...)
   391  	}
   392  
   393  	return string(b)
   394  }
   395  
   396  // FmtDateShort returns the short date representation of 't' for 'bas_CM'
   397  func (bas *bas_CM) FmtDateShort(t time.Time) string {
   398  
   399  	b := make([]byte, 0, 32)
   400  
   401  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   402  	b = append(b, []byte{0x2f}...)
   403  	b = strconv.AppendInt(b, int64(t.Month()), 10)
   404  	b = append(b, []byte{0x2f}...)
   405  
   406  	if t.Year() > 0 {
   407  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   408  	} else {
   409  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   410  	}
   411  
   412  	return string(b)
   413  }
   414  
   415  // FmtDateMedium returns the medium date representation of 't' for 'bas_CM'
   416  func (bas *bas_CM) FmtDateMedium(t time.Time) string {
   417  
   418  	b := make([]byte, 0, 32)
   419  
   420  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   421  	b = append(b, []byte{0x20}...)
   422  	b = append(b, bas.monthsAbbreviated[t.Month()]...)
   423  	b = append(b, []byte{0x2c, 0x20}...)
   424  
   425  	if t.Year() > 0 {
   426  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   427  	} else {
   428  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   429  	}
   430  
   431  	return string(b)
   432  }
   433  
   434  // FmtDateLong returns the long date representation of 't' for 'bas_CM'
   435  func (bas *bas_CM) FmtDateLong(t time.Time) string {
   436  
   437  	b := make([]byte, 0, 32)
   438  
   439  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   440  	b = append(b, []byte{0x20}...)
   441  	b = append(b, bas.monthsWide[t.Month()]...)
   442  	b = append(b, []byte{0x20}...)
   443  
   444  	if t.Year() > 0 {
   445  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   446  	} else {
   447  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   448  	}
   449  
   450  	return string(b)
   451  }
   452  
   453  // FmtDateFull returns the full date representation of 't' for 'bas_CM'
   454  func (bas *bas_CM) FmtDateFull(t time.Time) string {
   455  
   456  	b := make([]byte, 0, 32)
   457  
   458  	b = append(b, bas.daysWide[t.Weekday()]...)
   459  	b = append(b, []byte{0x20}...)
   460  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   461  	b = append(b, []byte{0x20}...)
   462  	b = append(b, bas.monthsWide[t.Month()]...)
   463  	b = append(b, []byte{0x20}...)
   464  
   465  	if t.Year() > 0 {
   466  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   467  	} else {
   468  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   469  	}
   470  
   471  	return string(b)
   472  }
   473  
   474  // FmtTimeShort returns the short time representation of 't' for 'bas_CM'
   475  func (bas *bas_CM) FmtTimeShort(t time.Time) string {
   476  
   477  	b := make([]byte, 0, 32)
   478  
   479  	if t.Hour() < 10 {
   480  		b = append(b, '0')
   481  	}
   482  
   483  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   484  	b = append(b, bas.timeSeparator...)
   485  
   486  	if t.Minute() < 10 {
   487  		b = append(b, '0')
   488  	}
   489  
   490  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   491  
   492  	return string(b)
   493  }
   494  
   495  // FmtTimeMedium returns the medium time representation of 't' for 'bas_CM'
   496  func (bas *bas_CM) FmtTimeMedium(t time.Time) string {
   497  
   498  	b := make([]byte, 0, 32)
   499  
   500  	if t.Hour() < 10 {
   501  		b = append(b, '0')
   502  	}
   503  
   504  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   505  	b = append(b, bas.timeSeparator...)
   506  
   507  	if t.Minute() < 10 {
   508  		b = append(b, '0')
   509  	}
   510  
   511  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   512  	b = append(b, bas.timeSeparator...)
   513  
   514  	if t.Second() < 10 {
   515  		b = append(b, '0')
   516  	}
   517  
   518  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   519  
   520  	return string(b)
   521  }
   522  
   523  // FmtTimeLong returns the long time representation of 't' for 'bas_CM'
   524  func (bas *bas_CM) FmtTimeLong(t time.Time) string {
   525  
   526  	b := make([]byte, 0, 32)
   527  
   528  	if t.Hour() < 10 {
   529  		b = append(b, '0')
   530  	}
   531  
   532  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   533  	b = append(b, bas.timeSeparator...)
   534  
   535  	if t.Minute() < 10 {
   536  		b = append(b, '0')
   537  	}
   538  
   539  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   540  	b = append(b, bas.timeSeparator...)
   541  
   542  	if t.Second() < 10 {
   543  		b = append(b, '0')
   544  	}
   545  
   546  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   547  	b = append(b, []byte{0x20}...)
   548  
   549  	tz, _ := t.Zone()
   550  	b = append(b, tz...)
   551  
   552  	return string(b)
   553  }
   554  
   555  // FmtTimeFull returns the full time representation of 't' for 'bas_CM'
   556  func (bas *bas_CM) FmtTimeFull(t time.Time) string {
   557  
   558  	b := make([]byte, 0, 32)
   559  
   560  	if t.Hour() < 10 {
   561  		b = append(b, '0')
   562  	}
   563  
   564  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   565  	b = append(b, bas.timeSeparator...)
   566  
   567  	if t.Minute() < 10 {
   568  		b = append(b, '0')
   569  	}
   570  
   571  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   572  	b = append(b, bas.timeSeparator...)
   573  
   574  	if t.Second() < 10 {
   575  		b = append(b, '0')
   576  	}
   577  
   578  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   579  	b = append(b, []byte{0x20}...)
   580  
   581  	tz, _ := t.Zone()
   582  
   583  	if btz, ok := bas.timezones[tz]; ok {
   584  		b = append(b, btz...)
   585  	} else {
   586  		b = append(b, tz...)
   587  	}
   588  
   589  	return string(b)
   590  }
   591  

View as plain text