Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/locales.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'smn/smn.go')
-rw-r--r--smn/smn.go308
1 files changed, 263 insertions, 45 deletions
diff --git a/smn/smn.go b/smn/smn.go
index a94a7416..de185c4c 100644
--- a/smn/smn.go
+++ b/smn/smn.go
@@ -18,13 +18,12 @@ type smn struct {
group string
minus string
percent string
+ percentSuffix string
perMille string
timeSeparator string
inifinity string
currencies []string // idx = enum of currency code
- currencyPositivePrefix string
currencyPositiveSuffix string
- currencyNegativePrefix string
currencyNegativeSuffix string
monthsAbbreviated []string
monthsNarrow []string
@@ -50,17 +49,31 @@ func New() locales.Translator {
pluralsCardinal: []locales.PluralRule{2, 3, 6},
pluralsOrdinal: nil,
pluralsRange: nil,
- timeSeparator: ":",
- 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", "BYR", "BZD", "CAD", "CDF", "CHE", "CHF", "CHW", "CLE", "CLF", "CLP", "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", "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", "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", "UZS", "VEB", "VEF", "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"},
- currencyPositivePrefix: " ",
- currencyPositiveSuffix: "K",
- currencyNegativePrefix: " ",
- currencyNegativeSuffix: "K",
+ decimal: ",",
+ group: " ",
+ minus: "-",
+ percent: "%",
+ perMille: "‰",
+ timeSeparator: ".",
+ inifinity: "∞",
+ 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", "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", "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", "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", "UZS", "VEB", "VEF", "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"},
+ percentSuffix: " ",
+ currencyPositiveSuffix: " ",
+ currencyNegativeSuffix: " ",
+ monthsAbbreviated: []string{"", "uđiv", "kuovâ", "njuhčâ", "cuáŋui", "vyesi", "kesi", "syeini", "porge", "čohčâ", "roovvâd", "skammâ", "juovlâ"},
+ monthsNarrow: []string{"", "U", "K", "NJ", "C", "V", "K", "S", "P", "Č", "R", "S", "J"},
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"},
- daysAbbreviated: []string{"pa", "vu", "ma", "ko", "tu", "vá", "lá"},
- daysNarrow: []string{"P", "V", "M", "K", "T", "V", "L"},
+ daysAbbreviated: []string{"pas", "vuo", "maj", "kos", "tuo", "vás", "láv"},
+ daysNarrow: []string{"p", "V", "M", "K", "T", "V", "L"},
+ daysShort: []string{"pa", "vu", "ma", "ko", "tu", "vá", "lá"},
daysWide: []string{"pasepeeivi", "vuossaargâ", "majebaargâ", "koskoho", "tuorâstuv", "vástuppeeivi", "lávurduv"},
- timezones: map[string]string{"BT": "BT", "MESZ": "MESZ", "EST": "EST", "AWST": "AWST", "WIT": "WIT", "AEDT": "AEDT", "AST": "AST", "NZDT": "NZDT", "ECT": "ECT", "VET": "VET", "AEST": "AEST", "BOT": "BOT", "OEZ": "OEZ", "OESZ": "OESZ", "MEZ": "MEZ", "COST": "COST", "ADT": "ADT", "COT": "COT", "WART": "WART", "WAT": "WAT", "WAST": "WAST", "MYT": "MYT", "UYT": "UYT", "SRT": "SRT", "CLT": "CLT", "GYT": "GYT", "CHADT": "CHADT", "SGT": "SGT", "ARST": "ARST", "HADT": "HADT", "CLST": "CLST", "CAT": "CAT", "WESZ": "WESZ", "AKST": "AKST", "AKDT": "AKDT", "EDT": "EDT", "LHST": "LHST", "IST": "IST", "ART": "ART", "PDT": "PDT", "MDT": "MDT", "JDT": "JDT", "HKST": "HKST", "WEZ": "WEZ", "WARST": "WARST", "HAST": "HAST", "CDT": "CDT", "∅∅∅": "∅∅∅", "LHDT": "LHDT", "ACWST": "ACWST", "WITA": "WITA", "TMST": "TMST", "MST": "MST", "AWDT": "AWDT", "JST": "JST", "WIB": "WIB", "ACST": "ACST", "ACDT": "ACDT", "TMT": "TMT", "ChST": "ChST", "HAT": "HAT", "GMT": "GMT", "GFT": "GFT", "ACWDT": "ACWDT", "PST": "PST", "CST": "CST", "NZST": "NZST", "HNT": "HNT", "UYST": "UYST", "EAT": "EAT", "SAST": "SAST", "HKT": "HKT", "CHAST": "CHAST"},
+ periodsAbbreviated: []string{"ip.", "ep."},
+ periodsNarrow: []string{"ip.", "ep."},
+ periodsWide: []string{"ip.", "ep."},
+ erasAbbreviated: []string{"oKr.", "mKr."},
+ erasNarrow: []string{"", ""},
+ erasWide: []string{"Ovdil Kristus šoddâm", "maŋa Kristus šoddâm"},
+ timezones: map[string]string{"AST": "AST", "VET": "VET", "ARST": "ARST", "LHDT": "LHDT", "COST": "COST", "JDT": "JDT", "WIT": "WIT", "PDT": "PDT", "WEZ": "WEZ", "WESZ": "WESZ", "NZST": "NZST", "GMT": "GMT", "HNCU": "HNCU", "CLT": "CLT", "HEEG": "HEEG", "TMT": "TMT", "TMST": "TMST", "COT": "COT", "HAST": "HAST", "NZDT": "NZDT", "EDT": "EDT", "AEDT": "AEDT", "HNPM": "HNPM", "WAT": "WAT", "MDT": "MDT", "UYST": "UYST", "CST": "CST", "PST": "PST", "AEST": "AEST", "WAST": "WAST", "LHST": "LHST", "∅∅∅": "∅∅∅", "EAT": "EAT", "MST": "MST", "SRT": "SRT", "ART": "ART", "HKST": "HKST", "WITA": "WITA", "HNPMX": "HNPMX", "CDT": "CDT", "BT": "BT", "HECU": "HECU", "AWDT": "AWDT", "SAST": "SAST", "JST": "JST", "EST": "EST", "UYT": "UYT", "AKST": "AKST", "HNOG": "HNOG", "ACWST": "ACWST", "ChST": "ChST", "CAT": "CAT", "ECT": "ECT", "HENOMX": "HENOMX", "AKDT": "AKDT", "HADT": "HADT", "HEOG": "HEOG", "MESZ": "MESZ", "ACDT": "ACDT", "OEZ": "OEZ", "WART": "WART", "WARST": "WARST", "MYT": "MYT", "WIB": "WIB", "HNT": "HNT", "HAT": "HAT", "CHAST": "CHAST", "ACWDT": "ACWDT", "HEPM": "HEPM", "SGT": "SGT", "GFT": "GFT", "HEPMX": "HEPMX", "ADT": "ADT", "AWST": "AWST", "HKT": "HKT", "HNEG": "HNEG", "CHADT": "CHADT", "BOT": "BOT", "OESZ": "OESZ", "HNNOMX": "HNNOMX", "GYT": "GYT", "MEZ": "MEZ", "IST": "IST", "CLST": "CLST", "ACST": "ACST"},
}
}
@@ -115,7 +128,7 @@ func (smn *smn) MonthAbbreviated(month time.Month) string {
// MonthsAbbreviated returns the locales abbreviated months
func (smn *smn) MonthsAbbreviated() []string {
- return nil
+ return smn.monthsAbbreviated[1:]
}
// MonthNarrow returns the locales narrow month given the 'month' provided
@@ -125,7 +138,7 @@ func (smn *smn) MonthNarrow(month time.Month) string {
// MonthsNarrow returns the locales narrow months
func (smn *smn) MonthsNarrow() []string {
- return nil
+ return smn.monthsNarrow[1:]
}
// MonthWide returns the locales wide month given the 'month' provided
@@ -181,13 +194,77 @@ func (smn *smn) WeekdaysWide() []string {
// FmtNumber returns 'num' with digits/precision of 'v' for 'smn' and handles both Whole and Real numbers based on 'v'
func (smn *smn) FmtNumber(num float64, v uint64) string {
- return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ l := len(s) + 2 + 2*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, smn.decimal[0])
+ inWhole = true
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(smn.group) - 1; j >= 0; j-- {
+ b = append(b, smn.group[j])
+ }
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+ b = append(b, smn.minus[0])
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ return string(b)
}
// FmtPercent returns 'num' with digits/precision of 'v' for 'smn' and handles both Whole and Real numbers based on 'v'
// NOTE: 'num' passed into FmtPercent is assumed to be in percent already
func (smn *smn) FmtPercent(num float64, v uint64) string {
- return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ l := len(s) + 5
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, smn.decimal[0])
+ continue
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+ b = append(b, smn.minus[0])
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ b = append(b, smn.percentSuffix...)
+
+ b = append(b, smn.percent...)
+
+ return string(b)
}
// FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'smn'
@@ -195,26 +272,31 @@ func (smn *smn) FmtCurrency(num float64, v uint64, currency currency.Type) strin
s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
symbol := smn.currencies[currency]
- l := len(s) + len(symbol) + 3
-
+ l := len(s) + len(symbol) + 4 + 2*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
b := make([]byte, 0, l)
for i := len(s) - 1; i >= 0; i-- {
if s[i] == '.' {
b = append(b, smn.decimal[0])
+ inWhole = true
continue
}
- b = append(b, s[i])
- }
-
- for j := len(symbol) - 1; j >= 0; j-- {
- b = append(b, symbol[j])
- }
+ if inWhole {
+ if count == 3 {
+ for j := len(smn.group) - 1; j >= 0; j-- {
+ b = append(b, smn.group[j])
+ }
+ count = 1
+ } else {
+ count++
+ }
+ }
- for j := len(smn.currencyPositivePrefix) - 1; j >= 0; j-- {
- b = append(b, smn.currencyPositivePrefix[j])
+ b = append(b, s[i])
}
if num < 0 {
@@ -226,8 +308,21 @@ func (smn *smn) FmtCurrency(num float64, v uint64, currency currency.Type) strin
b[i], b[j] = b[j], b[i]
}
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, smn.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
b = append(b, smn.currencyPositiveSuffix...)
+ b = append(b, symbol...)
+
return string(b)
}
@@ -237,42 +332,37 @@ func (smn *smn) FmtAccounting(num float64, v uint64, currency currency.Type) str
s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
symbol := smn.currencies[currency]
- l := len(s) + len(symbol) + 3
-
+ l := len(s) + len(symbol) + 4 + 2*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
b := make([]byte, 0, l)
for i := len(s) - 1; i >= 0; i-- {
if s[i] == '.' {
b = append(b, smn.decimal[0])
+ inWhole = true
continue
}
+ if inWhole {
+ if count == 3 {
+ for j := len(smn.group) - 1; j >= 0; j-- {
+ b = append(b, smn.group[j])
+ }
+ count = 1
+ } else {
+ count++
+ }
+ }
+
b = append(b, s[i])
}
if num < 0 {
- for j := len(symbol) - 1; j >= 0; j-- {
- b = append(b, symbol[j])
- }
-
- for j := len(smn.currencyNegativePrefix) - 1; j >= 0; j-- {
- b = append(b, smn.currencyNegativePrefix[j])
- }
-
b = append(b, smn.minus[0])
- } else {
-
- for j := len(symbol) - 1; j >= 0; j-- {
- b = append(b, symbol[j])
- }
-
- for j := len(smn.currencyPositivePrefix) - 1; j >= 0; j-- {
- b = append(b, smn.currencyPositivePrefix[j])
- }
-
}
// reverse
@@ -280,11 +370,24 @@ func (smn *smn) FmtAccounting(num float64, v uint64, currency currency.Type) str
b[i], b[j] = b[j], b[i]
}
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, smn.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
if num < 0 {
b = append(b, smn.currencyNegativeSuffix...)
+ b = append(b, symbol...)
} else {
b = append(b, smn.currencyPositiveSuffix...)
+ b = append(b, symbol...)
}
return string(b)
@@ -295,6 +398,17 @@ func (smn *smn) FmtDateShort(t time.Time) string {
b := make([]byte, 0, 32)
+ b = strconv.AppendInt(b, int64(t.Day()), 10)
+ b = append(b, []byte{0x2e}...)
+ b = strconv.AppendInt(b, int64(t.Month()), 10)
+ b = append(b, []byte{0x2e}...)
+
+ if t.Year() > 0 {
+ b = strconv.AppendInt(b, int64(t.Year()), 10)
+ } else {
+ b = strconv.AppendInt(b, int64(t.Year()*-1), 10)
+ }
+
return string(b)
}
@@ -303,6 +417,17 @@ func (smn *smn) FmtDateMedium(t time.Time) string {
b := make([]byte, 0, 32)
+ b = append(b, smn.monthsAbbreviated[t.Month()]...)
+ b = append(b, []byte{0x20}...)
+ b = strconv.AppendInt(b, int64(t.Day()), 10)
+ b = append(b, []byte{0x2e, 0x20}...)
+
+ if t.Year() > 0 {
+ b = strconv.AppendInt(b, int64(t.Year()), 10)
+ } else {
+ b = strconv.AppendInt(b, int64(t.Year()*-1), 10)
+ }
+
return string(b)
}
@@ -311,6 +436,17 @@ func (smn *smn) FmtDateLong(t time.Time) string {
b := make([]byte, 0, 32)
+ b = append(b, smn.monthsWide[t.Month()]...)
+ b = append(b, []byte{0x20}...)
+ b = strconv.AppendInt(b, int64(t.Day()), 10)
+ b = append(b, []byte{0x2e, 0x20}...)
+
+ if t.Year() > 0 {
+ b = strconv.AppendInt(b, int64(t.Year()), 10)
+ } else {
+ b = strconv.AppendInt(b, int64(t.Year()*-1), 10)
+ }
+
return string(b)
}
@@ -319,6 +455,18 @@ func (smn *smn) FmtDateFull(t time.Time) string {
b := make([]byte, 0, 32)
+ b = append(b, []byte{0x63, 0x63, 0x63, 0x63, 0x2c, 0x20}...)
+ b = append(b, smn.monthsWide[t.Month()]...)
+ b = append(b, []byte{0x20}...)
+ b = strconv.AppendInt(b, int64(t.Day()), 10)
+ b = append(b, []byte{0x2e, 0x20}...)
+
+ if t.Year() > 0 {
+ b = strconv.AppendInt(b, int64(t.Year()), 10)
+ } else {
+ b = strconv.AppendInt(b, int64(t.Year()*-1), 10)
+ }
+
return string(b)
}
@@ -327,6 +475,15 @@ func (smn *smn) FmtTimeShort(t time.Time) string {
b := make([]byte, 0, 32)
+ b = strconv.AppendInt(b, int64(t.Hour()), 10)
+ b = append(b, []byte{0x2e}...)
+
+ if t.Minute() < 10 {
+ b = append(b, '0')
+ }
+
+ b = strconv.AppendInt(b, int64(t.Minute()), 10)
+
return string(b)
}
@@ -335,6 +492,22 @@ func (smn *smn) FmtTimeMedium(t time.Time) string {
b := make([]byte, 0, 32)
+ b = strconv.AppendInt(b, int64(t.Hour()), 10)
+ b = append(b, []byte{0x2e}...)
+
+ if t.Minute() < 10 {
+ b = append(b, '0')
+ }
+
+ b = strconv.AppendInt(b, int64(t.Minute()), 10)
+ b = append(b, []byte{0x2e}...)
+
+ if t.Second() < 10 {
+ b = append(b, '0')
+ }
+
+ b = strconv.AppendInt(b, int64(t.Second()), 10)
+
return string(b)
}
@@ -343,6 +516,26 @@ func (smn *smn) FmtTimeLong(t time.Time) string {
b := make([]byte, 0, 32)
+ b = strconv.AppendInt(b, int64(t.Hour()), 10)
+ b = append(b, []byte{0x2e}...)
+
+ if t.Minute() < 10 {
+ b = append(b, '0')
+ }
+
+ b = strconv.AppendInt(b, int64(t.Minute()), 10)
+ b = append(b, []byte{0x2e}...)
+
+ if t.Second() < 10 {
+ b = append(b, '0')
+ }
+
+ b = strconv.AppendInt(b, int64(t.Second()), 10)
+ b = append(b, []byte{0x20}...)
+
+ tz, _ := t.Zone()
+ b = append(b, tz...)
+
return string(b)
}
@@ -351,5 +544,30 @@ func (smn *smn) FmtTimeFull(t time.Time) string {
b := make([]byte, 0, 32)
+ b = strconv.AppendInt(b, int64(t.Hour()), 10)
+ b = append(b, []byte{0x2e}...)
+
+ if t.Minute() < 10 {
+ b = append(b, '0')
+ }
+
+ b = strconv.AppendInt(b, int64(t.Minute()), 10)
+ b = append(b, []byte{0x2e}...)
+
+ if t.Second() < 10 {
+ b = append(b, '0')
+ }
+
+ b = strconv.AppendInt(b, int64(t.Second()), 10)
+ b = append(b, []byte{0x20}...)
+
+ tz, _ := t.Zone()
+
+ if btz, ok := smn.timezones[tz]; ok {
+ b = append(b, btz...)
+ } else {
+ b = append(b, tz...)
+ }
+
return string(b)
}