...

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

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

     1  package se_NO
     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 se_NO 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 'se_NO' locale
    46  func New() locales.Translator {
    47  	return &se_NO{
    48  		locale:                 "se_NO",
    49  		pluralsCardinal:        []locales.PluralRule{2, 3, 6},
    50  		pluralsOrdinal:         nil,
    51  		pluralsRange:           nil,
    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{"", "ođđj", "guov", "njuk", "cuo", "mies", "geas", "suoi", "borg", "čakč", "golg", "skáb", "juov"},
    64  		monthsNarrow:           []string{"", "O", "G", "N", "C", "M", "G", "S", "B", "Č", "G", "S", "J"},
    65  		monthsWide:             []string{"", "ođđajagemánnu", "guovvamánnu", "njukčamánnu", "cuoŋománnu", "miessemánnu", "geassemánnu", "suoidnemánnu", "borgemánnu", "čakčamánnu", "golggotmánnu", "skábmamánnu", "juovlamánnu"},
    66  		daysAbbreviated:        []string{"sotn", "vuos", "maŋ", "gask", "duor", "bear", "láv"},
    67  		daysNarrow:             []string{"S", "V", "M", "G", "D", "B", "L"},
    68  		daysShort:              []string{"sotn", "vuos", "maŋ", "gask", "duor", "bear", "láv"},
    69  		daysWide:               []string{"sotnabeaivi", "vuossárga", "maŋŋebárga", "gaskavahkku", "duorasdat", "bearjadat", "lávvardat"},
    70  		periodsAbbreviated:     []string{"i.b.", "e.b."},
    71  		periodsNarrow:          []string{"i.b.", "e.b."},
    72  		periodsWide:            []string{"iđitbeaivet", "eahketbeaivet"},
    73  		erasAbbreviated:        []string{"o.Kr.", "m.Kr."},
    74  		erasNarrow:             []string{"ooá", "oá"},
    75  		erasWide:               []string{"ovdal Kristtusa", "maŋŋel Kristtusa"},
    76  		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": "Greenwich gaskka áigi", "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": "gaska-Eurohpá geassiáigi", "MEZ": "gaska-Eurohpá dábálašáigi", "MST": "MST", "MYT": "MYT", "NZDT": "NZDT", "NZST": "NZST", "OESZ": "nuorti-Eurohpá geassiáigi", "OEZ": "nuorti-Eurohpá dábálašáigi", "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": "oarje-Eurohpá geassiáigi", "WEZ": "oarje-Eurohpá dábálašáigi", "WIB": "WIB", "WIT": "WIT", "WITA": "WITA", "∅∅∅": "∅∅∅"},
    77  	}
    78  }
    79  
    80  // Locale returns the current translators string locale
    81  func (se *se_NO) Locale() string {
    82  	return se.locale
    83  }
    84  
    85  // PluralsCardinal returns the list of cardinal plural rules associated with 'se_NO'
    86  func (se *se_NO) PluralsCardinal() []locales.PluralRule {
    87  	return se.pluralsCardinal
    88  }
    89  
    90  // PluralsOrdinal returns the list of ordinal plural rules associated with 'se_NO'
    91  func (se *se_NO) PluralsOrdinal() []locales.PluralRule {
    92  	return se.pluralsOrdinal
    93  }
    94  
    95  // PluralsRange returns the list of range plural rules associated with 'se_NO'
    96  func (se *se_NO) PluralsRange() []locales.PluralRule {
    97  	return se.pluralsRange
    98  }
    99  
   100  // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'se_NO'
   101  func (se *se_NO) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
   102  
   103  	n := math.Abs(num)
   104  
   105  	if n == 1 {
   106  		return locales.PluralRuleOne
   107  	} else if n == 2 {
   108  		return locales.PluralRuleTwo
   109  	}
   110  
   111  	return locales.PluralRuleOther
   112  }
   113  
   114  // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'se_NO'
   115  func (se *se_NO) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
   116  	return locales.PluralRuleUnknown
   117  }
   118  
   119  // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'se_NO'
   120  func (se *se_NO) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
   121  	return locales.PluralRuleUnknown
   122  }
   123  
   124  // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
   125  func (se *se_NO) MonthAbbreviated(month time.Month) string {
   126  	return se.monthsAbbreviated[month]
   127  }
   128  
   129  // MonthsAbbreviated returns the locales abbreviated months
   130  func (se *se_NO) MonthsAbbreviated() []string {
   131  	return se.monthsAbbreviated[1:]
   132  }
   133  
   134  // MonthNarrow returns the locales narrow month given the 'month' provided
   135  func (se *se_NO) MonthNarrow(month time.Month) string {
   136  	return se.monthsNarrow[month]
   137  }
   138  
   139  // MonthsNarrow returns the locales narrow months
   140  func (se *se_NO) MonthsNarrow() []string {
   141  	return se.monthsNarrow[1:]
   142  }
   143  
   144  // MonthWide returns the locales wide month given the 'month' provided
   145  func (se *se_NO) MonthWide(month time.Month) string {
   146  	return se.monthsWide[month]
   147  }
   148  
   149  // MonthsWide returns the locales wide months
   150  func (se *se_NO) MonthsWide() []string {
   151  	return se.monthsWide[1:]
   152  }
   153  
   154  // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
   155  func (se *se_NO) WeekdayAbbreviated(weekday time.Weekday) string {
   156  	return se.daysAbbreviated[weekday]
   157  }
   158  
   159  // WeekdaysAbbreviated returns the locales abbreviated weekdays
   160  func (se *se_NO) WeekdaysAbbreviated() []string {
   161  	return se.daysAbbreviated
   162  }
   163  
   164  // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
   165  func (se *se_NO) WeekdayNarrow(weekday time.Weekday) string {
   166  	return se.daysNarrow[weekday]
   167  }
   168  
   169  // WeekdaysNarrow returns the locales narrow weekdays
   170  func (se *se_NO) WeekdaysNarrow() []string {
   171  	return se.daysNarrow
   172  }
   173  
   174  // WeekdayShort returns the locales short weekday given the 'weekday' provided
   175  func (se *se_NO) WeekdayShort(weekday time.Weekday) string {
   176  	return se.daysShort[weekday]
   177  }
   178  
   179  // WeekdaysShort returns the locales short weekdays
   180  func (se *se_NO) WeekdaysShort() []string {
   181  	return se.daysShort
   182  }
   183  
   184  // WeekdayWide returns the locales wide weekday given the 'weekday' provided
   185  func (se *se_NO) WeekdayWide(weekday time.Weekday) string {
   186  	return se.daysWide[weekday]
   187  }
   188  
   189  // WeekdaysWide returns the locales wide weekdays
   190  func (se *se_NO) WeekdaysWide() []string {
   191  	return se.daysWide
   192  }
   193  
   194  // Decimal returns the decimal point of number
   195  func (se *se_NO) Decimal() string {
   196  	return se.decimal
   197  }
   198  
   199  // Group returns the group of number
   200  func (se *se_NO) Group() string {
   201  	return se.group
   202  }
   203  
   204  // Group returns the minus sign of number
   205  func (se *se_NO) Minus() string {
   206  	return se.minus
   207  }
   208  
   209  // FmtNumber returns 'num' with digits/precision of 'v' for 'se_NO' and handles both Whole and Real numbers based on 'v'
   210  func (se *se_NO) FmtNumber(num float64, v uint64) string {
   211  
   212  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   213  	l := len(s) + 4 + 2*len(s[:len(s)-int(v)-1])/3
   214  	count := 0
   215  	inWhole := v == 0
   216  	b := make([]byte, 0, l)
   217  
   218  	for i := len(s) - 1; i >= 0; i-- {
   219  
   220  		if s[i] == '.' {
   221  			b = append(b, se.decimal[0])
   222  			inWhole = true
   223  			continue
   224  		}
   225  
   226  		if inWhole {
   227  			if count == 3 {
   228  				for j := len(se.group) - 1; j >= 0; j-- {
   229  					b = append(b, se.group[j])
   230  				}
   231  				count = 1
   232  			} else {
   233  				count++
   234  			}
   235  		}
   236  
   237  		b = append(b, s[i])
   238  	}
   239  
   240  	if num < 0 {
   241  		for j := len(se.minus) - 1; j >= 0; j-- {
   242  			b = append(b, se.minus[j])
   243  		}
   244  	}
   245  
   246  	// reverse
   247  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   248  		b[i], b[j] = b[j], b[i]
   249  	}
   250  
   251  	return string(b)
   252  }
   253  
   254  // FmtPercent returns 'num' with digits/precision of 'v' for 'se_NO' and handles both Whole and Real numbers based on 'v'
   255  // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
   256  func (se *se_NO) FmtPercent(num float64, v uint64) string {
   257  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   258  	l := len(s) + 7
   259  	b := make([]byte, 0, l)
   260  
   261  	for i := len(s) - 1; i >= 0; i-- {
   262  
   263  		if s[i] == '.' {
   264  			b = append(b, se.decimal[0])
   265  			continue
   266  		}
   267  
   268  		b = append(b, s[i])
   269  	}
   270  
   271  	if num < 0 {
   272  		for j := len(se.minus) - 1; j >= 0; j-- {
   273  			b = append(b, se.minus[j])
   274  		}
   275  	}
   276  
   277  	// reverse
   278  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   279  		b[i], b[j] = b[j], b[i]
   280  	}
   281  
   282  	b = append(b, se.percentSuffix...)
   283  
   284  	b = append(b, se.percent...)
   285  
   286  	return string(b)
   287  }
   288  
   289  // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'se_NO'
   290  func (se *se_NO) FmtCurrency(num float64, v uint64, currency currency.Type) string {
   291  
   292  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   293  	symbol := se.currencies[currency]
   294  	l := len(s) + len(symbol) + 6 + 2*len(s[:len(s)-int(v)-1])/3
   295  	count := 0
   296  	inWhole := v == 0
   297  	b := make([]byte, 0, l)
   298  
   299  	for i := len(s) - 1; i >= 0; i-- {
   300  
   301  		if s[i] == '.' {
   302  			b = append(b, se.decimal[0])
   303  			inWhole = true
   304  			continue
   305  		}
   306  
   307  		if inWhole {
   308  			if count == 3 {
   309  				for j := len(se.group) - 1; j >= 0; j-- {
   310  					b = append(b, se.group[j])
   311  				}
   312  				count = 1
   313  			} else {
   314  				count++
   315  			}
   316  		}
   317  
   318  		b = append(b, s[i])
   319  	}
   320  
   321  	if num < 0 {
   322  		for j := len(se.minus) - 1; j >= 0; j-- {
   323  			b = append(b, se.minus[j])
   324  		}
   325  	}
   326  
   327  	// reverse
   328  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   329  		b[i], b[j] = b[j], b[i]
   330  	}
   331  
   332  	if int(v) < 2 {
   333  
   334  		if v == 0 {
   335  			b = append(b, se.decimal...)
   336  		}
   337  
   338  		for i := 0; i < 2-int(v); i++ {
   339  			b = append(b, '0')
   340  		}
   341  	}
   342  
   343  	b = append(b, se.currencyPositiveSuffix...)
   344  
   345  	b = append(b, symbol...)
   346  
   347  	return string(b)
   348  }
   349  
   350  // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'se_NO'
   351  // in accounting notation.
   352  func (se *se_NO) FmtAccounting(num float64, v uint64, currency currency.Type) string {
   353  
   354  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   355  	symbol := se.currencies[currency]
   356  	l := len(s) + len(symbol) + 6 + 2*len(s[:len(s)-int(v)-1])/3
   357  	count := 0
   358  	inWhole := v == 0
   359  	b := make([]byte, 0, l)
   360  
   361  	for i := len(s) - 1; i >= 0; i-- {
   362  
   363  		if s[i] == '.' {
   364  			b = append(b, se.decimal[0])
   365  			inWhole = true
   366  			continue
   367  		}
   368  
   369  		if inWhole {
   370  			if count == 3 {
   371  				for j := len(se.group) - 1; j >= 0; j-- {
   372  					b = append(b, se.group[j])
   373  				}
   374  				count = 1
   375  			} else {
   376  				count++
   377  			}
   378  		}
   379  
   380  		b = append(b, s[i])
   381  	}
   382  
   383  	if num < 0 {
   384  
   385  		for j := len(se.minus) - 1; j >= 0; j-- {
   386  			b = append(b, se.minus[j])
   387  		}
   388  
   389  	}
   390  
   391  	// reverse
   392  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   393  		b[i], b[j] = b[j], b[i]
   394  	}
   395  
   396  	if int(v) < 2 {
   397  
   398  		if v == 0 {
   399  			b = append(b, se.decimal...)
   400  		}
   401  
   402  		for i := 0; i < 2-int(v); i++ {
   403  			b = append(b, '0')
   404  		}
   405  	}
   406  
   407  	if num < 0 {
   408  		b = append(b, se.currencyNegativeSuffix...)
   409  		b = append(b, symbol...)
   410  	} else {
   411  
   412  		b = append(b, se.currencyPositiveSuffix...)
   413  		b = append(b, symbol...)
   414  	}
   415  
   416  	return string(b)
   417  }
   418  
   419  // FmtDateShort returns the short date representation of 't' for 'se_NO'
   420  func (se *se_NO) FmtDateShort(t time.Time) string {
   421  
   422  	b := make([]byte, 0, 32)
   423  
   424  	if t.Year() > 0 {
   425  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   426  	} else {
   427  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   428  	}
   429  
   430  	b = append(b, []byte{0x2d}...)
   431  
   432  	if t.Month() < 10 {
   433  		b = append(b, '0')
   434  	}
   435  
   436  	b = strconv.AppendInt(b, int64(t.Month()), 10)
   437  
   438  	b = append(b, []byte{0x2d}...)
   439  
   440  	if t.Day() < 10 {
   441  		b = append(b, '0')
   442  	}
   443  
   444  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   445  
   446  	return string(b)
   447  }
   448  
   449  // FmtDateMedium returns the medium date representation of 't' for 'se_NO'
   450  func (se *se_NO) FmtDateMedium(t time.Time) string {
   451  
   452  	b := make([]byte, 0, 32)
   453  
   454  	if t.Year() > 0 {
   455  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   456  	} else {
   457  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   458  	}
   459  
   460  	b = append(b, []byte{0x20}...)
   461  	b = append(b, se.monthsAbbreviated[t.Month()]...)
   462  	b = append(b, []byte{0x20}...)
   463  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   464  
   465  	return string(b)
   466  }
   467  
   468  // FmtDateLong returns the long date representation of 't' for 'se_NO'
   469  func (se *se_NO) FmtDateLong(t time.Time) string {
   470  
   471  	b := make([]byte, 0, 32)
   472  
   473  	if t.Year() > 0 {
   474  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   475  	} else {
   476  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   477  	}
   478  
   479  	b = append(b, []byte{0x20}...)
   480  	b = append(b, se.monthsWide[t.Month()]...)
   481  	b = append(b, []byte{0x20}...)
   482  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   483  
   484  	return string(b)
   485  }
   486  
   487  // FmtDateFull returns the full date representation of 't' for 'se_NO'
   488  func (se *se_NO) FmtDateFull(t time.Time) string {
   489  
   490  	b := make([]byte, 0, 32)
   491  
   492  	if t.Year() > 0 {
   493  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   494  	} else {
   495  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   496  	}
   497  
   498  	b = append(b, []byte{0x20}...)
   499  	b = append(b, se.monthsWide[t.Month()]...)
   500  	b = append(b, []byte{0x20}...)
   501  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   502  	b = append(b, []byte{0x2c, 0x20}...)
   503  	b = append(b, se.daysWide[t.Weekday()]...)
   504  
   505  	return string(b)
   506  }
   507  
   508  // FmtTimeShort returns the short time representation of 't' for 'se_NO'
   509  func (se *se_NO) FmtTimeShort(t time.Time) string {
   510  
   511  	b := make([]byte, 0, 32)
   512  
   513  	if t.Hour() < 10 {
   514  		b = append(b, '0')
   515  	}
   516  
   517  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   518  	b = append(b, se.timeSeparator...)
   519  
   520  	if t.Minute() < 10 {
   521  		b = append(b, '0')
   522  	}
   523  
   524  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   525  
   526  	return string(b)
   527  }
   528  
   529  // FmtTimeMedium returns the medium time representation of 't' for 'se_NO'
   530  func (se *se_NO) FmtTimeMedium(t time.Time) string {
   531  
   532  	b := make([]byte, 0, 32)
   533  
   534  	if t.Hour() < 10 {
   535  		b = append(b, '0')
   536  	}
   537  
   538  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   539  	b = append(b, se.timeSeparator...)
   540  
   541  	if t.Minute() < 10 {
   542  		b = append(b, '0')
   543  	}
   544  
   545  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   546  	b = append(b, se.timeSeparator...)
   547  
   548  	if t.Second() < 10 {
   549  		b = append(b, '0')
   550  	}
   551  
   552  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   553  
   554  	return string(b)
   555  }
   556  
   557  // FmtTimeLong returns the long time representation of 't' for 'se_NO'
   558  func (se *se_NO) FmtTimeLong(t time.Time) string {
   559  
   560  	b := make([]byte, 0, 32)
   561  
   562  	if t.Hour() < 10 {
   563  		b = append(b, '0')
   564  	}
   565  
   566  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   567  	b = append(b, se.timeSeparator...)
   568  
   569  	if t.Minute() < 10 {
   570  		b = append(b, '0')
   571  	}
   572  
   573  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   574  	b = append(b, se.timeSeparator...)
   575  
   576  	if t.Second() < 10 {
   577  		b = append(b, '0')
   578  	}
   579  
   580  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   581  	b = append(b, []byte{0x20}...)
   582  
   583  	tz, _ := t.Zone()
   584  	b = append(b, tz...)
   585  
   586  	return string(b)
   587  }
   588  
   589  // FmtTimeFull returns the full time representation of 't' for 'se_NO'
   590  func (se *se_NO) FmtTimeFull(t time.Time) string {
   591  
   592  	b := make([]byte, 0, 32)
   593  
   594  	if t.Hour() < 10 {
   595  		b = append(b, '0')
   596  	}
   597  
   598  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   599  	b = append(b, se.timeSeparator...)
   600  
   601  	if t.Minute() < 10 {
   602  		b = append(b, '0')
   603  	}
   604  
   605  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   606  	b = append(b, se.timeSeparator...)
   607  
   608  	if t.Second() < 10 {
   609  		b = append(b, '0')
   610  	}
   611  
   612  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   613  	b = append(b, []byte{0x20}...)
   614  
   615  	tz, _ := t.Zone()
   616  
   617  	if btz, ok := se.timezones[tz]; ok {
   618  		b = append(b, btz...)
   619  	} else {
   620  		b = append(b, tz...)
   621  	}
   622  
   623  	return string(b)
   624  }
   625  

View as plain text