...

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

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

     1  package he_IL
     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 he_IL 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  	currencyPositiveSuffix string
    26  	currencyNegativeSuffix 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 'he_IL' locale
    45  func New() locales.Translator {
    46  	return &he_IL{
    47  		locale:                 "he_IL",
    48  		pluralsCardinal:        []locales.PluralRule{2, 3, 5, 6},
    49  		pluralsOrdinal:         []locales.PluralRule{6},
    50  		pluralsRange:           []locales.PluralRule{5, 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  		currencyPositiveSuffix: " ",
    60  		currencyNegativeSuffix: " ",
    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{"א׳", "ב׳", "ג׳", "ד׳", "ה׳", "ו׳", "ש׳"},
    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": "שעון גריניץ׳\u200f", "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 (he *he_IL) Locale() string {
    80  	return he.locale
    81  }
    82  
    83  // PluralsCardinal returns the list of cardinal plural rules associated with 'he_IL'
    84  func (he *he_IL) PluralsCardinal() []locales.PluralRule {
    85  	return he.pluralsCardinal
    86  }
    87  
    88  // PluralsOrdinal returns the list of ordinal plural rules associated with 'he_IL'
    89  func (he *he_IL) PluralsOrdinal() []locales.PluralRule {
    90  	return he.pluralsOrdinal
    91  }
    92  
    93  // PluralsRange returns the list of range plural rules associated with 'he_IL'
    94  func (he *he_IL) PluralsRange() []locales.PluralRule {
    95  	return he.pluralsRange
    96  }
    97  
    98  // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'he_IL'
    99  func (he *he_IL) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
   100  
   101  	n := math.Abs(num)
   102  	i := int64(n)
   103  	nMod10 := math.Mod(n, 10)
   104  
   105  	if i == 1 && v == 0 {
   106  		return locales.PluralRuleOne
   107  	} else if i == 2 && v == 0 {
   108  		return locales.PluralRuleTwo
   109  	} else if v == 0 && (n < 0 || n > 10) && nMod10 == 0 {
   110  		return locales.PluralRuleMany
   111  	}
   112  
   113  	return locales.PluralRuleOther
   114  }
   115  
   116  // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'he_IL'
   117  func (he *he_IL) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
   118  	return locales.PluralRuleOther
   119  }
   120  
   121  // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'he_IL'
   122  func (he *he_IL) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
   123  
   124  	start := he.CardinalPluralRule(num1, v1)
   125  	end := he.CardinalPluralRule(num2, v2)
   126  
   127  	if start == locales.PluralRuleOne && end == locales.PluralRuleTwo {
   128  		return locales.PluralRuleOther
   129  	} else if start == locales.PluralRuleOne && end == locales.PluralRuleMany {
   130  		return locales.PluralRuleMany
   131  	} else if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
   132  		return locales.PluralRuleOther
   133  	} else if start == locales.PluralRuleTwo && end == locales.PluralRuleMany {
   134  		return locales.PluralRuleOther
   135  	} else if start == locales.PluralRuleTwo && end == locales.PluralRuleOther {
   136  		return locales.PluralRuleOther
   137  	} else if start == locales.PluralRuleMany && end == locales.PluralRuleMany {
   138  		return locales.PluralRuleMany
   139  	} else if start == locales.PluralRuleMany && end == locales.PluralRuleOther {
   140  		return locales.PluralRuleMany
   141  	} else if start == locales.PluralRuleOther && end == locales.PluralRuleOne {
   142  		return locales.PluralRuleOther
   143  	} else if start == locales.PluralRuleOther && end == locales.PluralRuleTwo {
   144  		return locales.PluralRuleOther
   145  	} else if start == locales.PluralRuleOther && end == locales.PluralRuleMany {
   146  		return locales.PluralRuleMany
   147  	}
   148  
   149  	return locales.PluralRuleOther
   150  
   151  }
   152  
   153  // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
   154  func (he *he_IL) MonthAbbreviated(month time.Month) string {
   155  	return he.monthsAbbreviated[month]
   156  }
   157  
   158  // MonthsAbbreviated returns the locales abbreviated months
   159  func (he *he_IL) MonthsAbbreviated() []string {
   160  	return he.monthsAbbreviated[1:]
   161  }
   162  
   163  // MonthNarrow returns the locales narrow month given the 'month' provided
   164  func (he *he_IL) MonthNarrow(month time.Month) string {
   165  	return he.monthsNarrow[month]
   166  }
   167  
   168  // MonthsNarrow returns the locales narrow months
   169  func (he *he_IL) MonthsNarrow() []string {
   170  	return he.monthsNarrow[1:]
   171  }
   172  
   173  // MonthWide returns the locales wide month given the 'month' provided
   174  func (he *he_IL) MonthWide(month time.Month) string {
   175  	return he.monthsWide[month]
   176  }
   177  
   178  // MonthsWide returns the locales wide months
   179  func (he *he_IL) MonthsWide() []string {
   180  	return he.monthsWide[1:]
   181  }
   182  
   183  // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
   184  func (he *he_IL) WeekdayAbbreviated(weekday time.Weekday) string {
   185  	return he.daysAbbreviated[weekday]
   186  }
   187  
   188  // WeekdaysAbbreviated returns the locales abbreviated weekdays
   189  func (he *he_IL) WeekdaysAbbreviated() []string {
   190  	return he.daysAbbreviated
   191  }
   192  
   193  // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
   194  func (he *he_IL) WeekdayNarrow(weekday time.Weekday) string {
   195  	return he.daysNarrow[weekday]
   196  }
   197  
   198  // WeekdaysNarrow returns the locales narrow weekdays
   199  func (he *he_IL) WeekdaysNarrow() []string {
   200  	return he.daysNarrow
   201  }
   202  
   203  // WeekdayShort returns the locales short weekday given the 'weekday' provided
   204  func (he *he_IL) WeekdayShort(weekday time.Weekday) string {
   205  	return he.daysShort[weekday]
   206  }
   207  
   208  // WeekdaysShort returns the locales short weekdays
   209  func (he *he_IL) WeekdaysShort() []string {
   210  	return he.daysShort
   211  }
   212  
   213  // WeekdayWide returns the locales wide weekday given the 'weekday' provided
   214  func (he *he_IL) WeekdayWide(weekday time.Weekday) string {
   215  	return he.daysWide[weekday]
   216  }
   217  
   218  // WeekdaysWide returns the locales wide weekdays
   219  func (he *he_IL) WeekdaysWide() []string {
   220  	return he.daysWide
   221  }
   222  
   223  // Decimal returns the decimal point of number
   224  func (he *he_IL) Decimal() string {
   225  	return he.decimal
   226  }
   227  
   228  // Group returns the group of number
   229  func (he *he_IL) Group() string {
   230  	return he.group
   231  }
   232  
   233  // Group returns the minus sign of number
   234  func (he *he_IL) Minus() string {
   235  	return he.minus
   236  }
   237  
   238  // FmtNumber returns 'num' with digits/precision of 'v' for 'he_IL' and handles both Whole and Real numbers based on 'v'
   239  func (he *he_IL) FmtNumber(num float64, v uint64) string {
   240  
   241  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   242  	l := len(s) + 5 + 1*len(s[:len(s)-int(v)-1])/3
   243  	count := 0
   244  	inWhole := v == 0
   245  	b := make([]byte, 0, l)
   246  
   247  	for i := len(s) - 1; i >= 0; i-- {
   248  
   249  		if s[i] == '.' {
   250  			b = append(b, he.decimal[0])
   251  			inWhole = true
   252  			continue
   253  		}
   254  
   255  		if inWhole {
   256  			if count == 3 {
   257  				b = append(b, he.group[0])
   258  				count = 1
   259  			} else {
   260  				count++
   261  			}
   262  		}
   263  
   264  		b = append(b, s[i])
   265  	}
   266  
   267  	if num < 0 {
   268  		for j := len(he.minus) - 1; j >= 0; j-- {
   269  			b = append(b, he.minus[j])
   270  		}
   271  	}
   272  
   273  	// reverse
   274  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   275  		b[i], b[j] = b[j], b[i]
   276  	}
   277  
   278  	return string(b)
   279  }
   280  
   281  // FmtPercent returns 'num' with digits/precision of 'v' for 'he_IL' and handles both Whole and Real numbers based on 'v'
   282  // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
   283  func (he *he_IL) FmtPercent(num float64, v uint64) string {
   284  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   285  	l := len(s) + 6
   286  	b := make([]byte, 0, l)
   287  
   288  	for i := len(s) - 1; i >= 0; i-- {
   289  
   290  		if s[i] == '.' {
   291  			b = append(b, he.decimal[0])
   292  			continue
   293  		}
   294  
   295  		b = append(b, s[i])
   296  	}
   297  
   298  	if num < 0 {
   299  		for j := len(he.minus) - 1; j >= 0; j-- {
   300  			b = append(b, he.minus[j])
   301  		}
   302  	}
   303  
   304  	// reverse
   305  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   306  		b[i], b[j] = b[j], b[i]
   307  	}
   308  
   309  	b = append(b, he.percent...)
   310  
   311  	return string(b)
   312  }
   313  
   314  // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'he_IL'
   315  func (he *he_IL) FmtCurrency(num float64, v uint64, currency currency.Type) string {
   316  
   317  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   318  	symbol := he.currencies[currency]
   319  	l := len(s) + len(symbol) + 7 + 1*len(s[:len(s)-int(v)-1])/3
   320  	count := 0
   321  	inWhole := v == 0
   322  	b := make([]byte, 0, l)
   323  
   324  	for i := len(s) - 1; i >= 0; i-- {
   325  
   326  		if s[i] == '.' {
   327  			b = append(b, he.decimal[0])
   328  			inWhole = true
   329  			continue
   330  		}
   331  
   332  		if inWhole {
   333  			if count == 3 {
   334  				b = append(b, he.group[0])
   335  				count = 1
   336  			} else {
   337  				count++
   338  			}
   339  		}
   340  
   341  		b = append(b, s[i])
   342  	}
   343  
   344  	if num < 0 {
   345  		for j := len(he.minus) - 1; j >= 0; j-- {
   346  			b = append(b, he.minus[j])
   347  		}
   348  	}
   349  
   350  	// reverse
   351  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   352  		b[i], b[j] = b[j], b[i]
   353  	}
   354  
   355  	if int(v) < 2 {
   356  
   357  		if v == 0 {
   358  			b = append(b, he.decimal...)
   359  		}
   360  
   361  		for i := 0; i < 2-int(v); i++ {
   362  			b = append(b, '0')
   363  		}
   364  	}
   365  
   366  	b = append(b, he.currencyPositiveSuffix...)
   367  
   368  	b = append(b, symbol...)
   369  
   370  	return string(b)
   371  }
   372  
   373  // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'he_IL'
   374  // in accounting notation.
   375  func (he *he_IL) FmtAccounting(num float64, v uint64, currency currency.Type) string {
   376  
   377  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   378  	symbol := he.currencies[currency]
   379  	l := len(s) + len(symbol) + 7 + 1*len(s[:len(s)-int(v)-1])/3
   380  	count := 0
   381  	inWhole := v == 0
   382  	b := make([]byte, 0, l)
   383  
   384  	for i := len(s) - 1; i >= 0; i-- {
   385  
   386  		if s[i] == '.' {
   387  			b = append(b, he.decimal[0])
   388  			inWhole = true
   389  			continue
   390  		}
   391  
   392  		if inWhole {
   393  			if count == 3 {
   394  				b = append(b, he.group[0])
   395  				count = 1
   396  			} else {
   397  				count++
   398  			}
   399  		}
   400  
   401  		b = append(b, s[i])
   402  	}
   403  
   404  	if num < 0 {
   405  
   406  		for j := len(he.minus) - 1; j >= 0; j-- {
   407  			b = append(b, he.minus[j])
   408  		}
   409  
   410  	}
   411  
   412  	// reverse
   413  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   414  		b[i], b[j] = b[j], b[i]
   415  	}
   416  
   417  	if int(v) < 2 {
   418  
   419  		if v == 0 {
   420  			b = append(b, he.decimal...)
   421  		}
   422  
   423  		for i := 0; i < 2-int(v); i++ {
   424  			b = append(b, '0')
   425  		}
   426  	}
   427  
   428  	if num < 0 {
   429  		b = append(b, he.currencyNegativeSuffix...)
   430  		b = append(b, symbol...)
   431  	} else {
   432  
   433  		b = append(b, he.currencyPositiveSuffix...)
   434  		b = append(b, symbol...)
   435  	}
   436  
   437  	return string(b)
   438  }
   439  
   440  // FmtDateShort returns the short date representation of 't' for 'he_IL'
   441  func (he *he_IL) FmtDateShort(t time.Time) string {
   442  
   443  	b := make([]byte, 0, 32)
   444  
   445  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   446  	b = append(b, []byte{0x2e}...)
   447  	b = strconv.AppendInt(b, int64(t.Month()), 10)
   448  	b = append(b, []byte{0x2e}...)
   449  
   450  	if t.Year() > 0 {
   451  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   452  	} else {
   453  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   454  	}
   455  
   456  	return string(b)
   457  }
   458  
   459  // FmtDateMedium returns the medium date representation of 't' for 'he_IL'
   460  func (he *he_IL) FmtDateMedium(t time.Time) string {
   461  
   462  	b := make([]byte, 0, 32)
   463  
   464  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   465  	b = append(b, []byte{0x20, 0xd7, 0x91}...)
   466  	b = append(b, he.monthsAbbreviated[t.Month()]...)
   467  	b = append(b, []byte{0x20}...)
   468  
   469  	if t.Year() > 0 {
   470  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   471  	} else {
   472  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   473  	}
   474  
   475  	return string(b)
   476  }
   477  
   478  // FmtDateLong returns the long date representation of 't' for 'he_IL'
   479  func (he *he_IL) FmtDateLong(t time.Time) string {
   480  
   481  	b := make([]byte, 0, 32)
   482  
   483  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   484  	b = append(b, []byte{0x20, 0xd7, 0x91}...)
   485  	b = append(b, he.monthsWide[t.Month()]...)
   486  	b = append(b, []byte{0x20}...)
   487  
   488  	if t.Year() > 0 {
   489  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   490  	} else {
   491  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   492  	}
   493  
   494  	return string(b)
   495  }
   496  
   497  // FmtDateFull returns the full date representation of 't' for 'he_IL'
   498  func (he *he_IL) FmtDateFull(t time.Time) string {
   499  
   500  	b := make([]byte, 0, 32)
   501  
   502  	b = append(b, he.daysWide[t.Weekday()]...)
   503  	b = append(b, []byte{0x2c, 0x20}...)
   504  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   505  	b = append(b, []byte{0x20, 0xd7, 0x91}...)
   506  	b = append(b, he.monthsWide[t.Month()]...)
   507  	b = append(b, []byte{0x20}...)
   508  
   509  	if t.Year() > 0 {
   510  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   511  	} else {
   512  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   513  	}
   514  
   515  	return string(b)
   516  }
   517  
   518  // FmtTimeShort returns the short time representation of 't' for 'he_IL'
   519  func (he *he_IL) FmtTimeShort(t time.Time) string {
   520  
   521  	b := make([]byte, 0, 32)
   522  
   523  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   524  	b = append(b, he.timeSeparator...)
   525  
   526  	if t.Minute() < 10 {
   527  		b = append(b, '0')
   528  	}
   529  
   530  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   531  
   532  	return string(b)
   533  }
   534  
   535  // FmtTimeMedium returns the medium time representation of 't' for 'he_IL'
   536  func (he *he_IL) FmtTimeMedium(t time.Time) string {
   537  
   538  	b := make([]byte, 0, 32)
   539  
   540  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   541  	b = append(b, he.timeSeparator...)
   542  
   543  	if t.Minute() < 10 {
   544  		b = append(b, '0')
   545  	}
   546  
   547  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   548  	b = append(b, he.timeSeparator...)
   549  
   550  	if t.Second() < 10 {
   551  		b = append(b, '0')
   552  	}
   553  
   554  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   555  
   556  	return string(b)
   557  }
   558  
   559  // FmtTimeLong returns the long time representation of 't' for 'he_IL'
   560  func (he *he_IL) FmtTimeLong(t time.Time) string {
   561  
   562  	b := make([]byte, 0, 32)
   563  
   564  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   565  	b = append(b, he.timeSeparator...)
   566  
   567  	if t.Minute() < 10 {
   568  		b = append(b, '0')
   569  	}
   570  
   571  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   572  	b = append(b, he.timeSeparator...)
   573  
   574  	if t.Second() < 10 {
   575  		b = append(b, '0')
   576  	}
   577  
   578  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   579  	b = append(b, []byte{0x20}...)
   580  
   581  	tz, _ := t.Zone()
   582  	b = append(b, tz...)
   583  
   584  	return string(b)
   585  }
   586  
   587  // FmtTimeFull returns the full time representation of 't' for 'he_IL'
   588  func (he *he_IL) FmtTimeFull(t time.Time) string {
   589  
   590  	b := make([]byte, 0, 32)
   591  
   592  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   593  	b = append(b, he.timeSeparator...)
   594  
   595  	if t.Minute() < 10 {
   596  		b = append(b, '0')
   597  	}
   598  
   599  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   600  	b = append(b, he.timeSeparator...)
   601  
   602  	if t.Second() < 10 {
   603  		b = append(b, '0')
   604  	}
   605  
   606  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   607  	b = append(b, []byte{0x20}...)
   608  
   609  	tz, _ := t.Zone()
   610  
   611  	if btz, ok := he.timezones[tz]; ok {
   612  		b = append(b, btz...)
   613  	} else {
   614  		b = append(b, tz...)
   615  	}
   616  
   617  	return string(b)
   618  }
   619  

View as plain text