...

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

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

     1  package sv_AX
     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 sv_AX 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 'sv_AX' locale
    46  func New() locales.Translator {
    47  	return &sv_AX{
    48  		locale:                 "sv_AX",
    49  		pluralsCardinal:        []locales.PluralRule{2, 6},
    50  		pluralsOrdinal:         []locales.PluralRule{2, 6},
    51  		pluralsRange:           []locales.PluralRule{6},
    52  		decimal:                ",",
    53  		group:                  " ",
    54  		minus:                  "−",
    55  		percent:                "%",
    56  		perMille:               "‰",
    57  		timeSeparator:          ":",
    58  		inifinity:              "∞",
    59  		currencies:             []string{"ADP", "AED", "AFA", "AFN", "ALK", "ALL", "AMD", "ANG", "AOA", "AOK", "AON", "AOR", "ARA", "ARL", "ARM", "ARP", "ARS", "ATS", "AUD", "AWG", "AZM", "AZN", "BAD", "BAM", "BAN", "BBD", "BDT", "BEC", "BEF", "BEL", "BGL", "BGM", "BGN", "BGO", "BHD", "BIF", "BMD", "BND", "BOB", "BOL", "BOP", "BOV", "BRB", "BRC", "BRE", "BRL", "BRN", "BRR", "BRZ", "BSD", "BTN", "BUK", "BWP", "BYB", "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"},
    60  		percentSuffix:          " ",
    61  		currencyPositiveSuffix: " ",
    62  		currencyNegativeSuffix: " ",
    63  		monthsAbbreviated:      []string{"", "jan.", "feb.", "mars", "apr.", "maj", "juni", "juli", "aug.", "sep.", "okt.", "nov.", "dec."},
    64  		monthsNarrow:           []string{"", "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"},
    65  		monthsWide:             []string{"", "januari", "februari", "mars", "april", "maj", "juni", "juli", "augusti", "september", "oktober", "november", "december"},
    66  		daysAbbreviated:        []string{"sön", "mån", "tis", "ons", "tors", "fre", "lör"},
    67  		daysNarrow:             []string{"S", "M", "T", "O", "T", "F", "L"},
    68  		daysShort:              []string{"sö", "må", "ti", "on", "to", "fr", "lö"},
    69  		daysWide:               []string{"söndag", "måndag", "tisdag", "onsdag", "torsdag", "fredag", "lördag"},
    70  		periodsAbbreviated:     []string{"fm", "em"},
    71  		periodsNarrow:          []string{"fm", "em"},
    72  		periodsWide:            []string{"fm", "em"},
    73  		erasAbbreviated:        []string{"f.Kr.", "e.Kr."},
    74  		erasNarrow:             []string{"f.Kr.", "e.Kr."},
    75  		erasWide:               []string{"före Kristus", "efter Kristus"},
    76  		timezones:              map[string]string{"ACDT": "centralaustralisk sommartid", "ACST": "centralaustralisk normaltid", "ACWDT": "västcentralaustralisk sommartid", "ACWST": "västcentralaustralisk normaltid", "ADT": "nordamerikansk atlantsommartid", "AEDT": "östaustralisk sommartid", "AEST": "östaustralisk normaltid", "AKDT": "Alaska, sommartid", "AKST": "Alaska, normaltid", "ARST": "östargentinsk sommartid", "ART": "östargentinsk normaltid", "AST": "nordamerikansk atlantnormaltid", "AWDT": "västaustralisk sommartid", "AWST": "västaustralisk normaltid", "BOT": "boliviansk tid", "BT": "bhutansk tid", "CAT": "centralafrikansk tid", "CDT": "centralnordamerikansk sommartid", "CHADT": "Chatham, sommartid", "CHAST": "Chatham, normaltid", "CLST": "chilensk sommartid", "CLT": "chilensk normaltid", "COST": "colombiansk sommartid", "COT": "colombiansk normaltid", "CST": "centralnordamerikansk normaltid", "ChST": "Chamorrotid", "EAT": "östafrikansk tid", "ECT": "ecuadoriansk tid", "EDT": "östnordamerikansk sommartid", "EST": "östnordamerikansk normaltid", "GFT": "Franska Guyanatid", "GMT": "Greenwichtid", "GST": "Persiska vikentid", "GYT": "Guyanatid", "HADT": "Honolulu, sommartid", "HAST": "Honolulu, normaltid", "HAT": "Newfoundland, sommartid", "HECU": "kubansk sommartid", "HEEG": "östgrönländsk sommartid", "HENOMX": "nordvästmexikansk sommartid", "HEOG": "västgrönländsk sommartid", "HEPM": "S:t Pierre och Miquelon, sommartid", "HEPMX": "mexikansk stillahavstid, sommartid", "HKST": "Hongkong, sommartid", "HKT": "Hongkong, normaltid", "HNCU": "kubansk normaltid", "HNEG": "östgrönländsk normaltid", "HNNOMX": "nordvästmexikansk normaltid", "HNOG": "västgrönländsk normaltid", "HNPM": "S:t Pierre och Miquelon, normaltid", "HNPMX": "mexikansk stillahavstid, normaltid", "HNT": "Newfoundland, normaltid", "IST": "indisk tid", "JDT": "japansk sommartid", "JST": "japansk normaltid", "LHDT": "Lord Howe, sommartid", "LHST": "Lord Howe, normaltid", "MDT": "Klippiga bergen, sommartid", "MESZ": "centraleuropeisk sommartid", "MEZ": "centraleuropeisk normaltid", "MST": "Klippiga bergen, normaltid", "MYT": "malaysisk tid", "NZDT": "nyzeeländsk sommartid", "NZST": "nyzeeländsk normaltid", "OESZ": "östeuropeisk sommartid", "OEZ": "östeuropeisk normaltid", "PDT": "västnordamerikansk sommartid", "PST": "västnordamerikansk normaltid", "SAST": "sydafrikansk tid", "SGT": "Singaporetid", "SRT": "Surinamtid", "TMST": "turkmensk sommartid", "TMT": "turkmensk normaltid", "UYST": "uruguayansk sommartid", "UYT": "uruguayansk normaltid", "VET": "venezuelansk tid", "WARST": "västargentinsk sommartid", "WART": "västargentinsk normaltid", "WAST": "västafrikansk sommartid", "WAT": "västafrikansk normaltid", "WESZ": "västeuropeisk sommartid", "WEZ": "västeuropeisk normaltid", "WIB": "västindonesisk tid", "WIT": "östindonesisk tid", "WITA": "centralindonesisk tid", "∅∅∅": "peruansk sommartid"},
    77  	}
    78  }
    79  
    80  // Locale returns the current translators string locale
    81  func (sv *sv_AX) Locale() string {
    82  	return sv.locale
    83  }
    84  
    85  // PluralsCardinal returns the list of cardinal plural rules associated with 'sv_AX'
    86  func (sv *sv_AX) PluralsCardinal() []locales.PluralRule {
    87  	return sv.pluralsCardinal
    88  }
    89  
    90  // PluralsOrdinal returns the list of ordinal plural rules associated with 'sv_AX'
    91  func (sv *sv_AX) PluralsOrdinal() []locales.PluralRule {
    92  	return sv.pluralsOrdinal
    93  }
    94  
    95  // PluralsRange returns the list of range plural rules associated with 'sv_AX'
    96  func (sv *sv_AX) PluralsRange() []locales.PluralRule {
    97  	return sv.pluralsRange
    98  }
    99  
   100  // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'sv_AX'
   101  func (sv *sv_AX) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
   102  
   103  	n := math.Abs(num)
   104  	i := int64(n)
   105  
   106  	if i == 1 && v == 0 {
   107  		return locales.PluralRuleOne
   108  	}
   109  
   110  	return locales.PluralRuleOther
   111  }
   112  
   113  // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'sv_AX'
   114  func (sv *sv_AX) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
   115  
   116  	n := math.Abs(num)
   117  	nMod10 := math.Mod(n, 10)
   118  	nMod100 := math.Mod(n, 100)
   119  
   120  	if (nMod10 == 1 || nMod10 == 2) && (nMod100 != 11 && nMod100 != 12) {
   121  		return locales.PluralRuleOne
   122  	}
   123  
   124  	return locales.PluralRuleOther
   125  }
   126  
   127  // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'sv_AX'
   128  func (sv *sv_AX) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
   129  	return locales.PluralRuleOther
   130  }
   131  
   132  // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
   133  func (sv *sv_AX) MonthAbbreviated(month time.Month) string {
   134  	return sv.monthsAbbreviated[month]
   135  }
   136  
   137  // MonthsAbbreviated returns the locales abbreviated months
   138  func (sv *sv_AX) MonthsAbbreviated() []string {
   139  	return sv.monthsAbbreviated[1:]
   140  }
   141  
   142  // MonthNarrow returns the locales narrow month given the 'month' provided
   143  func (sv *sv_AX) MonthNarrow(month time.Month) string {
   144  	return sv.monthsNarrow[month]
   145  }
   146  
   147  // MonthsNarrow returns the locales narrow months
   148  func (sv *sv_AX) MonthsNarrow() []string {
   149  	return sv.monthsNarrow[1:]
   150  }
   151  
   152  // MonthWide returns the locales wide month given the 'month' provided
   153  func (sv *sv_AX) MonthWide(month time.Month) string {
   154  	return sv.monthsWide[month]
   155  }
   156  
   157  // MonthsWide returns the locales wide months
   158  func (sv *sv_AX) MonthsWide() []string {
   159  	return sv.monthsWide[1:]
   160  }
   161  
   162  // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
   163  func (sv *sv_AX) WeekdayAbbreviated(weekday time.Weekday) string {
   164  	return sv.daysAbbreviated[weekday]
   165  }
   166  
   167  // WeekdaysAbbreviated returns the locales abbreviated weekdays
   168  func (sv *sv_AX) WeekdaysAbbreviated() []string {
   169  	return sv.daysAbbreviated
   170  }
   171  
   172  // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
   173  func (sv *sv_AX) WeekdayNarrow(weekday time.Weekday) string {
   174  	return sv.daysNarrow[weekday]
   175  }
   176  
   177  // WeekdaysNarrow returns the locales narrow weekdays
   178  func (sv *sv_AX) WeekdaysNarrow() []string {
   179  	return sv.daysNarrow
   180  }
   181  
   182  // WeekdayShort returns the locales short weekday given the 'weekday' provided
   183  func (sv *sv_AX) WeekdayShort(weekday time.Weekday) string {
   184  	return sv.daysShort[weekday]
   185  }
   186  
   187  // WeekdaysShort returns the locales short weekdays
   188  func (sv *sv_AX) WeekdaysShort() []string {
   189  	return sv.daysShort
   190  }
   191  
   192  // WeekdayWide returns the locales wide weekday given the 'weekday' provided
   193  func (sv *sv_AX) WeekdayWide(weekday time.Weekday) string {
   194  	return sv.daysWide[weekday]
   195  }
   196  
   197  // WeekdaysWide returns the locales wide weekdays
   198  func (sv *sv_AX) WeekdaysWide() []string {
   199  	return sv.daysWide
   200  }
   201  
   202  // Decimal returns the decimal point of number
   203  func (sv *sv_AX) Decimal() string {
   204  	return sv.decimal
   205  }
   206  
   207  // Group returns the group of number
   208  func (sv *sv_AX) Group() string {
   209  	return sv.group
   210  }
   211  
   212  // Group returns the minus sign of number
   213  func (sv *sv_AX) Minus() string {
   214  	return sv.minus
   215  }
   216  
   217  // FmtNumber returns 'num' with digits/precision of 'v' for 'sv_AX' and handles both Whole and Real numbers based on 'v'
   218  func (sv *sv_AX) FmtNumber(num float64, v uint64) string {
   219  
   220  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   221  	l := len(s) + 4 + 2*len(s[:len(s)-int(v)-1])/3
   222  	count := 0
   223  	inWhole := v == 0
   224  	b := make([]byte, 0, l)
   225  
   226  	for i := len(s) - 1; i >= 0; i-- {
   227  
   228  		if s[i] == '.' {
   229  			b = append(b, sv.decimal[0])
   230  			inWhole = true
   231  			continue
   232  		}
   233  
   234  		if inWhole {
   235  			if count == 3 {
   236  				for j := len(sv.group) - 1; j >= 0; j-- {
   237  					b = append(b, sv.group[j])
   238  				}
   239  				count = 1
   240  			} else {
   241  				count++
   242  			}
   243  		}
   244  
   245  		b = append(b, s[i])
   246  	}
   247  
   248  	if num < 0 {
   249  		for j := len(sv.minus) - 1; j >= 0; j-- {
   250  			b = append(b, sv.minus[j])
   251  		}
   252  	}
   253  
   254  	// reverse
   255  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   256  		b[i], b[j] = b[j], b[i]
   257  	}
   258  
   259  	return string(b)
   260  }
   261  
   262  // FmtPercent returns 'num' with digits/precision of 'v' for 'sv_AX' and handles both Whole and Real numbers based on 'v'
   263  // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
   264  func (sv *sv_AX) FmtPercent(num float64, v uint64) string {
   265  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   266  	l := len(s) + 7
   267  	b := make([]byte, 0, l)
   268  
   269  	for i := len(s) - 1; i >= 0; i-- {
   270  
   271  		if s[i] == '.' {
   272  			b = append(b, sv.decimal[0])
   273  			continue
   274  		}
   275  
   276  		b = append(b, s[i])
   277  	}
   278  
   279  	if num < 0 {
   280  		for j := len(sv.minus) - 1; j >= 0; j-- {
   281  			b = append(b, sv.minus[j])
   282  		}
   283  	}
   284  
   285  	// reverse
   286  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   287  		b[i], b[j] = b[j], b[i]
   288  	}
   289  
   290  	b = append(b, sv.percentSuffix...)
   291  
   292  	b = append(b, sv.percent...)
   293  
   294  	return string(b)
   295  }
   296  
   297  // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'sv_AX'
   298  func (sv *sv_AX) FmtCurrency(num float64, v uint64, currency currency.Type) string {
   299  
   300  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   301  	symbol := sv.currencies[currency]
   302  	l := len(s) + len(symbol) + 6 + 2*len(s[:len(s)-int(v)-1])/3
   303  	count := 0
   304  	inWhole := v == 0
   305  	b := make([]byte, 0, l)
   306  
   307  	for i := len(s) - 1; i >= 0; i-- {
   308  
   309  		if s[i] == '.' {
   310  			b = append(b, sv.decimal[0])
   311  			inWhole = true
   312  			continue
   313  		}
   314  
   315  		if inWhole {
   316  			if count == 3 {
   317  				for j := len(sv.group) - 1; j >= 0; j-- {
   318  					b = append(b, sv.group[j])
   319  				}
   320  				count = 1
   321  			} else {
   322  				count++
   323  			}
   324  		}
   325  
   326  		b = append(b, s[i])
   327  	}
   328  
   329  	if num < 0 {
   330  		for j := len(sv.minus) - 1; j >= 0; j-- {
   331  			b = append(b, sv.minus[j])
   332  		}
   333  	}
   334  
   335  	// reverse
   336  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   337  		b[i], b[j] = b[j], b[i]
   338  	}
   339  
   340  	if int(v) < 2 {
   341  
   342  		if v == 0 {
   343  			b = append(b, sv.decimal...)
   344  		}
   345  
   346  		for i := 0; i < 2-int(v); i++ {
   347  			b = append(b, '0')
   348  		}
   349  	}
   350  
   351  	b = append(b, sv.currencyPositiveSuffix...)
   352  
   353  	b = append(b, symbol...)
   354  
   355  	return string(b)
   356  }
   357  
   358  // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sv_AX'
   359  // in accounting notation.
   360  func (sv *sv_AX) FmtAccounting(num float64, v uint64, currency currency.Type) string {
   361  
   362  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   363  	symbol := sv.currencies[currency]
   364  	l := len(s) + len(symbol) + 6 + 2*len(s[:len(s)-int(v)-1])/3
   365  	count := 0
   366  	inWhole := v == 0
   367  	b := make([]byte, 0, l)
   368  
   369  	for i := len(s) - 1; i >= 0; i-- {
   370  
   371  		if s[i] == '.' {
   372  			b = append(b, sv.decimal[0])
   373  			inWhole = true
   374  			continue
   375  		}
   376  
   377  		if inWhole {
   378  			if count == 3 {
   379  				for j := len(sv.group) - 1; j >= 0; j-- {
   380  					b = append(b, sv.group[j])
   381  				}
   382  				count = 1
   383  			} else {
   384  				count++
   385  			}
   386  		}
   387  
   388  		b = append(b, s[i])
   389  	}
   390  
   391  	if num < 0 {
   392  
   393  		for j := len(sv.minus) - 1; j >= 0; j-- {
   394  			b = append(b, sv.minus[j])
   395  		}
   396  
   397  	}
   398  
   399  	// reverse
   400  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   401  		b[i], b[j] = b[j], b[i]
   402  	}
   403  
   404  	if int(v) < 2 {
   405  
   406  		if v == 0 {
   407  			b = append(b, sv.decimal...)
   408  		}
   409  
   410  		for i := 0; i < 2-int(v); i++ {
   411  			b = append(b, '0')
   412  		}
   413  	}
   414  
   415  	if num < 0 {
   416  		b = append(b, sv.currencyNegativeSuffix...)
   417  		b = append(b, symbol...)
   418  	} else {
   419  
   420  		b = append(b, sv.currencyPositiveSuffix...)
   421  		b = append(b, symbol...)
   422  	}
   423  
   424  	return string(b)
   425  }
   426  
   427  // FmtDateShort returns the short date representation of 't' for 'sv_AX'
   428  func (sv *sv_AX) FmtDateShort(t time.Time) string {
   429  
   430  	b := make([]byte, 0, 32)
   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  	b = append(b, []byte{0x2d}...)
   439  
   440  	if t.Month() < 10 {
   441  		b = append(b, '0')
   442  	}
   443  
   444  	b = strconv.AppendInt(b, int64(t.Month()), 10)
   445  
   446  	b = append(b, []byte{0x2d}...)
   447  
   448  	if t.Day() < 10 {
   449  		b = append(b, '0')
   450  	}
   451  
   452  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   453  
   454  	return string(b)
   455  }
   456  
   457  // FmtDateMedium returns the medium date representation of 't' for 'sv_AX'
   458  func (sv *sv_AX) FmtDateMedium(t time.Time) string {
   459  
   460  	b := make([]byte, 0, 32)
   461  
   462  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   463  	b = append(b, []byte{0x20}...)
   464  	b = append(b, sv.monthsAbbreviated[t.Month()]...)
   465  	b = append(b, []byte{0x20}...)
   466  
   467  	if t.Year() > 0 {
   468  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   469  	} else {
   470  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   471  	}
   472  
   473  	return string(b)
   474  }
   475  
   476  // FmtDateLong returns the long date representation of 't' for 'sv_AX'
   477  func (sv *sv_AX) FmtDateLong(t time.Time) string {
   478  
   479  	b := make([]byte, 0, 32)
   480  
   481  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   482  	b = append(b, []byte{0x20}...)
   483  	b = append(b, sv.monthsWide[t.Month()]...)
   484  	b = append(b, []byte{0x20}...)
   485  
   486  	if t.Year() > 0 {
   487  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   488  	} else {
   489  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   490  	}
   491  
   492  	return string(b)
   493  }
   494  
   495  // FmtDateFull returns the full date representation of 't' for 'sv_AX'
   496  func (sv *sv_AX) FmtDateFull(t time.Time) string {
   497  
   498  	b := make([]byte, 0, 32)
   499  
   500  	b = append(b, sv.daysWide[t.Weekday()]...)
   501  	b = append(b, []byte{0x20}...)
   502  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   503  	b = append(b, []byte{0x20}...)
   504  	b = append(b, sv.monthsWide[t.Month()]...)
   505  	b = append(b, []byte{0x20}...)
   506  
   507  	if t.Year() > 0 {
   508  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   509  	} else {
   510  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   511  	}
   512  
   513  	return string(b)
   514  }
   515  
   516  // FmtTimeShort returns the short time representation of 't' for 'sv_AX'
   517  func (sv *sv_AX) FmtTimeShort(t time.Time) string {
   518  
   519  	b := make([]byte, 0, 32)
   520  
   521  	if t.Hour() < 10 {
   522  		b = append(b, '0')
   523  	}
   524  
   525  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   526  	b = append(b, sv.timeSeparator...)
   527  
   528  	if t.Minute() < 10 {
   529  		b = append(b, '0')
   530  	}
   531  
   532  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   533  
   534  	return string(b)
   535  }
   536  
   537  // FmtTimeMedium returns the medium time representation of 't' for 'sv_AX'
   538  func (sv *sv_AX) FmtTimeMedium(t time.Time) string {
   539  
   540  	b := make([]byte, 0, 32)
   541  
   542  	if t.Hour() < 10 {
   543  		b = append(b, '0')
   544  	}
   545  
   546  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   547  	b = append(b, sv.timeSeparator...)
   548  
   549  	if t.Minute() < 10 {
   550  		b = append(b, '0')
   551  	}
   552  
   553  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   554  	b = append(b, sv.timeSeparator...)
   555  
   556  	if t.Second() < 10 {
   557  		b = append(b, '0')
   558  	}
   559  
   560  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   561  
   562  	return string(b)
   563  }
   564  
   565  // FmtTimeLong returns the long time representation of 't' for 'sv_AX'
   566  func (sv *sv_AX) FmtTimeLong(t time.Time) string {
   567  
   568  	b := make([]byte, 0, 32)
   569  
   570  	if t.Hour() < 10 {
   571  		b = append(b, '0')
   572  	}
   573  
   574  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   575  	b = append(b, sv.timeSeparator...)
   576  
   577  	if t.Minute() < 10 {
   578  		b = append(b, '0')
   579  	}
   580  
   581  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   582  	b = append(b, sv.timeSeparator...)
   583  
   584  	if t.Second() < 10 {
   585  		b = append(b, '0')
   586  	}
   587  
   588  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   589  	b = append(b, []byte{0x20}...)
   590  
   591  	tz, _ := t.Zone()
   592  	b = append(b, tz...)
   593  
   594  	return string(b)
   595  }
   596  
   597  // FmtTimeFull returns the full time representation of 't' for 'sv_AX'
   598  func (sv *sv_AX) FmtTimeFull(t time.Time) string {
   599  
   600  	b := make([]byte, 0, 32)
   601  
   602  	b = append(b, []byte{0x6b, 0x6c}...)
   603  	b = append(b, []byte{0x2e, 0x20}...)
   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, sv.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, sv.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}...)
   625  
   626  	tz, _ := t.Zone()
   627  
   628  	if btz, ok := sv.timezones[tz]; ok {
   629  		b = append(b, btz...)
   630  	} else {
   631  		b = append(b, tz...)
   632  	}
   633  
   634  	return string(b)
   635  }
   636  

View as plain text