OSDN Git Service

delete miner
[bytom/vapor.git] / vendor / github.com / go-playground / locales / kn / kn.go
1 package kn
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 kn 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         monthsAbbreviated  []string
26         monthsNarrow       []string
27         monthsWide         []string
28         daysAbbreviated    []string
29         daysNarrow         []string
30         daysShort          []string
31         daysWide           []string
32         periodsAbbreviated []string
33         periodsNarrow      []string
34         periodsShort       []string
35         periodsWide        []string
36         erasAbbreviated    []string
37         erasNarrow         []string
38         erasWide           []string
39         timezones          map[string]string
40 }
41
42 // New returns a new instance of translator for the 'kn' locale
43 func New() locales.Translator {
44         return &kn{
45                 locale:             "kn",
46                 pluralsCardinal:    []locales.PluralRule{2, 6},
47                 pluralsOrdinal:     []locales.PluralRule{6},
48                 pluralsRange:       []locales.PluralRule{2, 6},
49                 decimal:            ".",
50                 group:              ",",
51                 minus:              "-",
52                 percent:            "%",
53                 perMille:           "‰",
54                 timeSeparator:      ":",
55                 inifinity:          "∞",
56                 currencies:         []string{"ADP", "AED", "AFA", "AFN", "ALK", "ALL", "AMD", "ANG", "AOA", "AOK", "AON", "AOR", "ARA", "ARL", "ARM", "ARP", "ARS", "ATS", "A$", "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", "R$", "BRN", "BRR", "BRZ", "BSD", "BTN", "BUK", "BWP", "BYB", "BYN", "BYR", "BZD", "CA$", "CDF", "CHE", "CHF", "CHW", "CLE", "CLF", "CLP", "CNX", "CN¥", "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", "€", "FIM", "FJD", "FKP", "FRF", "£", "GEK", "GEL", "GHC", "GHS", "GIP", "GMD", "GNF", "GNS", "GQE", "GRD", "GTQ", "GWE", "GWP", "GYD", "HK$", "HNL", "HRD", "HRK", "HTG", "HUF", "IDR", "IEP", "ILP", "ILR", "₪", "₹", "IQD", "IRR", "ISJ", "ISK", "ITL", "JMD", "JOD", "JP¥", "KES", "KGS", "KHR", "KMF", "KPW", "KRH", "KRO", "₩", "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", "MX$", "MXP", "MXV", "MYR", "MZE", "MZM", "MZN", "NAD", "NGN", "NIC", "NIO", "NLG", "NOK", "NPR", "NZ$", "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", "฿", "TJR", "TJS", "TMM", "TMT", "TND", "TOP", "TPE", "TRL", "TRY", "TTD", "NT$", "TZS", "UAH", "UAK", "UGS", "UGX", "$", "USN", "USS", "UYI", "UYP", "UYU", "UZS", "VEB", "VEF", "₫", "VNN", "VUV", "WST", "FCFA", "XAG", "XAU", "XBA", "XBB", "XBC", "XBD", "EC$", "XDR", "XEU", "XFO", "XFU", "CFA", "XPD", "CFPF", "XPT", "XRE", "XSU", "XTS", "XUA", "XXX", "YDD", "YER", "YUD", "YUM", "YUN", "YUR", "ZAL", "ZAR", "ZMK", "ZMW", "ZRN", "ZRZ", "ZWD", "ZWL", "ZWR"},
57                 monthsAbbreviated:  []string{"", "ಜನ", "ಫೆಬ್ರ", "ಮಾರ್ಚ್", "ಏಪ್ರಿ", "ಮೇ", "ಜೂನ್", "ಜುಲೈ", "ಆಗ", "ಸೆಪ್ಟೆಂ", "ಅಕ್ಟೋ", "ನವೆಂ", "ಡಿಸೆಂ"},
58                 monthsNarrow:       []string{"", "ಜ", "ಫೆ", "ಮಾ", "ಏ", "ಮೇ", "ಜೂ", "ಜು", "ಆ", "ಸೆ", "ಅ", "ನ", "ಡಿ"},
59                 monthsWide:         []string{"", "ಜನವರಿ", "ಫೆಬ್ರವರಿ", "ಮಾರ್ಚ್", "ಏಪ್ರಿಲ್", "ಮೇ", "ಜೂನ್", "ಜುಲೈ", "ಆಗಸ್ಟ್", "ಸೆಪ್ಟೆಂಬರ್", "ಅಕ್ಟೋಬರ್", "ನವೆಂಬರ್", "ಡಿಸೆಂಬರ್"},
60                 daysAbbreviated:    []string{"ಭಾನು", "ಸೋಮ", "ಮಂಗಳ", "ಬುಧ", "ಗುರು", "ಶುಕ್ರ", "ಶನಿ"},
61                 daysNarrow:         []string{"ಭಾ", "ಸೋ", "ಮಂ", "ಬು", "ಗು", "ಶು", "ಶ"},
62                 daysShort:          []string{"ಭಾನು", "ಸೋಮ", "ಮಂಗಳ", "ಬುಧ", "ಗುರು", "ಶುಕ್ರ", "ಶನಿ"},
63                 daysWide:           []string{"ಭಾನುವಾರ", "ಸೋಮವಾರ", "ಮಂಗಳವಾರ", "ಬುಧವಾರ", "ಗುರುವಾರ", "ಶುಕ್ರವಾರ", "ಶನಿವಾರ"},
64                 periodsAbbreviated: []string{"ಪೂರ್ವಾಹ್ನ", "ಅಪರಾಹ್ನ"},
65                 periodsNarrow:      []string{"ಪೂ", "ಅ"},
66                 periodsWide:        []string{"ಪೂರ್ವಾಹ್ನ", "ಅಪರಾಹ್ನ"},
67                 erasAbbreviated:    []string{"ಕ್ರಿ.ಪೂ", "ಕ್ರಿ.ಶ"},
68                 erasNarrow:         []string{"", ""},
69                 erasWide:           []string{"ಕ್ರಿಸ್ತ ಪೂರ್ವ", "ಕ್ರಿಸ್ತ ಶಕ"},
70                 timezones:          map[string]string{"HNPM": "ಸೇಂಟ್ ಪಿಯರ್ ಮತ್ತು ಮಿಕ್ವೆಲನ್ ಪ್ರಮಾಣಿತ ಸಮಯ", "MST": "ಮಕಾವ್ ಪ್ರಮಾಣಿತ ಸಮಯ", "AWST": "ಆಸ್ಟ್ರೇಲಿಯಾದ ಪಶ್ಚಿಮ ಪ್ರಮಾಣಿತ ಸಮಯ", "AEDT": "ಪೂರ್ವ ಆಸ್ಟ್ರೇಲಿಯಾದ ಹಗಲು ಸಮಯ", "ACDT": "ಆಸ್ಟ್ರೇಲಿಯಾದ ಕೇಂದ್ರ ಹಗಲು ಸಮಯ", "COT": "ಕೊಲಂಬಿಯಾ ಪ್ರಮಾಣಿತ ಸಮಯ", "GYT": "ಗಯಾನಾ ಸಮಯ", "PDT": "ಉತ್ತರ ಅಮೆರಿಕದ ಪೆಸಿಫಿಕ್ ದಿನದ ಸಮಯ", "MEZ": "ಮಧ್ಯ ಯುರೋಪಿಯನ್ ಪ್ರಮಾಣಿತ ಸಮಯ", "EAT": "ಪೂರ್ವ ಆಫ್ರಿಕಾ ಸಮಯ", "HNEG": "ಪೂರ್ವ ಗ್ರೀನ್\u200cಲ್ಯಾಂಡ್ ಪ್ರಮಾಣಿತ ಸಮಯ", "ChST": "ಚಮೋರೋ ಪ್ರಮಾಣಿತ ಸಮಯ", "CHADT": "ಚಥಾಮ್ ಹಗಲು ಸಮಯ", "HEOG": "ಪಶ್ಚಿಮ ಗ್ರೀನ್\u200cಲ್ಯಾಂಡ್ ಬೇಸಿಗೆ ಸಮಯ", "CAT": "ಮಧ್ಯ ಆಫ್ರಿಕಾ ಸಮಯ", "WIB": "ಪಶ್ಚಿಮ ಇಂಡೋನೇಷಿಯ ಸಮಯ", "UYT": "ಉರುಗ್ವೇ ಪ್ರಮಾಣಿತ ಸಮಯ", "LHDT": "ಲಾರ್ಡ್ ಹೋವ್ ಬೆಳಗಿನ ಸಮಯ", "HEEG": "ಪೂರ್ವ ಗ್ರೀನ್\u200cಲ್ಯಾಂಡ್ ಬೇಸಿಗೆ ಸಮಯ", "HEPMX": "ಮೆಕ್ಸಿಕನ್ ಪೆಸಿಫಿಕ್ ಹಗಲು ಸಮಯ", "WIT": "ಪೂರ್ವ ಇಂಡೋನೇಷಿಯಾ ಸಮಯ", "MESZ": "ಮಧ್ಯ ಯುರೋಪಿಯನ್ ಬೇಸಿಗೆ ಸಮಯ", "HAST": "ಹವಾಯಿ-ಅಲ್ಯುಟಿಯನ್ ಪ್ರಮಾಣಿತ ಸಮಯ", "JST": "ಜಪಾನ್ ಪ್ರಮಾಣಿತ ಸಮಯ", "∅∅∅": "ಅಮೆಜಾನ್ ಬೇಸಿಗೆ ಸಮಯ", "CDT": "ಉತ್ತರ ಅಮೆರಿಕದ ಕೇಂದ್ರೀಯ ದಿನದ ಸಮಯ", "WART": "ಪಶ್ಚಿಮ ಅರ್ಜೆಂಟೀನಾ ಪ್ರಮಾಣಿತ ಸಮಯ", "VET": "ವೆನಿಜುವೆಲಾ ಸಮಯ", "HNNOMX": "ವಾಯವ್ಯ ಮೆಕ್ಸಿಕೊ ಪ್ರಮಾಣಿತ ಸಮಯ", "SAST": "ದಕ್ಷಿಣ ಆಫ್ರಿಕಾ ಪ್ರಮಾಣಿತ ಸಮಯ", "NZDT": "ನ್ಯೂಜಿಲ್ಯಾಂಡ್ ಹಗಲು ಸಮಯ", "HKST": "ಹಾಂಗ್ ಕಾಂಗ್ ಬೇಸಿಗೆ ಸಮಯ", "AWDT": "ಆಸ್ಟ್ರೇಲಿಯಾದ ಪಶ್ಚಿಮ ಹಗಲು ಸಮಯ", "WAST": "ಪಶ್ಚಿಮ ಆಫ್ರಿಕಾ ಬೇಸಿಗೆ ಸಮಯ", "HKT": "ಹಾಂಗ್ ಕಾಂಗ್ ಪ್ರಮಾಣಿತ ಸಮಯ", "MDT": "ಮಕಾವ್ ಬೇಸಿಗೆ ಸಮಯ", "ACWST": "ಆಸ್ಟ್ರೇಲಿಯಾದ ಕೇಂದ್ರ ಪಶ್ಚಿಮ ಪ್ರಮಾಣಿತ ಸಮಯ", "HADT": "ಹವಾಯಿ-ಅಲ್ಯುಟಿಯನ್ ಹಗಲು ಸಮಯ", "HNT": "ನ್ಯೂಫೌಂಡ್\u200cಲ್ಯಾಂಡ್ ಪ್ರಮಾಣಿತ ಸಮಯ", "CLST": "ಚಿಲಿ ಬೇಸಿಗೆ ಸಮಯ", "WAT": "ಪಶ್ಚಿಮ ಆಫ್ರಿಕಾ ಪ್ರಮಾಣಿತ ಸಮಯ", "EST": "ಉತ್ತರ ಅಮೆರಿಕದ ಪೂರ್ವದ ಪ್ರಮಾಣಿತ ಸಮಯ", "AKST": "ಅಲಸ್ಕಾ ಪ್ರಮಾಣಿತ ಸಮಯ", "HECU": "ಕ್ಯೂಬಾ ದಿನದ ಸಮಯ", "ACWDT": "ಆಸ್ಟ್ರೇಲಿಯಾದ ಕೇಂದ್ರ ಪಶ್ಚಿಮ ಹಗಲು ಸಮಯ", "WARST": "ಪಶ್ಚಿಮ ಅರ್ಜೆಂಟೀನಾ ಬೇಸಿಗೆ ಸಮಯ", "ART": "ಅರ್ಜೆಂಟೀನಾ ಪ್ರಮಾಣಿತ ಸಮಯ", "HNOG": "ಪಶ್ಚಿಮ ಗ್ರೀನ್\u200cಲ್ಯಾಂಡ್ ಪ್ರಮಾಣಿತ ಸಮಯ", "HENOMX": "ವಾಯವ್ಯ ಮೆಕ್ಸಿಕೊ ಹಗಲು ಸಮಯ", "EDT": "ಉತ್ತರ ಅಮೆರಿಕದ ಪೂರ್ವದ ದಿನದ ಸಮಯ", "ACST": "ಆಸ್ಟ್ರೇಲಿಯಾದ ಕೇಂದ್ರ ಪ್ರಮಾಣಿತ ಸಮಯ", "BT": "ಭೂತಾನ್ ಸಮಯ", "BOT": "ಬೊಲಿವಿಯಾ ಸಮಯ", "CST": "ಉತ್ತರ ಅಮೆರಿಕದ ಕೇಂದ್ರ ಪ್ರಮಾಣಿತ ಸಮಯ", "WITA": "ಮಧ್ಯ ಇಂಡೋನೇಷಿಯಾ ಸಮಯ", "AEST": "ಆಸ್ಟ್ರೇಲಿಯಾದ ಪೂರ್ವ ಪ್ರಮಾಣಿತ ಸಮಯ", "COST": "ಕೊಲಂಬಿಯಾ ಬೇಸಿಗೆ ಸಮಯ", "SRT": "ಸುರಿನೇಮ್ ಸಮಯ", "WEZ": "ಪಶ್ಚಿಮ ಯುರೋಪಿಯನ್ ಪ್ರಮಾಣಿತ ಸಮಯ", "GMT": "ಗ್ರೀನ್\u200cವಿಚ್ ಸರಾಸರಿ ಕಾಲಮಾನ", "MYT": "ಮಲೇಷಿಯಾ ಸಮಯ", "IST": "ಭಾರತೀಯ ಪ್ರಮಾಣಿತ ಸಮಯ", "WESZ": "ಪಶ್ಚಿಮ ಯುರೋಪಿಯನ್ ಬೇಸಿಗೆ ಸಮಯ", "HEPM": "ಸೇಂಟ್ ಪಿಯರ್ ಮತ್ತು ಮಿಕ್ವೆಲನ್ ಹಗಲು ಸಮಯ", "AKDT": "\u200cಅಲಾಸ್ಕಾ ಹಗಲು ಸಮಯ", "HNPMX": "ಮೆಕ್ಸಿಕನ್ ಪೆಸಿಫಿಕ್ ಪ್ರಮಾಣಿತ ಸಮಯ", "ADT": "ಅಟ್ಲಾಂಟಿಕ್ ದಿನದ ಸಮಯ", "GFT": "ಫ್ರೆಂಚ್ ಗಯಾನಾ ಸಮಯ", "ECT": "ಈಕ್ವೆಡಾರ್ ಸಮಯ", "TMT": "ತುರ್ಕ್\u200cಮೇನಿಸ್ತಾನ್ ಪ್ರಮಾಣಿತ ಸಮಯ", "TMST": "ತುರ್ಕ್\u200cಮೇನಿಸ್ತಾನ್ ಬೇಸಿಗೆ ಸಮಯ", "OEZ": "ಪೂರ್ವ ಯುರೋಪಿಯನ್ ಪ್ರಮಾಣಿತ ಸಮಯ", "HAT": "ನ್ಯೂಫೌಂಡ್\u200cಲ್ಯಾಂಡ್ ದಿನದ ಸಮಯ", "CLT": "ಚಿಲಿ ಪ್ರಮಾಣಿತ ಸಮಯ", "HNCU": "ಕ್ಯೂಬಾ ಪ್ರಮಾಣಿತ ಸಮಯ", "JDT": "ಜಪಾನ್ ಹಗಲು ಸಮಯ", "OESZ": "ಪೂರ್ವ ಯುರೋಪಿಯನ್ ಬೇಸಿಗೆ ಸಮಯ", "LHST": "ಲಾರ್ಡ್ ಹೋವ್ ಪ್ರಮಾಣಿತ ಸಮಯ", "AST": "ಅಟ್ಲಾಂಟಿಕ್ ಪ್ರಮಾಣಿತ ಸಮಯ", "ARST": "ಅರ್ಜೆಂಟಿನಾ ಬೇಸಿಗೆ ಸಮಯ", "CHAST": "ಚಥಾಮ್ ಪ್ರಮಾಣಿತ ಸಮಯ", "UYST": "ಉರುಗ್ವೇ ಬೇಸಿಗೆ ಸಮಯ", "NZST": "ನ್ಯೂಜಿಲ್ಯಾಂಡ್ ಪ್ರಮಾಣಿತ ಸಮಯ", "SGT": "ಸಿಂಗಾಪುರ್ ಪ್ರಮಾಣಿತ ಸಮಯ", "PST": "ಉತ್ತರ ಅಮೆರಿಕದ ಪೆಸಿಫಿಕ್ ಪ್ರಮಾಣಿತ ಸಮಯ"},
71         }
72 }
73
74 // Locale returns the current translators string locale
75 func (kn *kn) Locale() string {
76         return kn.locale
77 }
78
79 // PluralsCardinal returns the list of cardinal plural rules associated with 'kn'
80 func (kn *kn) PluralsCardinal() []locales.PluralRule {
81         return kn.pluralsCardinal
82 }
83
84 // PluralsOrdinal returns the list of ordinal plural rules associated with 'kn'
85 func (kn *kn) PluralsOrdinal() []locales.PluralRule {
86         return kn.pluralsOrdinal
87 }
88
89 // PluralsRange returns the list of range plural rules associated with 'kn'
90 func (kn *kn) PluralsRange() []locales.PluralRule {
91         return kn.pluralsRange
92 }
93
94 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'kn'
95 func (kn *kn) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
96
97         n := math.Abs(num)
98         i := int64(n)
99
100         if (i == 0) || (n == 1) {
101                 return locales.PluralRuleOne
102         }
103
104         return locales.PluralRuleOther
105 }
106
107 // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'kn'
108 func (kn *kn) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
109         return locales.PluralRuleOther
110 }
111
112 // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'kn'
113 func (kn *kn) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
114
115         start := kn.CardinalPluralRule(num1, v1)
116         end := kn.CardinalPluralRule(num2, v2)
117
118         if start == locales.PluralRuleOne && end == locales.PluralRuleOne {
119                 return locales.PluralRuleOne
120         } else if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
121                 return locales.PluralRuleOther
122         }
123
124         return locales.PluralRuleOther
125
126 }
127
128 // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
129 func (kn *kn) MonthAbbreviated(month time.Month) string {
130         return kn.monthsAbbreviated[month]
131 }
132
133 // MonthsAbbreviated returns the locales abbreviated months
134 func (kn *kn) MonthsAbbreviated() []string {
135         return kn.monthsAbbreviated[1:]
136 }
137
138 // MonthNarrow returns the locales narrow month given the 'month' provided
139 func (kn *kn) MonthNarrow(month time.Month) string {
140         return kn.monthsNarrow[month]
141 }
142
143 // MonthsNarrow returns the locales narrow months
144 func (kn *kn) MonthsNarrow() []string {
145         return kn.monthsNarrow[1:]
146 }
147
148 // MonthWide returns the locales wide month given the 'month' provided
149 func (kn *kn) MonthWide(month time.Month) string {
150         return kn.monthsWide[month]
151 }
152
153 // MonthsWide returns the locales wide months
154 func (kn *kn) MonthsWide() []string {
155         return kn.monthsWide[1:]
156 }
157
158 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
159 func (kn *kn) WeekdayAbbreviated(weekday time.Weekday) string {
160         return kn.daysAbbreviated[weekday]
161 }
162
163 // WeekdaysAbbreviated returns the locales abbreviated weekdays
164 func (kn *kn) WeekdaysAbbreviated() []string {
165         return kn.daysAbbreviated
166 }
167
168 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
169 func (kn *kn) WeekdayNarrow(weekday time.Weekday) string {
170         return kn.daysNarrow[weekday]
171 }
172
173 // WeekdaysNarrow returns the locales narrow weekdays
174 func (kn *kn) WeekdaysNarrow() []string {
175         return kn.daysNarrow
176 }
177
178 // WeekdayShort returns the locales short weekday given the 'weekday' provided
179 func (kn *kn) WeekdayShort(weekday time.Weekday) string {
180         return kn.daysShort[weekday]
181 }
182
183 // WeekdaysShort returns the locales short weekdays
184 func (kn *kn) WeekdaysShort() []string {
185         return kn.daysShort
186 }
187
188 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
189 func (kn *kn) WeekdayWide(weekday time.Weekday) string {
190         return kn.daysWide[weekday]
191 }
192
193 // WeekdaysWide returns the locales wide weekdays
194 func (kn *kn) WeekdaysWide() []string {
195         return kn.daysWide
196 }
197
198 // Decimal returns the decimal point of number
199 func (kn *kn) Decimal() string {
200         return kn.decimal
201 }
202
203 // Group returns the group of number
204 func (kn *kn) Group() string {
205         return kn.group
206 }
207
208 // Group returns the minus sign of number
209 func (kn *kn) Minus() string {
210         return kn.minus
211 }
212
213 // FmtNumber returns 'num' with digits/precision of 'v' for 'kn' and handles both Whole and Real numbers based on 'v'
214 func (kn *kn) FmtNumber(num float64, v uint64) string {
215
216         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
217         l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
218         count := 0
219         inWhole := v == 0
220         b := make([]byte, 0, l)
221
222         for i := len(s) - 1; i >= 0; i-- {
223
224                 if s[i] == '.' {
225                         b = append(b, kn.decimal[0])
226                         inWhole = true
227                         continue
228                 }
229
230                 if inWhole {
231                         if count == 3 {
232                                 b = append(b, kn.group[0])
233                                 count = 1
234                         } else {
235                                 count++
236                         }
237                 }
238
239                 b = append(b, s[i])
240         }
241
242         if num < 0 {
243                 b = append(b, kn.minus[0])
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 'kn' 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 (kn *kn) FmtPercent(num float64, v uint64) string {
257         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
258         l := len(s) + 3
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, kn.decimal[0])
265                         continue
266                 }
267
268                 b = append(b, s[i])
269         }
270
271         if num < 0 {
272                 b = append(b, kn.minus[0])
273         }
274
275         // reverse
276         for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
277                 b[i], b[j] = b[j], b[i]
278         }
279
280         b = append(b, kn.percent...)
281
282         return string(b)
283 }
284
285 // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'kn'
286 func (kn *kn) FmtCurrency(num float64, v uint64, currency currency.Type) string {
287
288         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
289         symbol := kn.currencies[currency]
290         l := len(s) + len(symbol) + 2 + 1*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, kn.decimal[0])
299                         inWhole = true
300                         continue
301                 }
302
303                 if inWhole {
304                         if count == 3 {
305                                 b = append(b, kn.group[0])
306                                 count = 1
307                         } else {
308                                 count++
309                         }
310                 }
311
312                 b = append(b, s[i])
313         }
314
315         for j := len(symbol) - 1; j >= 0; j-- {
316                 b = append(b, symbol[j])
317         }
318
319         if num < 0 {
320                 b = append(b, kn.minus[0])
321         }
322
323         // reverse
324         for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
325                 b[i], b[j] = b[j], b[i]
326         }
327
328         if int(v) < 2 {
329
330                 if v == 0 {
331                         b = append(b, kn.decimal...)
332                 }
333
334                 for i := 0; i < 2-int(v); i++ {
335                         b = append(b, '0')
336                 }
337         }
338
339         return string(b)
340 }
341
342 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'kn'
343 // in accounting notation.
344 func (kn *kn) FmtAccounting(num float64, v uint64, currency currency.Type) string {
345
346         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
347         symbol := kn.currencies[currency]
348         l := len(s) + len(symbol) + 2 + 1*len(s[:len(s)-int(v)-1])/3
349         count := 0
350         inWhole := v == 0
351         b := make([]byte, 0, l)
352
353         for i := len(s) - 1; i >= 0; i-- {
354
355                 if s[i] == '.' {
356                         b = append(b, kn.decimal[0])
357                         inWhole = true
358                         continue
359                 }
360
361                 if inWhole {
362                         if count == 3 {
363                                 b = append(b, kn.group[0])
364                                 count = 1
365                         } else {
366                                 count++
367                         }
368                 }
369
370                 b = append(b, s[i])
371         }
372
373         if num < 0 {
374
375                 for j := len(symbol) - 1; j >= 0; j-- {
376                         b = append(b, symbol[j])
377                 }
378
379                 b = append(b, kn.minus[0])
380
381         } else {
382
383                 for j := len(symbol) - 1; j >= 0; j-- {
384                         b = append(b, symbol[j])
385                 }
386
387         }
388
389         // reverse
390         for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
391                 b[i], b[j] = b[j], b[i]
392         }
393
394         if int(v) < 2 {
395
396                 if v == 0 {
397                         b = append(b, kn.decimal...)
398                 }
399
400                 for i := 0; i < 2-int(v); i++ {
401                         b = append(b, '0')
402                 }
403         }
404
405         return string(b)
406 }
407
408 // FmtDateShort returns the short date representation of 't' for 'kn'
409 func (kn *kn) FmtDateShort(t time.Time) string {
410
411         b := make([]byte, 0, 32)
412
413         b = strconv.AppendInt(b, int64(t.Day()), 10)
414         b = append(b, []byte{0x2f}...)
415         b = strconv.AppendInt(b, int64(t.Month()), 10)
416         b = append(b, []byte{0x2f}...)
417
418         if t.Year() > 9 {
419                 b = append(b, strconv.Itoa(t.Year())[2:]...)
420         } else {
421                 b = append(b, strconv.Itoa(t.Year())[1:]...)
422         }
423
424         return string(b)
425 }
426
427 // FmtDateMedium returns the medium date representation of 't' for 'kn'
428 func (kn *kn) FmtDateMedium(t time.Time) string {
429
430         b := make([]byte, 0, 32)
431
432         b = append(b, kn.monthsAbbreviated[t.Month()]...)
433         b = append(b, []byte{0x20}...)
434         b = strconv.AppendInt(b, int64(t.Day()), 10)
435         b = append(b, []byte{0x2c, 0x20}...)
436
437         if t.Year() > 0 {
438                 b = strconv.AppendInt(b, int64(t.Year()), 10)
439         } else {
440                 b = strconv.AppendInt(b, int64(-t.Year()), 10)
441         }
442
443         return string(b)
444 }
445
446 // FmtDateLong returns the long date representation of 't' for 'kn'
447 func (kn *kn) FmtDateLong(t time.Time) string {
448
449         b := make([]byte, 0, 32)
450
451         b = append(b, kn.monthsWide[t.Month()]...)
452         b = append(b, []byte{0x20}...)
453         b = strconv.AppendInt(b, int64(t.Day()), 10)
454         b = append(b, []byte{0x2c, 0x20}...)
455
456         if t.Year() > 0 {
457                 b = strconv.AppendInt(b, int64(t.Year()), 10)
458         } else {
459                 b = strconv.AppendInt(b, int64(-t.Year()), 10)
460         }
461
462         return string(b)
463 }
464
465 // FmtDateFull returns the full date representation of 't' for 'kn'
466 func (kn *kn) FmtDateFull(t time.Time) string {
467
468         b := make([]byte, 0, 32)
469
470         b = append(b, kn.daysWide[t.Weekday()]...)
471         b = append(b, []byte{0x2c, 0x20}...)
472         b = append(b, kn.monthsWide[t.Month()]...)
473         b = append(b, []byte{0x20}...)
474         b = strconv.AppendInt(b, int64(t.Day()), 10)
475         b = append(b, []byte{0x2c, 0x20}...)
476
477         if t.Year() > 0 {
478                 b = strconv.AppendInt(b, int64(t.Year()), 10)
479         } else {
480                 b = strconv.AppendInt(b, int64(-t.Year()), 10)
481         }
482
483         return string(b)
484 }
485
486 // FmtTimeShort returns the short time representation of 't' for 'kn'
487 func (kn *kn) FmtTimeShort(t time.Time) string {
488
489         b := make([]byte, 0, 32)
490
491         h := t.Hour()
492
493         if h > 12 {
494                 h -= 12
495         }
496
497         if h < 10 {
498                 b = append(b, '0')
499         }
500
501         b = strconv.AppendInt(b, int64(h), 10)
502         b = append(b, kn.timeSeparator...)
503
504         if t.Minute() < 10 {
505                 b = append(b, '0')
506         }
507
508         b = strconv.AppendInt(b, int64(t.Minute()), 10)
509         b = append(b, []byte{0x20}...)
510
511         if t.Hour() < 12 {
512                 b = append(b, kn.periodsAbbreviated[0]...)
513         } else {
514                 b = append(b, kn.periodsAbbreviated[1]...)
515         }
516
517         return string(b)
518 }
519
520 // FmtTimeMedium returns the medium time representation of 't' for 'kn'
521 func (kn *kn) FmtTimeMedium(t time.Time) string {
522
523         b := make([]byte, 0, 32)
524
525         h := t.Hour()
526
527         if h > 12 {
528                 h -= 12
529         }
530
531         if h < 10 {
532                 b = append(b, '0')
533         }
534
535         b = strconv.AppendInt(b, int64(h), 10)
536         b = append(b, kn.timeSeparator...)
537
538         if t.Minute() < 10 {
539                 b = append(b, '0')
540         }
541
542         b = strconv.AppendInt(b, int64(t.Minute()), 10)
543         b = append(b, kn.timeSeparator...)
544
545         if t.Second() < 10 {
546                 b = append(b, '0')
547         }
548
549         b = strconv.AppendInt(b, int64(t.Second()), 10)
550         b = append(b, []byte{0x20}...)
551
552         if t.Hour() < 12 {
553                 b = append(b, kn.periodsAbbreviated[0]...)
554         } else {
555                 b = append(b, kn.periodsAbbreviated[1]...)
556         }
557
558         return string(b)
559 }
560
561 // FmtTimeLong returns the long time representation of 't' for 'kn'
562 func (kn *kn) FmtTimeLong(t time.Time) string {
563
564         b := make([]byte, 0, 32)
565
566         h := t.Hour()
567
568         if h > 12 {
569                 h -= 12
570         }
571
572         if h < 10 {
573                 b = append(b, '0')
574         }
575
576         b = strconv.AppendInt(b, int64(h), 10)
577         b = append(b, kn.timeSeparator...)
578
579         if t.Minute() < 10 {
580                 b = append(b, '0')
581         }
582
583         b = strconv.AppendInt(b, int64(t.Minute()), 10)
584         b = append(b, kn.timeSeparator...)
585
586         if t.Second() < 10 {
587                 b = append(b, '0')
588         }
589
590         b = strconv.AppendInt(b, int64(t.Second()), 10)
591         b = append(b, []byte{0x20}...)
592
593         if t.Hour() < 12 {
594                 b = append(b, kn.periodsAbbreviated[0]...)
595         } else {
596                 b = append(b, kn.periodsAbbreviated[1]...)
597         }
598
599         b = append(b, []byte{0x20}...)
600
601         tz, _ := t.Zone()
602         b = append(b, tz...)
603
604         return string(b)
605 }
606
607 // FmtTimeFull returns the full time representation of 't' for 'kn'
608 func (kn *kn) FmtTimeFull(t time.Time) string {
609
610         b := make([]byte, 0, 32)
611
612         h := t.Hour()
613
614         if h > 12 {
615                 h -= 12
616         }
617
618         if h < 10 {
619                 b = append(b, '0')
620         }
621
622         b = strconv.AppendInt(b, int64(h), 10)
623         b = append(b, kn.timeSeparator...)
624
625         if t.Minute() < 10 {
626                 b = append(b, '0')
627         }
628
629         b = strconv.AppendInt(b, int64(t.Minute()), 10)
630         b = append(b, kn.timeSeparator...)
631
632         if t.Second() < 10 {
633                 b = append(b, '0')
634         }
635
636         b = strconv.AppendInt(b, int64(t.Second()), 10)
637         b = append(b, []byte{0x20}...)
638
639         if t.Hour() < 12 {
640                 b = append(b, kn.periodsAbbreviated[0]...)
641         } else {
642                 b = append(b, kn.periodsAbbreviated[1]...)
643         }
644
645         b = append(b, []byte{0x20}...)
646
647         tz, _ := t.Zone()
648
649         if btz, ok := kn.timezones[tz]; ok {
650                 b = append(b, btz...)
651         } else {
652                 b = append(b, tz...)
653         }
654
655         return string(b)
656 }