...

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

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

     1  package ha_NE
     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 ha_NE 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 'ha_NE' locale
    47  func New() locales.Translator {
    48  	return &ha_NE{
    49  		locale:                 "ha_NE",
    50  		pluralsCardinal:        []locales.PluralRule{2, 6},
    51  		pluralsOrdinal:         nil,
    52  		pluralsRange:           nil,
    53  		timeSeparator:          ":",
    54  		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"},
    55  		currencyPositivePrefix: " ",
    56  		currencyPositiveSuffix: "D",
    57  		currencyNegativePrefix: " ",
    58  		currencyNegativeSuffix: "D",
    59  		monthsAbbreviated:      []string{"", "Jan", "Fab", "Mar", "Afi", "May", "Yun", "Yul", "Agu", "Sat", "Okt", "Nuw", "Dis"},
    60  		monthsNarrow:           []string{"", "J", "F", "M", "A", "M", "Y", "Y", "A", "S", "O", "N", "D"},
    61  		monthsWide:             []string{"", "Janairu", "Faburairu", "Maris", "Afirilu", "Mayu", "Yuni", "Yuli", "Agusta", "Satumba", "Oktoba", "Nuwamba", "Disamba"},
    62  		daysAbbreviated:        []string{"Lah", "Lit", "Tal", "Lar", "Alh", "Jum", "Asa"},
    63  		daysNarrow:             []string{"L", "L", "T", "L", "A", "J", "A"},
    64  		daysShort:              []string{"Lh", "Li", "Ta", "Lr", "Al", "Ju", "As"},
    65  		daysWide:               []string{"Lahadi", "Litinin", "Talata", "Laraba", "Alhamis", "Jummaʼa", "Asabar"},
    66  		periodsAbbreviated:     []string{"AM", "PM"},
    67  		periodsNarrow:          []string{"AM", "PM"},
    68  		periodsWide:            []string{"Safiya", "Yamma"},
    69  		erasAbbreviated:        []string{"K.H", "BHAI"},
    70  		erasNarrow:             []string{"", ""},
    71  		erasWide:               []string{"", ""},
    72  		timezones:              map[string]string{"ACDT": "Australian Central Daylight Time", "ACST": "Australian Central Standard Time", "ACWDT": "Australian Central Western Daylight Time", "ACWST": "Australian Central Western Standard Time", "ADT": "Lokacin Rana na Kanada, Puerto Rico da Virgin Islands", "AEDT": "Australian Eastern Daylight Time", "AEST": "Australian Eastern Standard Time", "AKDT": "Lokacin Rana na Alaska", "AKST": "Tsayayyen Lokacin Alaska", "ARST": "ARST", "ART": "ART", "AST": "Lokaci Tsayayye na Kanada, Puerto Rico da Virgin Islands", "AWDT": "Australian Western Daylight Time", "AWST": "Australian Western Standard Time", "BOT": "BOT", "BT": "Bhutan Time", "CAT": "Central Africa Time", "CDT": "Lokacin Rana dake Arewacin Amurika ta Tsakiya", "CHADT": "Chatham Daylight Time", "CHAST": "Chatham Standard Time", "CLST": "CLST", "CLT": "CLT", "COST": "COST", "COT": "COT", "CST": "Tsayayyen Lokaci dake Arewacin Amurika ta Tsakiya", "ChST": "Chamorro Standard Time", "EAT": "East Africa Time", "ECT": "ECT", "EDT": "Lokacin Rana ta Gabas dake Arewacin Amurika", "EST": "Tsayayyen Lokacin Gabas dake Arewacin Amurika", "GFT": "GFT", "GMT": "Lokacin Greenwhich a London", "GST": "Gulf Standard Time [translation hint: translate as just \"Gulf Time\"]", "GYT": "GYT", "HADT": "Lokaci rana ta Hawaii-Aleutian", "HAST": "Ida Lokaci ta Hawaii-Aleutian", "HAT": "Lokaci rana ta Newfoundland", "HECU": "Lokaci rana ta Kuba", "HEEG": "Lokaci rana a gabas ta Greeland", "HENOMX": "Lokacin rana na arewa maso gabashin Mesiko", "HEOG": "Lokacin rana a yammacin Greeland", "HEPM": "Lokaci rana ta St. Pierre da Miquelon", "HEPMX": "Lokaci na rana na Mesiko Pacific", "HKST": "Hong Kong Summer Time", "HKT": "Hong Kong Standard Time", "HNCU": "Lokaci Tsayayye na Kuba", "HNEG": "Lokaci Tsayayye a gabashin ta Greenland", "HNNOMX": "Lokaci Tsayayye na arewa maso gabashin Mesiko", "HNOG": "Lokaci Tsayayye a yammacin Greeland", "HNPM": "Lokaci tsayayye St. Pierre da Miquelon", "HNPMX": "Lokaci Tsayayye na Mesiko Pacific", "HNT": "Lokaci Tsayayye ta Newfoundland", "IST": "India Standard Time", "JDT": "Japan Daylight Time", "JST": "Japan Standard Time", "LHDT": "Lord Howe Daylight Time", "LHST": "Lord Howe Standard Time", "MDT": "Lokaci rana tsauni a arewacin da Amirka", "MESZ": "Tsakiyar bazara a lokaci turai", "MEZ": "Ida Tsakiyar a Lokaci Turai", "MST": "Lokaci tsayayye na tsauni a Arewacin Amurica", "MYT": "Malaysia Time", "NZDT": "New Zealand Daylight Time", "NZST": "New Zealand Standard Time", "OESZ": "Gabas a lokaci turai da bazara", "OEZ": "Ida lokaci a turai gabas", "PDT": "Lokaci da rana a Arewacin Amurika", "PST": "Lokaci Tsayayye na Arewacin Amurika", "SAST": "South Africa Standard Time", "SGT": "Singapore Standard Time", "SRT": "SRT", "TMST": "Turkmenistan Summer Time", "TMT": "Turkmenistan Standard Time", "UYST": "UYST", "UYT": "UYT", "VET": "VET", "WARST": "WARST", "WART": "WART", "WAST": "West Africa Summer Time", "WAT": "West Africa Standard Time", "WESZ": "Ida lokaci ta yammacin turai da bazara", "WEZ": "Ida lokaci ta yammacin turai", "WIB": "Western Indonesia Time", "WIT": "Eastern Indonesia Time", "WITA": "Central Indonesia Time", "∅∅∅": "Azores Summer Time"},
    73  	}
    74  }
    75  
    76  // Locale returns the current translators string locale
    77  func (ha *ha_NE) Locale() string {
    78  	return ha.locale
    79  }
    80  
    81  // PluralsCardinal returns the list of cardinal plural rules associated with 'ha_NE'
    82  func (ha *ha_NE) PluralsCardinal() []locales.PluralRule {
    83  	return ha.pluralsCardinal
    84  }
    85  
    86  // PluralsOrdinal returns the list of ordinal plural rules associated with 'ha_NE'
    87  func (ha *ha_NE) PluralsOrdinal() []locales.PluralRule {
    88  	return ha.pluralsOrdinal
    89  }
    90  
    91  // PluralsRange returns the list of range plural rules associated with 'ha_NE'
    92  func (ha *ha_NE) PluralsRange() []locales.PluralRule {
    93  	return ha.pluralsRange
    94  }
    95  
    96  // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'ha_NE'
    97  func (ha *ha_NE) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
    98  
    99  	n := math.Abs(num)
   100  
   101  	if n == 1 {
   102  		return locales.PluralRuleOne
   103  	}
   104  
   105  	return locales.PluralRuleOther
   106  }
   107  
   108  // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'ha_NE'
   109  func (ha *ha_NE) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
   110  	return locales.PluralRuleUnknown
   111  }
   112  
   113  // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'ha_NE'
   114  func (ha *ha_NE) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
   115  	return locales.PluralRuleUnknown
   116  }
   117  
   118  // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
   119  func (ha *ha_NE) MonthAbbreviated(month time.Month) string {
   120  	return ha.monthsAbbreviated[month]
   121  }
   122  
   123  // MonthsAbbreviated returns the locales abbreviated months
   124  func (ha *ha_NE) MonthsAbbreviated() []string {
   125  	return ha.monthsAbbreviated[1:]
   126  }
   127  
   128  // MonthNarrow returns the locales narrow month given the 'month' provided
   129  func (ha *ha_NE) MonthNarrow(month time.Month) string {
   130  	return ha.monthsNarrow[month]
   131  }
   132  
   133  // MonthsNarrow returns the locales narrow months
   134  func (ha *ha_NE) MonthsNarrow() []string {
   135  	return ha.monthsNarrow[1:]
   136  }
   137  
   138  // MonthWide returns the locales wide month given the 'month' provided
   139  func (ha *ha_NE) MonthWide(month time.Month) string {
   140  	return ha.monthsWide[month]
   141  }
   142  
   143  // MonthsWide returns the locales wide months
   144  func (ha *ha_NE) MonthsWide() []string {
   145  	return ha.monthsWide[1:]
   146  }
   147  
   148  // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
   149  func (ha *ha_NE) WeekdayAbbreviated(weekday time.Weekday) string {
   150  	return ha.daysAbbreviated[weekday]
   151  }
   152  
   153  // WeekdaysAbbreviated returns the locales abbreviated weekdays
   154  func (ha *ha_NE) WeekdaysAbbreviated() []string {
   155  	return ha.daysAbbreviated
   156  }
   157  
   158  // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
   159  func (ha *ha_NE) WeekdayNarrow(weekday time.Weekday) string {
   160  	return ha.daysNarrow[weekday]
   161  }
   162  
   163  // WeekdaysNarrow returns the locales narrow weekdays
   164  func (ha *ha_NE) WeekdaysNarrow() []string {
   165  	return ha.daysNarrow
   166  }
   167  
   168  // WeekdayShort returns the locales short weekday given the 'weekday' provided
   169  func (ha *ha_NE) WeekdayShort(weekday time.Weekday) string {
   170  	return ha.daysShort[weekday]
   171  }
   172  
   173  // WeekdaysShort returns the locales short weekdays
   174  func (ha *ha_NE) WeekdaysShort() []string {
   175  	return ha.daysShort
   176  }
   177  
   178  // WeekdayWide returns the locales wide weekday given the 'weekday' provided
   179  func (ha *ha_NE) WeekdayWide(weekday time.Weekday) string {
   180  	return ha.daysWide[weekday]
   181  }
   182  
   183  // WeekdaysWide returns the locales wide weekdays
   184  func (ha *ha_NE) WeekdaysWide() []string {
   185  	return ha.daysWide
   186  }
   187  
   188  // Decimal returns the decimal point of number
   189  func (ha *ha_NE) Decimal() string {
   190  	return ha.decimal
   191  }
   192  
   193  // Group returns the group of number
   194  func (ha *ha_NE) Group() string {
   195  	return ha.group
   196  }
   197  
   198  // Group returns the minus sign of number
   199  func (ha *ha_NE) Minus() string {
   200  	return ha.minus
   201  }
   202  
   203  // FmtNumber returns 'num' with digits/precision of 'v' for 'ha_NE' and handles both Whole and Real numbers based on 'v'
   204  func (ha *ha_NE) FmtNumber(num float64, v uint64) string {
   205  
   206  	return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   207  }
   208  
   209  // FmtPercent returns 'num' with digits/precision of 'v' for 'ha_NE' and handles both Whole and Real numbers based on 'v'
   210  // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
   211  func (ha *ha_NE) FmtPercent(num float64, v uint64) string {
   212  	return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   213  }
   214  
   215  // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'ha_NE'
   216  func (ha *ha_NE) FmtCurrency(num float64, v uint64, currency currency.Type) string {
   217  
   218  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   219  	symbol := ha.currencies[currency]
   220  	l := len(s) + len(symbol) + 3
   221  
   222  	b := make([]byte, 0, l)
   223  
   224  	for i := len(s) - 1; i >= 0; i-- {
   225  
   226  		if s[i] == '.' {
   227  			b = append(b, ha.decimal[0])
   228  			continue
   229  		}
   230  
   231  		b = append(b, s[i])
   232  	}
   233  
   234  	for j := len(symbol) - 1; j >= 0; j-- {
   235  		b = append(b, symbol[j])
   236  	}
   237  
   238  	for j := len(ha.currencyPositivePrefix) - 1; j >= 0; j-- {
   239  		b = append(b, ha.currencyPositivePrefix[j])
   240  	}
   241  
   242  	if num < 0 {
   243  		b = append(b, ha.minus[0])
   244  	}
   245  
   246  	// reverse
   247  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   248  		b[i], b[j] = b[j], b[i]
   249  	}
   250  
   251  	b = append(b, ha.currencyPositiveSuffix...)
   252  
   253  	return string(b)
   254  }
   255  
   256  // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ha_NE'
   257  // in accounting notation.
   258  func (ha *ha_NE) FmtAccounting(num float64, v uint64, currency currency.Type) string {
   259  
   260  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   261  	symbol := ha.currencies[currency]
   262  	l := len(s) + len(symbol) + 3
   263  
   264  	b := make([]byte, 0, l)
   265  
   266  	for i := len(s) - 1; i >= 0; i-- {
   267  
   268  		if s[i] == '.' {
   269  			b = append(b, ha.decimal[0])
   270  			continue
   271  		}
   272  
   273  		b = append(b, s[i])
   274  	}
   275  
   276  	if num < 0 {
   277  
   278  		for j := len(symbol) - 1; j >= 0; j-- {
   279  			b = append(b, symbol[j])
   280  		}
   281  
   282  		for j := len(ha.currencyNegativePrefix) - 1; j >= 0; j-- {
   283  			b = append(b, ha.currencyNegativePrefix[j])
   284  		}
   285  
   286  		b = append(b, ha.minus[0])
   287  
   288  	} else {
   289  
   290  		for j := len(symbol) - 1; j >= 0; j-- {
   291  			b = append(b, symbol[j])
   292  		}
   293  
   294  		for j := len(ha.currencyPositivePrefix) - 1; j >= 0; j-- {
   295  			b = append(b, ha.currencyPositivePrefix[j])
   296  		}
   297  
   298  	}
   299  
   300  	// reverse
   301  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   302  		b[i], b[j] = b[j], b[i]
   303  	}
   304  
   305  	if num < 0 {
   306  		b = append(b, ha.currencyNegativeSuffix...)
   307  	} else {
   308  
   309  		b = append(b, ha.currencyPositiveSuffix...)
   310  	}
   311  
   312  	return string(b)
   313  }
   314  
   315  // FmtDateShort returns the short date representation of 't' for 'ha_NE'
   316  func (ha *ha_NE) FmtDateShort(t time.Time) string {
   317  
   318  	b := make([]byte, 0, 32)
   319  
   320  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   321  	b = append(b, []byte{0x2f}...)
   322  	b = strconv.AppendInt(b, int64(t.Month()), 10)
   323  	b = append(b, []byte{0x2f}...)
   324  
   325  	if t.Year() > 9 {
   326  		b = append(b, strconv.Itoa(t.Year())[2:]...)
   327  	} else {
   328  		b = append(b, strconv.Itoa(t.Year())[1:]...)
   329  	}
   330  
   331  	return string(b)
   332  }
   333  
   334  // FmtDateMedium returns the medium date representation of 't' for 'ha_NE'
   335  func (ha *ha_NE) FmtDateMedium(t time.Time) string {
   336  
   337  	b := make([]byte, 0, 32)
   338  
   339  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   340  	b = append(b, []byte{0x20}...)
   341  	b = append(b, ha.monthsAbbreviated[t.Month()]...)
   342  	b = append(b, []byte{0x2c, 0x20}...)
   343  
   344  	if t.Year() > 0 {
   345  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   346  	} else {
   347  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   348  	}
   349  
   350  	return string(b)
   351  }
   352  
   353  // FmtDateLong returns the long date representation of 't' for 'ha_NE'
   354  func (ha *ha_NE) FmtDateLong(t time.Time) string {
   355  
   356  	b := make([]byte, 0, 32)
   357  
   358  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   359  	b = append(b, []byte{0x20}...)
   360  	b = append(b, ha.monthsWide[t.Month()]...)
   361  	b = append(b, []byte{0x2c, 0x20}...)
   362  
   363  	if t.Year() > 0 {
   364  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   365  	} else {
   366  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   367  	}
   368  
   369  	return string(b)
   370  }
   371  
   372  // FmtDateFull returns the full date representation of 't' for 'ha_NE'
   373  func (ha *ha_NE) FmtDateFull(t time.Time) string {
   374  
   375  	b := make([]byte, 0, 32)
   376  
   377  	b = append(b, ha.daysWide[t.Weekday()]...)
   378  	b = append(b, []byte{0x20}...)
   379  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   380  	b = append(b, []byte{0x20}...)
   381  	b = append(b, ha.monthsWide[t.Month()]...)
   382  	b = append(b, []byte{0x2c, 0x20}...)
   383  
   384  	if t.Year() > 0 {
   385  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   386  	} else {
   387  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   388  	}
   389  
   390  	return string(b)
   391  }
   392  
   393  // FmtTimeShort returns the short time representation of 't' for 'ha_NE'
   394  func (ha *ha_NE) FmtTimeShort(t time.Time) string {
   395  
   396  	b := make([]byte, 0, 32)
   397  
   398  	if t.Hour() < 10 {
   399  		b = append(b, '0')
   400  	}
   401  
   402  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   403  	b = append(b, ha.timeSeparator...)
   404  
   405  	if t.Minute() < 10 {
   406  		b = append(b, '0')
   407  	}
   408  
   409  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   410  
   411  	return string(b)
   412  }
   413  
   414  // FmtTimeMedium returns the medium time representation of 't' for 'ha_NE'
   415  func (ha *ha_NE) FmtTimeMedium(t time.Time) string {
   416  
   417  	b := make([]byte, 0, 32)
   418  
   419  	if t.Hour() < 10 {
   420  		b = append(b, '0')
   421  	}
   422  
   423  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   424  	b = append(b, ha.timeSeparator...)
   425  
   426  	if t.Minute() < 10 {
   427  		b = append(b, '0')
   428  	}
   429  
   430  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   431  	b = append(b, ha.timeSeparator...)
   432  
   433  	if t.Second() < 10 {
   434  		b = append(b, '0')
   435  	}
   436  
   437  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   438  
   439  	return string(b)
   440  }
   441  
   442  // FmtTimeLong returns the long time representation of 't' for 'ha_NE'
   443  func (ha *ha_NE) FmtTimeLong(t time.Time) string {
   444  
   445  	b := make([]byte, 0, 32)
   446  
   447  	if t.Hour() < 10 {
   448  		b = append(b, '0')
   449  	}
   450  
   451  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   452  	b = append(b, ha.timeSeparator...)
   453  
   454  	if t.Minute() < 10 {
   455  		b = append(b, '0')
   456  	}
   457  
   458  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   459  	b = append(b, ha.timeSeparator...)
   460  
   461  	if t.Second() < 10 {
   462  		b = append(b, '0')
   463  	}
   464  
   465  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   466  	b = append(b, []byte{0x20}...)
   467  
   468  	tz, _ := t.Zone()
   469  	b = append(b, tz...)
   470  
   471  	return string(b)
   472  }
   473  
   474  // FmtTimeFull returns the full time representation of 't' for 'ha_NE'
   475  func (ha *ha_NE) FmtTimeFull(t time.Time) string {
   476  
   477  	b := make([]byte, 0, 32)
   478  
   479  	if t.Hour() < 10 {
   480  		b = append(b, '0')
   481  	}
   482  
   483  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   484  	b = append(b, ha.timeSeparator...)
   485  
   486  	if t.Minute() < 10 {
   487  		b = append(b, '0')
   488  	}
   489  
   490  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   491  	b = append(b, ha.timeSeparator...)
   492  
   493  	if t.Second() < 10 {
   494  		b = append(b, '0')
   495  	}
   496  
   497  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   498  	b = append(b, []byte{0x20}...)
   499  
   500  	tz, _ := t.Zone()
   501  
   502  	if btz, ok := ha.timezones[tz]; ok {
   503  		b = append(b, btz...)
   504  	} else {
   505  		b = append(b, tz...)
   506  	}
   507  
   508  	return string(b)
   509  }
   510  

View as plain text