...

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

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

     1  package smn_FI
     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 smn_FI 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 'smn_FI' locale
    46  func New() locales.Translator {
    47  	return &smn_FI{
    48  		locale:                 "smn_FI",
    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{"", "uđiv", "kuovâ", "njuhčâ", "cuáŋui", "vyesi", "kesi", "syeini", "porge", "čohčâ", "roovvâd", "skammâ", "juovlâ"},
    64  		monthsNarrow:           []string{"", "U", "K", "NJ", "C", "V", "K", "S", "P", "Č", "R", "S", "J"},
    65  		monthsWide:             []string{"", "uđđâivemáánu", "kuovâmáánu", "njuhčâmáánu", "cuáŋuimáánu", "vyesimáánu", "kesimáánu", "syeinimáánu", "porgemáánu", "čohčâmáánu", "roovvâdmáánu", "skammâmáánu", "juovlâmáánu"},
    66  		daysAbbreviated:        []string{"pas", "vuo", "maj", "kos", "tuo", "vás", "láv"},
    67  		daysNarrow:             []string{"p", "V", "M", "K", "T", "V", "L"},
    68  		daysShort:              []string{"pa", "vu", "ma", "ko", "tu", "vá", "lá"},
    69  		daysWide:               []string{"pasepeeivi", "vuossaargâ", "majebaargâ", "koskoho", "tuorâstuv", "vástuppeeivi", "lávurduv"},
    70  		periodsAbbreviated:     []string{"ip.", "ep."},
    71  		periodsNarrow:          []string{"ip.", "ep."},
    72  		periodsWide:            []string{"ip.", "ep."},
    73  		erasAbbreviated:        []string{"oKr.", "mKr."},
    74  		erasNarrow:             []string{"", ""},
    75  		erasWide:               []string{"Ovdil Kristus šoddâm", "maŋa Kristus šoddâm"},
    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": "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", "∅∅∅": "∅∅∅"},
    77  	}
    78  }
    79  
    80  // Locale returns the current translators string locale
    81  func (smn *smn_FI) Locale() string {
    82  	return smn.locale
    83  }
    84  
    85  // PluralsCardinal returns the list of cardinal plural rules associated with 'smn_FI'
    86  func (smn *smn_FI) PluralsCardinal() []locales.PluralRule {
    87  	return smn.pluralsCardinal
    88  }
    89  
    90  // PluralsOrdinal returns the list of ordinal plural rules associated with 'smn_FI'
    91  func (smn *smn_FI) PluralsOrdinal() []locales.PluralRule {
    92  	return smn.pluralsOrdinal
    93  }
    94  
    95  // PluralsRange returns the list of range plural rules associated with 'smn_FI'
    96  func (smn *smn_FI) PluralsRange() []locales.PluralRule {
    97  	return smn.pluralsRange
    98  }
    99  
   100  // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'smn_FI'
   101  func (smn *smn_FI) 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 'smn_FI'
   115  func (smn *smn_FI) 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 'smn_FI'
   120  func (smn *smn_FI) 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 (smn *smn_FI) MonthAbbreviated(month time.Month) string {
   126  	return smn.monthsAbbreviated[month]
   127  }
   128  
   129  // MonthsAbbreviated returns the locales abbreviated months
   130  func (smn *smn_FI) MonthsAbbreviated() []string {
   131  	return smn.monthsAbbreviated[1:]
   132  }
   133  
   134  // MonthNarrow returns the locales narrow month given the 'month' provided
   135  func (smn *smn_FI) MonthNarrow(month time.Month) string {
   136  	return smn.monthsNarrow[month]
   137  }
   138  
   139  // MonthsNarrow returns the locales narrow months
   140  func (smn *smn_FI) MonthsNarrow() []string {
   141  	return smn.monthsNarrow[1:]
   142  }
   143  
   144  // MonthWide returns the locales wide month given the 'month' provided
   145  func (smn *smn_FI) MonthWide(month time.Month) string {
   146  	return smn.monthsWide[month]
   147  }
   148  
   149  // MonthsWide returns the locales wide months
   150  func (smn *smn_FI) MonthsWide() []string {
   151  	return smn.monthsWide[1:]
   152  }
   153  
   154  // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
   155  func (smn *smn_FI) WeekdayAbbreviated(weekday time.Weekday) string {
   156  	return smn.daysAbbreviated[weekday]
   157  }
   158  
   159  // WeekdaysAbbreviated returns the locales abbreviated weekdays
   160  func (smn *smn_FI) WeekdaysAbbreviated() []string {
   161  	return smn.daysAbbreviated
   162  }
   163  
   164  // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
   165  func (smn *smn_FI) WeekdayNarrow(weekday time.Weekday) string {
   166  	return smn.daysNarrow[weekday]
   167  }
   168  
   169  // WeekdaysNarrow returns the locales narrow weekdays
   170  func (smn *smn_FI) WeekdaysNarrow() []string {
   171  	return smn.daysNarrow
   172  }
   173  
   174  // WeekdayShort returns the locales short weekday given the 'weekday' provided
   175  func (smn *smn_FI) WeekdayShort(weekday time.Weekday) string {
   176  	return smn.daysShort[weekday]
   177  }
   178  
   179  // WeekdaysShort returns the locales short weekdays
   180  func (smn *smn_FI) WeekdaysShort() []string {
   181  	return smn.daysShort
   182  }
   183  
   184  // WeekdayWide returns the locales wide weekday given the 'weekday' provided
   185  func (smn *smn_FI) WeekdayWide(weekday time.Weekday) string {
   186  	return smn.daysWide[weekday]
   187  }
   188  
   189  // WeekdaysWide returns the locales wide weekdays
   190  func (smn *smn_FI) WeekdaysWide() []string {
   191  	return smn.daysWide
   192  }
   193  
   194  // Decimal returns the decimal point of number
   195  func (smn *smn_FI) Decimal() string {
   196  	return smn.decimal
   197  }
   198  
   199  // Group returns the group of number
   200  func (smn *smn_FI) Group() string {
   201  	return smn.group
   202  }
   203  
   204  // Group returns the minus sign of number
   205  func (smn *smn_FI) Minus() string {
   206  	return smn.minus
   207  }
   208  
   209  // FmtNumber returns 'num' with digits/precision of 'v' for 'smn_FI' and handles both Whole and Real numbers based on 'v'
   210  func (smn *smn_FI) FmtNumber(num float64, v uint64) string {
   211  
   212  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   213  	l := len(s) + 2 + 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, smn.decimal[0])
   222  			inWhole = true
   223  			continue
   224  		}
   225  
   226  		if inWhole {
   227  			if count == 3 {
   228  				for j := len(smn.group) - 1; j >= 0; j-- {
   229  					b = append(b, smn.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  		b = append(b, smn.minus[0])
   242  	}
   243  
   244  	// reverse
   245  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   246  		b[i], b[j] = b[j], b[i]
   247  	}
   248  
   249  	return string(b)
   250  }
   251  
   252  // FmtPercent returns 'num' with digits/precision of 'v' for 'smn_FI' and handles both Whole and Real numbers based on 'v'
   253  // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
   254  func (smn *smn_FI) FmtPercent(num float64, v uint64) string {
   255  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   256  	l := len(s) + 5
   257  	b := make([]byte, 0, l)
   258  
   259  	for i := len(s) - 1; i >= 0; i-- {
   260  
   261  		if s[i] == '.' {
   262  			b = append(b, smn.decimal[0])
   263  			continue
   264  		}
   265  
   266  		b = append(b, s[i])
   267  	}
   268  
   269  	if num < 0 {
   270  		b = append(b, smn.minus[0])
   271  	}
   272  
   273  	// reverse
   274  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   275  		b[i], b[j] = b[j], b[i]
   276  	}
   277  
   278  	b = append(b, smn.percentSuffix...)
   279  
   280  	b = append(b, smn.percent...)
   281  
   282  	return string(b)
   283  }
   284  
   285  // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'smn_FI'
   286  func (smn *smn_FI) FmtCurrency(num float64, v uint64, currency currency.Type) string {
   287  
   288  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   289  	symbol := smn.currencies[currency]
   290  	l := len(s) + len(symbol) + 4 + 2*len(s[:len(s)-int(v)-1])/3
   291  	count := 0
   292  	inWhole := v == 0
   293  	b := make([]byte, 0, l)
   294  
   295  	for i := len(s) - 1; i >= 0; i-- {
   296  
   297  		if s[i] == '.' {
   298  			b = append(b, smn.decimal[0])
   299  			inWhole = true
   300  			continue
   301  		}
   302  
   303  		if inWhole {
   304  			if count == 3 {
   305  				for j := len(smn.group) - 1; j >= 0; j-- {
   306  					b = append(b, smn.group[j])
   307  				}
   308  				count = 1
   309  			} else {
   310  				count++
   311  			}
   312  		}
   313  
   314  		b = append(b, s[i])
   315  	}
   316  
   317  	if num < 0 {
   318  		b = append(b, smn.minus[0])
   319  	}
   320  
   321  	// reverse
   322  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   323  		b[i], b[j] = b[j], b[i]
   324  	}
   325  
   326  	if int(v) < 2 {
   327  
   328  		if v == 0 {
   329  			b = append(b, smn.decimal...)
   330  		}
   331  
   332  		for i := 0; i < 2-int(v); i++ {
   333  			b = append(b, '0')
   334  		}
   335  	}
   336  
   337  	b = append(b, smn.currencyPositiveSuffix...)
   338  
   339  	b = append(b, symbol...)
   340  
   341  	return string(b)
   342  }
   343  
   344  // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'smn_FI'
   345  // in accounting notation.
   346  func (smn *smn_FI) FmtAccounting(num float64, v uint64, currency currency.Type) string {
   347  
   348  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   349  	symbol := smn.currencies[currency]
   350  	l := len(s) + len(symbol) + 4 + 2*len(s[:len(s)-int(v)-1])/3
   351  	count := 0
   352  	inWhole := v == 0
   353  	b := make([]byte, 0, l)
   354  
   355  	for i := len(s) - 1; i >= 0; i-- {
   356  
   357  		if s[i] == '.' {
   358  			b = append(b, smn.decimal[0])
   359  			inWhole = true
   360  			continue
   361  		}
   362  
   363  		if inWhole {
   364  			if count == 3 {
   365  				for j := len(smn.group) - 1; j >= 0; j-- {
   366  					b = append(b, smn.group[j])
   367  				}
   368  				count = 1
   369  			} else {
   370  				count++
   371  			}
   372  		}
   373  
   374  		b = append(b, s[i])
   375  	}
   376  
   377  	if num < 0 {
   378  
   379  		b = append(b, smn.minus[0])
   380  
   381  	}
   382  
   383  	// reverse
   384  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   385  		b[i], b[j] = b[j], b[i]
   386  	}
   387  
   388  	if int(v) < 2 {
   389  
   390  		if v == 0 {
   391  			b = append(b, smn.decimal...)
   392  		}
   393  
   394  		for i := 0; i < 2-int(v); i++ {
   395  			b = append(b, '0')
   396  		}
   397  	}
   398  
   399  	if num < 0 {
   400  		b = append(b, smn.currencyNegativeSuffix...)
   401  		b = append(b, symbol...)
   402  	} else {
   403  
   404  		b = append(b, smn.currencyPositiveSuffix...)
   405  		b = append(b, symbol...)
   406  	}
   407  
   408  	return string(b)
   409  }
   410  
   411  // FmtDateShort returns the short date representation of 't' for 'smn_FI'
   412  func (smn *smn_FI) FmtDateShort(t time.Time) string {
   413  
   414  	b := make([]byte, 0, 32)
   415  
   416  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   417  	b = append(b, []byte{0x2e}...)
   418  	b = strconv.AppendInt(b, int64(t.Month()), 10)
   419  	b = append(b, []byte{0x2e}...)
   420  
   421  	if t.Year() > 0 {
   422  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   423  	} else {
   424  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   425  	}
   426  
   427  	return string(b)
   428  }
   429  
   430  // FmtDateMedium returns the medium date representation of 't' for 'smn_FI'
   431  func (smn *smn_FI) FmtDateMedium(t time.Time) string {
   432  
   433  	b := make([]byte, 0, 32)
   434  
   435  	b = append(b, smn.monthsAbbreviated[t.Month()]...)
   436  	b = append(b, []byte{0x20}...)
   437  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   438  	b = append(b, []byte{0x2e, 0x20}...)
   439  
   440  	if t.Year() > 0 {
   441  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   442  	} else {
   443  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   444  	}
   445  
   446  	return string(b)
   447  }
   448  
   449  // FmtDateLong returns the long date representation of 't' for 'smn_FI'
   450  func (smn *smn_FI) FmtDateLong(t time.Time) string {
   451  
   452  	b := make([]byte, 0, 32)
   453  
   454  	b = append(b, smn.monthsWide[t.Month()]...)
   455  	b = append(b, []byte{0x20}...)
   456  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   457  	b = append(b, []byte{0x2e, 0x20}...)
   458  
   459  	if t.Year() > 0 {
   460  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   461  	} else {
   462  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   463  	}
   464  
   465  	return string(b)
   466  }
   467  
   468  // FmtDateFull returns the full date representation of 't' for 'smn_FI'
   469  func (smn *smn_FI) FmtDateFull(t time.Time) string {
   470  
   471  	b := make([]byte, 0, 32)
   472  
   473  	b = append(b, []byte{0x63, 0x63, 0x63, 0x63, 0x2c, 0x20}...)
   474  	b = append(b, smn.monthsWide[t.Month()]...)
   475  	b = append(b, []byte{0x20}...)
   476  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   477  	b = append(b, []byte{0x2e, 0x20}...)
   478  
   479  	if t.Year() > 0 {
   480  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   481  	} else {
   482  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   483  	}
   484  
   485  	return string(b)
   486  }
   487  
   488  // FmtTimeShort returns the short time representation of 't' for 'smn_FI'
   489  func (smn *smn_FI) FmtTimeShort(t time.Time) string {
   490  
   491  	b := make([]byte, 0, 32)
   492  
   493  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   494  	b = append(b, []byte{0x2e}...)
   495  
   496  	if t.Minute() < 10 {
   497  		b = append(b, '0')
   498  	}
   499  
   500  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   501  
   502  	return string(b)
   503  }
   504  
   505  // FmtTimeMedium returns the medium time representation of 't' for 'smn_FI'
   506  func (smn *smn_FI) FmtTimeMedium(t time.Time) string {
   507  
   508  	b := make([]byte, 0, 32)
   509  
   510  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   511  	b = append(b, []byte{0x2e}...)
   512  
   513  	if t.Minute() < 10 {
   514  		b = append(b, '0')
   515  	}
   516  
   517  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   518  	b = append(b, []byte{0x2e}...)
   519  
   520  	if t.Second() < 10 {
   521  		b = append(b, '0')
   522  	}
   523  
   524  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   525  
   526  	return string(b)
   527  }
   528  
   529  // FmtTimeLong returns the long time representation of 't' for 'smn_FI'
   530  func (smn *smn_FI) FmtTimeLong(t time.Time) string {
   531  
   532  	b := make([]byte, 0, 32)
   533  
   534  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   535  	b = append(b, []byte{0x2e}...)
   536  
   537  	if t.Minute() < 10 {
   538  		b = append(b, '0')
   539  	}
   540  
   541  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   542  	b = append(b, []byte{0x2e}...)
   543  
   544  	if t.Second() < 10 {
   545  		b = append(b, '0')
   546  	}
   547  
   548  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   549  	b = append(b, []byte{0x20}...)
   550  
   551  	tz, _ := t.Zone()
   552  	b = append(b, tz...)
   553  
   554  	return string(b)
   555  }
   556  
   557  // FmtTimeFull returns the full time representation of 't' for 'smn_FI'
   558  func (smn *smn_FI) FmtTimeFull(t time.Time) string {
   559  
   560  	b := make([]byte, 0, 32)
   561  
   562  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   563  	b = append(b, []byte{0x2e}...)
   564  
   565  	if t.Minute() < 10 {
   566  		b = append(b, '0')
   567  	}
   568  
   569  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   570  	b = append(b, []byte{0x2e}...)
   571  
   572  	if t.Second() < 10 {
   573  		b = append(b, '0')
   574  	}
   575  
   576  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   577  	b = append(b, []byte{0x20}...)
   578  
   579  	tz, _ := t.Zone()
   580  
   581  	if btz, ok := smn.timezones[tz]; ok {
   582  		b = append(b, btz...)
   583  	} else {
   584  		b = append(b, tz...)
   585  	}
   586  
   587  	return string(b)
   588  }
   589  

View as plain text