...

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

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

     1  package af_ZA
     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 af_ZA 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 'af_ZA' locale
    45  func New() locales.Translator {
    46  	return &af_ZA{
    47  		locale:                 "af_ZA",
    48  		pluralsCardinal:        []locales.PluralRule{2, 6},
    49  		pluralsOrdinal:         []locales.PluralRule{6},
    50  		pluralsRange:           []locales.PluralRule{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  		currencyNegativePrefix: "(",
    60  		currencyNegativeSuffix: ")",
    61  		monthsAbbreviated:      []string{"", "Jan.", "Feb.", "Mrt.", "Apr.", "Mei", "Jun.", "Jul.", "Aug.", "Sep.", "Okt.", "Nov.", "Des."},
    62  		monthsNarrow:           []string{"", "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"},
    63  		monthsWide:             []string{"", "Januarie", "Februarie", "Maart", "April", "Mei", "Junie", "Julie", "Augustus", "September", "Oktober", "November", "Desember"},
    64  		daysAbbreviated:        []string{"So.", "Ma.", "Di.", "Wo.", "Do.", "Vr.", "Sa."},
    65  		daysNarrow:             []string{"S", "M", "D", "W", "D", "V", "S"},
    66  		daysShort:              []string{"So.", "Ma.", "Di.", "Wo.", "Do.", "Vr.", "Sa."},
    67  		daysWide:               []string{"Sondag", "Maandag", "Dinsdag", "Woensdag", "Donderdag", "Vrydag", "Saterdag"},
    68  		periodsAbbreviated:     []string{"vm.", "nm."},
    69  		periodsNarrow:          []string{"v", "n"},
    70  		periodsWide:            []string{"vm.", "nm."},
    71  		erasAbbreviated:        []string{"v.C.", "n.C."},
    72  		erasNarrow:             []string{"v.C.", "n.C."},
    73  		erasWide:               []string{"voor Christus", "na Christus"},
    74  		timezones:              map[string]string{"ACDT": "Sentraal-Australiese dagligtyd", "ACST": "Sentraal-Australiese standaardtyd", "ACWDT": "Sentraal-westelike Australiese dagligtyd", "ACWST": "Sentraal-westelike Australiese standaard-tyd", "ADT": "Atlantiese dagligtyd", "AEDT": "Oostelike Australiese dagligtyd", "AEST": "Oostelike Australiese standaardtyd", "AKDT": "Alaska-dagligtyd", "AKST": "Alaska-standaardtyd", "ARST": "Argentinië-somertyd", "ART": "Argentinië-standaardtyd", "AST": "Atlantiese standaardtyd", "AWDT": "Westelike Australiese dagligtyd", "AWST": "Westelike Australiese standaardtyd", "BOT": "Bolivia-tyd", "BT": "Bhoetan-tyd", "CAT": "Sentraal-Afrika-tyd", "CDT": "Noord-Amerikaanse sentrale dagligtyd", "CHADT": "Chatham-dagligtyd", "CHAST": "Chatham-standaardtyd", "CLST": "Chili-somertyd", "CLT": "Chili-standaardtyd", "COST": "Colombia-somertyd", "COT": "Colombië-standaardtyd", "CST": "Noord-Amerikaanse sentrale standaardtyd", "ChST": "Chamorro-standaardtyd", "EAT": "Oos-Afrika-tyd", "ECT": "Ecuador-tyd", "EDT": "Noord-Amerikaanse oostelike dagligtyd", "EST": "Noord-Amerikaanse oostelike standaardtyd", "GFT": "Frans-Guiana-tyd", "GMT": "Greenwich-tyd", "GST": "Persiese Golf-standaardtyd", "GYT": "Guyana-tyd", "HADT": "Hawaii-Aleoete-dagligtyd", "HAST": "Hawaii-Aleoete-standaardtyd", "HAT": "Newfoundland-dagligtyd", "HECU": "Kuba-dagligtyd", "HEEG": "Oos-Groenland-somertyd", "HENOMX": "Noordwes-Meksiko-dagligtyd", "HEOG": "Wes-Groenland-somertyd", "HEPM": "Sint-Pierre en Miquelon-dagligtyd", "HEPMX": "Meksikaanse Pasifiese dagligtyd", "HKST": "Hongkong-somertyd", "HKT": "Hongkong-standaardtyd", "HNCU": "Kuba-standaardtyd", "HNEG": "Oos-Groenland-standaardtyd", "HNNOMX": "Noordwes-Meksiko-standaardtyd", "HNOG": "Wes-Groenland-standaardtyd", "HNPM": "Sint-Pierre en Miquelon-standaardtyd", "HNPMX": "Meksikaanse Pasifiese standaardtyd", "HNT": "Newfoundland-standaardtyd", "IST": "Indië-standaardtyd", "JDT": "Japan-dagligtyd", "JST": "Japan-standaardtyd", "LHDT": "Lord Howe-dagligtyd", "LHST": "Lord Howe-standaardtyd", "MDT": "MDT", "MESZ": "Sentraal-Europese somertyd", "MEZ": "Sentraal-Europese standaardtyd", "MST": "MST", "MYT": "Maleisië-tyd", "NZDT": "Nieu-Seeland-dagligtyd", "NZST": "Nieu-Seeland-standaardtyd", "OESZ": "Oos-Europese somertyd", "OEZ": "Oos-Europese standaardtyd", "PDT": "Pasifiese dagligtyd", "PST": "Pasifiese standaardtyd", "SAST": "Suid-Afrika-standaardtyd", "SGT": "Singapoer-standaardtyd", "SRT": "Suriname-tyd", "TMST": "Turkmenistan-somertyd", "TMT": "Turkmenistan-standaardtyd", "UYST": "Uruguay-somertyd", "UYT": "Uruguay-standaardtyd", "VET": "Venezuela-tyd", "WARST": "Wes-Argentinië-somertyd", "WART": "Wes-Argentinië-standaardtyd", "WAST": "Wes-Afrika-somertyd", "WAT": "Wes-Afrika-standaardtyd", "WESZ": "Wes-Europese somertyd", "WEZ": "Wes-Europese standaardtyd", "WIB": "Wes-Indonesië-tyd", "WIT": "Oos-Indonesië-tyd", "WITA": "Sentraal-Indonesiese tyd", "∅∅∅": "Peru-somertyd"},
    75  	}
    76  }
    77  
    78  // Locale returns the current translators string locale
    79  func (af *af_ZA) Locale() string {
    80  	return af.locale
    81  }
    82  
    83  // PluralsCardinal returns the list of cardinal plural rules associated with 'af_ZA'
    84  func (af *af_ZA) PluralsCardinal() []locales.PluralRule {
    85  	return af.pluralsCardinal
    86  }
    87  
    88  // PluralsOrdinal returns the list of ordinal plural rules associated with 'af_ZA'
    89  func (af *af_ZA) PluralsOrdinal() []locales.PluralRule {
    90  	return af.pluralsOrdinal
    91  }
    92  
    93  // PluralsRange returns the list of range plural rules associated with 'af_ZA'
    94  func (af *af_ZA) PluralsRange() []locales.PluralRule {
    95  	return af.pluralsRange
    96  }
    97  
    98  // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'af_ZA'
    99  func (af *af_ZA) 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 'af_ZA'
   111  func (af *af_ZA) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
   112  	return locales.PluralRuleOther
   113  }
   114  
   115  // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'af_ZA'
   116  func (af *af_ZA) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
   117  	return locales.PluralRuleOther
   118  }
   119  
   120  // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
   121  func (af *af_ZA) MonthAbbreviated(month time.Month) string {
   122  	return af.monthsAbbreviated[month]
   123  }
   124  
   125  // MonthsAbbreviated returns the locales abbreviated months
   126  func (af *af_ZA) MonthsAbbreviated() []string {
   127  	return af.monthsAbbreviated[1:]
   128  }
   129  
   130  // MonthNarrow returns the locales narrow month given the 'month' provided
   131  func (af *af_ZA) MonthNarrow(month time.Month) string {
   132  	return af.monthsNarrow[month]
   133  }
   134  
   135  // MonthsNarrow returns the locales narrow months
   136  func (af *af_ZA) MonthsNarrow() []string {
   137  	return af.monthsNarrow[1:]
   138  }
   139  
   140  // MonthWide returns the locales wide month given the 'month' provided
   141  func (af *af_ZA) MonthWide(month time.Month) string {
   142  	return af.monthsWide[month]
   143  }
   144  
   145  // MonthsWide returns the locales wide months
   146  func (af *af_ZA) MonthsWide() []string {
   147  	return af.monthsWide[1:]
   148  }
   149  
   150  // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
   151  func (af *af_ZA) WeekdayAbbreviated(weekday time.Weekday) string {
   152  	return af.daysAbbreviated[weekday]
   153  }
   154  
   155  // WeekdaysAbbreviated returns the locales abbreviated weekdays
   156  func (af *af_ZA) WeekdaysAbbreviated() []string {
   157  	return af.daysAbbreviated
   158  }
   159  
   160  // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
   161  func (af *af_ZA) WeekdayNarrow(weekday time.Weekday) string {
   162  	return af.daysNarrow[weekday]
   163  }
   164  
   165  // WeekdaysNarrow returns the locales narrow weekdays
   166  func (af *af_ZA) WeekdaysNarrow() []string {
   167  	return af.daysNarrow
   168  }
   169  
   170  // WeekdayShort returns the locales short weekday given the 'weekday' provided
   171  func (af *af_ZA) WeekdayShort(weekday time.Weekday) string {
   172  	return af.daysShort[weekday]
   173  }
   174  
   175  // WeekdaysShort returns the locales short weekdays
   176  func (af *af_ZA) WeekdaysShort() []string {
   177  	return af.daysShort
   178  }
   179  
   180  // WeekdayWide returns the locales wide weekday given the 'weekday' provided
   181  func (af *af_ZA) WeekdayWide(weekday time.Weekday) string {
   182  	return af.daysWide[weekday]
   183  }
   184  
   185  // WeekdaysWide returns the locales wide weekdays
   186  func (af *af_ZA) WeekdaysWide() []string {
   187  	return af.daysWide
   188  }
   189  
   190  // Decimal returns the decimal point of number
   191  func (af *af_ZA) Decimal() string {
   192  	return af.decimal
   193  }
   194  
   195  // Group returns the group of number
   196  func (af *af_ZA) Group() string {
   197  	return af.group
   198  }
   199  
   200  // Group returns the minus sign of number
   201  func (af *af_ZA) Minus() string {
   202  	return af.minus
   203  }
   204  
   205  // FmtNumber returns 'num' with digits/precision of 'v' for 'af_ZA' and handles both Whole and Real numbers based on 'v'
   206  func (af *af_ZA) FmtNumber(num float64, v uint64) string {
   207  
   208  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   209  	l := len(s) + 2 + 2*len(s[:len(s)-int(v)-1])/3
   210  	count := 0
   211  	inWhole := v == 0
   212  	b := make([]byte, 0, l)
   213  
   214  	for i := len(s) - 1; i >= 0; i-- {
   215  
   216  		if s[i] == '.' {
   217  			b = append(b, af.decimal[0])
   218  			inWhole = true
   219  			continue
   220  		}
   221  
   222  		if inWhole {
   223  			if count == 3 {
   224  				for j := len(af.group) - 1; j >= 0; j-- {
   225  					b = append(b, af.group[j])
   226  				}
   227  				count = 1
   228  			} else {
   229  				count++
   230  			}
   231  		}
   232  
   233  		b = append(b, s[i])
   234  	}
   235  
   236  	if num < 0 {
   237  		b = append(b, af.minus[0])
   238  	}
   239  
   240  	// reverse
   241  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   242  		b[i], b[j] = b[j], b[i]
   243  	}
   244  
   245  	return string(b)
   246  }
   247  
   248  // FmtPercent returns 'num' with digits/precision of 'v' for 'af_ZA' and handles both Whole and Real numbers based on 'v'
   249  // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
   250  func (af *af_ZA) FmtPercent(num float64, v uint64) string {
   251  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   252  	l := len(s) + 3
   253  	b := make([]byte, 0, l)
   254  
   255  	for i := len(s) - 1; i >= 0; i-- {
   256  
   257  		if s[i] == '.' {
   258  			b = append(b, af.decimal[0])
   259  			continue
   260  		}
   261  
   262  		b = append(b, s[i])
   263  	}
   264  
   265  	if num < 0 {
   266  		b = append(b, af.minus[0])
   267  	}
   268  
   269  	// reverse
   270  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   271  		b[i], b[j] = b[j], b[i]
   272  	}
   273  
   274  	b = append(b, af.percent...)
   275  
   276  	return string(b)
   277  }
   278  
   279  // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'af_ZA'
   280  func (af *af_ZA) FmtCurrency(num float64, v uint64, currency currency.Type) string {
   281  
   282  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   283  	symbol := af.currencies[currency]
   284  	l := len(s) + len(symbol) + 2 + 2*len(s[:len(s)-int(v)-1])/3
   285  	count := 0
   286  	inWhole := v == 0
   287  	b := make([]byte, 0, l)
   288  
   289  	for i := len(s) - 1; i >= 0; i-- {
   290  
   291  		if s[i] == '.' {
   292  			b = append(b, af.decimal[0])
   293  			inWhole = true
   294  			continue
   295  		}
   296  
   297  		if inWhole {
   298  			if count == 3 {
   299  				for j := len(af.group) - 1; j >= 0; j-- {
   300  					b = append(b, af.group[j])
   301  				}
   302  				count = 1
   303  			} else {
   304  				count++
   305  			}
   306  		}
   307  
   308  		b = append(b, s[i])
   309  	}
   310  
   311  	for j := len(symbol) - 1; j >= 0; j-- {
   312  		b = append(b, symbol[j])
   313  	}
   314  
   315  	if num < 0 {
   316  		b = append(b, af.minus[0])
   317  	}
   318  
   319  	// reverse
   320  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   321  		b[i], b[j] = b[j], b[i]
   322  	}
   323  
   324  	if int(v) < 2 {
   325  
   326  		if v == 0 {
   327  			b = append(b, af.decimal...)
   328  		}
   329  
   330  		for i := 0; i < 2-int(v); i++ {
   331  			b = append(b, '0')
   332  		}
   333  	}
   334  
   335  	return string(b)
   336  }
   337  
   338  // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'af_ZA'
   339  // in accounting notation.
   340  func (af *af_ZA) FmtAccounting(num float64, v uint64, currency currency.Type) string {
   341  
   342  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   343  	symbol := af.currencies[currency]
   344  	l := len(s) + len(symbol) + 4 + 2*len(s[:len(s)-int(v)-1])/3
   345  	count := 0
   346  	inWhole := v == 0
   347  	b := make([]byte, 0, l)
   348  
   349  	for i := len(s) - 1; i >= 0; i-- {
   350  
   351  		if s[i] == '.' {
   352  			b = append(b, af.decimal[0])
   353  			inWhole = true
   354  			continue
   355  		}
   356  
   357  		if inWhole {
   358  			if count == 3 {
   359  				for j := len(af.group) - 1; j >= 0; j-- {
   360  					b = append(b, af.group[j])
   361  				}
   362  				count = 1
   363  			} else {
   364  				count++
   365  			}
   366  		}
   367  
   368  		b = append(b, s[i])
   369  	}
   370  
   371  	if num < 0 {
   372  
   373  		for j := len(symbol) - 1; j >= 0; j-- {
   374  			b = append(b, symbol[j])
   375  		}
   376  
   377  		b = append(b, af.currencyNegativePrefix[0])
   378  
   379  	} else {
   380  
   381  		for j := len(symbol) - 1; j >= 0; j-- {
   382  			b = append(b, symbol[j])
   383  		}
   384  
   385  	}
   386  
   387  	// reverse
   388  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   389  		b[i], b[j] = b[j], b[i]
   390  	}
   391  
   392  	if int(v) < 2 {
   393  
   394  		if v == 0 {
   395  			b = append(b, af.decimal...)
   396  		}
   397  
   398  		for i := 0; i < 2-int(v); i++ {
   399  			b = append(b, '0')
   400  		}
   401  	}
   402  
   403  	if num < 0 {
   404  		b = append(b, af.currencyNegativeSuffix...)
   405  	}
   406  
   407  	return string(b)
   408  }
   409  
   410  // FmtDateShort returns the short date representation of 't' for 'af_ZA'
   411  func (af *af_ZA) FmtDateShort(t time.Time) string {
   412  
   413  	b := make([]byte, 0, 32)
   414  
   415  	if t.Year() > 0 {
   416  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   417  	} else {
   418  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   419  	}
   420  
   421  	b = append(b, []byte{0x2d}...)
   422  
   423  	if t.Month() < 10 {
   424  		b = append(b, '0')
   425  	}
   426  
   427  	b = strconv.AppendInt(b, int64(t.Month()), 10)
   428  
   429  	b = append(b, []byte{0x2d}...)
   430  
   431  	if t.Day() < 10 {
   432  		b = append(b, '0')
   433  	}
   434  
   435  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   436  
   437  	return string(b)
   438  }
   439  
   440  // FmtDateMedium returns the medium date representation of 't' for 'af_ZA'
   441  func (af *af_ZA) FmtDateMedium(t time.Time) string {
   442  
   443  	b := make([]byte, 0, 32)
   444  
   445  	if t.Day() < 10 {
   446  		b = append(b, '0')
   447  	}
   448  
   449  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   450  	b = append(b, []byte{0x20}...)
   451  	b = append(b, af.monthsAbbreviated[t.Month()]...)
   452  	b = append(b, []byte{0x20}...)
   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  	return string(b)
   461  }
   462  
   463  // FmtDateLong returns the long date representation of 't' for 'af_ZA'
   464  func (af *af_ZA) FmtDateLong(t time.Time) string {
   465  
   466  	b := make([]byte, 0, 32)
   467  
   468  	if t.Day() < 10 {
   469  		b = append(b, '0')
   470  	}
   471  
   472  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   473  	b = append(b, []byte{0x20}...)
   474  	b = append(b, af.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 'af_ZA'
   487  func (af *af_ZA) FmtDateFull(t time.Time) string {
   488  
   489  	b := make([]byte, 0, 32)
   490  
   491  	b = append(b, af.daysWide[t.Weekday()]...)
   492  	b = append(b, []byte{0x20}...)
   493  
   494  	if t.Day() < 10 {
   495  		b = append(b, '0')
   496  	}
   497  
   498  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   499  	b = append(b, []byte{0x20}...)
   500  	b = append(b, af.monthsWide[t.Month()]...)
   501  	b = append(b, []byte{0x20}...)
   502  
   503  	if t.Year() > 0 {
   504  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   505  	} else {
   506  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   507  	}
   508  
   509  	return string(b)
   510  }
   511  
   512  // FmtTimeShort returns the short time representation of 't' for 'af_ZA'
   513  func (af *af_ZA) FmtTimeShort(t time.Time) string {
   514  
   515  	b := make([]byte, 0, 32)
   516  
   517  	if t.Hour() < 10 {
   518  		b = append(b, '0')
   519  	}
   520  
   521  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   522  	b = append(b, af.timeSeparator...)
   523  
   524  	if t.Minute() < 10 {
   525  		b = append(b, '0')
   526  	}
   527  
   528  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   529  
   530  	return string(b)
   531  }
   532  
   533  // FmtTimeMedium returns the medium time representation of 't' for 'af_ZA'
   534  func (af *af_ZA) FmtTimeMedium(t time.Time) string {
   535  
   536  	b := make([]byte, 0, 32)
   537  
   538  	if t.Hour() < 10 {
   539  		b = append(b, '0')
   540  	}
   541  
   542  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   543  	b = append(b, af.timeSeparator...)
   544  
   545  	if t.Minute() < 10 {
   546  		b = append(b, '0')
   547  	}
   548  
   549  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   550  	b = append(b, af.timeSeparator...)
   551  
   552  	if t.Second() < 10 {
   553  		b = append(b, '0')
   554  	}
   555  
   556  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   557  
   558  	return string(b)
   559  }
   560  
   561  // FmtTimeLong returns the long time representation of 't' for 'af_ZA'
   562  func (af *af_ZA) FmtTimeLong(t time.Time) string {
   563  
   564  	b := make([]byte, 0, 32)
   565  
   566  	if t.Hour() < 10 {
   567  		b = append(b, '0')
   568  	}
   569  
   570  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   571  	b = append(b, af.timeSeparator...)
   572  
   573  	if t.Minute() < 10 {
   574  		b = append(b, '0')
   575  	}
   576  
   577  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   578  	b = append(b, af.timeSeparator...)
   579  
   580  	if t.Second() < 10 {
   581  		b = append(b, '0')
   582  	}
   583  
   584  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   585  	b = append(b, []byte{0x20}...)
   586  
   587  	tz, _ := t.Zone()
   588  	b = append(b, tz...)
   589  
   590  	return string(b)
   591  }
   592  
   593  // FmtTimeFull returns the full time representation of 't' for 'af_ZA'
   594  func (af *af_ZA) FmtTimeFull(t time.Time) string {
   595  
   596  	b := make([]byte, 0, 32)
   597  
   598  	if t.Hour() < 10 {
   599  		b = append(b, '0')
   600  	}
   601  
   602  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   603  	b = append(b, af.timeSeparator...)
   604  
   605  	if t.Minute() < 10 {
   606  		b = append(b, '0')
   607  	}
   608  
   609  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   610  	b = append(b, af.timeSeparator...)
   611  
   612  	if t.Second() < 10 {
   613  		b = append(b, '0')
   614  	}
   615  
   616  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   617  	b = append(b, []byte{0x20}...)
   618  
   619  	tz, _ := t.Zone()
   620  
   621  	if btz, ok := af.timezones[tz]; ok {
   622  		b = append(b, btz...)
   623  	} else {
   624  		b = append(b, tz...)
   625  	}
   626  
   627  	return string(b)
   628  }
   629  

View as plain text