zu_ZA.go 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  1. package zu_ZA
  2. import (
  3. "math"
  4. "strconv"
  5. "time"
  6. "github.com/go-playground/locales"
  7. "github.com/go-playground/locales/currency"
  8. )
  9. type zu_ZA struct {
  10. locale string
  11. pluralsCardinal []locales.PluralRule
  12. pluralsOrdinal []locales.PluralRule
  13. pluralsRange []locales.PluralRule
  14. decimal string
  15. group string
  16. minus string
  17. percent string
  18. perMille string
  19. timeSeparator string
  20. inifinity string
  21. currencies []string // idx = enum of currency code
  22. monthsAbbreviated []string
  23. monthsNarrow []string
  24. monthsWide []string
  25. daysAbbreviated []string
  26. daysNarrow []string
  27. daysShort []string
  28. daysWide []string
  29. periodsAbbreviated []string
  30. periodsNarrow []string
  31. periodsShort []string
  32. periodsWide []string
  33. erasAbbreviated []string
  34. erasNarrow []string
  35. erasWide []string
  36. timezones map[string]string
  37. }
  38. // New returns a new instance of translator for the 'zu_ZA' locale
  39. func New() locales.Translator {
  40. return &zu_ZA{
  41. locale: "zu_ZA",
  42. pluralsCardinal: []locales.PluralRule{2, 6},
  43. pluralsOrdinal: []locales.PluralRule{6},
  44. pluralsRange: []locales.PluralRule{2, 6},
  45. decimal: ".",
  46. group: ",",
  47. minus: "-",
  48. percent: "%",
  49. perMille: "‰",
  50. timeSeparator: ":",
  51. inifinity: "∞",
  52. 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", "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", "UZS", "VEB", "VEF", "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"},
  53. monthsAbbreviated: []string{"", "Jan", "Feb", "Mas", "Eph", "Mey", "Jun", "Jul", "Aga", "Sep", "Okt", "Nov", "Dis"},
  54. monthsNarrow: []string{"", "J", "F", "M", "E", "M", "J", "J", "A", "S", "O", "N", "D"},
  55. monthsWide: []string{"", "Januwari", "Februwari", "Mashi", "Ephreli", "Meyi", "Juni", "Julayi", "Agasti", "Septhemba", "Okthoba", "Novemba", "Disemba"},
  56. daysAbbreviated: []string{"Son", "Mso", "Bil", "Tha", "Sin", "Hla", "Mgq"},
  57. daysNarrow: []string{"S", "M", "B", "T", "S", "H", "M"},
  58. daysShort: []string{"Son", "Mso", "Bil", "Tha", "Sin", "Hla", "Mgq"},
  59. daysWide: []string{"ISonto", "UMsombuluko", "ULwesibili", "ULwesithathu", "ULwesine", "ULwesihlanu", "UMgqibelo"},
  60. periodsAbbreviated: []string{"AM", "PM"},
  61. periodsNarrow: []string{"a", "p"},
  62. periodsWide: []string{"AM", "PM"},
  63. erasAbbreviated: []string{"BC", "AD"},
  64. erasNarrow: []string{"", ""},
  65. erasWide: []string{"BC", "AD"},
  66. timezones: map[string]string{"HNPM": "Iikhathi sase-Saint Pierre nase-Miquelon esijwayelekile", "EDT": "Isikhathi sase-North American East sasemini", "ECT": "Isikhathi sase-Ecuador", "EST": "Isikhathi sase-North American East esijwayelekile", "ACWST": "Isikhathi sase-Australian Central West esivamile", "ACWDT": "Isikhathi sasemini sase-Australian Central West", "TMST": "Isikhathi sehlobo sase-Turkmenistan", "MST": "Isikhathi sase-North American Mountain esijwayelekile", "HADT": "Isikhathi sase-Hawaii-Aleutia sasemini", "AWST": "Isikhathi sase-Australian Western esivamile", "HENOMX": "Isikhathi sase-Northwest Mexico sasemini", "BT": "Isikhathi sase-Bhutan", "AKDT": "Isikhathi sase-Alaska sasemini", "HKT": "Isikhathi esivamile sase-Hong Kong", "SRT": "Isikhathi sase-Suriname", "OESZ": "Isikhathi sasehlobo sase-Eastern Europe", "AST": "Isikhathi sase-Atlantic esijwayelekile", "WAST": "Isikhathi sasehlobo saseNtshonalanga Afrika", "JDT": "Isikhathi semini sase-Japan", "HKST": "Isikhathi sehlobo sase-Hong Kong", "HNNOMX": "Isikhathi sase-Northwest Mexico esijwayelekile", "COST": "Isikhathi sase-Colombia sasehlobo", "CHAST": "Isikhathi esivamile sase-Chatham", "AEST": "Isikhathi esivamile sase-Australian East", "HNOG": "Isikhathi sase-West Greenland esijwayelekile", "LHDT": "Isikhathi sase-Lord Howe sasemini", "HNT": "Isikhathi sase-Newfoundland esijwayelekile", "EAT": "Isikhathi saseMpumalanga Afrika", "CLST": "Isikhathi sase-Chile sasehlobo", "HEPMX": "Isikhathi sase-Mexican Pacific sasemini", "AEDT": "Isikhathi sasemini sase-Australian East", "BOT": "Isikhathi sase-Bolivia", "ACDT": "Isikhathi sase-Australian Central sasemini", "HEEG": "Isikhathi sase-East Greenland sasemini", "LHST": "Isikhathi sase-Lord Howe esivamile", "TMT": "Isikhathi esivamile sase-Turkmenistan", "HAST": "Isikhathi sase-Hawaii-Aleutia esijwayelekile", "AWDT": "Isikhathi sase-Australian Western sasemini", "ADT": "Isikhathi sase-Atlantic sasemini", "CAT": "Isikhathi sase-Central Africa", "OEZ": "Isikhathi esijwayelekile sase-Eastern Europe", "PDT": "Isikhathi sase-North American Pacific sasemini", "WEZ": "Isikhathi esijwayelekile sase-Western Europe", "HNPMX": "Isikhathi sase-Mexican Pacific esijwayelekile", "UYST": "Isikhathi sase-Uruguay sasehlobo", "JST": "Isikhathi esivamile sase-Japan", "WART": "Isikhathi saseNyakatho ne-Argentina esijwayelekile", "HAT": "Isikhathi sase-Newfoundland sasemini", "WIT": "Isikhathi sase-Eastern Indonesia", "HECU": "Isikhathi sase-Cuba sasemini", "PST": "Isikhathi sase-North American Pacific esijwayelekile", "GFT": "Isikhathi sase-French Guiana", "IST": "Isikhathi sase-India esivamile", "COT": "Isikhathi sase-Colombia esijwayelekile", "UYT": "Isikhathi sase-Uruguay esijwayelekile", "CDT": "Isikhathi sase-North American Central sasemini", "∅∅∅": "∅∅∅", "WESZ": "Isikhathi sasehlobo sase-Western Europe", "WIB": "Isikhathi sase-Western Indonesia", "NZDT": "Isikhathi sasemini sase-New Zealand", "HNEG": "Isikhathi sase-East Greenland esijwayelekile", "HNCU": "Isikhathi sase-Cuba esijwayelekile", "SAST": "Isikhathi esijwayelekile saseNingizimu Afrika", "SGT": "Isikhathi esivamile sase-Singapore", "ACST": "Isikhathi sase-Australian Central esivamile", "HEOG": "Isikhathi sase-West Greenland sasehlobo", "MEZ": "Isikhathi esijwayelekile sase-Central Europe", "MESZ": "Isikhathi sasehlobo sase-Central Europe", "VET": "Isikhathi sase-Venezuela", "HEPM": "Isikhathi sase-Saint Pierre nase-Miquelon sasemini", "MDT": "Isikhathi sase-North American Mountain sasemini", "ChST": "Isikhathi esijwayelekile sase-Chamorro", "CST": "Isikhathi sase-North American Central esijwayelekile", "GYT": "Isikhathi sase-Guyana", "MYT": "Isikhathi sase-Malaysia", "AKST": "Isikhathi sase-Alaska esijwayelekile", "WITA": "Isikhathi sase-Central Indonesia", "ARST": "Isikhathi sase-Argentina sasehlobo", "GMT": "Isikhathi sase-Greenwich Mean", "WAT": "Isikhathi esijwayelekile saseNtshonalanga Afrika", "ART": "Isikhathi sase-Argentina esijwayelekile", "WARST": "Isikhathi saseNyakatho ne-Argentina sasehlobo", "CLT": "Isikhathi sase-Chile esijwayelekile", "CHADT": "Isikhathi sasemini sase-Chatham", "NZST": "Isikhathi esivamile sase-New Zealand"},
  67. }
  68. }
  69. // Locale returns the current translators string locale
  70. func (zu *zu_ZA) Locale() string {
  71. return zu.locale
  72. }
  73. // PluralsCardinal returns the list of cardinal plural rules associated with 'zu_ZA'
  74. func (zu *zu_ZA) PluralsCardinal() []locales.PluralRule {
  75. return zu.pluralsCardinal
  76. }
  77. // PluralsOrdinal returns the list of ordinal plural rules associated with 'zu_ZA'
  78. func (zu *zu_ZA) PluralsOrdinal() []locales.PluralRule {
  79. return zu.pluralsOrdinal
  80. }
  81. // PluralsRange returns the list of range plural rules associated with 'zu_ZA'
  82. func (zu *zu_ZA) PluralsRange() []locales.PluralRule {
  83. return zu.pluralsRange
  84. }
  85. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'zu_ZA'
  86. func (zu *zu_ZA) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
  87. n := math.Abs(num)
  88. i := int64(n)
  89. if (i == 0) || (n == 1) {
  90. return locales.PluralRuleOne
  91. }
  92. return locales.PluralRuleOther
  93. }
  94. // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'zu_ZA'
  95. func (zu *zu_ZA) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
  96. return locales.PluralRuleOther
  97. }
  98. // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'zu_ZA'
  99. func (zu *zu_ZA) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
  100. start := zu.CardinalPluralRule(num1, v1)
  101. end := zu.CardinalPluralRule(num2, v2)
  102. if start == locales.PluralRuleOne && end == locales.PluralRuleOne {
  103. return locales.PluralRuleOne
  104. } else if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
  105. return locales.PluralRuleOther
  106. }
  107. return locales.PluralRuleOther
  108. }
  109. // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
  110. func (zu *zu_ZA) MonthAbbreviated(month time.Month) string {
  111. return zu.monthsAbbreviated[month]
  112. }
  113. // MonthsAbbreviated returns the locales abbreviated months
  114. func (zu *zu_ZA) MonthsAbbreviated() []string {
  115. return zu.monthsAbbreviated[1:]
  116. }
  117. // MonthNarrow returns the locales narrow month given the 'month' provided
  118. func (zu *zu_ZA) MonthNarrow(month time.Month) string {
  119. return zu.monthsNarrow[month]
  120. }
  121. // MonthsNarrow returns the locales narrow months
  122. func (zu *zu_ZA) MonthsNarrow() []string {
  123. return zu.monthsNarrow[1:]
  124. }
  125. // MonthWide returns the locales wide month given the 'month' provided
  126. func (zu *zu_ZA) MonthWide(month time.Month) string {
  127. return zu.monthsWide[month]
  128. }
  129. // MonthsWide returns the locales wide months
  130. func (zu *zu_ZA) MonthsWide() []string {
  131. return zu.monthsWide[1:]
  132. }
  133. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  134. func (zu *zu_ZA) WeekdayAbbreviated(weekday time.Weekday) string {
  135. return zu.daysAbbreviated[weekday]
  136. }
  137. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  138. func (zu *zu_ZA) WeekdaysAbbreviated() []string {
  139. return zu.daysAbbreviated
  140. }
  141. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  142. func (zu *zu_ZA) WeekdayNarrow(weekday time.Weekday) string {
  143. return zu.daysNarrow[weekday]
  144. }
  145. // WeekdaysNarrow returns the locales narrow weekdays
  146. func (zu *zu_ZA) WeekdaysNarrow() []string {
  147. return zu.daysNarrow
  148. }
  149. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  150. func (zu *zu_ZA) WeekdayShort(weekday time.Weekday) string {
  151. return zu.daysShort[weekday]
  152. }
  153. // WeekdaysShort returns the locales short weekdays
  154. func (zu *zu_ZA) WeekdaysShort() []string {
  155. return zu.daysShort
  156. }
  157. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  158. func (zu *zu_ZA) WeekdayWide(weekday time.Weekday) string {
  159. return zu.daysWide[weekday]
  160. }
  161. // WeekdaysWide returns the locales wide weekdays
  162. func (zu *zu_ZA) WeekdaysWide() []string {
  163. return zu.daysWide
  164. }
  165. // Decimal returns the decimal point of number
  166. func (zu *zu_ZA) Decimal() string {
  167. return zu.decimal
  168. }
  169. // Group returns the group of number
  170. func (zu *zu_ZA) Group() string {
  171. return zu.group
  172. }
  173. // Group returns the minus sign of number
  174. func (zu *zu_ZA) Minus() string {
  175. return zu.minus
  176. }
  177. // FmtNumber returns 'num' with digits/precision of 'v' for 'zu_ZA' and handles both Whole and Real numbers based on 'v'
  178. func (zu *zu_ZA) FmtNumber(num float64, v uint64) string {
  179. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  180. l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
  181. count := 0
  182. inWhole := v == 0
  183. b := make([]byte, 0, l)
  184. for i := len(s) - 1; i >= 0; i-- {
  185. if s[i] == '.' {
  186. b = append(b, zu.decimal[0])
  187. inWhole = true
  188. continue
  189. }
  190. if inWhole {
  191. if count == 3 {
  192. b = append(b, zu.group[0])
  193. count = 1
  194. } else {
  195. count++
  196. }
  197. }
  198. b = append(b, s[i])
  199. }
  200. if num < 0 {
  201. b = append(b, zu.minus[0])
  202. }
  203. // reverse
  204. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  205. b[i], b[j] = b[j], b[i]
  206. }
  207. return string(b)
  208. }
  209. // FmtPercent returns 'num' with digits/precision of 'v' for 'zu_ZA' 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 (zu *zu_ZA) FmtPercent(num float64, v uint64) string {
  212. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  213. l := len(s) + 3
  214. b := make([]byte, 0, l)
  215. for i := len(s) - 1; i >= 0; i-- {
  216. if s[i] == '.' {
  217. b = append(b, zu.decimal[0])
  218. continue
  219. }
  220. b = append(b, s[i])
  221. }
  222. if num < 0 {
  223. b = append(b, zu.minus[0])
  224. }
  225. // reverse
  226. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  227. b[i], b[j] = b[j], b[i]
  228. }
  229. b = append(b, zu.percent...)
  230. return string(b)
  231. }
  232. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'zu_ZA'
  233. func (zu *zu_ZA) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  234. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  235. symbol := zu.currencies[currency]
  236. l := len(s) + len(symbol) + 2 + 1*len(s[:len(s)-int(v)-1])/3
  237. count := 0
  238. inWhole := v == 0
  239. b := make([]byte, 0, l)
  240. for i := len(s) - 1; i >= 0; i-- {
  241. if s[i] == '.' {
  242. b = append(b, zu.decimal[0])
  243. inWhole = true
  244. continue
  245. }
  246. if inWhole {
  247. if count == 3 {
  248. b = append(b, zu.group[0])
  249. count = 1
  250. } else {
  251. count++
  252. }
  253. }
  254. b = append(b, s[i])
  255. }
  256. for j := len(symbol) - 1; j >= 0; j-- {
  257. b = append(b, symbol[j])
  258. }
  259. if num < 0 {
  260. b = append(b, zu.minus[0])
  261. }
  262. // reverse
  263. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  264. b[i], b[j] = b[j], b[i]
  265. }
  266. if int(v) < 2 {
  267. if v == 0 {
  268. b = append(b, zu.decimal...)
  269. }
  270. for i := 0; i < 2-int(v); i++ {
  271. b = append(b, '0')
  272. }
  273. }
  274. return string(b)
  275. }
  276. // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'zu_ZA'
  277. // in accounting notation.
  278. func (zu *zu_ZA) FmtAccounting(num float64, v uint64, currency currency.Type) string {
  279. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  280. symbol := zu.currencies[currency]
  281. l := len(s) + len(symbol) + 2 + 1*len(s[:len(s)-int(v)-1])/3
  282. count := 0
  283. inWhole := v == 0
  284. b := make([]byte, 0, l)
  285. for i := len(s) - 1; i >= 0; i-- {
  286. if s[i] == '.' {
  287. b = append(b, zu.decimal[0])
  288. inWhole = true
  289. continue
  290. }
  291. if inWhole {
  292. if count == 3 {
  293. b = append(b, zu.group[0])
  294. count = 1
  295. } else {
  296. count++
  297. }
  298. }
  299. b = append(b, s[i])
  300. }
  301. if num < 0 {
  302. for j := len(symbol) - 1; j >= 0; j-- {
  303. b = append(b, symbol[j])
  304. }
  305. b = append(b, zu.minus[0])
  306. } else {
  307. for j := len(symbol) - 1; j >= 0; j-- {
  308. b = append(b, symbol[j])
  309. }
  310. }
  311. // reverse
  312. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  313. b[i], b[j] = b[j], b[i]
  314. }
  315. if int(v) < 2 {
  316. if v == 0 {
  317. b = append(b, zu.decimal...)
  318. }
  319. for i := 0; i < 2-int(v); i++ {
  320. b = append(b, '0')
  321. }
  322. }
  323. return string(b)
  324. }
  325. // FmtDateShort returns the short date representation of 't' for 'zu_ZA'
  326. func (zu *zu_ZA) FmtDateShort(t time.Time) string {
  327. b := make([]byte, 0, 32)
  328. b = strconv.AppendInt(b, int64(t.Month()), 10)
  329. b = append(b, []byte{0x2f}...)
  330. b = strconv.AppendInt(b, int64(t.Day()), 10)
  331. b = append(b, []byte{0x2f}...)
  332. if t.Year() > 9 {
  333. b = append(b, strconv.Itoa(t.Year())[2:]...)
  334. } else {
  335. b = append(b, strconv.Itoa(t.Year())[1:]...)
  336. }
  337. return string(b)
  338. }
  339. // FmtDateMedium returns the medium date representation of 't' for 'zu_ZA'
  340. func (zu *zu_ZA) FmtDateMedium(t time.Time) string {
  341. b := make([]byte, 0, 32)
  342. b = append(b, zu.monthsAbbreviated[t.Month()]...)
  343. b = append(b, []byte{0x20}...)
  344. b = strconv.AppendInt(b, int64(t.Day()), 10)
  345. b = append(b, []byte{0x2c, 0x20}...)
  346. if t.Year() > 0 {
  347. b = strconv.AppendInt(b, int64(t.Year()), 10)
  348. } else {
  349. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  350. }
  351. return string(b)
  352. }
  353. // FmtDateLong returns the long date representation of 't' for 'zu_ZA'
  354. func (zu *zu_ZA) FmtDateLong(t time.Time) string {
  355. b := make([]byte, 0, 32)
  356. b = append(b, zu.monthsWide[t.Month()]...)
  357. b = append(b, []byte{0x20}...)
  358. b = strconv.AppendInt(b, int64(t.Day()), 10)
  359. b = append(b, []byte{0x2c, 0x20}...)
  360. if t.Year() > 0 {
  361. b = strconv.AppendInt(b, int64(t.Year()), 10)
  362. } else {
  363. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  364. }
  365. return string(b)
  366. }
  367. // FmtDateFull returns the full date representation of 't' for 'zu_ZA'
  368. func (zu *zu_ZA) FmtDateFull(t time.Time) string {
  369. b := make([]byte, 0, 32)
  370. b = append(b, zu.daysWide[t.Weekday()]...)
  371. b = append(b, []byte{0x2c, 0x20}...)
  372. b = append(b, zu.monthsWide[t.Month()]...)
  373. b = append(b, []byte{0x20}...)
  374. b = strconv.AppendInt(b, int64(t.Day()), 10)
  375. b = append(b, []byte{0x2c, 0x20}...)
  376. if t.Year() > 0 {
  377. b = strconv.AppendInt(b, int64(t.Year()), 10)
  378. } else {
  379. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  380. }
  381. return string(b)
  382. }
  383. // FmtTimeShort returns the short time representation of 't' for 'zu_ZA'
  384. func (zu *zu_ZA) FmtTimeShort(t time.Time) string {
  385. b := make([]byte, 0, 32)
  386. if t.Hour() < 10 {
  387. b = append(b, '0')
  388. }
  389. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  390. b = append(b, zu.timeSeparator...)
  391. if t.Minute() < 10 {
  392. b = append(b, '0')
  393. }
  394. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  395. return string(b)
  396. }
  397. // FmtTimeMedium returns the medium time representation of 't' for 'zu_ZA'
  398. func (zu *zu_ZA) FmtTimeMedium(t time.Time) string {
  399. b := make([]byte, 0, 32)
  400. if t.Hour() < 10 {
  401. b = append(b, '0')
  402. }
  403. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  404. b = append(b, zu.timeSeparator...)
  405. if t.Minute() < 10 {
  406. b = append(b, '0')
  407. }
  408. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  409. b = append(b, zu.timeSeparator...)
  410. if t.Second() < 10 {
  411. b = append(b, '0')
  412. }
  413. b = strconv.AppendInt(b, int64(t.Second()), 10)
  414. return string(b)
  415. }
  416. // FmtTimeLong returns the long time representation of 't' for 'zu_ZA'
  417. func (zu *zu_ZA) FmtTimeLong(t time.Time) string {
  418. b := make([]byte, 0, 32)
  419. if t.Hour() < 10 {
  420. b = append(b, '0')
  421. }
  422. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  423. b = append(b, zu.timeSeparator...)
  424. if t.Minute() < 10 {
  425. b = append(b, '0')
  426. }
  427. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  428. b = append(b, zu.timeSeparator...)
  429. if t.Second() < 10 {
  430. b = append(b, '0')
  431. }
  432. b = strconv.AppendInt(b, int64(t.Second()), 10)
  433. b = append(b, []byte{0x20}...)
  434. tz, _ := t.Zone()
  435. b = append(b, tz...)
  436. return string(b)
  437. }
  438. // FmtTimeFull returns the full time representation of 't' for 'zu_ZA'
  439. func (zu *zu_ZA) FmtTimeFull(t time.Time) string {
  440. b := make([]byte, 0, 32)
  441. if t.Hour() < 10 {
  442. b = append(b, '0')
  443. }
  444. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  445. b = append(b, zu.timeSeparator...)
  446. if t.Minute() < 10 {
  447. b = append(b, '0')
  448. }
  449. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  450. b = append(b, zu.timeSeparator...)
  451. if t.Second() < 10 {
  452. b = append(b, '0')
  453. }
  454. b = strconv.AppendInt(b, int64(t.Second()), 10)
  455. b = append(b, []byte{0x20}...)
  456. tz, _ := t.Zone()
  457. if btz, ok := zu.timezones[tz]; ok {
  458. b = append(b, btz...)
  459. } else {
  460. b = append(b, tz...)
  461. }
  462. return string(b)
  463. }