...

Source file src/github.com/go-playground/locales/pa_Arab/pa_Arab.go

Documentation: github.com/go-playground/locales/pa_Arab

     1  package pa_Arab
     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 pa_Arab 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  	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  // New returns a new instance of translator for the 'pa_Arab' locale
    47  func New() locales.Translator {
    48  	return &pa_Arab{
    49  		locale:                 "pa_Arab",
    50  		pluralsCardinal:        []locales.PluralRule{2, 6},
    51  		pluralsOrdinal:         []locales.PluralRule{6},
    52  		pluralsRange:           []locales.PluralRule{2, 6},
    53  		decimal:                ".",
    54  		group:                  ",",
    55  		minus:                  "-",
    56  		percent:                "%",
    57  		perMille:               "‰",
    58  		timeSeparator:          ":",
    59  		inifinity:              "∞",
    60  		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", "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", "ر", "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"},
    61  		currencyPositivePrefix: " ",
    62  		currencyPositiveSuffix: "K",
    63  		currencyNegativePrefix: " ",
    64  		currencyNegativeSuffix: "K",
    65  		monthsAbbreviated:      []string{"", "ਜਨ", "ਫ਼ਰ", "ਮਾਰਚ", "ਅਪ੍ਰੈ", "ਮਈ", "ਜੂਨ", "ਜੁਲਾ", "ਅਗ", "ਸਤੰ", "ਅਕਤੂ", "ਨਵੰ", "ਦਸੰ"},
    66  		monthsNarrow:           []string{"", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"},
    67  		monthsWide:             []string{"", "جنوری", "فروری", "مارچ", "اپریل", "مئ", "جون", "جولائی", "اگست", "ستمبر", "اکتوبر", "نومبر", "دسمبر"},
    68  		daysAbbreviated:        []string{"ਐਤ", "ਸੋਮ", "ਮੰਗਲ", "ਬੁੱਧ", "ਵੀਰ", "ਸ਼ੁੱਕਰ", "ਸ਼ਨਿੱਚਰ"},
    69  		daysNarrow:             []string{"S", "M", "T", "W", "T", "F", "S"},
    70  		daysShort:              []string{"ਐਤ", "ਸੋਮ", "ਮੰਗ", "ਬੁੱਧ", "ਵੀਰ", "ਸ਼ੁੱਕ", "ਸ਼ਨਿੱ"},
    71  		daysWide:               []string{"اتوار", "پیر", "منگل", "بُدھ", "جمعرات", "جمعہ", "ہفتہ"},
    72  		periodsAbbreviated:     []string{"AM", "PM"},
    73  		periodsNarrow:          []string{"", ""},
    74  		periodsWide:            []string{"", ""},
    75  		erasAbbreviated:        []string{"ايساپورو", "سں"},
    76  		erasNarrow:             []string{"", ""},
    77  		erasWide:               []string{"ايساپورو", "سں"},
    78  		timezones:              map[string]string{"ACDT": "ਆਸਟ੍ਰੇਲੀਆਈ ਕੇਂਦਰੀ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "ACST": "ਆਸਟ੍ਰੇਲੀਆਈ ਕੇਂਦਰੀ ਮਿਆਰੀ ਵੇਲਾ", "ACWDT": "ਆਸਟ੍ਰੇਲੀਆਈ ਕੇਂਦਰੀ ਪੱਛਮੀ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "ACWST": "ਆਸਟ੍ਰੇਲੀਆਈ ਕੇਂਦਰੀ ਪੱਛਮੀ ਮਿਆਰੀ ਵੇਲਾ", "ADT": "ਅਟਲਾਂਟਿਕ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "AEDT": "ਆਸਟ੍ਰੇਲੀਆਈ ਪੂਰਬੀ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "AEST": "ਆਸਟ੍ਰੇਲੀਆਈ ਪੂਰਬੀ ਮਿਆਰੀ ਵੇਲਾ", "AKDT": "ਅਲਾਸਕਾ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "AKST": "ਅਲਾਸਕਾ ਮਿਆਰੀ ਵੇਲਾ", "ARST": "ਅਰਜਨਟੀਨਾ ਗਰਮੀਆਂ ਦਾ ਵੇਲਾ", "ART": "ਅਰਜਨਟੀਨਾ ਮਿਆਰੀ ਵੇਲਾ", "AST": "ਅਟਲਾਂਟਿਕ ਮਿਆਰੀ ਵੇਲਾ", "AWDT": "ਆਸਟ੍ਰੇਲੀਆਈ ਪੱਛਮੀ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "AWST": "ਆਸਟ੍ਰੇਲੀਆਈ ਪੱਛਮੀ ਮਿਆਰੀ ਵੇਲਾ", "BOT": "ਬੋਲੀਵੀਆ ਵੇਲਾ", "BT": "ਭੂਟਾਨ ਵੇਲਾ", "CAT": "ਕੇਂਦਰੀ ਅਫਰੀਕਾ ਵੇਲਾ", "CDT": "ਉੱਤਰੀ ਅਮਰੀਕੀ ਕੇਂਦਰੀ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "CHADT": "ਚੈਥਮ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "CHAST": "ਚੈਥਮ ਮਿਆਰੀ ਵੇਲਾ", "CLST": "ਚਿਲੀ ਗਰਮੀਆਂ ਦਾ ਵੇਲਾ", "CLT": "ਚਿਲੀ ਮਿਆਰੀ ਵੇਲਾ", "COST": "ਕੋਲੰਬੀਆ ਗਰਮੀਆਂ ਦਾ ਵੇਲਾ", "COT": "ਕੋਲੰਬੀਆ ਮਿਆਰੀ ਵੇਲਾ", "CST": "ਉੱਤਰੀ ਅਮਰੀਕੀ ਕੇਂਦਰੀ ਮਿਆਰੀ ਵੇਲਾ", "ChST": "ਚਾਮੋਰੋ ਮਿਆਰੀ ਵੇਲਾ", "EAT": "ਪੂਰਬੀ ਅਫਰੀਕਾ ਵੇਲਾ", "ECT": "ਇਕਵੇਡੋਰ ਵੇਲਾ", "EDT": "ਉੱਤਰੀ ਅਮਰੀਕੀ ਪੂਰਬੀ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "EST": "ਉੱਤਰੀ ਅਮਰੀਕੀ ਪੂਰਬੀ ਮਿਆਰੀ ਵੇਲਾ", "GFT": "ਫ੍ਰੈਂਚ ਗੁਏਨਾ ਵੇਲਾ", "GMT": "ਗ੍ਰੀਨਵਿਚ ਮੀਨ ਵੇਲਾ", "GST": "ਖਾੜੀ ਮਿਆਰੀ ਵੇਲਾ", "GYT": "ਗੁਯਾਨਾ ਵੇਲਾ", "HADT": "ਹਵਾਈ-ਅਲੇਯੂਸ਼ਿਅਨ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "HAST": "ਹਵਾਈ-ਅਲੇਯੂਸ਼ਿਅਨ ਮਿਆਰੀ ਵੇਲਾ", "HAT": "ਨਿਊਫਾਉਂਡਲੈਂਡ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "HECU": "ਕਿਊਬਾ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "HEEG": "ਪੂਰਬੀ ਗ੍ਰੀਨਲੈਂਡ ਗਰਮੀਆਂ ਦਾ ਵੇਲਾ", "HENOMX": "ਉੱਤਰ ਪੱਛਮੀ ਮੈਕਸੀਕੋ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "HEOG": "ਪੱਛਮੀ ਗ੍ਰੀਨਲੈਂਡ ਗਰਮੀਆਂ ਦਾ ਵੇਲਾ", "HEPM": "ਸੈਂਟ ਪੀਅਰੇ ਅਤੇ ਮਿਕੇਲਨ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "HEPMX": "ਮੈਕਸੀਕਨ ਪੈਸਿਫਿਕ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "HKST": "ਹਾਂਗ ਕਾਂਗ ਗਰਮੀਆਂ ਦਾ ਵੇਲਾ", "HKT": "ਹਾਂਗ ਕਾਂਗ ਮਿਆਰੀ ਵੇਲਾ", "HNCU": "ਕਿਊਬਾ ਮਿਆਰੀ ਵੇਲਾ", "HNEG": "ਪੂਰਬੀ ਗ੍ਰੀਨਲੈਂਡ ਮਿਆਰੀ ਵੇਲਾ", "HNNOMX": "ਉੱਤਰ ਪੱਛਮੀ ਮੈਕਸੀਕੋ ਮਿਆਰੀ ਵੇਲਾ", "HNOG": "ਪੱਛਮੀ ਗ੍ਰੀਨਲੈਂਡ ਮਿਆਰੀ ਵੇਲਾ", "HNPM": "ਸੈਂਟ ਪੀਅਰੇ ਅਤੇ ਮਿਕੇਲਨ ਮਿਆਰੀ ਵੇਲਾ", "HNPMX": "ਮੈਕਸੀਕਨ ਪੈਸਿਫਿਕ ਮਿਆਰੀ ਵੇਲਾ", "HNT": "ਨਿਊਫਾਉਂਡਲੈਂਡ ਮਿਆਰੀ ਵੇਲਾ", "IST": "ਭਾਰਤੀ ਮਿਆਰੀ ਵੇਲਾ", "JDT": "ਜਪਾਨ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "JST": "ਜਪਾਨ ਮਿਆਰੀ ਵੇਲਾ", "LHDT": "ਲੌਰਡ ਹੋਵੇ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "LHST": "ਲੌਰਡ ਹੋਵੇ ਮਿਆਰੀ ਵੇਲਾ", "MDT": "ਉੱਤਰੀ ਅਮਰੀਕੀ ਮਾਉਂਟੇਨ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "MESZ": "ਮੱਧ ਯੂਰਪੀ ਗਰਮੀਆਂ ਦਾ ਵੇਲਾ", "MEZ": "ਮੱਧ ਯੂਰਪੀ ਮਿਆਰੀ ਵੇਲਾ", "MST": "ਉੱਤਰੀ ਅਮਰੀਕੀ ਮਾਉਂਟੇਨ ਮਿਆਰੀ ਵੇਲਾ", "MYT": "ਮਲੇਸ਼ੀਆ ਵੇਲਾ", "NZDT": "ਨਿਊਜ਼ੀਲੈਂਡ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "NZST": "ਨਿਊਜ਼ੀਲੈਂਡ ਮਿਆਰੀ ਵੇਲਾ", "OESZ": "ਪੂਰਬੀ ਯੂਰਪੀ ਗਰਮੀਆਂ ਦਾ ਵੇਲਾ", "OEZ": "ਪੂਰਬੀ ਯੂਰਪੀ ਮਿਆਰੀ ਵੇਲਾ", "PDT": "ਉੱਤਰੀ ਅਮਰੀਕੀ ਪੈਸਿਫਿਕ ਪ੍ਰਕਾਸ਼ ਵੇਲਾ", "PST": "ਉੱਤਰੀ ਅਮਰੀਕੀ ਪੈਸਿਫਿਕ ਮਿਆਰੀ ਵੇਲਾ", "SAST": "ਦੱਖਣੀ ਅਫ਼ਰੀਕਾ ਮਿਆਰੀ ਵੇਲਾ", "SGT": "ਸਿੰਗਾਪੁਰ ਮਿਆਰੀ ਵੇਲਾ", "SRT": "ਸੂਰੀਨਾਮ ਵੇਲਾ", "TMST": "ਤੁਰਕਮੇਨਿਸਤਾਨ ਗਰਮੀਆਂ ਦਾ ਵੇਲਾ", "TMT": "ਤੁਰਕਮੇਨਿਸਤਾਨ ਮਿਆਰੀ ਵੇਲਾ", "UYST": "ਉਰੂਗਵੇ ਗਰਮੀਆਂ ਦਾ ਵੇਲਾ", "UYT": "ਉਰੂਗਵੇ ਮਿਆਰੀ ਵੇਲਾ", "VET": "ਵੈਨੇਜ਼ੂਏਲਾ ਵੇਲਾ", "WARST": "ਪੱਛਮੀ ਅਰਜਨਟੀਨਾ ਗਰਮੀਆਂ ਦਾ ਵੇਲਾ", "WART": "ਪੱਛਮੀ ਅਰਜਨਟੀਨਾ ਮਿਆਰੀ ਵੇਲਾ", "WAST": "ਪੱਛਮੀ ਅਫਰੀਕਾ ਗਰਮੀਆਂ ਦਾ ਵੇਲਾ", "WAT": "ਪੱਛਮੀ ਅਫਰੀਕਾ ਮਿਆਰੀ ਵੇਲਾ", "WESZ": "ਪੱਛਮੀ ਯੂਰਪੀ ਗਰਮੀਆਂ ਦਾ ਵੇਲਾ", "WEZ": "ਪੱਛਮੀ ਯੂਰਪੀ ਮਿਆਰੀ ਵੇਲਾ", "WIB": "ਪੱਛਮੀ ਇੰਡੋਨੇਸ਼ੀਆ ਵੇਲਾ", "WIT": "ਪੂਰਬੀ ਇੰਡੋਨੇਸ਼ੀਆ ਵੇਲਾ", "WITA": "ਮੱਧ ਇੰਡੋਨੇਸ਼ੀਆਈ ਵੇਲਾ", "∅∅∅": "ਅਜੋਰੇਸ ਗਰਮੀਆਂ ਦਾ ਵੇਲਾ"},
    79  	}
    80  }
    81  
    82  // Locale returns the current translators string locale
    83  func (pa *pa_Arab) Locale() string {
    84  	return pa.locale
    85  }
    86  
    87  // PluralsCardinal returns the list of cardinal plural rules associated with 'pa_Arab'
    88  func (pa *pa_Arab) PluralsCardinal() []locales.PluralRule {
    89  	return pa.pluralsCardinal
    90  }
    91  
    92  // PluralsOrdinal returns the list of ordinal plural rules associated with 'pa_Arab'
    93  func (pa *pa_Arab) PluralsOrdinal() []locales.PluralRule {
    94  	return pa.pluralsOrdinal
    95  }
    96  
    97  // PluralsRange returns the list of range plural rules associated with 'pa_Arab'
    98  func (pa *pa_Arab) PluralsRange() []locales.PluralRule {
    99  	return pa.pluralsRange
   100  }
   101  
   102  // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'pa_Arab'
   103  func (pa *pa_Arab) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
   104  
   105  	n := math.Abs(num)
   106  
   107  	if n >= 0 && n <= 1 {
   108  		return locales.PluralRuleOne
   109  	}
   110  
   111  	return locales.PluralRuleOther
   112  }
   113  
   114  // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'pa_Arab'
   115  func (pa *pa_Arab) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
   116  	return locales.PluralRuleOther
   117  }
   118  
   119  // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'pa_Arab'
   120  func (pa *pa_Arab) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
   121  
   122  	start := pa.CardinalPluralRule(num1, v1)
   123  	end := pa.CardinalPluralRule(num2, v2)
   124  
   125  	if start == locales.PluralRuleOne && end == locales.PluralRuleOne {
   126  		return locales.PluralRuleOne
   127  	} else if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
   128  		return locales.PluralRuleOther
   129  	} else if start == locales.PluralRuleOther && end == locales.PluralRuleOne {
   130  		return locales.PluralRuleOne
   131  	}
   132  
   133  	return locales.PluralRuleOther
   134  
   135  }
   136  
   137  // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
   138  func (pa *pa_Arab) MonthAbbreviated(month time.Month) string {
   139  	return pa.monthsAbbreviated[month]
   140  }
   141  
   142  // MonthsAbbreviated returns the locales abbreviated months
   143  func (pa *pa_Arab) MonthsAbbreviated() []string {
   144  	return pa.monthsAbbreviated[1:]
   145  }
   146  
   147  // MonthNarrow returns the locales narrow month given the 'month' provided
   148  func (pa *pa_Arab) MonthNarrow(month time.Month) string {
   149  	return pa.monthsNarrow[month]
   150  }
   151  
   152  // MonthsNarrow returns the locales narrow months
   153  func (pa *pa_Arab) MonthsNarrow() []string {
   154  	return pa.monthsNarrow[1:]
   155  }
   156  
   157  // MonthWide returns the locales wide month given the 'month' provided
   158  func (pa *pa_Arab) MonthWide(month time.Month) string {
   159  	return pa.monthsWide[month]
   160  }
   161  
   162  // MonthsWide returns the locales wide months
   163  func (pa *pa_Arab) MonthsWide() []string {
   164  	return pa.monthsWide[1:]
   165  }
   166  
   167  // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
   168  func (pa *pa_Arab) WeekdayAbbreviated(weekday time.Weekday) string {
   169  	return pa.daysAbbreviated[weekday]
   170  }
   171  
   172  // WeekdaysAbbreviated returns the locales abbreviated weekdays
   173  func (pa *pa_Arab) WeekdaysAbbreviated() []string {
   174  	return pa.daysAbbreviated
   175  }
   176  
   177  // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
   178  func (pa *pa_Arab) WeekdayNarrow(weekday time.Weekday) string {
   179  	return pa.daysNarrow[weekday]
   180  }
   181  
   182  // WeekdaysNarrow returns the locales narrow weekdays
   183  func (pa *pa_Arab) WeekdaysNarrow() []string {
   184  	return pa.daysNarrow
   185  }
   186  
   187  // WeekdayShort returns the locales short weekday given the 'weekday' provided
   188  func (pa *pa_Arab) WeekdayShort(weekday time.Weekday) string {
   189  	return pa.daysShort[weekday]
   190  }
   191  
   192  // WeekdaysShort returns the locales short weekdays
   193  func (pa *pa_Arab) WeekdaysShort() []string {
   194  	return pa.daysShort
   195  }
   196  
   197  // WeekdayWide returns the locales wide weekday given the 'weekday' provided
   198  func (pa *pa_Arab) WeekdayWide(weekday time.Weekday) string {
   199  	return pa.daysWide[weekday]
   200  }
   201  
   202  // WeekdaysWide returns the locales wide weekdays
   203  func (pa *pa_Arab) WeekdaysWide() []string {
   204  	return pa.daysWide
   205  }
   206  
   207  // Decimal returns the decimal point of number
   208  func (pa *pa_Arab) Decimal() string {
   209  	return pa.decimal
   210  }
   211  
   212  // Group returns the group of number
   213  func (pa *pa_Arab) Group() string {
   214  	return pa.group
   215  }
   216  
   217  // Group returns the minus sign of number
   218  func (pa *pa_Arab) Minus() string {
   219  	return pa.minus
   220  }
   221  
   222  // FmtNumber returns 'num' with digits/precision of 'v' for 'pa_Arab' and handles both Whole and Real numbers based on 'v'
   223  func (pa *pa_Arab) FmtNumber(num float64, v uint64) string {
   224  
   225  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   226  	l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
   227  	count := 0
   228  	inWhole := v == 0
   229  	inSecondary := false
   230  	groupThreshold := 3
   231  
   232  	b := make([]byte, 0, l)
   233  
   234  	for i := len(s) - 1; i >= 0; i-- {
   235  
   236  		if s[i] == '.' {
   237  			b = append(b, pa.decimal[0])
   238  			inWhole = true
   239  			continue
   240  		}
   241  
   242  		if inWhole {
   243  
   244  			if count == groupThreshold {
   245  				b = append(b, pa.group[0])
   246  				count = 1
   247  
   248  				if !inSecondary {
   249  					inSecondary = true
   250  					groupThreshold = 2
   251  				}
   252  			} else {
   253  				count++
   254  			}
   255  		}
   256  
   257  		b = append(b, s[i])
   258  	}
   259  
   260  	if num < 0 {
   261  		b = append(b, pa.minus[0])
   262  	}
   263  
   264  	// reverse
   265  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   266  		b[i], b[j] = b[j], b[i]
   267  	}
   268  
   269  	return string(b)
   270  }
   271  
   272  // FmtPercent returns 'num' with digits/precision of 'v' for 'pa_Arab' and handles both Whole and Real numbers based on 'v'
   273  // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
   274  func (pa *pa_Arab) FmtPercent(num float64, v uint64) string {
   275  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   276  	l := len(s) + 3
   277  	b := make([]byte, 0, l)
   278  
   279  	for i := len(s) - 1; i >= 0; i-- {
   280  
   281  		if s[i] == '.' {
   282  			b = append(b, pa.decimal[0])
   283  			continue
   284  		}
   285  
   286  		b = append(b, s[i])
   287  	}
   288  
   289  	if num < 0 {
   290  		b = append(b, pa.minus[0])
   291  	}
   292  
   293  	// reverse
   294  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   295  		b[i], b[j] = b[j], b[i]
   296  	}
   297  
   298  	b = append(b, pa.percent...)
   299  
   300  	return string(b)
   301  }
   302  
   303  // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'pa_Arab'
   304  func (pa *pa_Arab) FmtCurrency(num float64, v uint64, currency currency.Type) string {
   305  
   306  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   307  	symbol := pa.currencies[currency]
   308  	l := len(s) + len(symbol) + 5
   309  
   310  	b := make([]byte, 0, l)
   311  
   312  	for i := len(s) - 1; i >= 0; i-- {
   313  
   314  		if s[i] == '.' {
   315  			b = append(b, pa.decimal[0])
   316  			continue
   317  		}
   318  
   319  		b = append(b, s[i])
   320  	}
   321  
   322  	for j := len(symbol) - 1; j >= 0; j-- {
   323  		b = append(b, symbol[j])
   324  	}
   325  
   326  	for j := len(pa.currencyPositivePrefix) - 1; j >= 0; j-- {
   327  		b = append(b, pa.currencyPositivePrefix[j])
   328  	}
   329  
   330  	if num < 0 {
   331  		b = append(b, pa.minus[0])
   332  	}
   333  
   334  	// reverse
   335  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   336  		b[i], b[j] = b[j], b[i]
   337  	}
   338  
   339  	b = append(b, pa.currencyPositiveSuffix...)
   340  
   341  	return string(b)
   342  }
   343  
   344  // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'pa_Arab'
   345  // in accounting notation.
   346  func (pa *pa_Arab) FmtAccounting(num float64, v uint64, currency currency.Type) string {
   347  
   348  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   349  	symbol := pa.currencies[currency]
   350  	l := len(s) + len(symbol) + 5
   351  
   352  	b := make([]byte, 0, l)
   353  
   354  	for i := len(s) - 1; i >= 0; i-- {
   355  
   356  		if s[i] == '.' {
   357  			b = append(b, pa.decimal[0])
   358  			continue
   359  		}
   360  
   361  		b = append(b, s[i])
   362  	}
   363  
   364  	if num < 0 {
   365  
   366  		for j := len(symbol) - 1; j >= 0; j-- {
   367  			b = append(b, symbol[j])
   368  		}
   369  
   370  		for j := len(pa.currencyNegativePrefix) - 1; j >= 0; j-- {
   371  			b = append(b, pa.currencyNegativePrefix[j])
   372  		}
   373  
   374  		b = append(b, pa.minus[0])
   375  
   376  	} else {
   377  
   378  		for j := len(symbol) - 1; j >= 0; j-- {
   379  			b = append(b, symbol[j])
   380  		}
   381  
   382  		for j := len(pa.currencyPositivePrefix) - 1; j >= 0; j-- {
   383  			b = append(b, pa.currencyPositivePrefix[j])
   384  		}
   385  
   386  	}
   387  
   388  	// reverse
   389  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   390  		b[i], b[j] = b[j], b[i]
   391  	}
   392  
   393  	if num < 0 {
   394  		b = append(b, pa.currencyNegativeSuffix...)
   395  	} else {
   396  
   397  		b = append(b, pa.currencyPositiveSuffix...)
   398  	}
   399  
   400  	return string(b)
   401  }
   402  
   403  // FmtDateShort returns the short date representation of 't' for 'pa_Arab'
   404  func (pa *pa_Arab) FmtDateShort(t time.Time) string {
   405  
   406  	b := make([]byte, 0, 32)
   407  
   408  	if t.Day() < 10 {
   409  		b = append(b, '0')
   410  	}
   411  
   412  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   413  	b = append(b, []byte{0x2f}...)
   414  
   415  	if t.Month() < 10 {
   416  		b = append(b, '0')
   417  	}
   418  
   419  	b = strconv.AppendInt(b, int64(t.Month()), 10)
   420  
   421  	b = append(b, []byte{0x2f}...)
   422  
   423  	if t.Year() > 0 {
   424  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   425  	} else {
   426  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   427  	}
   428  
   429  	return string(b)
   430  }
   431  
   432  // FmtDateMedium returns the medium date representation of 't' for 'pa_Arab'
   433  func (pa *pa_Arab) FmtDateMedium(t time.Time) string {
   434  
   435  	b := make([]byte, 0, 32)
   436  
   437  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   438  	b = append(b, []byte{0x20}...)
   439  	b = append(b, pa.monthsAbbreviated[t.Month()]...)
   440  	b = append(b, []byte{0x20}...)
   441  
   442  	if t.Year() > 0 {
   443  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   444  	} else {
   445  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   446  	}
   447  
   448  	return string(b)
   449  }
   450  
   451  // FmtDateLong returns the long date representation of 't' for 'pa_Arab'
   452  func (pa *pa_Arab) FmtDateLong(t time.Time) string {
   453  
   454  	b := make([]byte, 0, 32)
   455  
   456  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   457  	b = append(b, []byte{0x20}...)
   458  	b = append(b, pa.monthsWide[t.Month()]...)
   459  	b = append(b, []byte{0x20}...)
   460  
   461  	if t.Year() > 0 {
   462  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   463  	} else {
   464  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   465  	}
   466  
   467  	return string(b)
   468  }
   469  
   470  // FmtDateFull returns the full date representation of 't' for 'pa_Arab'
   471  func (pa *pa_Arab) FmtDateFull(t time.Time) string {
   472  
   473  	b := make([]byte, 0, 32)
   474  
   475  	b = append(b, pa.daysWide[t.Weekday()]...)
   476  	b = append(b, []byte{0x2c, 0x20}...)
   477  
   478  	if t.Day() < 10 {
   479  		b = append(b, '0')
   480  	}
   481  
   482  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   483  	b = append(b, []byte{0x20}...)
   484  	b = append(b, pa.monthsWide[t.Month()]...)
   485  	b = append(b, []byte{0x20}...)
   486  
   487  	if t.Year() > 0 {
   488  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   489  	} else {
   490  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   491  	}
   492  
   493  	return string(b)
   494  }
   495  
   496  // FmtTimeShort returns the short time representation of 't' for 'pa_Arab'
   497  func (pa *pa_Arab) FmtTimeShort(t time.Time) string {
   498  
   499  	b := make([]byte, 0, 32)
   500  
   501  	h := t.Hour()
   502  
   503  	if h > 12 {
   504  		h -= 12
   505  	}
   506  
   507  	b = strconv.AppendInt(b, int64(h), 10)
   508  	b = append(b, pa.timeSeparator...)
   509  
   510  	if t.Minute() < 10 {
   511  		b = append(b, '0')
   512  	}
   513  
   514  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   515  	b = append(b, []byte{0x20}...)
   516  
   517  	if t.Hour() < 12 {
   518  		b = append(b, pa.periodsAbbreviated[0]...)
   519  	} else {
   520  		b = append(b, pa.periodsAbbreviated[1]...)
   521  	}
   522  
   523  	return string(b)
   524  }
   525  
   526  // FmtTimeMedium returns the medium time representation of 't' for 'pa_Arab'
   527  func (pa *pa_Arab) FmtTimeMedium(t time.Time) string {
   528  
   529  	b := make([]byte, 0, 32)
   530  
   531  	h := t.Hour()
   532  
   533  	if h > 12 {
   534  		h -= 12
   535  	}
   536  
   537  	b = strconv.AppendInt(b, int64(h), 10)
   538  	b = append(b, pa.timeSeparator...)
   539  
   540  	if t.Minute() < 10 {
   541  		b = append(b, '0')
   542  	}
   543  
   544  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   545  	b = append(b, pa.timeSeparator...)
   546  
   547  	if t.Second() < 10 {
   548  		b = append(b, '0')
   549  	}
   550  
   551  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   552  	b = append(b, []byte{0x20}...)
   553  
   554  	if t.Hour() < 12 {
   555  		b = append(b, pa.periodsAbbreviated[0]...)
   556  	} else {
   557  		b = append(b, pa.periodsAbbreviated[1]...)
   558  	}
   559  
   560  	return string(b)
   561  }
   562  
   563  // FmtTimeLong returns the long time representation of 't' for 'pa_Arab'
   564  func (pa *pa_Arab) FmtTimeLong(t time.Time) string {
   565  
   566  	b := make([]byte, 0, 32)
   567  
   568  	h := t.Hour()
   569  
   570  	if h > 12 {
   571  		h -= 12
   572  	}
   573  
   574  	b = strconv.AppendInt(b, int64(h), 10)
   575  	b = append(b, pa.timeSeparator...)
   576  
   577  	if t.Minute() < 10 {
   578  		b = append(b, '0')
   579  	}
   580  
   581  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   582  	b = append(b, pa.timeSeparator...)
   583  
   584  	if t.Second() < 10 {
   585  		b = append(b, '0')
   586  	}
   587  
   588  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   589  	b = append(b, []byte{0x20}...)
   590  
   591  	if t.Hour() < 12 {
   592  		b = append(b, pa.periodsAbbreviated[0]...)
   593  	} else {
   594  		b = append(b, pa.periodsAbbreviated[1]...)
   595  	}
   596  
   597  	b = append(b, []byte{0x20}...)
   598  
   599  	tz, _ := t.Zone()
   600  	b = append(b, tz...)
   601  
   602  	return string(b)
   603  }
   604  
   605  // FmtTimeFull returns the full time representation of 't' for 'pa_Arab'
   606  func (pa *pa_Arab) FmtTimeFull(t time.Time) string {
   607  
   608  	b := make([]byte, 0, 32)
   609  
   610  	h := t.Hour()
   611  
   612  	if h > 12 {
   613  		h -= 12
   614  	}
   615  
   616  	b = strconv.AppendInt(b, int64(h), 10)
   617  	b = append(b, pa.timeSeparator...)
   618  
   619  	if t.Minute() < 10 {
   620  		b = append(b, '0')
   621  	}
   622  
   623  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   624  	b = append(b, pa.timeSeparator...)
   625  
   626  	if t.Second() < 10 {
   627  		b = append(b, '0')
   628  	}
   629  
   630  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   631  	b = append(b, []byte{0x20}...)
   632  
   633  	if t.Hour() < 12 {
   634  		b = append(b, pa.periodsAbbreviated[0]...)
   635  	} else {
   636  		b = append(b, pa.periodsAbbreviated[1]...)
   637  	}
   638  
   639  	b = append(b, []byte{0x20}...)
   640  
   641  	tz, _ := t.Zone()
   642  
   643  	if btz, ok := pa.timezones[tz]; ok {
   644  		b = append(b, btz...)
   645  	} else {
   646  		b = append(b, tz...)
   647  	}
   648  
   649  	return string(b)
   650  }
   651  

View as plain text