cs.go 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651
  1. package cs
  2. import (
  3. "math"
  4. "strconv"
  5. "time"
  6. "github.com/go-playground/locales"
  7. "github.com/go-playground/locales/currency"
  8. )
  9. type cs struct {
  10. locale string
  11. pluralsCardinal []locales.PluralRule
  12. pluralsOrdinal []locales.PluralRule
  13. pluralsRange []locales.PluralRule
  14. decimal []byte
  15. group []byte
  16. minus []byte
  17. percent []byte
  18. percentSuffix []byte
  19. perMille []byte
  20. timeSeparator []byte
  21. inifinity []byte
  22. currencies [][]byte // idx = enum of currency code
  23. currencyPositiveSuffix []byte
  24. currencyNegativeSuffix []byte
  25. monthsAbbreviated [][]byte
  26. monthsNarrow [][]byte
  27. monthsWide [][]byte
  28. daysAbbreviated [][]byte
  29. daysNarrow [][]byte
  30. daysShort [][]byte
  31. daysWide [][]byte
  32. periodsAbbreviated [][]byte
  33. periodsNarrow [][]byte
  34. periodsShort [][]byte
  35. periodsWide [][]byte
  36. erasAbbreviated [][]byte
  37. erasNarrow [][]byte
  38. erasWide [][]byte
  39. timezones map[string][]byte
  40. }
  41. // New returns a new instance of translator for the 'cs' locale
  42. func New() locales.Translator {
  43. return &cs{
  44. locale: "cs",
  45. pluralsCardinal: []locales.PluralRule{2, 4, 5, 6},
  46. pluralsOrdinal: []locales.PluralRule{6},
  47. pluralsRange: []locales.PluralRule{4, 5, 6, 2},
  48. decimal: []byte{},
  49. group: []byte{},
  50. minus: []byte{},
  51. percent: []byte{},
  52. perMille: []byte{},
  53. timeSeparator: []byte{0x3a},
  54. currencies: [][]uint8{{0x41, 0x44, 0x50}, {0x41, 0x45, 0x44}, {0x41, 0x46, 0x41}, {0x41, 0x46, 0x4e}, {0x41, 0x4c, 0x4b}, {0x41, 0x4c, 0x4c}, {0x41, 0x4d, 0x44}, {0x41, 0x4e, 0x47}, {0x41, 0x4f, 0x41}, {0x41, 0x4f, 0x4b}, {0x41, 0x4f, 0x4e}, {0x41, 0x4f, 0x52}, {0x41, 0x52, 0x41}, {0x41, 0x52, 0x4c}, {0x41, 0x52, 0x4d}, {0x41, 0x52, 0x50}, {0x41, 0x52, 0x53}, {0x41, 0x54, 0x53}, {0x41, 0x55, 0x24}, {0x41, 0x57, 0x47}, {0x41, 0x5a, 0x4d}, {0x41, 0x5a, 0x4e}, {0x42, 0x41, 0x44}, {0x42, 0x41, 0x4d}, {0x42, 0x41, 0x4e}, {0x42, 0x42, 0x44}, {0x42, 0x44, 0x54}, {0x42, 0x45, 0x43}, {0x42, 0x45, 0x46}, {0x42, 0x45, 0x4c}, {0x42, 0x47, 0x4c}, {0x42, 0x47, 0x4d}, {0x42, 0x47, 0x4e}, {0x42, 0x47, 0x4f}, {0x42, 0x48, 0x44}, {0x42, 0x49, 0x46}, {0x42, 0x4d, 0x44}, {0x42, 0x4e, 0x44}, {0x42, 0x4f, 0x42}, {0x42, 0x4f, 0x4c}, {0x42, 0x4f, 0x50}, {0x42, 0x4f, 0x56}, {0x42, 0x52, 0x42}, {0x42, 0x52, 0x43}, {0x42, 0x52, 0x45}, {0x52, 0x24}, {0x42, 0x52, 0x4e}, {0x42, 0x52, 0x52}, {0x42, 0x52, 0x5a}, {0x42, 0x53, 0x44}, {0x42, 0x54, 0x4e}, {0x42, 0x55, 0x4b}, {0x42, 0x57, 0x50}, {0x42, 0x59, 0x42}, {0x42, 0x59, 0x52}, {0x42, 0x5a, 0x44}, {0x43, 0x41, 0x24}, {0x43, 0x44, 0x46}, {0x43, 0x48, 0x45}, {0x43, 0x48, 0x46}, {0x43, 0x48, 0x57}, {0x43, 0x4c, 0x45}, {0x43, 0x4c, 0x46}, {0x43, 0x4c, 0x50}, {0x43, 0x4e, 0x58, 0x20}, {0x43, 0x4e, 0xc2, 0xa5}, {0x43, 0x4f, 0x50}, {0x43, 0x4f, 0x55}, {0x43, 0x52, 0x43}, {0x43, 0x53, 0x44}, {0x4b, 0xc4, 0x8d, 0x73}, {0x43, 0x55, 0x43}, {0x43, 0x55, 0x50}, {0x43, 0x56, 0x45}, {0x43, 0x59, 0x50}, {0x4b, 0xc4, 0x8d}, {0x44, 0x44, 0x4d}, {0x44, 0x45, 0x4d}, {0x44, 0x4a, 0x46}, {0x44, 0x4b, 0x4b}, {0x44, 0x4f, 0x50}, {0x44, 0x5a, 0x44}, {0x45, 0x43, 0x53}, {0x45, 0x43, 0x56}, {0x45, 0x45, 0x4b}, {0x45, 0x47, 0x50}, {0x45, 0x52, 0x4e}, {0x45, 0x53, 0x41}, {0x45, 0x53, 0x42}, {0x45, 0x53, 0x50}, {0x45, 0x54, 0x42}, {0xe2, 0x82, 0xac}, {0x46, 0x49, 0x4d}, {0x46, 0x4a, 0x44}, {0x46, 0x4b, 0x50}, {0x46, 0x52, 0x46}, {0xc2, 0xa3}, {0x47, 0x45, 0x4b}, {0x47, 0x45, 0x4c}, {0x47, 0x48, 0x43}, {0x47, 0x48, 0x53}, {0x47, 0x49, 0x50}, {0x47, 0x4d, 0x44}, {0x47, 0x4e, 0x46}, {0x47, 0x4e, 0x53}, {0x47, 0x51, 0x45}, {0x47, 0x52, 0x44}, {0x47, 0x54, 0x51}, {0x47, 0x57, 0x45}, {0x47, 0x57, 0x50}, {0x47, 0x59, 0x44}, {0x48, 0x4b, 0x24}, {0x48, 0x4e, 0x4c}, {0x48, 0x52, 0x44}, {0x48, 0x52, 0x4b}, {0x48, 0x54, 0x47}, {0x48, 0x55, 0x46}, {0x49, 0x44, 0x52}, {0x49, 0x45, 0x50}, {0x49, 0x4c, 0x50}, {0x49, 0x4c, 0x52}, {0x49, 0x4c, 0x53}, {0x49, 0x4e, 0x52}, {0x49, 0x51, 0x44}, {0x49, 0x52, 0x52}, {0x49, 0x53, 0x4a}, {0x49, 0x53, 0x4b}, {0x49, 0x54, 0x4c}, {0x4a, 0x4d, 0x44}, {0x4a, 0x4f, 0x44}, {0x4a, 0x50, 0xc2, 0xa5}, {0x4b, 0x45, 0x53}, {0x4b, 0x47, 0x53}, {0x4b, 0x48, 0x52}, {0x4b, 0x4d, 0x46}, {0x4b, 0x50, 0x57}, {0x4b, 0x52, 0x48}, {0x4b, 0x52, 0x4f}, {0xe2, 0x82, 0xa9}, {0x4b, 0x57, 0x44}, {0x4b, 0x59, 0x44}, {0x4b, 0x5a, 0x54}, {0x4c, 0x41, 0x4b}, {0x4c, 0x42, 0x50}, {0x4c, 0x4b, 0x52}, {0x4c, 0x52, 0x44}, {0x4c, 0x53, 0x4c}, {0x4c, 0x54, 0x4c}, {0x4c, 0x54, 0x54}, {0x4c, 0x55, 0x43}, {0x4c, 0x55, 0x46}, {0x4c, 0x55, 0x4c}, {0x4c, 0x56, 0x4c}, {0x4c, 0x56, 0x52}, {0x4c, 0x59, 0x44}, {0x4d, 0x41, 0x44}, {0x4d, 0x41, 0x46}, {0x4d, 0x43, 0x46}, {0x4d, 0x44, 0x43}, {0x4d, 0x44, 0x4c}, {0x4d, 0x47, 0x41}, {0x4d, 0x47, 0x46}, {0x4d, 0x4b, 0x44}, {0x4d, 0x4b, 0x4e}, {0x4d, 0x4c, 0x46}, {0x4d, 0x4d, 0x4b}, {0x4d, 0x4e, 0x54}, {0x4d, 0x4f, 0x50}, {0x4d, 0x52, 0x4f}, {0x4d, 0x54, 0x4c}, {0x4d, 0x54, 0x50}, {0x4d, 0x55, 0x52}, {0x4d, 0x56, 0x50}, {0x4d, 0x56, 0x52}, {0x4d, 0x57, 0x4b}, {0x4d, 0x58, 0x24}, {0x4d, 0x58, 0x50}, {0x4d, 0x58, 0x56}, {0x4d, 0x59, 0x52}, {0x4d, 0x5a, 0x45}, {0x4d, 0x5a, 0x4d}, {0x4d, 0x5a, 0x4e}, {0x4e, 0x41, 0x44}, {0x4e, 0x47, 0x4e}, {0x4e, 0x49, 0x43}, {0x4e, 0x49, 0x4f}, {0x4e, 0x4c, 0x47}, {0x4e, 0x4f, 0x4b}, {0x4e, 0x50, 0x52}, {0x4e, 0x5a, 0x24}, {0x4f, 0x4d, 0x52}, {0x50, 0x41, 0x42}, {0x50, 0x45, 0x49}, {0x50, 0x45, 0x4e}, {0x50, 0x45, 0x53}, {0x50, 0x47, 0x4b}, {0x50, 0x48, 0x50}, {0x50, 0x4b, 0x52}, {0x50, 0x4c, 0x4e}, {0x50, 0x4c, 0x5a}, {0x50, 0x54, 0x45}, {0x50, 0x59, 0x47}, {0x51, 0x41, 0x52}, {0x52, 0x48, 0x44}, {0x52, 0x4f, 0x4c}, {0x52, 0x4f, 0x4e}, {0x52, 0x53, 0x44}, {0x52, 0x55, 0x42}, {0x52, 0x55, 0x52}, {0x52, 0x57, 0x46}, {0x53, 0x41, 0x52}, {0x53, 0x42, 0x44}, {0x53, 0x43, 0x52}, {0x53, 0x44, 0x44}, {0x53, 0x44, 0x47}, {0x53, 0x44, 0x50}, {0x53, 0x45, 0x4b}, {0x53, 0x47, 0x44}, {0x53, 0x48, 0x50}, {0x53, 0x49, 0x54}, {0x53, 0x4b, 0x4b}, {0x53, 0x4c, 0x4c}, {0x53, 0x4f, 0x53}, {0x53, 0x52, 0x44}, {0x53, 0x52, 0x47}, {0x53, 0x53, 0x50}, {0x53, 0x54, 0x44}, {0x53, 0x55, 0x52}, {0x53, 0x56, 0x43}, {0x53, 0x59, 0x50}, {0x53, 0x5a, 0x4c}, {0x54, 0x48, 0x42}, {0x54, 0x4a, 0x52}, {0x54, 0x4a, 0x53}, {0x54, 0x4d, 0x4d}, {0x54, 0x4d, 0x54}, {0x54, 0x4e, 0x44}, {0x54, 0x4f, 0x50}, {0x54, 0x50, 0x45}, {0x54, 0x52, 0x4c}, {0x54, 0x52, 0x59}, {0x54, 0x54, 0x44}, {0x4e, 0x54, 0x24}, {0x54, 0x5a, 0x53}, {0x55, 0x41, 0x48}, {0x55, 0x41, 0x4b}, {0x55, 0x47, 0x53}, {0x55, 0x47, 0x58}, {0x55, 0x53, 0x24}, {0x55, 0x53, 0x4e}, {0x55, 0x53, 0x53}, {0x55, 0x59, 0x49}, {0x55, 0x59, 0x50}, {0x55, 0x59, 0x55}, {0x55, 0x5a, 0x53}, {0x56, 0x45, 0x42}, {0x56, 0x45, 0x46}, {0x56, 0x4e, 0x44}, {0x56, 0x4e, 0x4e}, {0x56, 0x55, 0x56}, {0x57, 0x53, 0x54}, {0x46, 0x43, 0x46, 0x41}, {0x58, 0x41, 0x47}, {0x58, 0x41, 0x55}, {0x58, 0x42, 0x41}, {0x58, 0x42, 0x42}, {0x58, 0x42, 0x43}, {0x58, 0x42, 0x44}, {0x45, 0x43, 0x24}, {0x58, 0x44, 0x52}, {0x45, 0x43, 0x55}, {0x58, 0x46, 0x4f}, {0x58, 0x46, 0x55}, {0x43, 0x46, 0x41}, {0x58, 0x50, 0x44}, {0x43, 0x46, 0x50, 0x46}, {0x58, 0x50, 0x54}, {0x58, 0x52, 0x45}, {0x58, 0x53, 0x55}, {0x58, 0x54, 0x53}, {0x58, 0x55, 0x41}, {0x58, 0x58, 0x58}, {0x59, 0x44, 0x44}, {0x59, 0x45, 0x52}, {0x59, 0x55, 0x44}, {0x59, 0x55, 0x4d}, {0x59, 0x55, 0x4e}, {0x59, 0x55, 0x52}, {0x5a, 0x41, 0x4c}, {0x5a, 0x41, 0x52}, {0x5a, 0x4d, 0x4b}, {0x5a, 0x4d, 0x57}, {0x5a, 0x52, 0x4e}, {0x5a, 0x52, 0x5a}, {0x5a, 0x57, 0x44}, {0x5a, 0x57, 0x4c}, {0x5a, 0x57, 0x52}},
  55. percentSuffix: []byte{0xc2, 0xa0},
  56. currencyPositiveSuffix: []byte{0xc2, 0xa0},
  57. currencyNegativeSuffix: []byte{0xc2, 0xa0},
  58. monthsAbbreviated: [][]uint8{[]uint8(nil), {0x6c, 0x65, 0x64}, {0xc3, 0xba, 0x6e, 0x6f}, {0x62, 0xc5, 0x99, 0x65}, {0x64, 0x75, 0x62}, {0x6b, 0x76, 0xc4, 0x9b}, {0xc4, 0x8d, 0x76, 0x6e}, {0xc4, 0x8d, 0x76, 0x63}, {0x73, 0x72, 0x70}, {0x7a, 0xc3, 0xa1, 0xc5, 0x99}, {0xc5, 0x99, 0xc3, 0xad, 0x6a}, {0x6c, 0x69, 0x73}, {0x70, 0x72, 0x6f}},
  59. monthsNarrow: [][]uint8{[]uint8(nil), {0x31}, {0x32}, {0x33}, {0x34}, {0x35}, {0x36}, {0x37}, {0x38}, {0x39}, {0x31, 0x30}, {0x31, 0x31}, {0x31, 0x32}},
  60. monthsWide: [][]uint8{[]uint8(nil), {0x6c, 0x65, 0x64, 0x6e, 0x61}, {0xc3, 0xba, 0x6e, 0x6f, 0x72, 0x61}, {0x62, 0xc5, 0x99, 0x65, 0x7a, 0x6e, 0x61}, {0x64, 0x75, 0x62, 0x6e, 0x61}, {0x6b, 0x76, 0xc4, 0x9b, 0x74, 0x6e, 0x61}, {0xc4, 0x8d, 0x65, 0x72, 0x76, 0x6e, 0x61}, {0xc4, 0x8d, 0x65, 0x72, 0x76, 0x65, 0x6e, 0x63, 0x65}, {0x73, 0x72, 0x70, 0x6e, 0x61}, {0x7a, 0xc3, 0xa1, 0xc5, 0x99, 0xc3, 0xad}, {0xc5, 0x99, 0xc3, 0xad, 0x6a, 0x6e, 0x61}, {0x6c, 0x69, 0x73, 0x74, 0x6f, 0x70, 0x61, 0x64, 0x75}, {0x70, 0x72, 0x6f, 0x73, 0x69, 0x6e, 0x63, 0x65}},
  61. daysAbbreviated: [][]uint8{{0x6e, 0x65}, {0x70, 0x6f}, {0xc3, 0xba, 0x74}, {0x73, 0x74}, {0xc4, 0x8d, 0x74}, {0x70, 0xc3, 0xa1}, {0x73, 0x6f}},
  62. daysNarrow: [][]uint8{{0x4e}, {0x50}, {0xc3, 0x9a}, {0x53}, {0xc4, 0x8c}, {0x50}, {0x53}},
  63. daysShort: [][]uint8{{0x6e, 0x65}, {0x70, 0x6f}, {0xc3, 0xba, 0x74}, {0x73, 0x74}, {0xc4, 0x8d, 0x74}, {0x70, 0xc3, 0xa1}, {0x73, 0x6f}},
  64. daysWide: [][]uint8{{0x6e, 0x65, 0x64, 0xc4, 0x9b, 0x6c, 0x65}, {0x70, 0x6f, 0x6e, 0x64, 0xc4, 0x9b, 0x6c, 0xc3, 0xad}, {0xc3, 0xba, 0x74, 0x65, 0x72, 0xc3, 0xbd}, {0x73, 0x74, 0xc5, 0x99, 0x65, 0x64, 0x61}, {0xc4, 0x8d, 0x74, 0x76, 0x72, 0x74, 0x65, 0x6b}, {0x70, 0xc3, 0xa1, 0x74, 0x65, 0x6b}, {0x73, 0x6f, 0x62, 0x6f, 0x74, 0x61}},
  65. periodsAbbreviated: [][]uint8{{0x64, 0x6f, 0x70, 0x2e}, {0x6f, 0x64, 0x70, 0x2e}},
  66. periodsNarrow: [][]uint8{{0x64, 0x6f, 0x70, 0x2e}, {0x6f, 0x64, 0x70, 0x2e}},
  67. periodsWide: [][]uint8{{0x64, 0x6f, 0x70, 0x2e}, {0x6f, 0x64, 0x70, 0x2e}},
  68. erasAbbreviated: [][]uint8{{0x70, 0xc5, 0x99, 0x2e, 0x20, 0x6e, 0x2e, 0x20, 0x6c, 0x2e}, {0x6e, 0x2e, 0x20, 0x6c, 0x2e}},
  69. erasNarrow: [][]uint8{{0x70, 0xc5, 0x99, 0x2e, 0x6e, 0x2e, 0x6c, 0x2e}, {0x6e, 0x2e, 0x6c, 0x2e}},
  70. erasWide: [][]uint8{{0x70, 0xc5, 0x99, 0x2e, 0x20, 0x6e, 0x2e, 0x20, 0x6c, 0x2e}, {0x6e, 0x2e, 0x20, 0x6c, 0x2e}},
  71. timezones: map[string][]uint8{"HAST": {0x48, 0x61, 0x76, 0x61, 0x6a, 0x73, 0x6b, 0x6f, 0x2d, 0x61, 0x6c, 0x65, 0x75, 0x74, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "PDT": {0x53, 0x65, 0x76, 0x65, 0x72, 0x6f, 0x61, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x6b, 0xc3, 0xbd, 0x20, 0x70, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x6b, 0xc3, 0xbd, 0x20, 0x6c, 0x65, 0x74, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "ART": {0x41, 0x72, 0x67, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "ARST": {0x41, 0x72, 0x67, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x6c, 0x65, 0x74, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "HKST": {0x48, 0x6f, 0x6e, 0x67, 0x6b, 0x6f, 0x6e, 0x67, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x6c, 0x65, 0x74, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "CLT": {0x43, 0x68, 0x69, 0x6c, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "HKT": {0x48, 0x6f, 0x6e, 0x67, 0x6b, 0x6f, 0x6e, 0x67, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "SRT": {0x53, 0x75, 0x72, 0x69, 0x6e, 0x61, 0x6d, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "JST": {0x4a, 0x61, 0x70, 0x6f, 0x6e, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "IST": {0x49, 0x6e, 0x64, 0x69, 0x63, 0x6b, 0xc3, 0xbd, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "∅∅∅": {0x50, 0x65, 0x72, 0x75, 0xc3, 0xa1, 0x6e, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x6c, 0x65, 0x74, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "UYST": {0x55, 0x72, 0x75, 0x67, 0x75, 0x61, 0x79, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x6c, 0x65, 0x74, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "LHST": {0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73, 0x20, 0x6f, 0x73, 0x74, 0x72, 0x6f, 0x76, 0x61, 0x20, 0x6c, 0x6f, 0x72, 0x64, 0x61, 0x20, 0x48, 0x6f, 0x77, 0x61}, "CAT": {0x53, 0x74, 0xc5, 0x99, 0x65, 0x64, 0x6f, 0x61, 0x66, 0x72, 0x69, 0x63, 0x6b, 0xc3, 0xbd, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "MST": {0x53, 0x65, 0x76, 0x65, 0x72, 0x6f, 0x61, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x6b, 0xc3, 0xbd, 0x20, 0x68, 0x6f, 0x72, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "EAT": {0x56, 0xc3, 0xbd, 0x63, 0x68, 0x6f, 0x64, 0x6f, 0x61, 0x66, 0x72, 0x69, 0x63, 0x6b, 0xc3, 0xbd, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "JDT": {0x4a, 0x61, 0x70, 0x6f, 0x6e, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x6c, 0x65, 0x74, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "AWST": {0x5a, 0xc3, 0xa1, 0x70, 0x61, 0x64, 0x6f, 0x61, 0x75, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "VET": {0x56, 0x65, 0x6e, 0x65, 0x7a, 0x75, 0x65, 0x6c, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "AEST": {0x56, 0xc3, 0xbd, 0x63, 0x68, 0x6f, 0x64, 0x6f, 0x61, 0x75, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "AEDT": {0x56, 0xc3, 0xbd, 0x63, 0x68, 0x6f, 0x64, 0x6f, 0x61, 0x75, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x6c, 0x65, 0x74, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "WITA": {0x53, 0x74, 0xc5, 0x99, 0x65, 0x64, 0x6f, 0x69, 0x6e, 0x64, 0x6f, 0x6e, 0xc3, 0xa9, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "CHAST": {0x43, 0x68, 0x61, 0x74, 0x68, 0x61, 0x6d, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "CHADT": {0x43, 0x68, 0x61, 0x74, 0x68, 0x61, 0x6d, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x6c, 0x65, 0x74, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "TMST": {0x54, 0x75, 0x72, 0x6b, 0x6d, 0x65, 0x6e, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x6c, 0x65, 0x74, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "BOT": {0x42, 0x6f, 0x6c, 0x69, 0x76, 0x69, 0x6a, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "NZST": {0x4e, 0x6f, 0x76, 0x6f, 0x7a, 0xc3, 0xa9, 0x6c, 0x61, 0x6e, 0x64, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "COT": {0x4b, 0x6f, 0x6c, 0x75, 0x6d, 0x62, 0x69, 0x6a, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "HADT": {0x48, 0x61, 0x76, 0x61, 0x6a, 0x73, 0x6b, 0x6f, 0x2d, 0x61, 0x6c, 0x65, 0x75, 0x74, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x6c, 0x65, 0x74, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "TMT": {0x54, 0x75, 0x72, 0x6b, 0x6d, 0x65, 0x6e, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "ADT": {0x41, 0x74, 0x6c, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x6b, 0xc3, 0xbd, 0x20, 0x6c, 0x65, 0x74, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "WEZ": {0x5a, 0xc3, 0xa1, 0x70, 0x61, 0x64, 0x6f, 0x65, 0x76, 0x72, 0x6f, 0x70, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "ACST": {0x53, 0x74, 0xc5, 0x99, 0x65, 0x64, 0x6f, 0x61, 0x75, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "AST": {0x41, 0x74, 0x6c, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x6b, 0xc3, 0xbd, 0x20, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "OESZ": {0x56, 0xc3, 0xbd, 0x63, 0x68, 0x6f, 0x64, 0x6f, 0x65, 0x76, 0x72, 0x6f, 0x70, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x6c, 0x65, 0x74, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "GMT": {0x47, 0x72, 0x65, 0x65, 0x6e, 0x77, 0x69, 0x63, 0x68, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x73, 0x74, 0xc5, 0x99, 0x65, 0x64, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "AKDT": {0x41, 0x6c, 0x6a, 0x61, 0xc5, 0xa1, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x6c, 0x65, 0x74, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "BT": {0x42, 0x68, 0xc3, 0xba, 0x74, 0xc3, 0xa1, 0x6e, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "PST": {0x53, 0x65, 0x76, 0x65, 0x72, 0x6f, 0x61, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x6b, 0xc3, 0xbd, 0x20, 0x70, 0x61, 0x63, 0x69, 0x66, 0x69, 0x63, 0x6b, 0xc3, 0xbd, 0x20, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "UYT": {0x55, 0x72, 0x75, 0x67, 0x75, 0x61, 0x79, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "EDT": {0x53, 0x65, 0x76, 0x65, 0x72, 0x6f, 0x61, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x6b, 0xc3, 0xbd, 0x20, 0x76, 0xc3, 0xbd, 0x63, 0x68, 0x6f, 0x64, 0x6e, 0xc3, 0xad, 0x20, 0x6c, 0x65, 0x74, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "ACWDT": {0x53, 0x74, 0xc5, 0x99, 0x65, 0x64, 0x6f, 0x7a, 0xc3, 0xa1, 0x70, 0x61, 0x64, 0x6e, 0xc3, 0xad, 0x20, 0x61, 0x75, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x6c, 0x65, 0x74, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "GYT": {0x47, 0x75, 0x79, 0x61, 0x6e, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "CLST": {0x43, 0x68, 0x69, 0x6c, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x6c, 0x65, 0x74, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "WIT": {0x56, 0xc3, 0xbd, 0x63, 0x68, 0x6f, 0x64, 0x6f, 0x69, 0x6e, 0x64, 0x6f, 0x6e, 0xc3, 0xa9, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "HAT": {0x4e, 0x65, 0x77, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x6c, 0x61, 0x6e, 0x64, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x6c, 0x65, 0x74, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "WESZ": {0x5a, 0xc3, 0xa1, 0x70, 0x61, 0x64, 0x6f, 0x65, 0x76, 0x72, 0x6f, 0x70, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x6c, 0x65, 0x74, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "MESZ": {0x53, 0x74, 0xc5, 0x99, 0x65, 0x64, 0x6f, 0x65, 0x76, 0x72, 0x6f, 0x70, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x6c, 0x65, 0x74, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "OEZ": {0x56, 0xc3, 0xbd, 0x63, 0x68, 0x6f, 0x64, 0x6f, 0x65, 0x76, 0x72, 0x6f, 0x70, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "NZDT": {0x4e, 0x6f, 0x76, 0x6f, 0x7a, 0xc3, 0xa9, 0x6c, 0x61, 0x6e, 0x64, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x6c, 0x65, 0x74, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "EST": {0x53, 0x65, 0x76, 0x65, 0x72, 0x6f, 0x61, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x6b, 0xc3, 0xbd, 0x20, 0x76, 0xc3, 0xbd, 0x63, 0x68, 0x6f, 0x64, 0x6e, 0xc3, 0xad, 0x20, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "WARST": {0x5a, 0xc3, 0xa1, 0x70, 0x61, 0x64, 0x6f, 0x61, 0x72, 0x67, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x6c, 0x65, 0x74, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "WAST": {0x5a, 0xc3, 0xa1, 0x70, 0x61, 0x64, 0x6f, 0x61, 0x66, 0x72, 0x69, 0x63, 0x6b, 0xc3, 0xbd, 0x20, 0x6c, 0x65, 0x74, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "COST": {0x4b, 0x6f, 0x6c, 0x75, 0x6d, 0x62, 0x69, 0x6a, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x6c, 0x65, 0x74, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "CDT": {0x53, 0x65, 0x76, 0x65, 0x72, 0x6f, 0x61, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x6b, 0xc3, 0xbd, 0x20, 0x63, 0x65, 0x6e, 0x74, 0x72, 0xc3, 0xa1, 0x6c, 0x6e, 0xc3, 0xad, 0x20, 0x6c, 0x65, 0x74, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "MDT": {0x53, 0x65, 0x76, 0x65, 0x72, 0x6f, 0x61, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x6b, 0xc3, 0xbd, 0x20, 0x68, 0x6f, 0x72, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x6c, 0x65, 0x74, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "SGT": {0x53, 0x69, 0x6e, 0x67, 0x61, 0x70, 0x75, 0x72, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "ACWST": {0x53, 0x74, 0xc5, 0x99, 0x65, 0x64, 0x6f, 0x7a, 0xc3, 0xa1, 0x70, 0x61, 0x64, 0x6e, 0xc3, 0xad, 0x20, 0x61, 0x75, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "MYT": {0x4d, 0x61, 0x6c, 0x61, 0x6a, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "AWDT": {0x5a, 0xc3, 0xa1, 0x70, 0x61, 0x64, 0x6f, 0x61, 0x75, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x6c, 0x65, 0x74, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "WAT": {0x5a, 0xc3, 0xa1, 0x70, 0x61, 0x64, 0x6f, 0x61, 0x66, 0x72, 0x69, 0x63, 0x6b, 0xc3, 0xbd, 0x20, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "MEZ": {0x53, 0x74, 0xc5, 0x99, 0x65, 0x64, 0x6f, 0x65, 0x76, 0x72, 0x6f, 0x70, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "LHDT": {0x4c, 0x65, 0x74, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73, 0x20, 0x6f, 0x73, 0x74, 0x72, 0x6f, 0x76, 0x61, 0x20, 0x6c, 0x6f, 0x72, 0x64, 0x61, 0x20, 0x48, 0x6f, 0x77, 0x61}, "CST": {0x53, 0x65, 0x76, 0x65, 0x72, 0x6f, 0x61, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x6b, 0xc3, 0xbd, 0x20, 0x63, 0x65, 0x6e, 0x74, 0x72, 0xc3, 0xa1, 0x6c, 0x6e, 0xc3, 0xad, 0x20, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "HNT": {0x4e, 0x65, 0x77, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x6c, 0x61, 0x6e, 0x64, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "ChST": {0x43, 0x68, 0x61, 0x6d, 0x6f, 0x72, 0x72, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "WART": {0x5a, 0xc3, 0xa1, 0x70, 0x61, 0x64, 0x6f, 0x61, 0x72, 0x67, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "WIB": {0x5a, 0xc3, 0xa1, 0x70, 0x61, 0x64, 0x6f, 0x69, 0x6e, 0x64, 0x6f, 0x6e, 0xc3, 0xa9, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "SAST": {0x4a, 0x69, 0x68, 0x6f, 0x61, 0x66, 0x72, 0x69, 0x63, 0x6b, 0xc3, 0xbd, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "GFT": {0x46, 0x72, 0x61, 0x6e, 0x63, 0x6f, 0x75, 0x7a, 0x73, 0x6b, 0x6f, 0x67, 0x75, 0x79, 0x61, 0x6e, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "AKST": {0x41, 0x6c, 0x6a, 0x61, 0xc5, 0xa1, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "ECT": {0x45, 0x6b, 0x76, 0xc3, 0xa1, 0x64, 0x6f, 0x72, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0xc4, 0x8d, 0x61, 0x73}, "ACDT": {0x53, 0x74, 0xc5, 0x99, 0x65, 0x64, 0x6f, 0x61, 0x75, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x73, 0x6b, 0xc3, 0xbd, 0x20, 0x6c, 0x65, 0x74, 0x6e, 0xc3, 0xad, 0x20, 0xc4, 0x8d, 0x61, 0x73}},
  72. }
  73. }
  74. // Locale returns the current translators string locale
  75. func (cs *cs) Locale() string {
  76. return cs.locale
  77. }
  78. // PluralsCardinal returns the list of cardinal plural rules associated with 'cs'
  79. func (cs *cs) PluralsCardinal() []locales.PluralRule {
  80. return cs.pluralsCardinal
  81. }
  82. // PluralsOrdinal returns the list of ordinal plural rules associated with 'cs'
  83. func (cs *cs) PluralsOrdinal() []locales.PluralRule {
  84. return cs.pluralsOrdinal
  85. }
  86. // PluralsRange returns the list of range plural rules associated with 'cs'
  87. func (cs *cs) PluralsRange() []locales.PluralRule {
  88. return cs.pluralsRange
  89. }
  90. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'cs'
  91. func (cs *cs) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
  92. n := math.Abs(num)
  93. i := int64(n)
  94. if i == 1 && v == 0 {
  95. return locales.PluralRuleOne
  96. } else if i >= 2 && i <= 4 && v == 0 {
  97. return locales.PluralRuleFew
  98. } else if v != 0 {
  99. return locales.PluralRuleMany
  100. }
  101. return locales.PluralRuleOther
  102. }
  103. // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'cs'
  104. func (cs *cs) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
  105. return locales.PluralRuleOther
  106. }
  107. // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'cs'
  108. func (cs *cs) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
  109. start := cs.CardinalPluralRule(num1, v1)
  110. end := cs.CardinalPluralRule(num2, v2)
  111. if start == locales.PluralRuleOne && end == locales.PluralRuleFew {
  112. return locales.PluralRuleFew
  113. } else if start == locales.PluralRuleOne && end == locales.PluralRuleMany {
  114. return locales.PluralRuleMany
  115. } else if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
  116. return locales.PluralRuleOther
  117. } else if start == locales.PluralRuleFew && end == locales.PluralRuleFew {
  118. return locales.PluralRuleFew
  119. } else if start == locales.PluralRuleFew && end == locales.PluralRuleMany {
  120. return locales.PluralRuleMany
  121. } else if start == locales.PluralRuleFew && end == locales.PluralRuleOther {
  122. return locales.PluralRuleOther
  123. } else if start == locales.PluralRuleMany && end == locales.PluralRuleOne {
  124. return locales.PluralRuleOne
  125. } else if start == locales.PluralRuleMany && end == locales.PluralRuleFew {
  126. return locales.PluralRuleFew
  127. } else if start == locales.PluralRuleMany && end == locales.PluralRuleMany {
  128. return locales.PluralRuleMany
  129. } else if start == locales.PluralRuleMany && end == locales.PluralRuleOther {
  130. return locales.PluralRuleOther
  131. } else if start == locales.PluralRuleOther && end == locales.PluralRuleOne {
  132. return locales.PluralRuleOne
  133. } else if start == locales.PluralRuleOther && end == locales.PluralRuleFew {
  134. return locales.PluralRuleFew
  135. } else if start == locales.PluralRuleOther && end == locales.PluralRuleMany {
  136. return locales.PluralRuleMany
  137. }
  138. return locales.PluralRuleOther
  139. }
  140. // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
  141. func (cs *cs) MonthAbbreviated(month time.Month) []byte {
  142. return cs.monthsAbbreviated[month]
  143. }
  144. // MonthsAbbreviated returns the locales abbreviated months
  145. func (cs *cs) MonthsAbbreviated() [][]byte {
  146. return cs.monthsAbbreviated[1:]
  147. }
  148. // MonthNarrow returns the locales narrow month given the 'month' provided
  149. func (cs *cs) MonthNarrow(month time.Month) []byte {
  150. return cs.monthsNarrow[month]
  151. }
  152. // MonthsNarrow returns the locales narrow months
  153. func (cs *cs) MonthsNarrow() [][]byte {
  154. return cs.monthsNarrow[1:]
  155. }
  156. // MonthWide returns the locales wide month given the 'month' provided
  157. func (cs *cs) MonthWide(month time.Month) []byte {
  158. return cs.monthsWide[month]
  159. }
  160. // MonthsWide returns the locales wide months
  161. func (cs *cs) MonthsWide() [][]byte {
  162. return cs.monthsWide[1:]
  163. }
  164. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  165. func (cs *cs) WeekdayAbbreviated(weekday time.Weekday) []byte {
  166. return cs.daysAbbreviated[weekday]
  167. }
  168. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  169. func (cs *cs) WeekdaysAbbreviated() [][]byte {
  170. return cs.daysAbbreviated
  171. }
  172. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  173. func (cs *cs) WeekdayNarrow(weekday time.Weekday) []byte {
  174. return cs.daysNarrow[weekday]
  175. }
  176. // WeekdaysNarrow returns the locales narrow weekdays
  177. func (cs *cs) WeekdaysNarrow() [][]byte {
  178. return cs.daysNarrow
  179. }
  180. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  181. func (cs *cs) WeekdayShort(weekday time.Weekday) []byte {
  182. return cs.daysShort[weekday]
  183. }
  184. // WeekdaysShort returns the locales short weekdays
  185. func (cs *cs) WeekdaysShort() [][]byte {
  186. return cs.daysShort
  187. }
  188. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  189. func (cs *cs) WeekdayWide(weekday time.Weekday) []byte {
  190. return cs.daysWide[weekday]
  191. }
  192. // WeekdaysWide returns the locales wide weekdays
  193. func (cs *cs) WeekdaysWide() [][]byte {
  194. return cs.daysWide
  195. }
  196. // FmtNumber returns 'num' with digits/precision of 'v' for 'cs' and handles both Whole and Real numbers based on 'v'
  197. // returned as a []byte just in case the caller wishes to add more and can help
  198. // avoid allocations; otherwise just cast as string.
  199. func (cs *cs) FmtNumber(num float64, v uint64) []byte {
  200. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  201. l := len(s) + len(cs.decimal) + len(cs.group)*len(s[:len(s)-int(v)-1])/3
  202. count := 0
  203. inWhole := v == 0
  204. b := make([]byte, 0, l)
  205. for i := len(s) - 1; i >= 0; i-- {
  206. if s[i] == '.' {
  207. for j := len(cs.decimal) - 1; j >= 0; j-- {
  208. b = append(b, cs.decimal[j])
  209. }
  210. inWhole = true
  211. continue
  212. }
  213. if inWhole {
  214. if count == 3 {
  215. for j := len(cs.group) - 1; j >= 0; j-- {
  216. b = append(b, cs.group[j])
  217. }
  218. count = 1
  219. } else {
  220. count++
  221. }
  222. }
  223. b = append(b, s[i])
  224. }
  225. if num < 0 {
  226. for j := len(cs.minus) - 1; j >= 0; j-- {
  227. b = append(b, cs.minus[j])
  228. }
  229. }
  230. // reverse
  231. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  232. b[i], b[j] = b[j], b[i]
  233. }
  234. return b
  235. }
  236. // FmtPercent returns 'num' with digits/precision of 'v' for 'cs' and handles both Whole and Real numbers based on 'v'
  237. // returned as a []byte just in case the caller wishes to add more and can help
  238. // avoid allocations; otherwise just cast as string.
  239. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
  240. func (cs *cs) FmtPercent(num float64, v uint64) []byte {
  241. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  242. l := len(s) + len(cs.decimal)
  243. b := make([]byte, 0, l)
  244. for i := len(s) - 1; i >= 0; i-- {
  245. if s[i] == '.' {
  246. for j := len(cs.decimal) - 1; j >= 0; j-- {
  247. b = append(b, cs.decimal[j])
  248. }
  249. continue
  250. }
  251. b = append(b, s[i])
  252. }
  253. if num < 0 {
  254. for j := len(cs.minus) - 1; j >= 0; j-- {
  255. b = append(b, cs.minus[j])
  256. }
  257. }
  258. // reverse
  259. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  260. b[i], b[j] = b[j], b[i]
  261. }
  262. b = append(b, cs.percentSuffix...)
  263. b = append(b, cs.percent...)
  264. return b
  265. }
  266. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'cs'
  267. // returned as a []byte just in case the caller wishes to add more and can help
  268. // avoid allocations; otherwise just cast as string.
  269. func (cs *cs) FmtCurrency(num float64, v uint64, currency currency.Type) []byte {
  270. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  271. symbol := cs.currencies[currency]
  272. l := len(s) + len(cs.decimal) + len(cs.group)*len(s[:len(s)-int(v)-1])/3
  273. count := 0
  274. inWhole := v == 0
  275. b := make([]byte, 0, l)
  276. for i := len(s) - 1; i >= 0; i-- {
  277. if s[i] == '.' {
  278. for j := len(cs.decimal) - 1; j >= 0; j-- {
  279. b = append(b, cs.decimal[j])
  280. }
  281. inWhole = true
  282. continue
  283. }
  284. if inWhole {
  285. if count == 3 {
  286. for j := len(cs.group) - 1; j >= 0; j-- {
  287. b = append(b, cs.group[j])
  288. }
  289. count = 1
  290. } else {
  291. count++
  292. }
  293. }
  294. b = append(b, s[i])
  295. }
  296. if num < 0 {
  297. for j := len(cs.minus) - 1; j >= 0; j-- {
  298. b = append(b, cs.minus[j])
  299. }
  300. }
  301. // reverse
  302. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  303. b[i], b[j] = b[j], b[i]
  304. }
  305. if int(v) < 2 {
  306. if v == 0 {
  307. b = append(b, cs.decimal...)
  308. }
  309. for i := 0; i < 2-int(v); i++ {
  310. b = append(b, '0')
  311. }
  312. }
  313. b = append(b, cs.currencyPositiveSuffix...)
  314. b = append(b, symbol...)
  315. return b
  316. }
  317. // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'cs'
  318. // in accounting notation. returned as a []byte just in case the caller wishes to add more and can help
  319. // avoid allocations; otherwise just cast as string.
  320. func (cs *cs) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
  321. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  322. symbol := cs.currencies[currency]
  323. l := len(s) + len(cs.decimal) + len(cs.group)*len(s[:len(s)-int(v)-1])/3
  324. count := 0
  325. inWhole := v == 0
  326. b := make([]byte, 0, l)
  327. for i := len(s) - 1; i >= 0; i-- {
  328. if s[i] == '.' {
  329. for j := len(cs.decimal) - 1; j >= 0; j-- {
  330. b = append(b, cs.decimal[j])
  331. }
  332. inWhole = true
  333. continue
  334. }
  335. if inWhole {
  336. if count == 3 {
  337. for j := len(cs.group) - 1; j >= 0; j-- {
  338. b = append(b, cs.group[j])
  339. }
  340. count = 1
  341. } else {
  342. count++
  343. }
  344. }
  345. b = append(b, s[i])
  346. }
  347. if num < 0 {
  348. for j := len(cs.minus) - 1; j >= 0; j-- {
  349. b = append(b, cs.minus[j])
  350. }
  351. }
  352. // reverse
  353. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  354. b[i], b[j] = b[j], b[i]
  355. }
  356. if int(v) < 2 {
  357. if v == 0 {
  358. b = append(b, cs.decimal...)
  359. }
  360. for i := 0; i < 2-int(v); i++ {
  361. b = append(b, '0')
  362. }
  363. }
  364. if num < 0 {
  365. b = append(b, cs.currencyNegativeSuffix...)
  366. b = append(b, symbol...)
  367. } else {
  368. b = append(b, cs.currencyPositiveSuffix...)
  369. b = append(b, symbol...)
  370. }
  371. return b
  372. }
  373. // FmtDateShort returns the short date representation of 't' for 'cs'
  374. // returned as a []byte just in case the caller wishes to add more and can help
  375. // avoid allocations; otherwise just cast as string.
  376. func (cs *cs) FmtDateShort(t time.Time) []byte {
  377. b := make([]byte, 0, 32)
  378. if t.Day() < 10 {
  379. b = append(b, '0')
  380. }
  381. b = strconv.AppendInt(b, int64(t.Day()), 10)
  382. b = append(b, []byte{0x2e}...)
  383. if t.Month() < 10 {
  384. b = append(b, '0')
  385. }
  386. b = strconv.AppendInt(b, int64(t.Month()), 10)
  387. b = append(b, []byte{0x2e}...)
  388. if t.Year() > 9 {
  389. b = append(b, strconv.Itoa(t.Year())[2:]...)
  390. } else {
  391. b = append(b, strconv.Itoa(t.Year())[1:]...)
  392. }
  393. return b
  394. }
  395. // FmtDateMedium returns the medium date representation of 't' for 'cs'
  396. // returned as a []byte just in case the caller wishes to add more and can help
  397. // avoid allocations; otherwise just cast as string.
  398. func (cs *cs) FmtDateMedium(t time.Time) []byte {
  399. b := make([]byte, 0, 32)
  400. b = strconv.AppendInt(b, int64(t.Day()), 10)
  401. b = append(b, []byte{0x2e, 0x20}...)
  402. b = strconv.AppendInt(b, int64(t.Month()), 10)
  403. b = append(b, []byte{0x2e, 0x20}...)
  404. b = strconv.AppendInt(b, int64(t.Year()), 10)
  405. return b
  406. }
  407. // FmtDateLong returns the long date representation of 't' for 'cs'
  408. // returned as a []byte just in case the caller wishes to add more and can help
  409. // avoid allocations; otherwise just cast as string.
  410. func (cs *cs) FmtDateLong(t time.Time) []byte {
  411. b := make([]byte, 0, 32)
  412. b = strconv.AppendInt(b, int64(t.Day()), 10)
  413. b = append(b, []byte{0x2e, 0x20}...)
  414. b = append(b, cs.monthsWide[t.Month()]...)
  415. b = append(b, []byte{0x20}...)
  416. b = strconv.AppendInt(b, int64(t.Year()), 10)
  417. return b
  418. }
  419. // FmtDateFull returns the full date representation of 't' for 'cs'
  420. // returned as a []byte just in case the caller wishes to add more and can help
  421. // avoid allocations; otherwise just cast as string.
  422. func (cs *cs) FmtDateFull(t time.Time) []byte {
  423. b := make([]byte, 0, 32)
  424. b = append(b, cs.daysWide[t.Weekday()]...)
  425. b = append(b, []byte{0x20}...)
  426. b = strconv.AppendInt(b, int64(t.Day()), 10)
  427. b = append(b, []byte{0x2e, 0x20}...)
  428. b = append(b, cs.monthsWide[t.Month()]...)
  429. b = append(b, []byte{0x20}...)
  430. b = strconv.AppendInt(b, int64(t.Year()), 10)
  431. return b
  432. }
  433. // FmtTimeShort returns the short time representation of 't' for 'cs'
  434. // returned as a []byte just in case the caller wishes to add more and can help
  435. // avoid allocations; otherwise just cast as string.
  436. func (cs *cs) FmtTimeShort(t time.Time) []byte {
  437. b := make([]byte, 0, 32)
  438. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  439. b = append(b, cs.timeSeparator...)
  440. if t.Minute() < 10 {
  441. b = append(b, '0')
  442. }
  443. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  444. return b
  445. }
  446. // FmtTimeMedium returns the medium time representation of 't' for 'cs'
  447. // returned as a []byte just in case the caller wishes to add more and can help
  448. // avoid allocations; otherwise just cast as string.
  449. func (cs *cs) FmtTimeMedium(t time.Time) []byte {
  450. b := make([]byte, 0, 32)
  451. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  452. b = append(b, cs.timeSeparator...)
  453. if t.Minute() < 10 {
  454. b = append(b, '0')
  455. }
  456. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  457. b = append(b, cs.timeSeparator...)
  458. if t.Second() < 10 {
  459. b = append(b, '0')
  460. }
  461. b = strconv.AppendInt(b, int64(t.Second()), 10)
  462. return b
  463. }
  464. // FmtTimeLong returns the long time representation of 't' for 'cs'
  465. // returned as a []byte just in case the caller wishes to add more and can help
  466. // avoid allocations; otherwise just cast as string.
  467. func (cs *cs) FmtTimeLong(t time.Time) []byte {
  468. b := make([]byte, 0, 32)
  469. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  470. b = append(b, cs.timeSeparator...)
  471. if t.Minute() < 10 {
  472. b = append(b, '0')
  473. }
  474. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  475. b = append(b, cs.timeSeparator...)
  476. if t.Second() < 10 {
  477. b = append(b, '0')
  478. }
  479. b = strconv.AppendInt(b, int64(t.Second()), 10)
  480. b = append(b, []byte{0x20}...)
  481. tz, _ := t.Zone()
  482. b = append(b, tz...)
  483. return b
  484. }
  485. // FmtTimeFull returns the full time representation of 't' for 'cs'
  486. // returned as a []byte just in case the caller wishes to add more and can help
  487. // avoid allocations; otherwise just cast as string.
  488. func (cs *cs) FmtTimeFull(t time.Time) []byte {
  489. b := make([]byte, 0, 32)
  490. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  491. b = append(b, cs.timeSeparator...)
  492. if t.Minute() < 10 {
  493. b = append(b, '0')
  494. }
  495. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  496. b = append(b, cs.timeSeparator...)
  497. if t.Second() < 10 {
  498. b = append(b, '0')
  499. }
  500. b = strconv.AppendInt(b, int64(t.Second()), 10)
  501. b = append(b, []byte{0x20}...)
  502. tz, _ := t.Zone()
  503. if btz, ok := cs.timezones[tz]; ok {
  504. b = append(b, btz...)
  505. } else {
  506. b = append(b, tz...)
  507. }
  508. return b
  509. }