1 package ha_GH
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 ha_GH 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
25 currencyPositivePrefix string
26 currencyPositiveSuffix string
27 currencyNegativePrefix string
28 currencyNegativeSuffix string
29 monthsAbbreviated []string
30 monthsNarrow []string
31 monthsWide []string
32 daysAbbreviated []string
33 daysNarrow []string
34 daysShort []string
35 daysWide []string
36 periodsAbbreviated []string
37 periodsNarrow []string
38 periodsShort []string
39 periodsWide []string
40 erasAbbreviated []string
41 erasNarrow []string
42 erasWide []string
43 timezones map[string]string
44 }
45
46
47 func New() locales.Translator {
48 return &ha_GH{
49 locale: "ha_GH",
50 pluralsCardinal: []locales.PluralRule{2, 6},
51 pluralsOrdinal: nil,
52 pluralsRange: nil,
53 timeSeparator: ":",
54 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", "GH₵", "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"},
55 currencyPositivePrefix: " ",
56 currencyPositiveSuffix: "D",
57 currencyNegativePrefix: " ",
58 currencyNegativeSuffix: "D",
59 monthsAbbreviated: []string{"", "Jan", "Fab", "Mar", "Afi", "May", "Yun", "Yul", "Agu", "Sat", "Okt", "Nuw", "Dis"},
60 monthsNarrow: []string{"", "J", "F", "M", "A", "M", "Y", "Y", "A", "S", "O", "N", "D"},
61 monthsWide: []string{"", "Janairu", "Faburairu", "Maris", "Afirilu", "Mayu", "Yuni", "Yuli", "Agusta", "Satumba", "Oktoba", "Nuwamba", "Disamba"},
62 daysAbbreviated: []string{"Lah", "Lit", "Tal", "Lar", "Alh", "Jum", "Asa"},
63 daysNarrow: []string{"L", "L", "T", "L", "A", "J", "A"},
64 daysShort: []string{"Lh", "Li", "Ta", "Lr", "Al", "Ju", "As"},
65 daysWide: []string{"Lahadi", "Litinin", "Talata", "Laraba", "Alhamis", "Jummaʼa", "Asabar"},
66 periodsAbbreviated: []string{"AM", "PM"},
67 periodsNarrow: []string{"AM", "PM"},
68 periodsWide: []string{"Safiya", "Yamma"},
69 erasAbbreviated: []string{"K.H", "BHAI"},
70 erasNarrow: []string{"", ""},
71 erasWide: []string{"", ""},
72 timezones: map[string]string{"ACDT": "Australian Central Daylight Time", "ACST": "Australian Central Standard Time", "ACWDT": "Australian Central Western Daylight Time", "ACWST": "Australian Central Western Standard Time", "ADT": "Lokacin Rana na Kanada, Puerto Rico da Virgin Islands", "AEDT": "Australian Eastern Daylight Time", "AEST": "Australian Eastern Standard Time", "AKDT": "Lokacin Rana na Alaska", "AKST": "Tsayayyen Lokacin Alaska", "ARST": "ARST", "ART": "ART", "AST": "Lokaci Tsayayye na Kanada, Puerto Rico da Virgin Islands", "AWDT": "Australian Western Daylight Time", "AWST": "Australian Western Standard Time", "BOT": "BOT", "BT": "Bhutan Time", "CAT": "Central Africa Time", "CDT": "Lokacin Rana dake Arewacin Amurika ta Tsakiya", "CHADT": "Chatham Daylight Time", "CHAST": "Chatham Standard Time", "CLST": "CLST", "CLT": "CLT", "COST": "COST", "COT": "COT", "CST": "Tsayayyen Lokaci dake Arewacin Amurika ta Tsakiya", "ChST": "Chamorro Standard Time", "EAT": "East Africa Time", "ECT": "ECT", "EDT": "Lokacin Rana ta Gabas dake Arewacin Amurika", "EST": "Tsayayyen Lokacin Gabas dake Arewacin Amurika", "GFT": "GFT", "GMT": "Lokacin Greenwhich a London", "GST": "Gulf Standard Time [translation hint: translate as just \"Gulf Time\"]", "GYT": "GYT", "HADT": "Lokaci rana ta Hawaii-Aleutian", "HAST": "Ida Lokaci ta Hawaii-Aleutian", "HAT": "Lokaci rana ta Newfoundland", "HECU": "Lokaci rana ta Kuba", "HEEG": "Lokaci rana a gabas ta Greeland", "HENOMX": "Lokacin rana na arewa maso gabashin Mesiko", "HEOG": "Lokacin rana a yammacin Greeland", "HEPM": "Lokaci rana ta St. Pierre da Miquelon", "HEPMX": "Lokaci na rana na Mesiko Pacific", "HKST": "Hong Kong Summer Time", "HKT": "Hong Kong Standard Time", "HNCU": "Lokaci Tsayayye na Kuba", "HNEG": "Lokaci Tsayayye a gabashin ta Greenland", "HNNOMX": "Lokaci Tsayayye na arewa maso gabashin Mesiko", "HNOG": "Lokaci Tsayayye a yammacin Greeland", "HNPM": "Lokaci tsayayye St. Pierre da Miquelon", "HNPMX": "Lokaci Tsayayye na Mesiko Pacific", "HNT": "Lokaci Tsayayye ta Newfoundland", "IST": "India Standard Time", "JDT": "Japan Daylight Time", "JST": "Japan Standard Time", "LHDT": "Lord Howe Daylight Time", "LHST": "Lord Howe Standard Time", "MDT": "Lokaci rana tsauni a arewacin da Amirka", "MESZ": "Tsakiyar bazara a lokaci turai", "MEZ": "Ida Tsakiyar a Lokaci Turai", "MST": "Lokaci tsayayye na tsauni a Arewacin Amurica", "MYT": "Malaysia Time", "NZDT": "New Zealand Daylight Time", "NZST": "New Zealand Standard Time", "OESZ": "Gabas a lokaci turai da bazara", "OEZ": "Ida lokaci a turai gabas", "PDT": "Lokaci da rana a Arewacin Amurika", "PST": "Lokaci Tsayayye na Arewacin Amurika", "SAST": "South Africa Standard Time", "SGT": "Singapore Standard Time", "SRT": "SRT", "TMST": "Turkmenistan Summer Time", "TMT": "Turkmenistan Standard Time", "UYST": "UYST", "UYT": "UYT", "VET": "VET", "WARST": "WARST", "WART": "WART", "WAST": "West Africa Summer Time", "WAT": "West Africa Standard Time", "WESZ": "Ida lokaci ta yammacin turai da bazara", "WEZ": "Ida lokaci ta yammacin turai", "WIB": "Western Indonesia Time", "WIT": "Eastern Indonesia Time", "WITA": "Central Indonesia Time", "∅∅∅": "∅∅∅"},
73 }
74 }
75
76
77 func (ha *ha_GH) Locale() string {
78 return ha.locale
79 }
80
81
82 func (ha *ha_GH) PluralsCardinal() []locales.PluralRule {
83 return ha.pluralsCardinal
84 }
85
86
87 func (ha *ha_GH) PluralsOrdinal() []locales.PluralRule {
88 return ha.pluralsOrdinal
89 }
90
91
92 func (ha *ha_GH) PluralsRange() []locales.PluralRule {
93 return ha.pluralsRange
94 }
95
96
97 func (ha *ha_GH) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
98
99 n := math.Abs(num)
100
101 if n == 1 {
102 return locales.PluralRuleOne
103 }
104
105 return locales.PluralRuleOther
106 }
107
108
109 func (ha *ha_GH) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
110 return locales.PluralRuleUnknown
111 }
112
113
114 func (ha *ha_GH) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
115 return locales.PluralRuleUnknown
116 }
117
118
119 func (ha *ha_GH) MonthAbbreviated(month time.Month) string {
120 return ha.monthsAbbreviated[month]
121 }
122
123
124 func (ha *ha_GH) MonthsAbbreviated() []string {
125 return ha.monthsAbbreviated[1:]
126 }
127
128
129 func (ha *ha_GH) MonthNarrow(month time.Month) string {
130 return ha.monthsNarrow[month]
131 }
132
133
134 func (ha *ha_GH) MonthsNarrow() []string {
135 return ha.monthsNarrow[1:]
136 }
137
138
139 func (ha *ha_GH) MonthWide(month time.Month) string {
140 return ha.monthsWide[month]
141 }
142
143
144 func (ha *ha_GH) MonthsWide() []string {
145 return ha.monthsWide[1:]
146 }
147
148
149 func (ha *ha_GH) WeekdayAbbreviated(weekday time.Weekday) string {
150 return ha.daysAbbreviated[weekday]
151 }
152
153
154 func (ha *ha_GH) WeekdaysAbbreviated() []string {
155 return ha.daysAbbreviated
156 }
157
158
159 func (ha *ha_GH) WeekdayNarrow(weekday time.Weekday) string {
160 return ha.daysNarrow[weekday]
161 }
162
163
164 func (ha *ha_GH) WeekdaysNarrow() []string {
165 return ha.daysNarrow
166 }
167
168
169 func (ha *ha_GH) WeekdayShort(weekday time.Weekday) string {
170 return ha.daysShort[weekday]
171 }
172
173
174 func (ha *ha_GH) WeekdaysShort() []string {
175 return ha.daysShort
176 }
177
178
179 func (ha *ha_GH) WeekdayWide(weekday time.Weekday) string {
180 return ha.daysWide[weekday]
181 }
182
183
184 func (ha *ha_GH) WeekdaysWide() []string {
185 return ha.daysWide
186 }
187
188
189 func (ha *ha_GH) Decimal() string {
190 return ha.decimal
191 }
192
193
194 func (ha *ha_GH) Group() string {
195 return ha.group
196 }
197
198
199 func (ha *ha_GH) Minus() string {
200 return ha.minus
201 }
202
203
204 func (ha *ha_GH) FmtNumber(num float64, v uint64) string {
205
206 return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
207 }
208
209
210
211 func (ha *ha_GH) FmtPercent(num float64, v uint64) string {
212 return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
213 }
214
215
216 func (ha *ha_GH) FmtCurrency(num float64, v uint64, currency currency.Type) string {
217
218 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
219 symbol := ha.currencies[currency]
220 l := len(s) + len(symbol) + 3
221
222 b := make([]byte, 0, l)
223
224 for i := len(s) - 1; i >= 0; i-- {
225
226 if s[i] == '.' {
227 b = append(b, ha.decimal[0])
228 continue
229 }
230
231 b = append(b, s[i])
232 }
233
234 for j := len(symbol) - 1; j >= 0; j-- {
235 b = append(b, symbol[j])
236 }
237
238 for j := len(ha.currencyPositivePrefix) - 1; j >= 0; j-- {
239 b = append(b, ha.currencyPositivePrefix[j])
240 }
241
242 if num < 0 {
243 b = append(b, ha.minus[0])
244 }
245
246
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 b = append(b, ha.currencyPositiveSuffix...)
252
253 return string(b)
254 }
255
256
257
258 func (ha *ha_GH) FmtAccounting(num float64, v uint64, currency currency.Type) string {
259
260 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
261 symbol := ha.currencies[currency]
262 l := len(s) + len(symbol) + 3
263
264 b := make([]byte, 0, l)
265
266 for i := len(s) - 1; i >= 0; i-- {
267
268 if s[i] == '.' {
269 b = append(b, ha.decimal[0])
270 continue
271 }
272
273 b = append(b, s[i])
274 }
275
276 if num < 0 {
277
278 for j := len(symbol) - 1; j >= 0; j-- {
279 b = append(b, symbol[j])
280 }
281
282 for j := len(ha.currencyNegativePrefix) - 1; j >= 0; j-- {
283 b = append(b, ha.currencyNegativePrefix[j])
284 }
285
286 b = append(b, ha.minus[0])
287
288 } else {
289
290 for j := len(symbol) - 1; j >= 0; j-- {
291 b = append(b, symbol[j])
292 }
293
294 for j := len(ha.currencyPositivePrefix) - 1; j >= 0; j-- {
295 b = append(b, ha.currencyPositivePrefix[j])
296 }
297
298 }
299
300
301 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
302 b[i], b[j] = b[j], b[i]
303 }
304
305 if num < 0 {
306 b = append(b, ha.currencyNegativeSuffix...)
307 } else {
308
309 b = append(b, ha.currencyPositiveSuffix...)
310 }
311
312 return string(b)
313 }
314
315
316 func (ha *ha_GH) FmtDateShort(t time.Time) string {
317
318 b := make([]byte, 0, 32)
319
320 b = strconv.AppendInt(b, int64(t.Day()), 10)
321 b = append(b, []byte{0x2f}...)
322 b = strconv.AppendInt(b, int64(t.Month()), 10)
323 b = append(b, []byte{0x2f}...)
324
325 if t.Year() > 9 {
326 b = append(b, strconv.Itoa(t.Year())[2:]...)
327 } else {
328 b = append(b, strconv.Itoa(t.Year())[1:]...)
329 }
330
331 return string(b)
332 }
333
334
335 func (ha *ha_GH) FmtDateMedium(t time.Time) string {
336
337 b := make([]byte, 0, 32)
338
339 b = strconv.AppendInt(b, int64(t.Day()), 10)
340 b = append(b, []byte{0x20}...)
341 b = append(b, ha.monthsAbbreviated[t.Month()]...)
342 b = append(b, []byte{0x2c, 0x20}...)
343
344 if t.Year() > 0 {
345 b = strconv.AppendInt(b, int64(t.Year()), 10)
346 } else {
347 b = strconv.AppendInt(b, int64(-t.Year()), 10)
348 }
349
350 return string(b)
351 }
352
353
354 func (ha *ha_GH) FmtDateLong(t time.Time) string {
355
356 b := make([]byte, 0, 32)
357
358 b = strconv.AppendInt(b, int64(t.Day()), 10)
359 b = append(b, []byte{0x20}...)
360 b = append(b, ha.monthsWide[t.Month()]...)
361 b = append(b, []byte{0x2c, 0x20}...)
362
363 if t.Year() > 0 {
364 b = strconv.AppendInt(b, int64(t.Year()), 10)
365 } else {
366 b = strconv.AppendInt(b, int64(-t.Year()), 10)
367 }
368
369 return string(b)
370 }
371
372
373 func (ha *ha_GH) FmtDateFull(t time.Time) string {
374
375 b := make([]byte, 0, 32)
376
377 b = append(b, ha.daysWide[t.Weekday()]...)
378 b = append(b, []byte{0x20}...)
379 b = strconv.AppendInt(b, int64(t.Day()), 10)
380 b = append(b, []byte{0x20}...)
381 b = append(b, ha.monthsWide[t.Month()]...)
382 b = append(b, []byte{0x2c, 0x20}...)
383
384 if t.Year() > 0 {
385 b = strconv.AppendInt(b, int64(t.Year()), 10)
386 } else {
387 b = strconv.AppendInt(b, int64(-t.Year()), 10)
388 }
389
390 return string(b)
391 }
392
393
394 func (ha *ha_GH) FmtTimeShort(t time.Time) string {
395
396 b := make([]byte, 0, 32)
397
398 h := t.Hour()
399
400 if h > 12 {
401 h -= 12
402 }
403
404 b = strconv.AppendInt(b, int64(h), 10)
405 b = append(b, ha.timeSeparator...)
406
407 if t.Minute() < 10 {
408 b = append(b, '0')
409 }
410
411 b = strconv.AppendInt(b, int64(t.Minute()), 10)
412 b = append(b, []byte{0x20}...)
413
414 if t.Hour() < 12 {
415 b = append(b, ha.periodsAbbreviated[0]...)
416 } else {
417 b = append(b, ha.periodsAbbreviated[1]...)
418 }
419
420 return string(b)
421 }
422
423
424 func (ha *ha_GH) FmtTimeMedium(t time.Time) string {
425
426 b := make([]byte, 0, 32)
427
428 h := t.Hour()
429
430 if h > 12 {
431 h -= 12
432 }
433
434 b = strconv.AppendInt(b, int64(h), 10)
435 b = append(b, ha.timeSeparator...)
436
437 if t.Minute() < 10 {
438 b = append(b, '0')
439 }
440
441 b = strconv.AppendInt(b, int64(t.Minute()), 10)
442 b = append(b, ha.timeSeparator...)
443
444 if t.Second() < 10 {
445 b = append(b, '0')
446 }
447
448 b = strconv.AppendInt(b, int64(t.Second()), 10)
449 b = append(b, []byte{0x20}...)
450
451 if t.Hour() < 12 {
452 b = append(b, ha.periodsAbbreviated[0]...)
453 } else {
454 b = append(b, ha.periodsAbbreviated[1]...)
455 }
456
457 return string(b)
458 }
459
460
461 func (ha *ha_GH) FmtTimeLong(t time.Time) string {
462
463 b := make([]byte, 0, 32)
464
465 h := t.Hour()
466
467 if h > 12 {
468 h -= 12
469 }
470
471 b = strconv.AppendInt(b, int64(h), 10)
472 b = append(b, ha.timeSeparator...)
473
474 if t.Minute() < 10 {
475 b = append(b, '0')
476 }
477
478 b = strconv.AppendInt(b, int64(t.Minute()), 10)
479 b = append(b, ha.timeSeparator...)
480
481 if t.Second() < 10 {
482 b = append(b, '0')
483 }
484
485 b = strconv.AppendInt(b, int64(t.Second()), 10)
486 b = append(b, []byte{0x20}...)
487
488 if t.Hour() < 12 {
489 b = append(b, ha.periodsAbbreviated[0]...)
490 } else {
491 b = append(b, ha.periodsAbbreviated[1]...)
492 }
493
494 b = append(b, []byte{0x20}...)
495
496 tz, _ := t.Zone()
497 b = append(b, tz...)
498
499 return string(b)
500 }
501
502
503 func (ha *ha_GH) FmtTimeFull(t time.Time) string {
504
505 b := make([]byte, 0, 32)
506
507 h := t.Hour()
508
509 if h > 12 {
510 h -= 12
511 }
512
513 b = strconv.AppendInt(b, int64(h), 10)
514 b = append(b, ha.timeSeparator...)
515
516 if t.Minute() < 10 {
517 b = append(b, '0')
518 }
519
520 b = strconv.AppendInt(b, int64(t.Minute()), 10)
521 b = append(b, ha.timeSeparator...)
522
523 if t.Second() < 10 {
524 b = append(b, '0')
525 }
526
527 b = strconv.AppendInt(b, int64(t.Second()), 10)
528 b = append(b, []byte{0x20}...)
529
530 if t.Hour() < 12 {
531 b = append(b, ha.periodsAbbreviated[0]...)
532 } else {
533 b = append(b, ha.periodsAbbreviated[1]...)
534 }
535
536 b = append(b, []byte{0x20}...)
537
538 tz, _ := t.Zone()
539
540 if btz, ok := ha.timezones[tz]; ok {
541 b = append(b, btz...)
542 } else {
543 b = append(b, tz...)
544 }
545
546 return string(b)
547 }
548
View as plain text