OSDN Git Service

new repo
[bytom/vapor.git] / vendor / github.com / go-playground / locales / my / my.go
1 package my
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 my 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         currencyPositivePrefix string
26         currencyNegativePrefix string
27         monthsAbbreviated      []string
28         monthsNarrow           []string
29         monthsWide             []string
30         daysAbbreviated        []string
31         daysNarrow             []string
32         daysShort              []string
33         daysWide               []string
34         periodsAbbreviated     []string
35         periodsNarrow          []string
36         periodsShort           []string
37         periodsWide            []string
38         erasAbbreviated        []string
39         erasNarrow             []string
40         erasWide               []string
41         timezones              map[string]string
42 }
43
44 // New returns a new instance of translator for the 'my' locale
45 func New() locales.Translator {
46         return &my{
47                 locale:                 "my",
48                 pluralsCardinal:        []locales.PluralRule{6},
49                 pluralsOrdinal:         []locales.PluralRule{6},
50                 pluralsRange:           []locales.PluralRule{6},
51                 percent:                "%",
52                 perMille:               "‰",
53                 timeSeparator:          ":",
54                 inifinity:              "∞",
55                 currencies:             []string{"ADP", "AED", "AFA", "AFN", "ALK", "ALL", "AMD", "NAf", "AOA", "AOK", "AON", "AOR", "ARA", "ARL", "ARM", "ARP", "ARS", "ATS", "A$", "Afl", "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", "G", "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", "K", "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", "B/.", "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", "TT$", "NT$", "TZS", "UAH", "UAK", "UGS", "UGX", "US$", "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"},
56                 currencyPositivePrefix: " ",
57                 currencyNegativePrefix: " ",
58                 monthsAbbreviated:      []string{"", "ဇန်", "ဖေ", "မတ်", "ဧ", "မေ", "ဇွန်", "ဇူ", "ဩ", "စက်", "အောက်", "နို", "ဒီ"},
59                 monthsNarrow:           []string{"", "ဇ", "ဖ", "မ", "ဧ", "မ", "ဇ", "ဇ", "ဩ", "စ", "အ", "န", "ဒ"},
60                 monthsWide:             []string{"", "ဇန်နဝါရီ", "ဖေဖော်ဝါရီ", "မတ်", "ဧပြီ", "မေ", "ဇွန်", "ဇူလိုင်", "ဩဂုတ်", "စက်တင်ဘာ", "အောက်တိုဘာ", "နိုဝင်ဘာ", "ဒီဇင်ဘာ"},
61                 daysAbbreviated:        []string{"တနင်္ဂနွေ", "တနင်္လာ", "အင်္ဂါ", "ဗုဒ္ဓဟူး", "ကြာသပတေး", "သောကြာ", "စနေ"},
62                 daysNarrow:             []string{"တ", "တ", "အ", "ဗ", "က", "သ", "စ"},
63                 daysShort:              []string{"တနင်္ဂနွေ", "တနင်္လာ", "အင်္ဂါ", "ဗုဒ္ဓဟူး", "ကြာသပတေး", "သောကြာ", "စနေ"},
64                 daysWide:               []string{"တနင်္ဂနွေ", "တနင်္လာ", "အင်္ဂါ", "ဗုဒ္ဓဟူး", "ကြာသပတေး", "သောကြာ", "စနေ"},
65                 periodsAbbreviated:     []string{"နံနက်", "ညနေ"},
66                 periodsNarrow:          []string{"နံနက်", "ညနေ"},
67                 periodsWide:            []string{"နံနက်", "ညနေ"},
68                 erasAbbreviated:        []string{"ဘီစီ", "အေဒီ"},
69                 erasNarrow:             []string{"", ""},
70                 erasWide:               []string{"ခရစ်တော် မပေါ်မီနှစ်", "ခရစ်နှစ်"},
71                 timezones:              map[string]string{"HAT": "နယူးဖောင်လန် နွေရာသီ စံတော်ချိန်", "ChST": "ချာမိုရိုအချိန်", "GMT": "ဂရင်းနစ် စံတော်ချိန်", "MESZ": "ဥရောပ အလယ်ပိုင်း နွေရာသီ အချိန်", "VET": "ဗင်နီဇွဲလား အချိန်", "ARST": "အာဂျင်တီးနား နွေရာသီအချိန်", "EAT": "အရှေ့အာဖရိက အချိန်", "SGT": "စင်္ကာပူ အချိန်", "HEPMX": "မက္ကစီကန် ပစိဖိတ် နွေရာသီ စံတော်ချိန်", "CST": "မြောက်အမေရိက အလယ်ပိုင်းစံတော်ချိန်", "AEDT": "အရှေ့ဩစတြေးလျား နွေရာသီ အချိန်", "AKDT": "အလားစကား နွေရာသီစံတော်ချိန်", "WEZ": "အနောက်ဥရောပ စံတော်ချိန်", "JDT": "ဂျပန် နွေရာသီ အချိန်", "SAST": "တောင်အာဖရိက အချိန်", "HNEG": "အရှေ့ဂရင်းလန်း စံတော်ချိန်", "HNPMX": "မက္ကဆီကန် ပစိဖိတ် စံတော်ချိန်", "CDT": "မြောက်အမေရိက အလယ်ပိုင်း နွေရာသီစံတော်ချိန်", "UYT": "ဥရုဂွေး စံတော်ချိန်", "ACWST": "ဩစတြေးလျား အလယ်အနောက်ပိုင်း စံတော်ချိန်", "HADT": "ဟာဝိုင်ယီ အယ်လူးရှန်း နွေရာသီ စံတော်ချိန်", "OEZ": "အရှေ့ဥရောပ စံတော်ချိန်", "AEST": "အရှေ့ဩစတြေးလျား စံတော်ချိန်", "CLT": "ချီလီ စံတော်ချိန်", "HNCU": "ကျူးဘား စံတော်ချိန်", "MYT": "မလေးရှား အချိန်", "WAT": "အနောက်အာဖရိက စံတော်ချိန်", "ACDT": "ဩစတြေးလျား အလယ်ပိုင်း နွေရာသီ အချိန်", "CAT": "အလယ်အာဖရိက အချိန်", "ACWDT": "ဩစတြေးလျား အလယ်အနောက်ပိုင်း နွေရာသီ အချိန်", "WARST": "အနောက် အာဂျင်တီးနား နွေရာသီ အချိန်", "HENOMX": "အနောက်တောင် မက္ကစီကို နွေရာသီ စံတော်ချိန်", "GFT": "ပြင်သစ် ဂီအားနား အချိန်", "WIB": "အနောက်ပိုင်း အင်ဒိုနီးရှား အချိန်", "AST": "အတ္တလန်တစ် စံတော်ချိန်", "CLST": "ချီလီ နွေရာသီ အချိန်", "COT": "ကိုလံဘီယာ စံတော်ချိန်", "HEPM": "စိန့်ပီအဲနှင့် မီခွီလွန် နွေရာသီ စံတော်ချိန်", "WIT": "အရှေ့ပိုင်း အင်ဒိုနီးရှား အချိန်", "TMST": "တာ့ခ်မင်နစ္စတန် နွေရာသီ အချိန်", "∅∅∅": "အေဇိုးရီးစ် နွေရာသီ အချိန်", "ADT": "အတ္တလန်တစ် နွေရာသီ စံတော်ချိန်", "HEEG": "အရှေ့ဂရင်းလန် နွေရာသီ စံတော်ချိန်", "HNT": "နယူးဖောင်လန် စံတော်ချိန်", "AKST": "အလားစကားစံတော်ချိန်", "AWDT": "ဩစတြေးလျား နွေရာသီ အချိန်", "UYST": "ဥရုဂွေး နွေရာသီ အချိန်", "JST": "ဂျပန် စံတော်ချိန်", "ART": "အာဂျင်တီးနား စံတော်ချိန်", "HKT": "ဟောင်ကောင် စံတော်ချိန်", "EST": "မြောက်အမေရိက အရှေ့ပိုင်းစံတော်ချိန်", "HECU": "ကျူးဘား နွေရာသီ စံတော်ချိန်", "BOT": "ဘိုလီးဘီးယား အချိန်", "MST": "မြောက်အမေရိက တောင်တန်းဒေသစံတော်ချိန်", "WITA": "အလယ်ပိုင်း အင်ဒိုနီးရှား အချိန်", "OESZ": "အရှေ့ဥရောပ နွေရာသီ အချိန်", "TMT": "တာ့ခ်မင်နစ္စတန် စံတော်ချိန်", "WART": "အနောက် အာဂျင်တီးနား စံတော်ချိန်", "COST": "ကိုလံဘီယာ နွေရာသီ အချိန်", "SRT": "စူးရီနာမ်အချိန်", "GYT": "ဂိုင်ယာနာ အချိန်", "CHAST": "ချားသမ်စံတော်ချိန်", "PDT": "မြောက်အမေရိက ပစိဖိတ် နွေရာသီစံတော်ချိန်", "MDT": "မြောက်အမေရိက တောင်တန်းဒေသ နွေရာသီစံတော်ချိန်", "IST": "အိန္ဒိယ စံတော်ချိန်", "HNOG": "အနောက် ဂရင်းလန်း စံတော်ချိန်", "HEOG": "အနောက် ဂရင်းလန် နွေရာသီ စံတော်ချိန်", "ECT": "အီကွေဒေါ အချိန်", "BT": "ဘူတန် အချိန်", "HAST": "ဟာဝိုင်ယီ အယ်လူးရှန်း စံတော်ချိန်", "NZST": "နယူးဇီလန် စံတော်ချိန်", "LHST": "လော့ဒ်ဟောင်စံတော်ချိန်", "LHDT": "လော့ဒ်ဟောင် နွေရာသီ အချိန်", "HNNOMX": "အနောက်တောင် မက္ကဆီကို စံတော်ချိန်", "NZDT": "နယူးဇီလန် နွေရာသီ အချိန်", "CHADT": "ချာသမ် နွေရာသီ အချိန်", "HNPM": "စိန့်ပီအဲနှင့်မီခွီလွန်စံတော်ချိန်", "MEZ": "ဥရောပ အလယ်ပိုင်း စံတော်ချိန်", "WAST": "အနောက်အာဖရိက နွေရာသီ အချိန်", "EDT": "မြောက်အမေရိက အရှေ့ပိုင်း နွေရာသီစံတော်ချိန်", "WESZ": "အနောက်ဥရောပ နွေရာသီ အချိန်", "AWST": "အနောက်ဩစတြေးလျား စံတော်ချိန်", "HKST": "ဟောင်ကောင် နွေရာသီ အချိန်", "ACST": "ဩစတြေးလျား အလယ်ပိုင်း စံတော်ချိန်", "PST": "မြောက်အမေရိက ပစိဖိတ်စံတော်ချိန်"},
72         }
73 }
74
75 // Locale returns the current translators string locale
76 func (my *my) Locale() string {
77         return my.locale
78 }
79
80 // PluralsCardinal returns the list of cardinal plural rules associated with 'my'
81 func (my *my) PluralsCardinal() []locales.PluralRule {
82         return my.pluralsCardinal
83 }
84
85 // PluralsOrdinal returns the list of ordinal plural rules associated with 'my'
86 func (my *my) PluralsOrdinal() []locales.PluralRule {
87         return my.pluralsOrdinal
88 }
89
90 // PluralsRange returns the list of range plural rules associated with 'my'
91 func (my *my) PluralsRange() []locales.PluralRule {
92         return my.pluralsRange
93 }
94
95 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'my'
96 func (my *my) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
97         return locales.PluralRuleOther
98 }
99
100 // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'my'
101 func (my *my) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
102         return locales.PluralRuleOther
103 }
104
105 // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'my'
106 func (my *my) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
107         return locales.PluralRuleOther
108 }
109
110 // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
111 func (my *my) MonthAbbreviated(month time.Month) string {
112         return my.monthsAbbreviated[month]
113 }
114
115 // MonthsAbbreviated returns the locales abbreviated months
116 func (my *my) MonthsAbbreviated() []string {
117         return my.monthsAbbreviated[1:]
118 }
119
120 // MonthNarrow returns the locales narrow month given the 'month' provided
121 func (my *my) MonthNarrow(month time.Month) string {
122         return my.monthsNarrow[month]
123 }
124
125 // MonthsNarrow returns the locales narrow months
126 func (my *my) MonthsNarrow() []string {
127         return my.monthsNarrow[1:]
128 }
129
130 // MonthWide returns the locales wide month given the 'month' provided
131 func (my *my) MonthWide(month time.Month) string {
132         return my.monthsWide[month]
133 }
134
135 // MonthsWide returns the locales wide months
136 func (my *my) MonthsWide() []string {
137         return my.monthsWide[1:]
138 }
139
140 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
141 func (my *my) WeekdayAbbreviated(weekday time.Weekday) string {
142         return my.daysAbbreviated[weekday]
143 }
144
145 // WeekdaysAbbreviated returns the locales abbreviated weekdays
146 func (my *my) WeekdaysAbbreviated() []string {
147         return my.daysAbbreviated
148 }
149
150 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
151 func (my *my) WeekdayNarrow(weekday time.Weekday) string {
152         return my.daysNarrow[weekday]
153 }
154
155 // WeekdaysNarrow returns the locales narrow weekdays
156 func (my *my) WeekdaysNarrow() []string {
157         return my.daysNarrow
158 }
159
160 // WeekdayShort returns the locales short weekday given the 'weekday' provided
161 func (my *my) WeekdayShort(weekday time.Weekday) string {
162         return my.daysShort[weekday]
163 }
164
165 // WeekdaysShort returns the locales short weekdays
166 func (my *my) WeekdaysShort() []string {
167         return my.daysShort
168 }
169
170 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
171 func (my *my) WeekdayWide(weekday time.Weekday) string {
172         return my.daysWide[weekday]
173 }
174
175 // WeekdaysWide returns the locales wide weekdays
176 func (my *my) WeekdaysWide() []string {
177         return my.daysWide
178 }
179
180 // Decimal returns the decimal point of number
181 func (my *my) Decimal() string {
182         return my.decimal
183 }
184
185 // Group returns the group of number
186 func (my *my) Group() string {
187         return my.group
188 }
189
190 // Group returns the minus sign of number
191 func (my *my) Minus() string {
192         return my.minus
193 }
194
195 // FmtNumber returns 'num' with digits/precision of 'v' for 'my' and handles both Whole and Real numbers based on 'v'
196 func (my *my) FmtNumber(num float64, v uint64) string {
197
198         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
199         l := len(s) + 0
200         count := 0
201         inWhole := v == 0
202         b := make([]byte, 0, l)
203
204         for i := len(s) - 1; i >= 0; i-- {
205
206                 if s[i] == '.' {
207                         b = append(b, my.decimal[0])
208                         inWhole = true
209                         continue
210                 }
211
212                 if inWhole {
213                         if count == 3 {
214                                 b = append(b, my.group[0])
215                                 count = 1
216                         } else {
217                                 count++
218                         }
219                 }
220
221                 b = append(b, s[i])
222         }
223
224         if num < 0 {
225                 b = append(b, my.minus[0])
226         }
227
228         // reverse
229         for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
230                 b[i], b[j] = b[j], b[i]
231         }
232
233         return string(b)
234 }
235
236 // FmtPercent returns 'num' with digits/precision of 'v' for 'my' and handles both Whole and Real numbers based on 'v'
237 // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
238 func (my *my) FmtPercent(num float64, v uint64) string {
239         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
240         l := len(s) + 1
241         b := make([]byte, 0, l)
242
243         for i := len(s) - 1; i >= 0; i-- {
244
245                 if s[i] == '.' {
246                         b = append(b, my.decimal[0])
247                         continue
248                 }
249
250                 b = append(b, s[i])
251         }
252
253         if num < 0 {
254                 b = append(b, my.minus[0])
255         }
256
257         // reverse
258         for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
259                 b[i], b[j] = b[j], b[i]
260         }
261
262         b = append(b, my.percent...)
263
264         return string(b)
265 }
266
267 // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'my'
268 func (my *my) FmtCurrency(num float64, v uint64, currency currency.Type) string {
269
270         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
271         symbol := my.currencies[currency]
272         l := len(s) + len(symbol) + 2
273         count := 0
274         inWhole := v == 0
275         b := make([]byte, 0, l)
276
277         for i := len(s) - 1; i >= 0; i-- {
278
279                 if s[i] == '.' {
280                         b = append(b, my.decimal[0])
281                         inWhole = true
282                         continue
283                 }
284
285                 if inWhole {
286                         if count == 3 {
287                                 b = append(b, my.group[0])
288                                 count = 1
289                         } else {
290                                 count++
291                         }
292                 }
293
294                 b = append(b, s[i])
295         }
296
297         for j := len(symbol) - 1; j >= 0; j-- {
298                 b = append(b, symbol[j])
299         }
300
301         for j := len(my.currencyPositivePrefix) - 1; j >= 0; j-- {
302                 b = append(b, my.currencyPositivePrefix[j])
303         }
304
305         if num < 0 {
306                 b = append(b, my.minus[0])
307         }
308
309         // reverse
310         for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
311                 b[i], b[j] = b[j], b[i]
312         }
313
314         if int(v) < 2 {
315
316                 if v == 0 {
317                         b = append(b, my.decimal...)
318                 }
319
320                 for i := 0; i < 2-int(v); i++ {
321                         b = append(b, '0')
322                 }
323         }
324
325         return string(b)
326 }
327
328 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'my'
329 // in accounting notation.
330 func (my *my) FmtAccounting(num float64, v uint64, currency currency.Type) string {
331
332         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
333         symbol := my.currencies[currency]
334         l := len(s) + len(symbol) + 2
335         count := 0
336         inWhole := v == 0
337         b := make([]byte, 0, l)
338
339         for i := len(s) - 1; i >= 0; i-- {
340
341                 if s[i] == '.' {
342                         b = append(b, my.decimal[0])
343                         inWhole = true
344                         continue
345                 }
346
347                 if inWhole {
348                         if count == 3 {
349                                 b = append(b, my.group[0])
350                                 count = 1
351                         } else {
352                                 count++
353                         }
354                 }
355
356                 b = append(b, s[i])
357         }
358
359         if num < 0 {
360
361                 for j := len(symbol) - 1; j >= 0; j-- {
362                         b = append(b, symbol[j])
363                 }
364
365                 for j := len(my.currencyNegativePrefix) - 1; j >= 0; j-- {
366                         b = append(b, my.currencyNegativePrefix[j])
367                 }
368
369                 b = append(b, my.minus[0])
370
371         } else {
372
373                 for j := len(symbol) - 1; j >= 0; j-- {
374                         b = append(b, symbol[j])
375                 }
376
377                 for j := len(my.currencyPositivePrefix) - 1; j >= 0; j-- {
378                         b = append(b, my.currencyPositivePrefix[j])
379                 }
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, my.decimal...)
392                 }
393
394                 for i := 0; i < 2-int(v); i++ {
395                         b = append(b, '0')
396                 }
397         }
398
399         return string(b)
400 }
401
402 // FmtDateShort returns the short date representation of 't' for 'my'
403 func (my *my) FmtDateShort(t time.Time) string {
404
405         b := make([]byte, 0, 32)
406
407         if t.Day() < 10 {
408                 b = append(b, '0')
409         }
410
411         b = strconv.AppendInt(b, int64(t.Day()), 10)
412         b = append(b, []byte{0x2d}...)
413
414         if t.Month() < 10 {
415                 b = append(b, '0')
416         }
417
418         b = strconv.AppendInt(b, int64(t.Month()), 10)
419
420         b = append(b, []byte{0x2d}...)
421
422         if t.Year() > 9 {
423                 b = append(b, strconv.Itoa(t.Year())[2:]...)
424         } else {
425                 b = append(b, strconv.Itoa(t.Year())[1:]...)
426         }
427
428         return string(b)
429 }
430
431 // FmtDateMedium returns the medium date representation of 't' for 'my'
432 func (my *my) FmtDateMedium(t time.Time) string {
433
434         b := make([]byte, 0, 32)
435
436         b = strconv.AppendInt(b, int64(t.Day()), 10)
437         b = append(b, []byte{0x20}...)
438         b = append(b, my.monthsAbbreviated[t.Month()]...)
439         b = append(b, []byte{0x20}...)
440
441         if t.Year() > 0 {
442                 b = strconv.AppendInt(b, int64(t.Year()), 10)
443         } else {
444                 b = strconv.AppendInt(b, int64(-t.Year()), 10)
445         }
446
447         return string(b)
448 }
449
450 // FmtDateLong returns the long date representation of 't' for 'my'
451 func (my *my) FmtDateLong(t time.Time) string {
452
453         b := make([]byte, 0, 32)
454
455         b = strconv.AppendInt(b, int64(t.Day()), 10)
456         b = append(b, []byte{0x20}...)
457         b = append(b, my.monthsWide[t.Month()]...)
458         b = append(b, []byte{0x20}...)
459
460         if t.Year() > 0 {
461                 b = strconv.AppendInt(b, int64(t.Year()), 10)
462         } else {
463                 b = strconv.AppendInt(b, int64(-t.Year()), 10)
464         }
465
466         return string(b)
467 }
468
469 // FmtDateFull returns the full date representation of 't' for 'my'
470 func (my *my) FmtDateFull(t time.Time) string {
471
472         b := make([]byte, 0, 32)
473
474         b = append(b, my.daysWide[t.Weekday()]...)
475         b = append(b, []byte{0x20}...)
476         b = strconv.AppendInt(b, int64(t.Day()), 10)
477         b = append(b, []byte{0x20}...)
478         b = append(b, my.monthsWide[t.Month()]...)
479         b = append(b, []byte{0x20}...)
480
481         if t.Year() > 0 {
482                 b = strconv.AppendInt(b, int64(t.Year()), 10)
483         } else {
484                 b = strconv.AppendInt(b, int64(-t.Year()), 10)
485         }
486
487         return string(b)
488 }
489
490 // FmtTimeShort returns the short time representation of 't' for 'my'
491 func (my *my) FmtTimeShort(t time.Time) string {
492
493         b := make([]byte, 0, 32)
494
495         if t.Hour() < 10 {
496                 b = append(b, '0')
497         }
498
499         b = strconv.AppendInt(b, int64(t.Hour()), 10)
500         b = append(b, my.timeSeparator...)
501
502         if t.Minute() < 10 {
503                 b = append(b, '0')
504         }
505
506         b = strconv.AppendInt(b, int64(t.Minute()), 10)
507
508         return string(b)
509 }
510
511 // FmtTimeMedium returns the medium time representation of 't' for 'my'
512 func (my *my) FmtTimeMedium(t time.Time) string {
513
514         b := make([]byte, 0, 32)
515
516         if t.Hour() < 10 {
517                 b = append(b, '0')
518         }
519
520         b = strconv.AppendInt(b, int64(t.Hour()), 10)
521         b = append(b, my.timeSeparator...)
522
523         if t.Minute() < 10 {
524                 b = append(b, '0')
525         }
526
527         b = strconv.AppendInt(b, int64(t.Minute()), 10)
528         b = append(b, my.timeSeparator...)
529
530         if t.Second() < 10 {
531                 b = append(b, '0')
532         }
533
534         b = strconv.AppendInt(b, int64(t.Second()), 10)
535
536         return string(b)
537 }
538
539 // FmtTimeLong returns the long time representation of 't' for 'my'
540 func (my *my) FmtTimeLong(t time.Time) string {
541
542         b := make([]byte, 0, 32)
543
544         tz, _ := t.Zone()
545         b = append(b, tz...)
546
547         b = append(b, []byte{0x20}...)
548
549         if t.Hour() < 10 {
550                 b = append(b, '0')
551         }
552
553         b = strconv.AppendInt(b, int64(t.Hour()), 10)
554         b = append(b, my.timeSeparator...)
555
556         if t.Minute() < 10 {
557                 b = append(b, '0')
558         }
559
560         b = strconv.AppendInt(b, int64(t.Minute()), 10)
561         b = append(b, my.timeSeparator...)
562
563         if t.Second() < 10 {
564                 b = append(b, '0')
565         }
566
567         b = strconv.AppendInt(b, int64(t.Second()), 10)
568
569         return string(b)
570 }
571
572 // FmtTimeFull returns the full time representation of 't' for 'my'
573 func (my *my) FmtTimeFull(t time.Time) string {
574
575         b := make([]byte, 0, 32)
576
577         tz, _ := t.Zone()
578
579         if btz, ok := my.timezones[tz]; ok {
580                 b = append(b, btz...)
581         } else {
582                 b = append(b, tz...)
583         }
584
585         b = append(b, []byte{0x20}...)
586
587         if t.Hour() < 10 {
588                 b = append(b, '0')
589         }
590
591         b = strconv.AppendInt(b, int64(t.Hour()), 10)
592         b = append(b, my.timeSeparator...)
593
594         if t.Minute() < 10 {
595                 b = append(b, '0')
596         }
597
598         b = strconv.AppendInt(b, int64(t.Minute()), 10)
599         b = append(b, my.timeSeparator...)
600
601         if t.Second() < 10 {
602                 b = append(b, '0')
603         }
604
605         b = strconv.AppendInt(b, int64(t.Second()), 10)
606
607         return string(b)
608 }