...

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

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

     1  package ga_IE
     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 ga_IE 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  	currencyNegativePrefix 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 'ga_IE' locale
    45  func New() locales.Translator {
    46  	return &ga_IE{
    47  		locale:                 "ga_IE",
    48  		pluralsCardinal:        []locales.PluralRule{2, 3, 4, 5, 6},
    49  		pluralsOrdinal:         []locales.PluralRule{2, 6},
    50  		pluralsRange:           []locales.PluralRule{2, 3, 4, 5, 6},
    51  		group:                  ",",
    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", "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"},
    57  		currencyNegativePrefix: "(",
    58  		currencyNegativeSuffix: ")",
    59  		monthsAbbreviated:      []string{"", "Ean", "Feabh", "Márta", "Aib", "Beal", "Meith", "Iúil", "Lún", "MFómh", "DFómh", "Samh", "Noll"},
    60  		monthsNarrow:           []string{"", "E", "F", "M", "A", "B", "M", "I", "L", "M", "D", "S", "N"},
    61  		monthsWide:             []string{"", "Eanáir", "Feabhra", "Márta", "Aibreán", "Bealtaine", "Meitheamh", "Iúil", "Lúnasa", "Meán Fómhair", "Deireadh Fómhair", "Samhain", "Nollaig"},
    62  		daysAbbreviated:        []string{"Domh", "Luan", "Máirt", "Céad", "Déar", "Aoine", "Sath"},
    63  		daysNarrow:             []string{"D", "L", "M", "C", "D", "A", "S"},
    64  		daysShort:              []string{"Do", "Lu", "Má", "Cé", "Dé", "Ao", "Sa"},
    65  		daysWide:               []string{"Dé Domhnaigh", "Dé Luain", "Dé Máirt", "Dé Céadaoin", "Déardaoin", "Dé hAoine", "Dé Sathairn"},
    66  		periodsAbbreviated:     []string{"r.n.", "i.n."},
    67  		periodsNarrow:          []string{"r.n.", "i.n."},
    68  		periodsWide:            []string{"r.n.", "i.n."},
    69  		erasAbbreviated:        []string{"RC", "AD"},
    70  		erasNarrow:             []string{"RC", "AD"},
    71  		erasWide:               []string{"Roimh Chríost", "Anno Domini"},
    72  		timezones:              map[string]string{"ACDT": "Am Samhraidh Lár na hAstráile", "ACST": "Am Caighdeánach Lár na hAstráile", "ACWDT": "Am Samhraidh Mheániarthar na hAstráile", "ACWST": "Am Caighdeánach Mheániarthar na hAstráile", "ADT": "Am Samhraidh an Atlantaigh", "AEDT": "Am Samhraidh Oirthear na hAstráile", "AEST": "Am Caighdeánach Oirthear na hAstráile", "AKDT": "Am Samhraidh Alasca", "AKST": "Am Caighdeánach Alasca", "ARST": "Am Samhraidh na hAirgintíne", "ART": "Am Caighdeánach na hAirgintíne", "AST": "Am Caighdeánach an Atlantaigh", "AWDT": "Am Samhraidh Iarthar na hAstráile", "AWST": "Am Caighdeánach Iarthar na hAstráile", "BOT": "Am na Bolaive", "BT": "Am na Bútáine", "CAT": "Am Lár na hAfraice", "CDT": "Am Samhraidh Lárnach", "CHADT": "Am Samhraidh Chatham", "CHAST": "Am Caighdeánach Chatham", "CLST": "Am Samhraidh na Sile", "CLT": "Am Caighdeánach na Sile", "COST": "Am Samhraidh na Colóime", "COT": "Am Caighdeánach na Colóime", "CST": "Am Caighdeánach Lárnach", "ChST": "Am Caighdeánach Seamórach", "EAT": "Am Oirthear na hAfraice", "ECT": "Am Eacuadór", "EDT": "Am Samhraidh an Oirthir", "EST": "Am Caighdeánach an Oirthir", "GFT": "Am Ghuáin na Fraince", "GMT": "Meán-Am Greenwich", "GST": "Am Caighdeánach na Murascaille", "GYT": "Am na Guáine", "HADT": "Am Samhraidh Haváí-Ailiúit", "HAST": "Am Caighdeánach Haváí-Ailiúit", "HAT": "Am Samhraidh Thalamh an Éisc", "HECU": "Am Samhraidh Chúba", "HEEG": "Am Samhraidh Oirthear na Graonlainne", "HENOMX": "Am Samhraidh Iarthuaisceart Mheicsiceo", "HEOG": "Am Samhraidh Iarthar na Graonlainne", "HEPM": "Am Samhraidh Saint-Pierre-et-Miquelon", "HEPMX": "Am Samhraidh Meicsiceach an Aigéin Chiúin", "HKST": "Am Samhraidh Hong Cong", "HKT": "Am Caighdeánach Hong Cong", "HNCU": "Am Caighdeánach Chúba", "HNEG": "Am Caighdeánach Oirthear na Graonlainne", "HNNOMX": "Am Caighdeánach Iarthuaisceart Mheicsiceo", "HNOG": "Am Caighdeánach Iarthar na Graonlainne", "HNPM": "Am Caighdeánach Saint-Pierre-et-Miquelon", "HNPMX": "Am Caighdeánach Meicsiceach an Aigéin Chiúin", "HNT": "Am Caighdeánach Thalamh an Éisc", "IST": "Am Caighdeánach na hIndia", "JDT": "Am Samhraidh na Seapáine", "JST": "Am Caighdeánach na Seapáine", "LHDT": "Am Samhraidh Lord Howe", "LHST": "Am Caighdeánach Lord Howe", "MDT": "Am Samhraidh na Sléibhte", "MESZ": "Am Samhraidh Lár na hEorpa", "MEZ": "Am Caighdeánach Lár na hEorpa", "MST": "Am Caighdeánach na Sléibhte", "MYT": "Am na Malaeisia", "NZDT": "Am Samhraidh na Nua-Shéalainne", "NZST": "Am Caighdeánach na Nua-Shéalainne", "OESZ": "Am Samhraidh Oirthear na hEorpa", "OEZ": "Am Caighdeánach Oirthear na hEorpa", "PDT": "Am Samhraidh an Aigéin Chiúin", "PST": "Am Caighdeánach an Aigéin Chiúin", "SAST": "Am Caighdeánach na hAfraice Theas", "SGT": "Am Caighdeánach Shingeapór", "SRT": "Am Shuranam", "TMST": "Am Samhraidh na Tuircméanastáine", "TMT": "Am Caighdeánach na Tuircméanastáine", "UYST": "Am Samhraidh Uragua", "UYT": "Am Caighdeánach Uragua", "VET": "Am Veiniséala", "WARST": "Am Samhraidh Iarthar na hAirgintíne", "WART": "Am Caighdeánach Iarthar na hAirgintíne", "WAST": "Am Samhraidh Iarthar na hAfraice", "WAT": "Am Caighdeánach Iarthar na hAfraice", "WESZ": "Am Samhraidh Iarthar na hEorpa", "WEZ": "Am Caighdeánach Iarthar na hEorpa", "WIB": "Am Iarthar na hIndinéise", "WIT": "Am Oirthear na hIndinéise", "WITA": "Am Lár na hIndinéise", "∅∅∅": "Am Samhraidh Bhrasília"},
    73  	}
    74  }
    75  
    76  // Locale returns the current translators string locale
    77  func (ga *ga_IE) Locale() string {
    78  	return ga.locale
    79  }
    80  
    81  // PluralsCardinal returns the list of cardinal plural rules associated with 'ga_IE'
    82  func (ga *ga_IE) PluralsCardinal() []locales.PluralRule {
    83  	return ga.pluralsCardinal
    84  }
    85  
    86  // PluralsOrdinal returns the list of ordinal plural rules associated with 'ga_IE'
    87  func (ga *ga_IE) PluralsOrdinal() []locales.PluralRule {
    88  	return ga.pluralsOrdinal
    89  }
    90  
    91  // PluralsRange returns the list of range plural rules associated with 'ga_IE'
    92  func (ga *ga_IE) PluralsRange() []locales.PluralRule {
    93  	return ga.pluralsRange
    94  }
    95  
    96  // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'ga_IE'
    97  func (ga *ga_IE) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
    98  
    99  	n := math.Abs(num)
   100  
   101  	if n == 1 {
   102  		return locales.PluralRuleOne
   103  	} else if n == 2 {
   104  		return locales.PluralRuleTwo
   105  	} else if n >= 3 && n <= 6 {
   106  		return locales.PluralRuleFew
   107  	} else if n >= 7 && n <= 10 {
   108  		return locales.PluralRuleMany
   109  	}
   110  
   111  	return locales.PluralRuleOther
   112  }
   113  
   114  // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'ga_IE'
   115  func (ga *ga_IE) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
   116  
   117  	n := math.Abs(num)
   118  
   119  	if n == 1 {
   120  		return locales.PluralRuleOne
   121  	}
   122  
   123  	return locales.PluralRuleOther
   124  }
   125  
   126  // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'ga_IE'
   127  func (ga *ga_IE) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
   128  
   129  	start := ga.CardinalPluralRule(num1, v1)
   130  	end := ga.CardinalPluralRule(num2, v2)
   131  
   132  	if start == locales.PluralRuleOne && end == locales.PluralRuleTwo {
   133  		return locales.PluralRuleTwo
   134  	} else if start == locales.PluralRuleOne && end == locales.PluralRuleFew {
   135  		return locales.PluralRuleFew
   136  	} else if start == locales.PluralRuleOne && end == locales.PluralRuleMany {
   137  		return locales.PluralRuleMany
   138  	} else if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
   139  		return locales.PluralRuleOther
   140  	} else if start == locales.PluralRuleTwo && end == locales.PluralRuleFew {
   141  		return locales.PluralRuleFew
   142  	} else if start == locales.PluralRuleTwo && end == locales.PluralRuleMany {
   143  		return locales.PluralRuleMany
   144  	} else if start == locales.PluralRuleTwo && end == locales.PluralRuleOther {
   145  		return locales.PluralRuleOther
   146  	} else if start == locales.PluralRuleFew && end == locales.PluralRuleFew {
   147  		return locales.PluralRuleFew
   148  	} else if start == locales.PluralRuleFew && end == locales.PluralRuleMany {
   149  		return locales.PluralRuleMany
   150  	} else if start == locales.PluralRuleFew && end == locales.PluralRuleOther {
   151  		return locales.PluralRuleOther
   152  	} else if start == locales.PluralRuleMany && end == locales.PluralRuleMany {
   153  		return locales.PluralRuleMany
   154  	} else if start == locales.PluralRuleMany && end == locales.PluralRuleOther {
   155  		return locales.PluralRuleOther
   156  	} else if start == locales.PluralRuleOther && end == locales.PluralRuleOne {
   157  		return locales.PluralRuleOne
   158  	} else if start == locales.PluralRuleOther && end == locales.PluralRuleTwo {
   159  		return locales.PluralRuleTwo
   160  	} else if start == locales.PluralRuleOther && end == locales.PluralRuleFew {
   161  		return locales.PluralRuleFew
   162  	} else if start == locales.PluralRuleOther && end == locales.PluralRuleMany {
   163  		return locales.PluralRuleMany
   164  	}
   165  
   166  	return locales.PluralRuleOther
   167  
   168  }
   169  
   170  // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
   171  func (ga *ga_IE) MonthAbbreviated(month time.Month) string {
   172  	return ga.monthsAbbreviated[month]
   173  }
   174  
   175  // MonthsAbbreviated returns the locales abbreviated months
   176  func (ga *ga_IE) MonthsAbbreviated() []string {
   177  	return ga.monthsAbbreviated[1:]
   178  }
   179  
   180  // MonthNarrow returns the locales narrow month given the 'month' provided
   181  func (ga *ga_IE) MonthNarrow(month time.Month) string {
   182  	return ga.monthsNarrow[month]
   183  }
   184  
   185  // MonthsNarrow returns the locales narrow months
   186  func (ga *ga_IE) MonthsNarrow() []string {
   187  	return ga.monthsNarrow[1:]
   188  }
   189  
   190  // MonthWide returns the locales wide month given the 'month' provided
   191  func (ga *ga_IE) MonthWide(month time.Month) string {
   192  	return ga.monthsWide[month]
   193  }
   194  
   195  // MonthsWide returns the locales wide months
   196  func (ga *ga_IE) MonthsWide() []string {
   197  	return ga.monthsWide[1:]
   198  }
   199  
   200  // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
   201  func (ga *ga_IE) WeekdayAbbreviated(weekday time.Weekday) string {
   202  	return ga.daysAbbreviated[weekday]
   203  }
   204  
   205  // WeekdaysAbbreviated returns the locales abbreviated weekdays
   206  func (ga *ga_IE) WeekdaysAbbreviated() []string {
   207  	return ga.daysAbbreviated
   208  }
   209  
   210  // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
   211  func (ga *ga_IE) WeekdayNarrow(weekday time.Weekday) string {
   212  	return ga.daysNarrow[weekday]
   213  }
   214  
   215  // WeekdaysNarrow returns the locales narrow weekdays
   216  func (ga *ga_IE) WeekdaysNarrow() []string {
   217  	return ga.daysNarrow
   218  }
   219  
   220  // WeekdayShort returns the locales short weekday given the 'weekday' provided
   221  func (ga *ga_IE) WeekdayShort(weekday time.Weekday) string {
   222  	return ga.daysShort[weekday]
   223  }
   224  
   225  // WeekdaysShort returns the locales short weekdays
   226  func (ga *ga_IE) WeekdaysShort() []string {
   227  	return ga.daysShort
   228  }
   229  
   230  // WeekdayWide returns the locales wide weekday given the 'weekday' provided
   231  func (ga *ga_IE) WeekdayWide(weekday time.Weekday) string {
   232  	return ga.daysWide[weekday]
   233  }
   234  
   235  // WeekdaysWide returns the locales wide weekdays
   236  func (ga *ga_IE) WeekdaysWide() []string {
   237  	return ga.daysWide
   238  }
   239  
   240  // Decimal returns the decimal point of number
   241  func (ga *ga_IE) Decimal() string {
   242  	return ga.decimal
   243  }
   244  
   245  // Group returns the group of number
   246  func (ga *ga_IE) Group() string {
   247  	return ga.group
   248  }
   249  
   250  // Group returns the minus sign of number
   251  func (ga *ga_IE) Minus() string {
   252  	return ga.minus
   253  }
   254  
   255  // FmtNumber returns 'num' with digits/precision of 'v' for 'ga_IE' and handles both Whole and Real numbers based on 'v'
   256  func (ga *ga_IE) FmtNumber(num float64, v uint64) string {
   257  
   258  	return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   259  }
   260  
   261  // FmtPercent returns 'num' with digits/precision of 'v' for 'ga_IE' and handles both Whole and Real numbers based on 'v'
   262  // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
   263  func (ga *ga_IE) FmtPercent(num float64, v uint64) string {
   264  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   265  	l := len(s) + 1
   266  	b := make([]byte, 0, l)
   267  
   268  	for i := len(s) - 1; i >= 0; i-- {
   269  
   270  		if s[i] == '.' {
   271  			b = append(b, ga.decimal[0])
   272  			continue
   273  		}
   274  
   275  		b = append(b, s[i])
   276  	}
   277  
   278  	if num < 0 {
   279  		b = append(b, ga.minus[0])
   280  	}
   281  
   282  	// reverse
   283  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   284  		b[i], b[j] = b[j], b[i]
   285  	}
   286  
   287  	b = append(b, ga.percent...)
   288  
   289  	return string(b)
   290  }
   291  
   292  // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'ga_IE'
   293  func (ga *ga_IE) FmtCurrency(num float64, v uint64, currency currency.Type) string {
   294  
   295  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   296  	symbol := ga.currencies[currency]
   297  	l := len(s) + len(symbol) + 0 + 1*len(s[:len(s)-int(v)-1])/3
   298  	count := 0
   299  	inWhole := v == 0
   300  	b := make([]byte, 0, l)
   301  
   302  	for i := len(s) - 1; i >= 0; i-- {
   303  
   304  		if s[i] == '.' {
   305  			b = append(b, ga.decimal[0])
   306  			inWhole = true
   307  			continue
   308  		}
   309  
   310  		if inWhole {
   311  			if count == 3 {
   312  				b = append(b, ga.group[0])
   313  				count = 1
   314  			} else {
   315  				count++
   316  			}
   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  	if num < 0 {
   327  		b = append(b, ga.minus[0])
   328  	}
   329  
   330  	// reverse
   331  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   332  		b[i], b[j] = b[j], b[i]
   333  	}
   334  
   335  	if int(v) < 2 {
   336  
   337  		if v == 0 {
   338  			b = append(b, ga.decimal...)
   339  		}
   340  
   341  		for i := 0; i < 2-int(v); i++ {
   342  			b = append(b, '0')
   343  		}
   344  	}
   345  
   346  	return string(b)
   347  }
   348  
   349  // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ga_IE'
   350  // in accounting notation.
   351  func (ga *ga_IE) FmtAccounting(num float64, v uint64, currency currency.Type) string {
   352  
   353  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   354  	symbol := ga.currencies[currency]
   355  	l := len(s) + len(symbol) + 2 + 1*len(s[:len(s)-int(v)-1])/3
   356  	count := 0
   357  	inWhole := v == 0
   358  	b := make([]byte, 0, l)
   359  
   360  	for i := len(s) - 1; i >= 0; i-- {
   361  
   362  		if s[i] == '.' {
   363  			b = append(b, ga.decimal[0])
   364  			inWhole = true
   365  			continue
   366  		}
   367  
   368  		if inWhole {
   369  			if count == 3 {
   370  				b = append(b, ga.group[0])
   371  				count = 1
   372  			} else {
   373  				count++
   374  			}
   375  		}
   376  
   377  		b = append(b, s[i])
   378  	}
   379  
   380  	if num < 0 {
   381  
   382  		for j := len(symbol) - 1; j >= 0; j-- {
   383  			b = append(b, symbol[j])
   384  		}
   385  
   386  		b = append(b, ga.currencyNegativePrefix[0])
   387  
   388  	} else {
   389  
   390  		for j := len(symbol) - 1; j >= 0; j-- {
   391  			b = append(b, symbol[j])
   392  		}
   393  
   394  	}
   395  
   396  	// reverse
   397  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   398  		b[i], b[j] = b[j], b[i]
   399  	}
   400  
   401  	if int(v) < 2 {
   402  
   403  		if v == 0 {
   404  			b = append(b, ga.decimal...)
   405  		}
   406  
   407  		for i := 0; i < 2-int(v); i++ {
   408  			b = append(b, '0')
   409  		}
   410  	}
   411  
   412  	if num < 0 {
   413  		b = append(b, ga.currencyNegativeSuffix...)
   414  	}
   415  
   416  	return string(b)
   417  }
   418  
   419  // FmtDateShort returns the short date representation of 't' for 'ga_IE'
   420  func (ga *ga_IE) FmtDateShort(t time.Time) string {
   421  
   422  	b := make([]byte, 0, 32)
   423  
   424  	if t.Day() < 10 {
   425  		b = append(b, '0')
   426  	}
   427  
   428  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   429  	b = append(b, []byte{0x2f}...)
   430  
   431  	if t.Month() < 10 {
   432  		b = append(b, '0')
   433  	}
   434  
   435  	b = strconv.AppendInt(b, int64(t.Month()), 10)
   436  
   437  	b = append(b, []byte{0x2f}...)
   438  
   439  	if t.Year() > 0 {
   440  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   441  	} else {
   442  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   443  	}
   444  
   445  	return string(b)
   446  }
   447  
   448  // FmtDateMedium returns the medium date representation of 't' for 'ga_IE'
   449  func (ga *ga_IE) FmtDateMedium(t time.Time) string {
   450  
   451  	b := make([]byte, 0, 32)
   452  
   453  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   454  	b = append(b, []byte{0x20}...)
   455  	b = append(b, ga.monthsAbbreviated[t.Month()]...)
   456  	b = append(b, []byte{0x20}...)
   457  
   458  	if t.Year() > 0 {
   459  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   460  	} else {
   461  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   462  	}
   463  
   464  	return string(b)
   465  }
   466  
   467  // FmtDateLong returns the long date representation of 't' for 'ga_IE'
   468  func (ga *ga_IE) FmtDateLong(t time.Time) string {
   469  
   470  	b := make([]byte, 0, 32)
   471  
   472  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   473  	b = append(b, []byte{0x20}...)
   474  	b = append(b, ga.monthsWide[t.Month()]...)
   475  	b = append(b, []byte{0x20}...)
   476  
   477  	if t.Year() > 0 {
   478  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   479  	} else {
   480  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   481  	}
   482  
   483  	return string(b)
   484  }
   485  
   486  // FmtDateFull returns the full date representation of 't' for 'ga_IE'
   487  func (ga *ga_IE) FmtDateFull(t time.Time) string {
   488  
   489  	b := make([]byte, 0, 32)
   490  
   491  	b = append(b, ga.daysWide[t.Weekday()]...)
   492  	b = append(b, []byte{0x20}...)
   493  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   494  	b = append(b, []byte{0x20}...)
   495  	b = append(b, ga.monthsWide[t.Month()]...)
   496  	b = append(b, []byte{0x20}...)
   497  
   498  	if t.Year() > 0 {
   499  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   500  	} else {
   501  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   502  	}
   503  
   504  	return string(b)
   505  }
   506  
   507  // FmtTimeShort returns the short time representation of 't' for 'ga_IE'
   508  func (ga *ga_IE) FmtTimeShort(t time.Time) string {
   509  
   510  	b := make([]byte, 0, 32)
   511  
   512  	if t.Hour() < 10 {
   513  		b = append(b, '0')
   514  	}
   515  
   516  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   517  	b = append(b, ga.timeSeparator...)
   518  
   519  	if t.Minute() < 10 {
   520  		b = append(b, '0')
   521  	}
   522  
   523  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   524  
   525  	return string(b)
   526  }
   527  
   528  // FmtTimeMedium returns the medium time representation of 't' for 'ga_IE'
   529  func (ga *ga_IE) FmtTimeMedium(t time.Time) string {
   530  
   531  	b := make([]byte, 0, 32)
   532  
   533  	if t.Hour() < 10 {
   534  		b = append(b, '0')
   535  	}
   536  
   537  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   538  	b = append(b, ga.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, ga.timeSeparator...)
   546  
   547  	if t.Second() < 10 {
   548  		b = append(b, '0')
   549  	}
   550  
   551  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   552  
   553  	return string(b)
   554  }
   555  
   556  // FmtTimeLong returns the long time representation of 't' for 'ga_IE'
   557  func (ga *ga_IE) FmtTimeLong(t time.Time) string {
   558  
   559  	b := make([]byte, 0, 32)
   560  
   561  	if t.Hour() < 10 {
   562  		b = append(b, '0')
   563  	}
   564  
   565  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   566  	b = append(b, ga.timeSeparator...)
   567  
   568  	if t.Minute() < 10 {
   569  		b = append(b, '0')
   570  	}
   571  
   572  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   573  	b = append(b, ga.timeSeparator...)
   574  
   575  	if t.Second() < 10 {
   576  		b = append(b, '0')
   577  	}
   578  
   579  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   580  	b = append(b, []byte{0x20}...)
   581  
   582  	tz, _ := t.Zone()
   583  	b = append(b, tz...)
   584  
   585  	return string(b)
   586  }
   587  
   588  // FmtTimeFull returns the full time representation of 't' for 'ga_IE'
   589  func (ga *ga_IE) FmtTimeFull(t time.Time) string {
   590  
   591  	b := make([]byte, 0, 32)
   592  
   593  	if t.Hour() < 10 {
   594  		b = append(b, '0')
   595  	}
   596  
   597  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   598  	b = append(b, ga.timeSeparator...)
   599  
   600  	if t.Minute() < 10 {
   601  		b = append(b, '0')
   602  	}
   603  
   604  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   605  	b = append(b, ga.timeSeparator...)
   606  
   607  	if t.Second() < 10 {
   608  		b = append(b, '0')
   609  	}
   610  
   611  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   612  	b = append(b, []byte{0x20}...)
   613  
   614  	tz, _ := t.Zone()
   615  
   616  	if btz, ok := ga.timezones[tz]; ok {
   617  		b = append(b, btz...)
   618  	} else {
   619  		b = append(b, tz...)
   620  	}
   621  
   622  	return string(b)
   623  }
   624  

View as plain text