...

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

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

     1  package yo_BJ
     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 yo_BJ 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  	currencyNegativePrefix 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 'yo_BJ' locale
    45  func New() locales.Translator {
    46  	return &yo_BJ{
    47  		locale:                 "yo_BJ",
    48  		pluralsCardinal:        []locales.PluralRule{6},
    49  		pluralsOrdinal:         nil,
    50  		pluralsRange:           nil,
    51  		decimal:                ".",
    52  		group:                  ",",
    53  		minus:                  "-",
    54  		percent:                "%",
    55  		perMille:               "‰",
    56  		timeSeparator:          ":",
    57  		inifinity:              "∞",
    58  		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"},
    59  		currencyNegativePrefix: "(",
    60  		currencyNegativeSuffix: ")",
    61  		monthsAbbreviated:      []string{"", "Shɛ́r", "Èrèl", "Ɛrɛ̀n", "Ìgb", "Ɛ̀bi", "Òkú", "Agɛ", "Ògú", "Owe", "Ɔ̀wà", "Bél", "Ɔ̀pɛ"},
    62  		monthsNarrow:           []string{"", "S", "È", "Ɛ", "Ì", "Ɛ̀", "Ò", "A", "Ò", "O", "Ɔ̀", "B", "Ɔ̀"},
    63  		monthsWide:             []string{"", "Oshù Shɛ́rɛ́", "Oshù Èrèlè", "Oshù Ɛrɛ̀nà", "Oshù Ìgbé", "Oshù Ɛ̀bibi", "Oshù Òkúdu", "Oshù Agɛmɔ", "Oshù Ògún", "Oshù Owewe", "Oshù Ɔ̀wàrà", "Oshù Bélú", "Oshù Ɔ̀pɛ̀"},
    64  		daysAbbreviated:        []string{"Àìk", "Aj", "Ìsɛ́g", "Ɔjɔ́r", "Ɔjɔ́b", "Ɛt", "Àbám"},
    65  		daysNarrow:             []string{"À", "A", "Ì", "Ɔ", "Ɔ", "Ɛ", "À"},
    66  		daysShort:              []string{"Àìkú", "Ajé", "Ìsɛ́gun", "Ɔjɔ́rú", "Ɔjɔ́bɔ", "Ɛtì", "Àbámɛ́ta"},
    67  		daysWide:               []string{"Ɔjɔ́ Àìkú", "Ɔjɔ́ Ajé", "Ɔjɔ́ Ìsɛ́gun", "Ɔjɔ́rú", "Ɔjɔ́bɔ", "Ɔjɔ́ Ɛtì", "Ɔjɔ́ Àbámɛ́ta"},
    68  		periodsAbbreviated:     []string{"Àárɔ̀", "Ɔ̀sán"},
    69  		periodsNarrow:          []string{"Àárɔ̀", "Ɔ̀sán"},
    70  		periodsWide:            []string{"Àárɔ̀", "Ɔ̀sán"},
    71  		erasAbbreviated:        []string{"BCE", "AD"},
    72  		erasNarrow:             []string{"", ""},
    73  		erasWide:               []string{"Saju Kristi", "Lehin Kristi"},
    74  		timezones:              map[string]string{"ACDT": "Australian Central Daylight Time", "ACST": "Australian Central Standard Time", "ACWDT": "Australian Central Western Daylight Time", "ACWST": "Australian Central Western Standard Time", "ADT": "Àkókò Ìyálɛta Àtìláńtíìkì", "AEDT": "Australian Eastern Daylight Time", "AEST": "Australian Eastern Standard Time", "AKDT": "Alaska Daylight Time", "AKST": "Alaska Standard Time", "ARST": "Argentina Summer Time", "ART": "Argentina Standard Time", "AST": "Àkókò àsikò Àtìláńtíìkì", "AWDT": "Australian Western Daylight Time", "AWST": "Australian Western Standard Time", "BOT": "Bolivia Time", "BT": "Bhutan Time", "CAT": "Central Africa Time", "CDT": "Akókò àárín gbùngbùn ojúmɔmɔ", "CHADT": "Chatham Daylight Time", "CHAST": "Chatham Standard Time", "CLST": "Chile Summer Time", "CLT": "Chile Standard Time", "COST": "Colombia Summer Time", "COT": "Colombia Standard Time", "CST": "àkókò asiko àárín gbùngbùn", "ChST": "Chamorro Standard Time", "EAT": "East Africa Time", "ECT": "Ecuador Time", "EDT": "Àkókò ojúmɔmɔ Ìhà Ìlà Oòrun", "EST": "Akókò Àsikò Ìha Ìla Oòrùn", "GFT": "French Guiana Time", "GMT": "Greenwich Mean Time", "GST": "Gulf Standard Time [translation hint: translate as just \"Gulf Time\"]", "GYT": "Guyana Time", "HADT": "HADT", "HAST": "HAST", "HAT": "HAT", "HECU": "HECU", "HEEG": "HEEG", "HENOMX": "HENOMX", "HEOG": "HEOG", "HEPM": "HEPM", "HEPMX": "HEPMX", "HKST": "Hong Kong Summer Time", "HKT": "Hong Kong Standard Time", "HNCU": "HNCU", "HNEG": "HNEG", "HNNOMX": "HNNOMX", "HNOG": "HNOG", "HNPM": "HNPM", "HNPMX": "HNPMX", "HNT": "HNT", "IST": "India Standard Time", "JDT": "Japan Daylight Time", "JST": "Japan Standard Time", "LHDT": "Lord Howe Daylight Time", "LHST": "Lord Howe Standard Time", "MDT": "Àkókò ojúmɔmɔ Ori-òkè", "MESZ": "Àkókò Àárin Sɔmà Europe", "MEZ": "Àkókò Àárin àsikò Europe", "MST": "Àkókò asiko òkè", "MYT": "Malaysia Time", "NZDT": "New Zealand Daylight Time", "NZST": "New Zealand Standard Time", "OESZ": "Àkókò Sɔmà Ìha Ìlà Oòrùn Europe", "OEZ": "Àkókò àsikò Ìhà Ìlà Oòrùn Europe", "PDT": "Àkókò Ìyálɛta Pàsífíìkì", "PST": "Àkókò àsikò Pàsífíìkì", "SAST": "South Africa Standard Time", "SGT": "Singapore Standard Time", "SRT": "Suriname Time", "TMST": "Turkmenistan Summer Time", "TMT": "Turkmenistan Standard Time", "UYST": "Uruguay Summer Time", "UYT": "Uruguay Standard Time", "VET": "Venezuela Time", "WARST": "Western Argentina Summer Time", "WART": "Western Argentina Standard Time", "WAST": "West Africa Summer Time", "WAT": "West Africa Standard Time", "WESZ": "Àkókò Sɔmà Ìhà Ìwɔ Oòrùn Europe", "WEZ": "Àkókò àsikò Ìwɔ Oòrùn Europe", "WIB": "WIB", "WIT": "Eastern Indonesia Time", "WITA": "WITA", "∅∅∅": "Brasilia Summer Time"},
    75  	}
    76  }
    77  
    78  // Locale returns the current translators string locale
    79  func (yo *yo_BJ) Locale() string {
    80  	return yo.locale
    81  }
    82  
    83  // PluralsCardinal returns the list of cardinal plural rules associated with 'yo_BJ'
    84  func (yo *yo_BJ) PluralsCardinal() []locales.PluralRule {
    85  	return yo.pluralsCardinal
    86  }
    87  
    88  // PluralsOrdinal returns the list of ordinal plural rules associated with 'yo_BJ'
    89  func (yo *yo_BJ) PluralsOrdinal() []locales.PluralRule {
    90  	return yo.pluralsOrdinal
    91  }
    92  
    93  // PluralsRange returns the list of range plural rules associated with 'yo_BJ'
    94  func (yo *yo_BJ) PluralsRange() []locales.PluralRule {
    95  	return yo.pluralsRange
    96  }
    97  
    98  // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'yo_BJ'
    99  func (yo *yo_BJ) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
   100  	return locales.PluralRuleOther
   101  }
   102  
   103  // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'yo_BJ'
   104  func (yo *yo_BJ) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
   105  	return locales.PluralRuleUnknown
   106  }
   107  
   108  // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'yo_BJ'
   109  func (yo *yo_BJ) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
   110  	return locales.PluralRuleUnknown
   111  }
   112  
   113  // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
   114  func (yo *yo_BJ) MonthAbbreviated(month time.Month) string {
   115  	return yo.monthsAbbreviated[month]
   116  }
   117  
   118  // MonthsAbbreviated returns the locales abbreviated months
   119  func (yo *yo_BJ) MonthsAbbreviated() []string {
   120  	return yo.monthsAbbreviated[1:]
   121  }
   122  
   123  // MonthNarrow returns the locales narrow month given the 'month' provided
   124  func (yo *yo_BJ) MonthNarrow(month time.Month) string {
   125  	return yo.monthsNarrow[month]
   126  }
   127  
   128  // MonthsNarrow returns the locales narrow months
   129  func (yo *yo_BJ) MonthsNarrow() []string {
   130  	return yo.monthsNarrow[1:]
   131  }
   132  
   133  // MonthWide returns the locales wide month given the 'month' provided
   134  func (yo *yo_BJ) MonthWide(month time.Month) string {
   135  	return yo.monthsWide[month]
   136  }
   137  
   138  // MonthsWide returns the locales wide months
   139  func (yo *yo_BJ) MonthsWide() []string {
   140  	return yo.monthsWide[1:]
   141  }
   142  
   143  // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
   144  func (yo *yo_BJ) WeekdayAbbreviated(weekday time.Weekday) string {
   145  	return yo.daysAbbreviated[weekday]
   146  }
   147  
   148  // WeekdaysAbbreviated returns the locales abbreviated weekdays
   149  func (yo *yo_BJ) WeekdaysAbbreviated() []string {
   150  	return yo.daysAbbreviated
   151  }
   152  
   153  // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
   154  func (yo *yo_BJ) WeekdayNarrow(weekday time.Weekday) string {
   155  	return yo.daysNarrow[weekday]
   156  }
   157  
   158  // WeekdaysNarrow returns the locales narrow weekdays
   159  func (yo *yo_BJ) WeekdaysNarrow() []string {
   160  	return yo.daysNarrow
   161  }
   162  
   163  // WeekdayShort returns the locales short weekday given the 'weekday' provided
   164  func (yo *yo_BJ) WeekdayShort(weekday time.Weekday) string {
   165  	return yo.daysShort[weekday]
   166  }
   167  
   168  // WeekdaysShort returns the locales short weekdays
   169  func (yo *yo_BJ) WeekdaysShort() []string {
   170  	return yo.daysShort
   171  }
   172  
   173  // WeekdayWide returns the locales wide weekday given the 'weekday' provided
   174  func (yo *yo_BJ) WeekdayWide(weekday time.Weekday) string {
   175  	return yo.daysWide[weekday]
   176  }
   177  
   178  // WeekdaysWide returns the locales wide weekdays
   179  func (yo *yo_BJ) WeekdaysWide() []string {
   180  	return yo.daysWide
   181  }
   182  
   183  // Decimal returns the decimal point of number
   184  func (yo *yo_BJ) Decimal() string {
   185  	return yo.decimal
   186  }
   187  
   188  // Group returns the group of number
   189  func (yo *yo_BJ) Group() string {
   190  	return yo.group
   191  }
   192  
   193  // Group returns the minus sign of number
   194  func (yo *yo_BJ) Minus() string {
   195  	return yo.minus
   196  }
   197  
   198  // FmtNumber returns 'num' with digits/precision of 'v' for 'yo_BJ' and handles both Whole and Real numbers based on 'v'
   199  func (yo *yo_BJ) FmtNumber(num float64, v uint64) string {
   200  
   201  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   202  	l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
   203  	count := 0
   204  	inWhole := v == 0
   205  	b := make([]byte, 0, l)
   206  
   207  	for i := len(s) - 1; i >= 0; i-- {
   208  
   209  		if s[i] == '.' {
   210  			b = append(b, yo.decimal[0])
   211  			inWhole = true
   212  			continue
   213  		}
   214  
   215  		if inWhole {
   216  			if count == 3 {
   217  				b = append(b, yo.group[0])
   218  				count = 1
   219  			} else {
   220  				count++
   221  			}
   222  		}
   223  
   224  		b = append(b, s[i])
   225  	}
   226  
   227  	if num < 0 {
   228  		b = append(b, yo.minus[0])
   229  	}
   230  
   231  	// reverse
   232  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   233  		b[i], b[j] = b[j], b[i]
   234  	}
   235  
   236  	return string(b)
   237  }
   238  
   239  // FmtPercent returns 'num' with digits/precision of 'v' for 'yo_BJ' and handles both Whole and Real numbers based on 'v'
   240  // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
   241  func (yo *yo_BJ) FmtPercent(num float64, v uint64) string {
   242  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   243  	l := len(s) + 3
   244  	b := make([]byte, 0, l)
   245  
   246  	for i := len(s) - 1; i >= 0; i-- {
   247  
   248  		if s[i] == '.' {
   249  			b = append(b, yo.decimal[0])
   250  			continue
   251  		}
   252  
   253  		b = append(b, s[i])
   254  	}
   255  
   256  	if num < 0 {
   257  		b = append(b, yo.minus[0])
   258  	}
   259  
   260  	// reverse
   261  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   262  		b[i], b[j] = b[j], b[i]
   263  	}
   264  
   265  	b = append(b, yo.percent...)
   266  
   267  	return string(b)
   268  }
   269  
   270  // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'yo_BJ'
   271  func (yo *yo_BJ) FmtCurrency(num float64, v uint64, currency currency.Type) string {
   272  
   273  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   274  	symbol := yo.currencies[currency]
   275  	l := len(s) + len(symbol) + 2 + 1*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, yo.decimal[0])
   284  			inWhole = true
   285  			continue
   286  		}
   287  
   288  		if inWhole {
   289  			if count == 3 {
   290  				b = append(b, yo.group[0])
   291  				count = 1
   292  			} else {
   293  				count++
   294  			}
   295  		}
   296  
   297  		b = append(b, s[i])
   298  	}
   299  
   300  	for j := len(symbol) - 1; j >= 0; j-- {
   301  		b = append(b, symbol[j])
   302  	}
   303  
   304  	if num < 0 {
   305  		b = append(b, yo.minus[0])
   306  	}
   307  
   308  	// reverse
   309  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   310  		b[i], b[j] = b[j], b[i]
   311  	}
   312  
   313  	if int(v) < 2 {
   314  
   315  		if v == 0 {
   316  			b = append(b, yo.decimal...)
   317  		}
   318  
   319  		for i := 0; i < 2-int(v); i++ {
   320  			b = append(b, '0')
   321  		}
   322  	}
   323  
   324  	return string(b)
   325  }
   326  
   327  // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'yo_BJ'
   328  // in accounting notation.
   329  func (yo *yo_BJ) FmtAccounting(num float64, v uint64, currency currency.Type) string {
   330  
   331  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   332  	symbol := yo.currencies[currency]
   333  	l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
   334  	count := 0
   335  	inWhole := v == 0
   336  	b := make([]byte, 0, l)
   337  
   338  	for i := len(s) - 1; i >= 0; i-- {
   339  
   340  		if s[i] == '.' {
   341  			b = append(b, yo.decimal[0])
   342  			inWhole = true
   343  			continue
   344  		}
   345  
   346  		if inWhole {
   347  			if count == 3 {
   348  				b = append(b, yo.group[0])
   349  				count = 1
   350  			} else {
   351  				count++
   352  			}
   353  		}
   354  
   355  		b = append(b, s[i])
   356  	}
   357  
   358  	if num < 0 {
   359  
   360  		for j := len(symbol) - 1; j >= 0; j-- {
   361  			b = append(b, symbol[j])
   362  		}
   363  
   364  		b = append(b, yo.currencyNegativePrefix[0])
   365  
   366  	} else {
   367  
   368  		for j := len(symbol) - 1; j >= 0; j-- {
   369  			b = append(b, symbol[j])
   370  		}
   371  
   372  	}
   373  
   374  	// reverse
   375  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   376  		b[i], b[j] = b[j], b[i]
   377  	}
   378  
   379  	if int(v) < 2 {
   380  
   381  		if v == 0 {
   382  			b = append(b, yo.decimal...)
   383  		}
   384  
   385  		for i := 0; i < 2-int(v); i++ {
   386  			b = append(b, '0')
   387  		}
   388  	}
   389  
   390  	if num < 0 {
   391  		b = append(b, yo.currencyNegativeSuffix...)
   392  	}
   393  
   394  	return string(b)
   395  }
   396  
   397  // FmtDateShort returns the short date representation of 't' for 'yo_BJ'
   398  func (yo *yo_BJ) FmtDateShort(t time.Time) string {
   399  
   400  	b := make([]byte, 0, 32)
   401  
   402  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   403  	b = append(b, []byte{0x2f}...)
   404  	b = strconv.AppendInt(b, int64(t.Month()), 10)
   405  	b = append(b, []byte{0x2f}...)
   406  
   407  	if t.Year() > 0 {
   408  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   409  	} else {
   410  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   411  	}
   412  
   413  	return string(b)
   414  }
   415  
   416  // FmtDateMedium returns the medium date representation of 't' for 'yo_BJ'
   417  func (yo *yo_BJ) FmtDateMedium(t time.Time) string {
   418  
   419  	b := make([]byte, 0, 32)
   420  
   421  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   422  	b = append(b, []byte{0x20}...)
   423  
   424  	if t.Month() < 10 {
   425  		b = append(b, '0')
   426  	}
   427  
   428  	b = strconv.AppendInt(b, int64(t.Month()), 10)
   429  
   430  	b = append(b, []byte{0x20}...)
   431  
   432  	if t.Year() > 0 {
   433  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   434  	} else {
   435  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   436  	}
   437  
   438  	return string(b)
   439  }
   440  
   441  // FmtDateLong returns the long date representation of 't' for 'yo_BJ'
   442  func (yo *yo_BJ) FmtDateLong(t time.Time) string {
   443  
   444  	b := make([]byte, 0, 32)
   445  
   446  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   447  	b = append(b, []byte{0x20}...)
   448  	b = append(b, yo.monthsAbbreviated[t.Month()]...)
   449  	b = append(b, []byte{0x20}...)
   450  
   451  	if t.Year() > 0 {
   452  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   453  	} else {
   454  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   455  	}
   456  
   457  	return string(b)
   458  }
   459  
   460  // FmtDateFull returns the full date representation of 't' for 'yo_BJ'
   461  func (yo *yo_BJ) FmtDateFull(t time.Time) string {
   462  
   463  	b := make([]byte, 0, 32)
   464  
   465  	b = append(b, yo.daysWide[t.Weekday()]...)
   466  	b = append(b, []byte{0x2c, 0x20}...)
   467  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   468  	b = append(b, []byte{0x20}...)
   469  	b = append(b, yo.monthsAbbreviated[t.Month()]...)
   470  	b = append(b, []byte{0x20}...)
   471  
   472  	if t.Year() > 0 {
   473  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   474  	} else {
   475  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   476  	}
   477  
   478  	return string(b)
   479  }
   480  
   481  // FmtTimeShort returns the short time representation of 't' for 'yo_BJ'
   482  func (yo *yo_BJ) FmtTimeShort(t time.Time) string {
   483  
   484  	b := make([]byte, 0, 32)
   485  
   486  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   487  	b = append(b, yo.timeSeparator...)
   488  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   489  
   490  	return string(b)
   491  }
   492  
   493  // FmtTimeMedium returns the medium time representation of 't' for 'yo_BJ'
   494  func (yo *yo_BJ) FmtTimeMedium(t time.Time) string {
   495  
   496  	b := make([]byte, 0, 32)
   497  
   498  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   499  	b = append(b, yo.timeSeparator...)
   500  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   501  	b = append(b, yo.timeSeparator...)
   502  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   503  
   504  	return string(b)
   505  }
   506  
   507  // FmtTimeLong returns the long time representation of 't' for 'yo_BJ'
   508  func (yo *yo_BJ) FmtTimeLong(t time.Time) string {
   509  
   510  	b := make([]byte, 0, 32)
   511  
   512  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   513  	b = append(b, yo.timeSeparator...)
   514  
   515  	if t.Minute() < 10 {
   516  		b = append(b, '0')
   517  	}
   518  
   519  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   520  	b = append(b, yo.timeSeparator...)
   521  
   522  	if t.Second() < 10 {
   523  		b = append(b, '0')
   524  	}
   525  
   526  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   527  	b = append(b, []byte{0x20}...)
   528  
   529  	tz, _ := t.Zone()
   530  	b = append(b, tz...)
   531  
   532  	return string(b)
   533  }
   534  
   535  // FmtTimeFull returns the full time representation of 't' for 'yo_BJ'
   536  func (yo *yo_BJ) FmtTimeFull(t time.Time) string {
   537  
   538  	b := make([]byte, 0, 32)
   539  
   540  	if t.Hour() < 10 {
   541  		b = append(b, '0')
   542  	}
   543  
   544  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   545  	b = append(b, yo.timeSeparator...)
   546  
   547  	if t.Minute() < 10 {
   548  		b = append(b, '0')
   549  	}
   550  
   551  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   552  	b = append(b, yo.timeSeparator...)
   553  
   554  	if t.Second() < 10 {
   555  		b = append(b, '0')
   556  	}
   557  
   558  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   559  	b = append(b, []byte{0x20}...)
   560  
   561  	tz, _ := t.Zone()
   562  
   563  	if btz, ok := yo.timezones[tz]; ok {
   564  		b = append(b, btz...)
   565  	} else {
   566  		b = append(b, tz...)
   567  	}
   568  
   569  	return string(b)
   570  }
   571  

View as plain text