...

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

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

     1  package ne_IN
     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 ne_IN struct {
    13  	locale                 string
    14  	pluralsCardinal        []locales.PluralRule
    15  	pluralsOrdinal         []locales.PluralRule
    16  	pluralsRange           []locales.PluralRule
    17  	decimal                string
    18  	group                  string
    19  	minus                  string
    20  	percent                string
    21  	perMille               string
    22  	timeSeparator          string
    23  	inifinity              string
    24  	currencies             []string // idx = enum of currency code
    25  	currencyPositivePrefix string
    26  	currencyNegativePrefix string
    27  	monthsAbbreviated      []string
    28  	monthsNarrow           []string
    29  	monthsWide             []string
    30  	daysAbbreviated        []string
    31  	daysNarrow             []string
    32  	daysShort              []string
    33  	daysWide               []string
    34  	periodsAbbreviated     []string
    35  	periodsNarrow          []string
    36  	periodsShort           []string
    37  	periodsWide            []string
    38  	erasAbbreviated        []string
    39  	erasNarrow             []string
    40  	erasWide               []string
    41  	timezones              map[string]string
    42  }
    43  
    44  // New returns a new instance of translator for the 'ne_IN' locale
    45  func New() locales.Translator {
    46  	return &ne_IN{
    47  		locale:                 "ne_IN",
    48  		pluralsCardinal:        []locales.PluralRule{2, 6},
    49  		pluralsOrdinal:         []locales.PluralRule{2, 6},
    50  		pluralsRange:           []locales.PluralRule{2, 6},
    51  		decimal:                ".",
    52  		group:                  ",",
    53  		minus:                  "-",
    54  		percent:                "%",
    55  		perMille:               "‰",
    56  		timeSeparator:          ":",
    57  		inifinity:              "∞",
    58  		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", "PKR", "PLN", "PLZ", "PTE", "PYG", "QAR", "RHD", "ROL", "RON", "RSD", "RUB", "RUR", "RWF", "SAR", "SBD", "SCR", "SDD", "SDG", "SDP", "SEK", "SGD", "SHP", "SIT", "SKK", "SLL", "SOS", "SRD", "SRG", "SSP", "STD", "STN", "SUR", "SVC", "SYP", "SZL", "THB", "TJR", "TJS", "TMM", "TMT", "TND", "TOP", "TPE", "TRL", "TRY", "TTD", "TWD", "TZS", "UAH", "UAK", "UGS", "UGX", "USD", "USN", "USS", "UYI", "UYP", "UYU", "UYW", "UZS", "VEB", "VEF", "VES", "VND", "VNN", "VUV", "WST", "XAF", "XAG", "XAU", "XBA", "XBB", "XBC", "XBD", "XCD", "XDR", "XEU", "XFO", "XFU", "XOF", "XPD", "XPF", "XPT", "XRE", "XSU", "XTS", "XUA", "XXX", "YDD", "YER", "YUD", "YUM", "YUN", "YUR", "ZAL", "ZAR", "ZMK", "ZMW", "ZRN", "ZRZ", "ZWD", "ZWL", "ZWR"},
    59  		currencyPositivePrefix: " ",
    60  		currencyNegativePrefix: " ",
    61  		monthsAbbreviated:      []string{"", "जनवरी", "फेब्रुअरी", "मार्च", "अप्रिल", "मे", "जुन", "जुलाई", "अगस्ट", "सेप्टेम्बर", "अक्टोबर", "नोभेम्बर", "डिसेम्बर"},
    62  		monthsNarrow:           []string{"", "जन", "फेब", "मार्च", "अप्र", "मे", "जुन", "जुल", "अग", "सेप", "अक्टो", "नोभे", "डिसे"},
    63  		monthsWide:             []string{"", "जनवरी", "फेब्रुअरी", "मार्च", "अप्रिल", "मे", "जुन", "जुलाई", "अगस्ट", "सेप्टेम्बर", "अक्टोबर", "नोभेम्बर", "डिसेम्बर"},
    64  		daysAbbreviated:        []string{"आइत", "सोम", "मङ्गल", "बुध", "बिहि", "शुक्र", "शनि"},
    65  		daysNarrow:             []string{"आ", "सो", "म", "बु", "बि", "शु", "श"},
    66  		daysShort:              []string{"आइत", "सोम", "मङ्गल", "बुध", "बिहि", "शुक्र", "शनि"},
    67  		daysWide:               []string{"आइतबार", "सोमबार", "मङ्गलबार", "बुधबार", "बिहिबार", "शुक्रबार", "शनिबार"},
    68  		periodsAbbreviated:     []string{"पूर्वाह्न", "अपराह्न"},
    69  		periodsNarrow:          []string{"पूर्वाह्न", "अपराह्न"},
    70  		periodsWide:            []string{"पूर्वाह्न", "अपराह्न"},
    71  		erasAbbreviated:        []string{"ईसा पूर्व", "सन्"},
    72  		erasNarrow:             []string{"", ""},
    73  		erasWide:               []string{"ईसा पूर्व", "सन्"},
    74  		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": "केन्द्रीय इन्डोनेशिया समय", "∅∅∅": "ब्राजिलीया ग्रीष्मकालीन समय"},
    75  	}
    76  }
    77  
    78  // Locale returns the current translators string locale
    79  func (ne *ne_IN) Locale() string {
    80  	return ne.locale
    81  }
    82  
    83  // PluralsCardinal returns the list of cardinal plural rules associated with 'ne_IN'
    84  func (ne *ne_IN) PluralsCardinal() []locales.PluralRule {
    85  	return ne.pluralsCardinal
    86  }
    87  
    88  // PluralsOrdinal returns the list of ordinal plural rules associated with 'ne_IN'
    89  func (ne *ne_IN) PluralsOrdinal() []locales.PluralRule {
    90  	return ne.pluralsOrdinal
    91  }
    92  
    93  // PluralsRange returns the list of range plural rules associated with 'ne_IN'
    94  func (ne *ne_IN) PluralsRange() []locales.PluralRule {
    95  	return ne.pluralsRange
    96  }
    97  
    98  // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'ne_IN'
    99  func (ne *ne_IN) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
   100  
   101  	n := math.Abs(num)
   102  
   103  	if n == 1 {
   104  		return locales.PluralRuleOne
   105  	}
   106  
   107  	return locales.PluralRuleOther
   108  }
   109  
   110  // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'ne_IN'
   111  func (ne *ne_IN) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
   112  
   113  	n := math.Abs(num)
   114  
   115  	if n >= 1 && n <= 4 {
   116  		return locales.PluralRuleOne
   117  	}
   118  
   119  	return locales.PluralRuleOther
   120  }
   121  
   122  // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'ne_IN'
   123  func (ne *ne_IN) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
   124  
   125  	start := ne.CardinalPluralRule(num1, v1)
   126  	end := ne.CardinalPluralRule(num2, v2)
   127  
   128  	if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
   129  		return locales.PluralRuleOther
   130  	} else if start == locales.PluralRuleOther && end == locales.PluralRuleOne {
   131  		return locales.PluralRuleOne
   132  	}
   133  
   134  	return locales.PluralRuleOther
   135  
   136  }
   137  
   138  // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
   139  func (ne *ne_IN) MonthAbbreviated(month time.Month) string {
   140  	return ne.monthsAbbreviated[month]
   141  }
   142  
   143  // MonthsAbbreviated returns the locales abbreviated months
   144  func (ne *ne_IN) MonthsAbbreviated() []string {
   145  	return ne.monthsAbbreviated[1:]
   146  }
   147  
   148  // MonthNarrow returns the locales narrow month given the 'month' provided
   149  func (ne *ne_IN) MonthNarrow(month time.Month) string {
   150  	return ne.monthsNarrow[month]
   151  }
   152  
   153  // MonthsNarrow returns the locales narrow months
   154  func (ne *ne_IN) MonthsNarrow() []string {
   155  	return ne.monthsNarrow[1:]
   156  }
   157  
   158  // MonthWide returns the locales wide month given the 'month' provided
   159  func (ne *ne_IN) MonthWide(month time.Month) string {
   160  	return ne.monthsWide[month]
   161  }
   162  
   163  // MonthsWide returns the locales wide months
   164  func (ne *ne_IN) MonthsWide() []string {
   165  	return ne.monthsWide[1:]
   166  }
   167  
   168  // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
   169  func (ne *ne_IN) WeekdayAbbreviated(weekday time.Weekday) string {
   170  	return ne.daysAbbreviated[weekday]
   171  }
   172  
   173  // WeekdaysAbbreviated returns the locales abbreviated weekdays
   174  func (ne *ne_IN) WeekdaysAbbreviated() []string {
   175  	return ne.daysAbbreviated
   176  }
   177  
   178  // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
   179  func (ne *ne_IN) WeekdayNarrow(weekday time.Weekday) string {
   180  	return ne.daysNarrow[weekday]
   181  }
   182  
   183  // WeekdaysNarrow returns the locales narrow weekdays
   184  func (ne *ne_IN) WeekdaysNarrow() []string {
   185  	return ne.daysNarrow
   186  }
   187  
   188  // WeekdayShort returns the locales short weekday given the 'weekday' provided
   189  func (ne *ne_IN) WeekdayShort(weekday time.Weekday) string {
   190  	return ne.daysShort[weekday]
   191  }
   192  
   193  // WeekdaysShort returns the locales short weekdays
   194  func (ne *ne_IN) WeekdaysShort() []string {
   195  	return ne.daysShort
   196  }
   197  
   198  // WeekdayWide returns the locales wide weekday given the 'weekday' provided
   199  func (ne *ne_IN) WeekdayWide(weekday time.Weekday) string {
   200  	return ne.daysWide[weekday]
   201  }
   202  
   203  // WeekdaysWide returns the locales wide weekdays
   204  func (ne *ne_IN) WeekdaysWide() []string {
   205  	return ne.daysWide
   206  }
   207  
   208  // Decimal returns the decimal point of number
   209  func (ne *ne_IN) Decimal() string {
   210  	return ne.decimal
   211  }
   212  
   213  // Group returns the group of number
   214  func (ne *ne_IN) Group() string {
   215  	return ne.group
   216  }
   217  
   218  // Group returns the minus sign of number
   219  func (ne *ne_IN) Minus() string {
   220  	return ne.minus
   221  }
   222  
   223  // FmtNumber returns 'num' with digits/precision of 'v' for 'ne_IN' and handles both Whole and Real numbers based on 'v'
   224  func (ne *ne_IN) FmtNumber(num float64, v uint64) string {
   225  
   226  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   227  	l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
   228  	count := 0
   229  	inWhole := v == 0
   230  	b := make([]byte, 0, l)
   231  
   232  	for i := len(s) - 1; i >= 0; i-- {
   233  
   234  		if s[i] == '.' {
   235  			b = append(b, ne.decimal[0])
   236  			inWhole = true
   237  			continue
   238  		}
   239  
   240  		if inWhole {
   241  			if count == 3 {
   242  				b = append(b, ne.group[0])
   243  				count = 1
   244  			} else {
   245  				count++
   246  			}
   247  		}
   248  
   249  		b = append(b, s[i])
   250  	}
   251  
   252  	if num < 0 {
   253  		b = append(b, ne.minus[0])
   254  	}
   255  
   256  	// reverse
   257  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   258  		b[i], b[j] = b[j], b[i]
   259  	}
   260  
   261  	return string(b)
   262  }
   263  
   264  // FmtPercent returns 'num' with digits/precision of 'v' for 'ne_IN' and handles both Whole and Real numbers based on 'v'
   265  // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
   266  func (ne *ne_IN) FmtPercent(num float64, v uint64) string {
   267  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   268  	l := len(s) + 3
   269  	b := make([]byte, 0, l)
   270  
   271  	for i := len(s) - 1; i >= 0; i-- {
   272  
   273  		if s[i] == '.' {
   274  			b = append(b, ne.decimal[0])
   275  			continue
   276  		}
   277  
   278  		b = append(b, s[i])
   279  	}
   280  
   281  	if num < 0 {
   282  		b = append(b, ne.minus[0])
   283  	}
   284  
   285  	// reverse
   286  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   287  		b[i], b[j] = b[j], b[i]
   288  	}
   289  
   290  	b = append(b, ne.percent...)
   291  
   292  	return string(b)
   293  }
   294  
   295  // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'ne_IN'
   296  func (ne *ne_IN) FmtCurrency(num float64, v uint64, currency currency.Type) string {
   297  
   298  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   299  	symbol := ne.currencies[currency]
   300  	l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
   301  	count := 0
   302  	inWhole := v == 0
   303  	b := make([]byte, 0, l)
   304  
   305  	for i := len(s) - 1; i >= 0; i-- {
   306  
   307  		if s[i] == '.' {
   308  			b = append(b, ne.decimal[0])
   309  			inWhole = true
   310  			continue
   311  		}
   312  
   313  		if inWhole {
   314  			if count == 3 {
   315  				b = append(b, ne.group[0])
   316  				count = 1
   317  			} else {
   318  				count++
   319  			}
   320  		}
   321  
   322  		b = append(b, s[i])
   323  	}
   324  
   325  	for j := len(symbol) - 1; j >= 0; j-- {
   326  		b = append(b, symbol[j])
   327  	}
   328  
   329  	for j := len(ne.currencyPositivePrefix) - 1; j >= 0; j-- {
   330  		b = append(b, ne.currencyPositivePrefix[j])
   331  	}
   332  
   333  	if num < 0 {
   334  		b = append(b, ne.minus[0])
   335  	}
   336  
   337  	// reverse
   338  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   339  		b[i], b[j] = b[j], b[i]
   340  	}
   341  
   342  	if int(v) < 2 {
   343  
   344  		if v == 0 {
   345  			b = append(b, ne.decimal...)
   346  		}
   347  
   348  		for i := 0; i < 2-int(v); i++ {
   349  			b = append(b, '0')
   350  		}
   351  	}
   352  
   353  	return string(b)
   354  }
   355  
   356  // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ne_IN'
   357  // in accounting notation.
   358  func (ne *ne_IN) FmtAccounting(num float64, v uint64, currency currency.Type) string {
   359  
   360  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   361  	symbol := ne.currencies[currency]
   362  	l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
   363  	count := 0
   364  	inWhole := v == 0
   365  	b := make([]byte, 0, l)
   366  
   367  	for i := len(s) - 1; i >= 0; i-- {
   368  
   369  		if s[i] == '.' {
   370  			b = append(b, ne.decimal[0])
   371  			inWhole = true
   372  			continue
   373  		}
   374  
   375  		if inWhole {
   376  			if count == 3 {
   377  				b = append(b, ne.group[0])
   378  				count = 1
   379  			} else {
   380  				count++
   381  			}
   382  		}
   383  
   384  		b = append(b, s[i])
   385  	}
   386  
   387  	if num < 0 {
   388  
   389  		for j := len(symbol) - 1; j >= 0; j-- {
   390  			b = append(b, symbol[j])
   391  		}
   392  
   393  		for j := len(ne.currencyNegativePrefix) - 1; j >= 0; j-- {
   394  			b = append(b, ne.currencyNegativePrefix[j])
   395  		}
   396  
   397  		b = append(b, ne.minus[0])
   398  
   399  	} else {
   400  
   401  		for j := len(symbol) - 1; j >= 0; j-- {
   402  			b = append(b, symbol[j])
   403  		}
   404  
   405  		for j := len(ne.currencyPositivePrefix) - 1; j >= 0; j-- {
   406  			b = append(b, ne.currencyPositivePrefix[j])
   407  		}
   408  
   409  	}
   410  
   411  	// reverse
   412  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   413  		b[i], b[j] = b[j], b[i]
   414  	}
   415  
   416  	if int(v) < 2 {
   417  
   418  		if v == 0 {
   419  			b = append(b, ne.decimal...)
   420  		}
   421  
   422  		for i := 0; i < 2-int(v); i++ {
   423  			b = append(b, '0')
   424  		}
   425  	}
   426  
   427  	return string(b)
   428  }
   429  
   430  // FmtDateShort returns the short date representation of 't' for 'ne_IN'
   431  func (ne *ne_IN) FmtDateShort(t time.Time) string {
   432  
   433  	b := make([]byte, 0, 32)
   434  
   435  	if t.Year() > 9 {
   436  		b = append(b, strconv.Itoa(t.Year())[2:]...)
   437  	} else {
   438  		b = append(b, strconv.Itoa(t.Year())[1:]...)
   439  	}
   440  
   441  	b = append(b, []byte{0x2f}...)
   442  	b = strconv.AppendInt(b, int64(t.Month()), 10)
   443  	b = append(b, []byte{0x2f}...)
   444  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   445  
   446  	return string(b)
   447  }
   448  
   449  // FmtDateMedium returns the medium date representation of 't' for 'ne_IN'
   450  func (ne *ne_IN) FmtDateMedium(t time.Time) string {
   451  
   452  	b := make([]byte, 0, 32)
   453  
   454  	if t.Year() > 0 {
   455  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   456  	} else {
   457  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   458  	}
   459  
   460  	b = append(b, []byte{0x20}...)
   461  	b = append(b, ne.monthsAbbreviated[t.Month()]...)
   462  	b = append(b, []byte{0x20}...)
   463  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   464  
   465  	return string(b)
   466  }
   467  
   468  // FmtDateLong returns the long date representation of 't' for 'ne_IN'
   469  func (ne *ne_IN) FmtDateLong(t time.Time) string {
   470  
   471  	b := make([]byte, 0, 32)
   472  
   473  	if t.Year() > 0 {
   474  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   475  	} else {
   476  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   477  	}
   478  
   479  	b = append(b, []byte{0x20}...)
   480  	b = append(b, ne.monthsWide[t.Month()]...)
   481  	b = append(b, []byte{0x20}...)
   482  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   483  
   484  	return string(b)
   485  }
   486  
   487  // FmtDateFull returns the full date representation of 't' for 'ne_IN'
   488  func (ne *ne_IN) FmtDateFull(t time.Time) string {
   489  
   490  	b := make([]byte, 0, 32)
   491  
   492  	if t.Year() > 0 {
   493  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   494  	} else {
   495  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   496  	}
   497  
   498  	b = append(b, []byte{0x20}...)
   499  	b = append(b, ne.monthsWide[t.Month()]...)
   500  	b = append(b, []byte{0x20}...)
   501  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   502  	b = append(b, []byte{0x2c, 0x20}...)
   503  	b = append(b, ne.daysWide[t.Weekday()]...)
   504  
   505  	return string(b)
   506  }
   507  
   508  // FmtTimeShort returns the short time representation of 't' for 'ne_IN'
   509  func (ne *ne_IN) FmtTimeShort(t time.Time) string {
   510  
   511  	b := make([]byte, 0, 32)
   512  
   513  	h := t.Hour()
   514  
   515  	if h > 12 {
   516  		h -= 12
   517  	}
   518  
   519  	b = strconv.AppendInt(b, int64(h), 10)
   520  	b = append(b, ne.timeSeparator...)
   521  
   522  	if t.Minute() < 10 {
   523  		b = append(b, '0')
   524  	}
   525  
   526  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   527  	b = append(b, []byte{0x20}...)
   528  
   529  	if t.Hour() < 12 {
   530  		b = append(b, ne.periodsAbbreviated[0]...)
   531  	} else {
   532  		b = append(b, ne.periodsAbbreviated[1]...)
   533  	}
   534  
   535  	return string(b)
   536  }
   537  
   538  // FmtTimeMedium returns the medium time representation of 't' for 'ne_IN'
   539  func (ne *ne_IN) FmtTimeMedium(t time.Time) string {
   540  
   541  	b := make([]byte, 0, 32)
   542  
   543  	h := t.Hour()
   544  
   545  	if h > 12 {
   546  		h -= 12
   547  	}
   548  
   549  	b = strconv.AppendInt(b, int64(h), 10)
   550  	b = append(b, ne.timeSeparator...)
   551  
   552  	if t.Minute() < 10 {
   553  		b = append(b, '0')
   554  	}
   555  
   556  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   557  	b = append(b, ne.timeSeparator...)
   558  
   559  	if t.Second() < 10 {
   560  		b = append(b, '0')
   561  	}
   562  
   563  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   564  	b = append(b, []byte{0x20}...)
   565  
   566  	if t.Hour() < 12 {
   567  		b = append(b, ne.periodsAbbreviated[0]...)
   568  	} else {
   569  		b = append(b, ne.periodsAbbreviated[1]...)
   570  	}
   571  
   572  	return string(b)
   573  }
   574  
   575  // FmtTimeLong returns the long time representation of 't' for 'ne_IN'
   576  func (ne *ne_IN) FmtTimeLong(t time.Time) string {
   577  
   578  	b := make([]byte, 0, 32)
   579  
   580  	h := t.Hour()
   581  
   582  	if h > 12 {
   583  		h -= 12
   584  	}
   585  
   586  	b = strconv.AppendInt(b, int64(h), 10)
   587  	b = append(b, ne.timeSeparator...)
   588  
   589  	if t.Minute() < 10 {
   590  		b = append(b, '0')
   591  	}
   592  
   593  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   594  	b = append(b, ne.timeSeparator...)
   595  
   596  	if t.Second() < 10 {
   597  		b = append(b, '0')
   598  	}
   599  
   600  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   601  	b = append(b, []byte{0x20}...)
   602  
   603  	if t.Hour() < 12 {
   604  		b = append(b, ne.periodsAbbreviated[0]...)
   605  	} else {
   606  		b = append(b, ne.periodsAbbreviated[1]...)
   607  	}
   608  
   609  	b = append(b, []byte{0x20}...)
   610  
   611  	tz, _ := t.Zone()
   612  	b = append(b, tz...)
   613  
   614  	return string(b)
   615  }
   616  
   617  // FmtTimeFull returns the full time representation of 't' for 'ne_IN'
   618  func (ne *ne_IN) FmtTimeFull(t time.Time) string {
   619  
   620  	b := make([]byte, 0, 32)
   621  
   622  	h := t.Hour()
   623  
   624  	if h > 12 {
   625  		h -= 12
   626  	}
   627  
   628  	b = strconv.AppendInt(b, int64(h), 10)
   629  	b = append(b, ne.timeSeparator...)
   630  
   631  	if t.Minute() < 10 {
   632  		b = append(b, '0')
   633  	}
   634  
   635  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   636  	b = append(b, ne.timeSeparator...)
   637  
   638  	if t.Second() < 10 {
   639  		b = append(b, '0')
   640  	}
   641  
   642  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   643  	b = append(b, []byte{0x20}...)
   644  
   645  	if t.Hour() < 12 {
   646  		b = append(b, ne.periodsAbbreviated[0]...)
   647  	} else {
   648  		b = append(b, ne.periodsAbbreviated[1]...)
   649  	}
   650  
   651  	b = append(b, []byte{0x20}...)
   652  
   653  	tz, _ := t.Zone()
   654  
   655  	if btz, ok := ne.timezones[tz]; ok {
   656  		b = append(b, btz...)
   657  	} else {
   658  		b = append(b, tz...)
   659  	}
   660  
   661  	return string(b)
   662  }
   663  

View as plain text