pa_Arab.go 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  1. package pa_Arab
  2. import (
  3. "math"
  4. "strconv"
  5. "time"
  6. "github.com/go-playground/locales"
  7. "github.com/go-playground/locales/currency"
  8. )
  9. type pa_Arab struct {
  10. locale string
  11. pluralsCardinal []locales.PluralRule
  12. pluralsOrdinal []locales.PluralRule
  13. pluralsRange []locales.PluralRule
  14. decimal string
  15. group string
  16. minus string
  17. percent string
  18. perMille string
  19. timeSeparator string
  20. inifinity string
  21. currencies []string // idx = enum of currency code
  22. currencyPositivePrefix string
  23. currencyPositiveSuffix string
  24. currencyNegativePrefix string
  25. currencyNegativeSuffix string
  26. monthsAbbreviated []string
  27. monthsNarrow []string
  28. monthsWide []string
  29. daysAbbreviated []string
  30. daysNarrow []string
  31. daysShort []string
  32. daysWide []string
  33. periodsAbbreviated []string
  34. periodsNarrow []string
  35. periodsShort []string
  36. periodsWide []string
  37. erasAbbreviated []string
  38. erasNarrow []string
  39. erasWide []string
  40. timezones map[string]string
  41. }
  42. // New returns a new instance of translator for the 'pa_Arab' locale
  43. func New() locales.Translator {
  44. return &pa_Arab{
  45. locale: "pa_Arab",
  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", "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", "GHS", "GIP", "GMD", "GNF", "GNS", "GQE", "GRD", "GTQ", "GWE", "GWP", "GYD", "HKD", "HNL", "HRD", "HRK", "HTG", "HUF", "IDR", "IEP", "ILP", "ILR", "ILS", "INR", "IQD", "IRR", "ISJ", "ISK", "ITL", "JMD", "JOD", "JPY", "KES", "KGS", "KHR", "KMF", "KPW", "KRH", "KRO", "KRW", "KWD", "KYD", "KZT", "LAK", "LBP", "LKR", "LRD", "LSL", "LTL", "LTT", "LUC", "LUF", "LUL", "LVL", "LVR", "LYD", "MAD", "MAF", "MCF", "MDC", "MDL", "MGA", "MGF", "MKD", "MKN", "MLF", "MMK", "MNT", "MOP", "MRO", "MTL", "MTP", "MUR", "MVP", "MVR", "MWK", "MXN", "MXP", "MXV", "MYR", "MZE", "MZM", "MZN", "NAD", "NGN", "NIC", "NIO", "NLG", "NOK", "NPR", "NZD", "OMR", "PAB", "PEI", "PEN", "PES", "PGK", "PHP", "ر", "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", "UZS", "VEB", "VEF", "VND", "VNN", "VUV", "WST", "XAF", "XAG", "XAU", "XBA", "XBB", "XBC", "XBD", "XCD", "XDR", "XEU", "XFO", "XFU", "XOF", "XPD", "XPF", "XPT", "XRE", "XSU", "XTS", "XUA", "XXX", "YDD", "YER", "YUD", "YUM", "YUN", "YUR", "ZAL", "ZAR", "ZMK", "ZMW", "ZRN", "ZRZ", "ZWD", "ZWL", "ZWR"},
  57. currencyPositivePrefix: " ",
  58. currencyPositiveSuffix: "K",
  59. currencyNegativePrefix: " ",
  60. currencyNegativeSuffix: "K",
  61. monthsAbbreviated: []string{"", "ਜਨ", "ਫ਼ਰ", "ਮਾਰਚ", "ਅਪ੍ਰੈ", "ਮਈ", "ਜੂਨ", "ਜੁਲਾ", "ਅਗ", "ਸਤੰ", "ਅਕਤੂ", "ਨਵੰ", "ਦਸੰ"},
  62. monthsNarrow: []string{"", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"},
  63. monthsWide: []string{"", "جنوری", "فروری", "مارچ", "اپریل", "مئ", "جون", "جولائی", "اگست", "ستمبر", "اکتوبر", "نومبر", "دسمبر"},
  64. daysAbbreviated: []string{"ਐਤ", "ਸੋਮ", "ਮੰਗਲ", "ਬੁੱਧ", "ਵੀਰ", "ਸ਼ੁੱਕਰ", "ਸ਼ਨਿੱਚਰ"},
  65. daysNarrow: []string{"S", "M", "T", "W", "T", "F", "S"},
  66. daysShort: []string{"ਐਤ", "ਸੋਮ", "ਮੰਗ", "ਬੁੱਧ", "ਵੀਰ", "ਸ਼ੁੱਕ", "ਸ਼ਨਿੱ"},
  67. daysWide: []string{"اتوار", "پیر", "منگل", "بُدھ", "جمعرات", "جمعہ", "ہفتہ"},
  68. periodsAbbreviated: []string{"AM", "PM"},
  69. periodsNarrow: []string{"", ""},
  70. periodsWide: []string{"", ""},
  71. erasAbbreviated: []string{"ايساپورو", "سں"},
  72. erasNarrow: []string{"", ""},
  73. erasWide: []string{"ايساپورو", "سں"},
  74. timezones: map[string]string{"AWDT": "ਆਸਟ੍ਰੇਲੀਆਈ ਪੱਛਮੀ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "NZDT": "ਨਿਊਜ਼ੀਲੈਂਡ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "IST": "ਭਾਰਤੀ ਮਿਆਰੀ ਵੇਲਾ", "HNT": "ਨਿਊਫਾਉਂਡਲੈਂਡ ਮਿਆਰੀ ਵੇਲਾ", "HAT": "ਨਿਊਫਾਉਂਡਲੈਂਡ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "EAT": "ਪੂਰਬੀ ਅਫਰੀਕਾ ਵੇਲਾ", "CLT": "ਚਿਲੀ ਮਿਆਰੀ ਵੇਲਾ", "OEZ": "ਪੂਰਬੀ ਯੂਰਪੀ ਮਿਆਰੀ ਵੇਲਾ", "UYT": "ਉਰੂਗਵੇ ਮਿਆਰੀ ਵੇਲਾ", "HEPM": "ਸੈਂਟ ਪੀਅਰੇ ਅਤੇ ਮਿਕੇਲਨ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "HNNOMX": "ਉੱਤਰ ਪੱਛਮੀ ਮੈਕਸੀਕੋ ਮਿਆਰੀ ਵੇਲਾ", "HECU": "ਕਿਊਬਾ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "CST": "ਉੱਤਰੀ ਅਮਰੀਕੀ ਕੇਂਦਰੀ ਮਿਆਰੀ ਵੇਲਾ", "NZST": "ਨਿਊਜ਼ੀਲੈਂਡ ਮਿਆਰੀ ਵੇਲਾ", "MYT": "ਮਲੇਸ਼ੀਆ ਵੇਲਾ", "BOT": "ਬੋਲੀਵੀਆ ਵੇਲਾ", "LHDT": "ਲੌਰਡ ਹੋਵੇ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "VET": "ਵੈਨੇਜ਼ੂਏਲਾ ਵੇਲਾ", "EST": "ਉੱਤਰੀ ਅਮਰੀਕੀ ਪੂਰਬੀ ਮਿਆਰੀ ਵੇਲਾ", "CDT": "ਉੱਤਰੀ ਅਮਰੀਕੀ ਕੇਂਦਰੀ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "PDT": "ਉੱਤਰੀ ਅਮਰੀਕੀ ਪੈਸਿਫਿਕ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "HEPMX": "ਮੈਕਸੀਕਨ ਪੈਸਿਫਿਕ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "ADT": "ਅਟਲਾਂਟਿਕ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "WAST": "ਪੱਛਮੀ ਅਫਰੀਕਾ ਗਰਮੀਆਂ ਦਾ ਵੇਲਾ", "JDT": "ਜਪਾਨ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "HEOG": "ਪੱਛਮੀ ਗ੍ਰੀਨਲੈਂਡ ਗਰਮੀਆਂ ਦਾ ਵੇਲਾ", "ACWST": "ਆਸਟ੍ਰੇਲੀਆਈ ਕੇਂਦਰੀ ਪੱਛਮੀ ਮਿਆਰੀ ਵੇਲਾ", "MEZ": "ਮੱਧ ਯੂਰਪੀ ਮਿਆਰੀ ਵੇਲਾ", "LHST": "ਲੌਰਡ ਹੋਵੇ ਮਿਆਰੀ ਵੇਲਾ", "WITA": "ਮੱਧ ਇੰਡੋਨੇਸ਼ੀਆਈ ਵੇਲਾ", "HADT": "ਹਵਾਈ-ਅਲੇਯੂਸ਼ਿਅਨ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "GYT": "ਗੁਯਾਨਾ ਵੇਲਾ", "AWST": "ਆਸਟ੍ਰੇਲੀਆਈ ਪੱਛਮੀ ਮਿਆਰੀ ਵੇਲਾ", "MST": "ਉੱਤਰੀ ਅਮਰੀਕੀ ਮਾਉਂਟੇਨ ਮਿਆਰੀ ਵੇਲਾ", "AKST": "ਅਲਾਸਕਾ ਮਿਆਰੀ ਵੇਲਾ", "AKDT": "ਅਲਾਸਕਾ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "TMST": "ਤੁਰਕਮੇਨਿਸਤਾਨ ਗਰਮੀਆਂ ਦਾ ਵੇਲਾ", "HAST": "ਹਵਾਈ-ਅਲੇਯੂਸ਼ਿਅਨ ਮਿਆਰੀ ਵੇਲਾ", "HENOMX": "ਉੱਤਰ ਪੱਛਮੀ ਮੈਕਸੀਕੋ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "SRT": "ਸੂਰੀਨਾਮ ਵੇਲਾ", "OESZ": "ਪੂਰਬੀ ਯੂਰਪੀ ਗਰਮੀਆਂ ਦਾ ਵੇਲਾ", "WEZ": "ਪੱਛਮੀ ਯੂਰਪੀ ਮਿਆਰੀ ਵੇਲਾ", "ART": "ਅਰਜਨਟੀਨਾ ਮਿਆਰੀ ਵੇਲਾ", "COT": "ਕੋਲੰਬੀਆ ਮਿਆਰੀ ਵੇਲਾ", "UYST": "ਉਰੂਗਵੇ ਗਰਮੀਆਂ ਦਾ ਵੇਲਾ", "HNCU": "ਕਿਊਬਾ ਮਿਆਰੀ ਵੇਲਾ", "∅∅∅": "ਬ੍ਰਾਜ਼ੀਲੀਆ ਗਰਮੀਆਂ ਦਾ ਵੇਲਾ", "AEST": "ਆਸਟ੍ਰੇਲੀਆਈ ਪੂਰਬੀ ਮਿਆਰੀ ਵੇਲਾ", "WIB": "ਪੱਛਮੀ ਇੰਡੋਨੇਸ਼ੀਆ ਵੇਲਾ", "WART": "ਪੱਛਮੀ ਅਰਜਨਟੀਨਾ ਮਿਆਰੀ ਵੇਲਾ", "PST": "ਉੱਤਰੀ ਅਮਰੀਕੀ ਪੈਸਿਫਿਕ ਮਿਆਰੀ ਵੇਲਾ", "WAT": "ਪੱਛਮੀ ਅਫਰੀਕਾ ਮਿਆਰੀ ਵੇਲਾ", "BT": "ਭੂਟਾਨ ਵੇਲਾ", "ECT": "ਇਕਵੇਡੋਰ ਵੇਲਾ", "EDT": "ਉੱਤਰੀ ਅਮਰੀਕੀ ਪੂਰਬੀ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "HEEG": "ਪੂਰਬੀ ਗ੍ਰੀਨਲੈਂਡ ਗਰਮੀਆਂ ਦਾ ਵੇਲਾ", "CAT": "ਕੇਂਦਰੀ ਅਫਰੀਕਾ ਵੇਲਾ", "ChST": "ਚਾਮੋਰੋ ਮਿਆਰੀ ਵੇਲਾ", "HNPMX": "ਮੈਕਸੀਕਨ ਪੈਸਿਫਿਕ ਮਿਆਰੀ ਵੇਲਾ", "AEDT": "ਆਸਟ੍ਰੇਲੀਆਈ ਪੂਰਬੀ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "MDT": "ਉੱਤਰੀ ਅਮਰੀਕੀ ਮਾਉਂਟੇਨ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "WESZ": "ਪੱਛਮੀ ਯੂਰਪੀ ਗਰਮੀਆਂ ਦਾ ਵੇਲਾ", "CHAST": "ਚੈਥਮ ਮਿਆਰੀ ਵੇਲਾ", "HNEG": "ਪੂਰਬੀ ਗ੍ਰੀਨਲੈਂਡ ਮਿਆਰੀ ਵੇਲਾ", "HKT": "ਹਾਂਗ ਕਾਂਗ ਮਿਆਰੀ ਵੇਲਾ", "ARST": "ਅਰਜਨਟੀਨਾ ਗਰਮੀਆਂ ਦਾ ਵੇਲਾ", "SGT": "ਸਿੰਗਾਪੁਰ ਮਿਆਰੀ ਵੇਲਾ", "HNOG": "ਪੱਛਮੀ ਗ੍ਰੀਨਲੈਂਡ ਮਿਆਰੀ ਵੇਲਾ", "ACWDT": "ਆਸਟ੍ਰੇਲੀਆਈ ਕੇਂਦਰੀ ਪੱਛਮੀ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "WARST": "ਪੱਛਮੀ ਅਰਜਨਟੀਨਾ ਗਰਮੀਆਂ ਦਾ ਵੇਲਾ", "HNPM": "ਸੈਂਟ ਪੀਅਰੇ ਅਤੇ ਮਿਕੇਲਨ ਮਿਆਰੀ ਵੇਲਾ", "TMT": "ਤੁਰਕਮੇਨਿਸਤਾਨ ਮਿਆਰੀ ਵੇਲਾ", "CHADT": "ਚੈਥਮ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "GFT": "ਫ੍ਰੈਂਚ ਗੁਏਨਾ ਵੇਲਾ", "ACST": "ਆਸਟ੍ਰੇਲੀਆਈ ਕੇਂਦਰੀ ਮਿਆਰੀ ਵੇਲਾ", "WIT": "ਪੂਰਬੀ ਇੰਡੋਨੇਸ਼ੀਆ ਵੇਲਾ", "COST": "ਕੋਲੰਬੀਆ ਗਰਮੀਆਂ ਦਾ ਵੇਲਾ", "GMT": "ਗ੍ਰੀਨਵਿਚ ਮੀਨ ਵੇਲਾ", "AST": "ਅਟਲਾਂਟਿਕ ਮਿਆਰੀ ਵੇਲਾ", "SAST": "ਦੱਖਣੀ ਅਫ਼ਰੀਕਾ ਮਿਆਰੀ ਵੇਲਾ", "CLST": "ਚਿਲੀ ਗਰਮੀਆਂ ਦਾ ਵੇਲਾ", "JST": "ਜਪਾਨ ਮਿਆਰੀ ਵੇਲਾ", "ACDT": "ਆਸਟ੍ਰੇਲੀਆਈ ਕੇਂਦਰੀ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "MESZ": "ਮੱਧ ਯੂਰਪੀ ਗਰਮੀਆਂ ਦਾ ਵੇਲਾ", "HKST": "ਹਾਂਗ ਕਾਂਗ ਗਰਮੀਆਂ ਦਾ ਵੇਲਾ"},
  75. }
  76. }
  77. // Locale returns the current translators string locale
  78. func (pa *pa_Arab) Locale() string {
  79. return pa.locale
  80. }
  81. // PluralsCardinal returns the list of cardinal plural rules associated with 'pa_Arab'
  82. func (pa *pa_Arab) PluralsCardinal() []locales.PluralRule {
  83. return pa.pluralsCardinal
  84. }
  85. // PluralsOrdinal returns the list of ordinal plural rules associated with 'pa_Arab'
  86. func (pa *pa_Arab) PluralsOrdinal() []locales.PluralRule {
  87. return pa.pluralsOrdinal
  88. }
  89. // PluralsRange returns the list of range plural rules associated with 'pa_Arab'
  90. func (pa *pa_Arab) PluralsRange() []locales.PluralRule {
  91. return pa.pluralsRange
  92. }
  93. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'pa_Arab'
  94. func (pa *pa_Arab) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
  95. n := math.Abs(num)
  96. if n >= 0 && n <= 1 {
  97. return locales.PluralRuleOne
  98. }
  99. return locales.PluralRuleOther
  100. }
  101. // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'pa_Arab'
  102. func (pa *pa_Arab) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
  103. return locales.PluralRuleOther
  104. }
  105. // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'pa_Arab'
  106. func (pa *pa_Arab) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
  107. start := pa.CardinalPluralRule(num1, v1)
  108. end := pa.CardinalPluralRule(num2, v2)
  109. if start == locales.PluralRuleOne && end == locales.PluralRuleOne {
  110. return locales.PluralRuleOne
  111. } else if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
  112. return locales.PluralRuleOther
  113. } else if start == locales.PluralRuleOther && end == locales.PluralRuleOne {
  114. return locales.PluralRuleOne
  115. }
  116. return locales.PluralRuleOther
  117. }
  118. // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
  119. func (pa *pa_Arab) MonthAbbreviated(month time.Month) string {
  120. return pa.monthsAbbreviated[month]
  121. }
  122. // MonthsAbbreviated returns the locales abbreviated months
  123. func (pa *pa_Arab) MonthsAbbreviated() []string {
  124. return pa.monthsAbbreviated[1:]
  125. }
  126. // MonthNarrow returns the locales narrow month given the 'month' provided
  127. func (pa *pa_Arab) MonthNarrow(month time.Month) string {
  128. return pa.monthsNarrow[month]
  129. }
  130. // MonthsNarrow returns the locales narrow months
  131. func (pa *pa_Arab) MonthsNarrow() []string {
  132. return pa.monthsNarrow[1:]
  133. }
  134. // MonthWide returns the locales wide month given the 'month' provided
  135. func (pa *pa_Arab) MonthWide(month time.Month) string {
  136. return pa.monthsWide[month]
  137. }
  138. // MonthsWide returns the locales wide months
  139. func (pa *pa_Arab) MonthsWide() []string {
  140. return pa.monthsWide[1:]
  141. }
  142. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  143. func (pa *pa_Arab) WeekdayAbbreviated(weekday time.Weekday) string {
  144. return pa.daysAbbreviated[weekday]
  145. }
  146. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  147. func (pa *pa_Arab) WeekdaysAbbreviated() []string {
  148. return pa.daysAbbreviated
  149. }
  150. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  151. func (pa *pa_Arab) WeekdayNarrow(weekday time.Weekday) string {
  152. return pa.daysNarrow[weekday]
  153. }
  154. // WeekdaysNarrow returns the locales narrow weekdays
  155. func (pa *pa_Arab) WeekdaysNarrow() []string {
  156. return pa.daysNarrow
  157. }
  158. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  159. func (pa *pa_Arab) WeekdayShort(weekday time.Weekday) string {
  160. return pa.daysShort[weekday]
  161. }
  162. // WeekdaysShort returns the locales short weekdays
  163. func (pa *pa_Arab) WeekdaysShort() []string {
  164. return pa.daysShort
  165. }
  166. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  167. func (pa *pa_Arab) WeekdayWide(weekday time.Weekday) string {
  168. return pa.daysWide[weekday]
  169. }
  170. // WeekdaysWide returns the locales wide weekdays
  171. func (pa *pa_Arab) WeekdaysWide() []string {
  172. return pa.daysWide
  173. }
  174. // Decimal returns the decimal point of number
  175. func (pa *pa_Arab) Decimal() string {
  176. return pa.decimal
  177. }
  178. // Group returns the group of number
  179. func (pa *pa_Arab) Group() string {
  180. return pa.group
  181. }
  182. // Group returns the minus sign of number
  183. func (pa *pa_Arab) Minus() string {
  184. return pa.minus
  185. }
  186. // FmtNumber returns 'num' with digits/precision of 'v' for 'pa_Arab' and handles both Whole and Real numbers based on 'v'
  187. func (pa *pa_Arab) FmtNumber(num float64, v uint64) string {
  188. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  189. l := len(s) + 5 + 1*len(s[:len(s)-int(v)-1])/3
  190. count := 0
  191. inWhole := v == 0
  192. inSecondary := false
  193. groupThreshold := 3
  194. b := make([]byte, 0, l)
  195. for i := len(s) - 1; i >= 0; i-- {
  196. if s[i] == '.' {
  197. b = append(b, pa.decimal[0])
  198. inWhole = true
  199. continue
  200. }
  201. if inWhole {
  202. if count == groupThreshold {
  203. b = append(b, pa.group[0])
  204. count = 1
  205. if !inSecondary {
  206. inSecondary = true
  207. groupThreshold = 2
  208. }
  209. } else {
  210. count++
  211. }
  212. }
  213. b = append(b, s[i])
  214. }
  215. if num < 0 {
  216. for j := len(pa.minus) - 1; j >= 0; j-- {
  217. b = append(b, pa.minus[j])
  218. }
  219. }
  220. // reverse
  221. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  222. b[i], b[j] = b[j], b[i]
  223. }
  224. return string(b)
  225. }
  226. // FmtPercent returns 'num' with digits/precision of 'v' for 'pa_Arab' and handles both Whole and Real numbers based on 'v'
  227. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
  228. func (pa *pa_Arab) FmtPercent(num float64, v uint64) string {
  229. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  230. l := len(s) + 6
  231. b := make([]byte, 0, l)
  232. for i := len(s) - 1; i >= 0; i-- {
  233. if s[i] == '.' {
  234. b = append(b, pa.decimal[0])
  235. continue
  236. }
  237. b = append(b, s[i])
  238. }
  239. if num < 0 {
  240. for j := len(pa.minus) - 1; j >= 0; j-- {
  241. b = append(b, pa.minus[j])
  242. }
  243. }
  244. // reverse
  245. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  246. b[i], b[j] = b[j], b[i]
  247. }
  248. b = append(b, pa.percent...)
  249. return string(b)
  250. }
  251. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'pa_Arab'
  252. func (pa *pa_Arab) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  253. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  254. symbol := pa.currencies[currency]
  255. l := len(s) + len(symbol) + 8
  256. b := make([]byte, 0, l)
  257. for i := len(s) - 1; i >= 0; i-- {
  258. if s[i] == '.' {
  259. b = append(b, pa.decimal[0])
  260. continue
  261. }
  262. b = append(b, s[i])
  263. }
  264. for j := len(symbol) - 1; j >= 0; j-- {
  265. b = append(b, symbol[j])
  266. }
  267. for j := len(pa.currencyPositivePrefix) - 1; j >= 0; j-- {
  268. b = append(b, pa.currencyPositivePrefix[j])
  269. }
  270. if num < 0 {
  271. for j := len(pa.minus) - 1; j >= 0; j-- {
  272. b = append(b, pa.minus[j])
  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. b = append(b, pa.currencyPositiveSuffix...)
  280. return string(b)
  281. }
  282. // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'pa_Arab'
  283. // in accounting notation.
  284. func (pa *pa_Arab) FmtAccounting(num float64, v uint64, currency currency.Type) string {
  285. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  286. symbol := pa.currencies[currency]
  287. l := len(s) + len(symbol) + 8
  288. b := make([]byte, 0, l)
  289. for i := len(s) - 1; i >= 0; i-- {
  290. if s[i] == '.' {
  291. b = append(b, pa.decimal[0])
  292. continue
  293. }
  294. b = append(b, s[i])
  295. }
  296. if num < 0 {
  297. for j := len(symbol) - 1; j >= 0; j-- {
  298. b = append(b, symbol[j])
  299. }
  300. for j := len(pa.currencyNegativePrefix) - 1; j >= 0; j-- {
  301. b = append(b, pa.currencyNegativePrefix[j])
  302. }
  303. for j := len(pa.minus) - 1; j >= 0; j-- {
  304. b = append(b, pa.minus[j])
  305. }
  306. } else {
  307. for j := len(symbol) - 1; j >= 0; j-- {
  308. b = append(b, symbol[j])
  309. }
  310. for j := len(pa.currencyPositivePrefix) - 1; j >= 0; j-- {
  311. b = append(b, pa.currencyPositivePrefix[j])
  312. }
  313. }
  314. // reverse
  315. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  316. b[i], b[j] = b[j], b[i]
  317. }
  318. if num < 0 {
  319. b = append(b, pa.currencyNegativeSuffix...)
  320. } else {
  321. b = append(b, pa.currencyPositiveSuffix...)
  322. }
  323. return string(b)
  324. }
  325. // FmtDateShort returns the short date representation of 't' for 'pa_Arab'
  326. func (pa *pa_Arab) FmtDateShort(t time.Time) string {
  327. b := make([]byte, 0, 32)
  328. if t.Day() < 10 {
  329. b = append(b, '0')
  330. }
  331. b = strconv.AppendInt(b, int64(t.Day()), 10)
  332. b = append(b, []byte{0x2f}...)
  333. if t.Month() < 10 {
  334. b = append(b, '0')
  335. }
  336. b = strconv.AppendInt(b, int64(t.Month()), 10)
  337. b = append(b, []byte{0x2f}...)
  338. if t.Year() > 0 {
  339. b = strconv.AppendInt(b, int64(t.Year()), 10)
  340. } else {
  341. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  342. }
  343. return string(b)
  344. }
  345. // FmtDateMedium returns the medium date representation of 't' for 'pa_Arab'
  346. func (pa *pa_Arab) FmtDateMedium(t time.Time) string {
  347. b := make([]byte, 0, 32)
  348. b = strconv.AppendInt(b, int64(t.Day()), 10)
  349. b = append(b, []byte{0x20}...)
  350. b = append(b, pa.monthsAbbreviated[t.Month()]...)
  351. b = append(b, []byte{0x20}...)
  352. if t.Year() > 0 {
  353. b = strconv.AppendInt(b, int64(t.Year()), 10)
  354. } else {
  355. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  356. }
  357. return string(b)
  358. }
  359. // FmtDateLong returns the long date representation of 't' for 'pa_Arab'
  360. func (pa *pa_Arab) FmtDateLong(t time.Time) string {
  361. b := make([]byte, 0, 32)
  362. b = strconv.AppendInt(b, int64(t.Day()), 10)
  363. b = append(b, []byte{0x20}...)
  364. b = append(b, pa.monthsWide[t.Month()]...)
  365. b = append(b, []byte{0x20}...)
  366. if t.Year() > 0 {
  367. b = strconv.AppendInt(b, int64(t.Year()), 10)
  368. } else {
  369. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  370. }
  371. return string(b)
  372. }
  373. // FmtDateFull returns the full date representation of 't' for 'pa_Arab'
  374. func (pa *pa_Arab) FmtDateFull(t time.Time) string {
  375. b := make([]byte, 0, 32)
  376. b = append(b, pa.daysWide[t.Weekday()]...)
  377. b = append(b, []byte{0x2c, 0x20}...)
  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{0x20}...)
  383. b = append(b, pa.monthsWide[t.Month()]...)
  384. b = append(b, []byte{0x20}...)
  385. if t.Year() > 0 {
  386. b = strconv.AppendInt(b, int64(t.Year()), 10)
  387. } else {
  388. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  389. }
  390. return string(b)
  391. }
  392. // FmtTimeShort returns the short time representation of 't' for 'pa_Arab'
  393. func (pa *pa_Arab) FmtTimeShort(t time.Time) string {
  394. b := make([]byte, 0, 32)
  395. h := t.Hour()
  396. if h > 12 {
  397. h -= 12
  398. }
  399. b = strconv.AppendInt(b, int64(h), 10)
  400. b = append(b, pa.timeSeparator...)
  401. if t.Minute() < 10 {
  402. b = append(b, '0')
  403. }
  404. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  405. b = append(b, []byte{0x20}...)
  406. if t.Hour() < 12 {
  407. b = append(b, pa.periodsAbbreviated[0]...)
  408. } else {
  409. b = append(b, pa.periodsAbbreviated[1]...)
  410. }
  411. return string(b)
  412. }
  413. // FmtTimeMedium returns the medium time representation of 't' for 'pa_Arab'
  414. func (pa *pa_Arab) FmtTimeMedium(t time.Time) string {
  415. b := make([]byte, 0, 32)
  416. h := t.Hour()
  417. if h > 12 {
  418. h -= 12
  419. }
  420. b = strconv.AppendInt(b, int64(h), 10)
  421. b = append(b, pa.timeSeparator...)
  422. if t.Minute() < 10 {
  423. b = append(b, '0')
  424. }
  425. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  426. b = append(b, pa.timeSeparator...)
  427. if t.Second() < 10 {
  428. b = append(b, '0')
  429. }
  430. b = strconv.AppendInt(b, int64(t.Second()), 10)
  431. b = append(b, []byte{0x20}...)
  432. if t.Hour() < 12 {
  433. b = append(b, pa.periodsAbbreviated[0]...)
  434. } else {
  435. b = append(b, pa.periodsAbbreviated[1]...)
  436. }
  437. return string(b)
  438. }
  439. // FmtTimeLong returns the long time representation of 't' for 'pa_Arab'
  440. func (pa *pa_Arab) FmtTimeLong(t time.Time) string {
  441. b := make([]byte, 0, 32)
  442. h := t.Hour()
  443. if h > 12 {
  444. h -= 12
  445. }
  446. b = strconv.AppendInt(b, int64(h), 10)
  447. b = append(b, pa.timeSeparator...)
  448. if t.Minute() < 10 {
  449. b = append(b, '0')
  450. }
  451. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  452. b = append(b, pa.timeSeparator...)
  453. if t.Second() < 10 {
  454. b = append(b, '0')
  455. }
  456. b = strconv.AppendInt(b, int64(t.Second()), 10)
  457. b = append(b, []byte{0x20}...)
  458. if t.Hour() < 12 {
  459. b = append(b, pa.periodsAbbreviated[0]...)
  460. } else {
  461. b = append(b, pa.periodsAbbreviated[1]...)
  462. }
  463. b = append(b, []byte{0x20}...)
  464. tz, _ := t.Zone()
  465. b = append(b, tz...)
  466. return string(b)
  467. }
  468. // FmtTimeFull returns the full time representation of 't' for 'pa_Arab'
  469. func (pa *pa_Arab) FmtTimeFull(t time.Time) string {
  470. b := make([]byte, 0, 32)
  471. h := t.Hour()
  472. if h > 12 {
  473. h -= 12
  474. }
  475. b = strconv.AppendInt(b, int64(h), 10)
  476. b = append(b, pa.timeSeparator...)
  477. if t.Minute() < 10 {
  478. b = append(b, '0')
  479. }
  480. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  481. b = append(b, pa.timeSeparator...)
  482. if t.Second() < 10 {
  483. b = append(b, '0')
  484. }
  485. b = strconv.AppendInt(b, int64(t.Second()), 10)
  486. b = append(b, []byte{0x20}...)
  487. if t.Hour() < 12 {
  488. b = append(b, pa.periodsAbbreviated[0]...)
  489. } else {
  490. b = append(b, pa.periodsAbbreviated[1]...)
  491. }
  492. b = append(b, []byte{0x20}...)
  493. tz, _ := t.Zone()
  494. if btz, ok := pa.timezones[tz]; ok {
  495. b = append(b, btz...)
  496. } else {
  497. b = append(b, tz...)
  498. }
  499. return string(b)
  500. }