af_ZA.go 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. package af_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 af_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. currencyNegativePrefix string
  23. currencyNegativeSuffix string
  24. monthsAbbreviated []string
  25. monthsNarrow []string
  26. monthsWide []string
  27. daysAbbreviated []string
  28. daysNarrow []string
  29. daysShort []string
  30. daysWide []string
  31. periodsAbbreviated []string
  32. periodsNarrow []string
  33. periodsShort []string
  34. periodsWide []string
  35. erasAbbreviated []string
  36. erasNarrow []string
  37. erasWide []string
  38. timezones map[string]string
  39. }
  40. // New returns a new instance of translator for the 'af_ZA' locale
  41. func New() locales.Translator {
  42. return &af_ZA{
  43. locale: "af_ZA",
  44. pluralsCardinal: []locales.PluralRule{2, 6},
  45. pluralsOrdinal: []locales.PluralRule{6},
  46. pluralsRange: []locales.PluralRule{6},
  47. decimal: ",",
  48. group: " ",
  49. minus: "-",
  50. percent: "%",
  51. perMille: "‰",
  52. timeSeparator: ":",
  53. inifinity: "∞",
  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", "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"},
  55. currencyNegativePrefix: "(",
  56. currencyNegativeSuffix: ")",
  57. monthsAbbreviated: []string{"", "Jan.", "Feb.", "Mrt.", "Apr.", "Mei", "Jun.", "Jul.", "Aug.", "Sep.", "Okt.", "Nov.", "Des."},
  58. monthsNarrow: []string{"", "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"},
  59. monthsWide: []string{"", "Januarie", "Februarie", "Maart", "April", "Mei", "Junie", "Julie", "Augustus", "September", "Oktober", "November", "Desember"},
  60. daysAbbreviated: []string{"So.", "Ma.", "Di.", "Wo.", "Do.", "Vr.", "Sa."},
  61. daysNarrow: []string{"S", "M", "D", "W", "D", "V", "S"},
  62. daysShort: []string{"So.", "Ma.", "Di.", "Wo.", "Do.", "Vr.", "Sa."},
  63. daysWide: []string{"Sondag", "Maandag", "Dinsdag", "Woensdag", "Donderdag", "Vrydag", "Saterdag"},
  64. periodsAbbreviated: []string{"vm.", "nm."},
  65. periodsNarrow: []string{"v", "n"},
  66. periodsWide: []string{"vm.", "nm."},
  67. erasAbbreviated: []string{"v.C.", "n.C."},
  68. erasNarrow: []string{"v.C.", "n.C."},
  69. erasWide: []string{"voor Christus", "na Christus"},
  70. timezones: map[string]string{"TMST": "Turkmenistan-somertyd", "ARST": "Argentinië-somertyd", "BOT": "Bolivia-tyd", "AEDT": "Oostelike Australiese dagligtyd", "WAT": "Wes-Afrika-standaardtyd", "JDT": "Japan-dagligtyd", "CLT": "Chili-standaardtyd", "OESZ": "Oos-Europese somertyd", "GYT": "Guyana-tyd", "PDT": "Pasifiese dagligtyd", "HNPMX": "Meksikaanse Pasifiese standaardtyd", "NZST": "Nieu-Seeland-standaardtyd", "EST": "Noord-Amerikaanse oostelike standaardtyd", "WART": "Wes-Argentinië-standaardtyd", "ChST": "Chamorro-standaardtyd", "BT": "Bhoetan-tyd", "ACWST": "Sentraal-westelike Australiese standaard-tyd", "HEEG": "Oos-Groenland-somertyd", "MST": "MST", "CAT": "Sentraal-Afrika-tyd", "TMT": "Turkmenistan-standaardtyd", "COST": "Colombië-somertyd", "CST": "Noord-Amerikaanse sentrale standaardtyd", "HADT": "Hawaii-Aleoete-dagligtyd", "∅∅∅": "Amasone-somertyd", "AKDT": "Alaska-dagligtyd", "MESZ": "Sentraal-Europese somertyd", "LHST": "Lord Howe-standaardtyd", "MDT": "MDT", "OEZ": "Oos-Europese standaardtyd", "UYST": "Uruguay-somertyd", "SAST": "Suid-Afrika-standaardtyd", "WAST": "Wes-Afrika-somertyd", "HAT": "Newfoundland-dagligtyd", "PST": "Pasifiese standaardtyd", "WEZ": "Wes-Europese standaardtyd", "AKST": "Alaska-standaardtyd", "SGT": "Singapoer-standaardtyd", "HNOG": "Wes-Groenland-standaardtyd", "HEPMX": "Meksikaanse Pasifiese dagligtyd", "MYT": "Maleisië-tyd", "HAST": "Hawaii-Aleoete-standaardtyd", "AWDT": "Westelike Australiese dagligtyd", "VET": "Venezuela-tyd", "HNPM": "Sint-Pierre en Miquelon-standaardtyd", "HEPM": "Sint-Pierre en Miquelon-dagligtyd", "CHADT": "Chatham-dagligtyd", "HECU": "Kuba-dagligtyd", "AEST": "Oostelike Australiese standaardtyd", "HNEG": "Oos-Groenland-standaardtyd", "WARST": "Wes-Argentinië-somertyd", "MEZ": "Sentraal-Europese standaardtyd", "SRT": "Suriname-tyd", "WIT": "Oos-Indonesië-tyd", "UYT": "Uruguay-standaardtyd", "HNCU": "Kuba-standaardtyd", "AST": "Atlantiese standaardtyd", "WESZ": "Wes-Europese somertyd", "JST": "Japan-standaardtyd", "GFT": "Frans-Guiana-tyd", "ACWDT": "Sentraal-westelike Australiese dagligtyd", "WITA": "Sentraal-Indonesiese tyd", "ACDT": "Sentraal-Australiese dagligtyd", "HEOG": "Wes-Groenland-somertyd", "HKT": "Hongkong-standaardtyd", "HNNOMX": "Noordwes-Meksiko-standaardtyd", "EAT": "Oos-Afrika-tyd", "ART": "Argentinië-standaardtyd", "NZDT": "Nieu-Seeland-dagligtyd", "EDT": "Noord-Amerikaanse oostelike dagligtyd", "HKST": "Hongkong-somertyd", "IST": "Indië-standaardtyd", "LHDT": "Lord Howe-dagligtyd", "HENOMX": "Noordwes-Meksiko-dagligtyd", "GMT": "Greenwich-tyd", "CHAST": "Chatham-standaardtyd", "CDT": "Noord-Amerikaanse sentrale dagligtyd", "ECT": "Ecuador-tyd", "ACST": "Sentraal-Australiese standaardtyd", "HNT": "Newfoundland-standaardtyd", "CLST": "Chili-somertyd", "COT": "Colombië-standaardtyd", "AWST": "Westelike Australiese standaardtyd", "ADT": "Atlantiese dagligtyd", "WIB": "Wes-Indonesië-tyd"},
  71. }
  72. }
  73. // Locale returns the current translators string locale
  74. func (af *af_ZA) Locale() string {
  75. return af.locale
  76. }
  77. // PluralsCardinal returns the list of cardinal plural rules associated with 'af_ZA'
  78. func (af *af_ZA) PluralsCardinal() []locales.PluralRule {
  79. return af.pluralsCardinal
  80. }
  81. // PluralsOrdinal returns the list of ordinal plural rules associated with 'af_ZA'
  82. func (af *af_ZA) PluralsOrdinal() []locales.PluralRule {
  83. return af.pluralsOrdinal
  84. }
  85. // PluralsRange returns the list of range plural rules associated with 'af_ZA'
  86. func (af *af_ZA) PluralsRange() []locales.PluralRule {
  87. return af.pluralsRange
  88. }
  89. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'af_ZA'
  90. func (af *af_ZA) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
  91. n := math.Abs(num)
  92. if n == 1 {
  93. return locales.PluralRuleOne
  94. }
  95. return locales.PluralRuleOther
  96. }
  97. // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'af_ZA'
  98. func (af *af_ZA) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
  99. return locales.PluralRuleOther
  100. }
  101. // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'af_ZA'
  102. func (af *af_ZA) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
  103. return locales.PluralRuleOther
  104. }
  105. // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
  106. func (af *af_ZA) MonthAbbreviated(month time.Month) string {
  107. return af.monthsAbbreviated[month]
  108. }
  109. // MonthsAbbreviated returns the locales abbreviated months
  110. func (af *af_ZA) MonthsAbbreviated() []string {
  111. return af.monthsAbbreviated[1:]
  112. }
  113. // MonthNarrow returns the locales narrow month given the 'month' provided
  114. func (af *af_ZA) MonthNarrow(month time.Month) string {
  115. return af.monthsNarrow[month]
  116. }
  117. // MonthsNarrow returns the locales narrow months
  118. func (af *af_ZA) MonthsNarrow() []string {
  119. return af.monthsNarrow[1:]
  120. }
  121. // MonthWide returns the locales wide month given the 'month' provided
  122. func (af *af_ZA) MonthWide(month time.Month) string {
  123. return af.monthsWide[month]
  124. }
  125. // MonthsWide returns the locales wide months
  126. func (af *af_ZA) MonthsWide() []string {
  127. return af.monthsWide[1:]
  128. }
  129. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  130. func (af *af_ZA) WeekdayAbbreviated(weekday time.Weekday) string {
  131. return af.daysAbbreviated[weekday]
  132. }
  133. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  134. func (af *af_ZA) WeekdaysAbbreviated() []string {
  135. return af.daysAbbreviated
  136. }
  137. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  138. func (af *af_ZA) WeekdayNarrow(weekday time.Weekday) string {
  139. return af.daysNarrow[weekday]
  140. }
  141. // WeekdaysNarrow returns the locales narrow weekdays
  142. func (af *af_ZA) WeekdaysNarrow() []string {
  143. return af.daysNarrow
  144. }
  145. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  146. func (af *af_ZA) WeekdayShort(weekday time.Weekday) string {
  147. return af.daysShort[weekday]
  148. }
  149. // WeekdaysShort returns the locales short weekdays
  150. func (af *af_ZA) WeekdaysShort() []string {
  151. return af.daysShort
  152. }
  153. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  154. func (af *af_ZA) WeekdayWide(weekday time.Weekday) string {
  155. return af.daysWide[weekday]
  156. }
  157. // WeekdaysWide returns the locales wide weekdays
  158. func (af *af_ZA) WeekdaysWide() []string {
  159. return af.daysWide
  160. }
  161. // Decimal returns the decimal point of number
  162. func (af *af_ZA) Decimal() string {
  163. return af.decimal
  164. }
  165. // Group returns the group of number
  166. func (af *af_ZA) Group() string {
  167. return af.group
  168. }
  169. // Group returns the minus sign of number
  170. func (af *af_ZA) Minus() string {
  171. return af.minus
  172. }
  173. // FmtNumber returns 'num' with digits/precision of 'v' for 'af_ZA' and handles both Whole and Real numbers based on 'v'
  174. func (af *af_ZA) FmtNumber(num float64, v uint64) string {
  175. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  176. l := len(s) + 2 + 2*len(s[:len(s)-int(v)-1])/3
  177. count := 0
  178. inWhole := v == 0
  179. b := make([]byte, 0, l)
  180. for i := len(s) - 1; i >= 0; i-- {
  181. if s[i] == '.' {
  182. b = append(b, af.decimal[0])
  183. inWhole = true
  184. continue
  185. }
  186. if inWhole {
  187. if count == 3 {
  188. for j := len(af.group) - 1; j >= 0; j-- {
  189. b = append(b, af.group[j])
  190. }
  191. count = 1
  192. } else {
  193. count++
  194. }
  195. }
  196. b = append(b, s[i])
  197. }
  198. if num < 0 {
  199. b = append(b, af.minus[0])
  200. }
  201. // reverse
  202. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  203. b[i], b[j] = b[j], b[i]
  204. }
  205. return string(b)
  206. }
  207. // FmtPercent returns 'num' with digits/precision of 'v' for 'af_ZA' and handles both Whole and Real numbers based on 'v'
  208. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
  209. func (af *af_ZA) FmtPercent(num float64, v uint64) string {
  210. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  211. l := len(s) + 3
  212. b := make([]byte, 0, l)
  213. for i := len(s) - 1; i >= 0; i-- {
  214. if s[i] == '.' {
  215. b = append(b, af.decimal[0])
  216. continue
  217. }
  218. b = append(b, s[i])
  219. }
  220. if num < 0 {
  221. b = append(b, af.minus[0])
  222. }
  223. // reverse
  224. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  225. b[i], b[j] = b[j], b[i]
  226. }
  227. b = append(b, af.percent...)
  228. return string(b)
  229. }
  230. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'af_ZA'
  231. func (af *af_ZA) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  232. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  233. symbol := af.currencies[currency]
  234. l := len(s) + len(symbol) + 2 + 2*len(s[:len(s)-int(v)-1])/3
  235. count := 0
  236. inWhole := v == 0
  237. b := make([]byte, 0, l)
  238. for i := len(s) - 1; i >= 0; i-- {
  239. if s[i] == '.' {
  240. b = append(b, af.decimal[0])
  241. inWhole = true
  242. continue
  243. }
  244. if inWhole {
  245. if count == 3 {
  246. for j := len(af.group) - 1; j >= 0; j-- {
  247. b = append(b, af.group[j])
  248. }
  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, af.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, af.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 'af_ZA'
  277. // in accounting notation.
  278. func (af *af_ZA) FmtAccounting(num float64, v uint64, currency currency.Type) string {
  279. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  280. symbol := af.currencies[currency]
  281. l := len(s) + len(symbol) + 4 + 2*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, af.decimal[0])
  288. inWhole = true
  289. continue
  290. }
  291. if inWhole {
  292. if count == 3 {
  293. for j := len(af.group) - 1; j >= 0; j-- {
  294. b = append(b, af.group[j])
  295. }
  296. count = 1
  297. } else {
  298. count++
  299. }
  300. }
  301. b = append(b, s[i])
  302. }
  303. if num < 0 {
  304. for j := len(symbol) - 1; j >= 0; j-- {
  305. b = append(b, symbol[j])
  306. }
  307. b = append(b, af.currencyNegativePrefix[0])
  308. } else {
  309. for j := len(symbol) - 1; j >= 0; j-- {
  310. b = append(b, symbol[j])
  311. }
  312. }
  313. // reverse
  314. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  315. b[i], b[j] = b[j], b[i]
  316. }
  317. if int(v) < 2 {
  318. if v == 0 {
  319. b = append(b, af.decimal...)
  320. }
  321. for i := 0; i < 2-int(v); i++ {
  322. b = append(b, '0')
  323. }
  324. }
  325. if num < 0 {
  326. b = append(b, af.currencyNegativeSuffix...)
  327. }
  328. return string(b)
  329. }
  330. // FmtDateShort returns the short date representation of 't' for 'af_ZA'
  331. func (af *af_ZA) FmtDateShort(t time.Time) string {
  332. b := make([]byte, 0, 32)
  333. if t.Year() > 0 {
  334. b = strconv.AppendInt(b, int64(t.Year()), 10)
  335. } else {
  336. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  337. }
  338. b = append(b, []byte{0x2d}...)
  339. if t.Month() < 10 {
  340. b = append(b, '0')
  341. }
  342. b = strconv.AppendInt(b, int64(t.Month()), 10)
  343. b = append(b, []byte{0x2d}...)
  344. if t.Day() < 10 {
  345. b = append(b, '0')
  346. }
  347. b = strconv.AppendInt(b, int64(t.Day()), 10)
  348. return string(b)
  349. }
  350. // FmtDateMedium returns the medium date representation of 't' for 'af_ZA'
  351. func (af *af_ZA) FmtDateMedium(t time.Time) string {
  352. b := make([]byte, 0, 32)
  353. if t.Day() < 10 {
  354. b = append(b, '0')
  355. }
  356. b = strconv.AppendInt(b, int64(t.Day()), 10)
  357. b = append(b, []byte{0x20}...)
  358. b = append(b, af.monthsAbbreviated[t.Month()]...)
  359. b = append(b, []byte{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. // FmtDateLong returns the long date representation of 't' for 'af_ZA'
  368. func (af *af_ZA) FmtDateLong(t time.Time) string {
  369. b := make([]byte, 0, 32)
  370. if t.Day() < 10 {
  371. b = append(b, '0')
  372. }
  373. b = strconv.AppendInt(b, int64(t.Day()), 10)
  374. b = append(b, []byte{0x20}...)
  375. b = append(b, af.monthsWide[t.Month()]...)
  376. b = append(b, []byte{0x20}...)
  377. if t.Year() > 0 {
  378. b = strconv.AppendInt(b, int64(t.Year()), 10)
  379. } else {
  380. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  381. }
  382. return string(b)
  383. }
  384. // FmtDateFull returns the full date representation of 't' for 'af_ZA'
  385. func (af *af_ZA) FmtDateFull(t time.Time) string {
  386. b := make([]byte, 0, 32)
  387. b = append(b, af.daysWide[t.Weekday()]...)
  388. b = append(b, []byte{0x2c, 0x20}...)
  389. if t.Day() < 10 {
  390. b = append(b, '0')
  391. }
  392. b = strconv.AppendInt(b, int64(t.Day()), 10)
  393. b = append(b, []byte{0x20}...)
  394. b = append(b, af.monthsWide[t.Month()]...)
  395. b = append(b, []byte{0x20}...)
  396. if t.Year() > 0 {
  397. b = strconv.AppendInt(b, int64(t.Year()), 10)
  398. } else {
  399. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  400. }
  401. return string(b)
  402. }
  403. // FmtTimeShort returns the short time representation of 't' for 'af_ZA'
  404. func (af *af_ZA) FmtTimeShort(t time.Time) string {
  405. b := make([]byte, 0, 32)
  406. if t.Hour() < 10 {
  407. b = append(b, '0')
  408. }
  409. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  410. b = append(b, af.timeSeparator...)
  411. if t.Minute() < 10 {
  412. b = append(b, '0')
  413. }
  414. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  415. return string(b)
  416. }
  417. // FmtTimeMedium returns the medium time representation of 't' for 'af_ZA'
  418. func (af *af_ZA) FmtTimeMedium(t time.Time) string {
  419. b := make([]byte, 0, 32)
  420. if t.Hour() < 10 {
  421. b = append(b, '0')
  422. }
  423. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  424. b = append(b, af.timeSeparator...)
  425. if t.Minute() < 10 {
  426. b = append(b, '0')
  427. }
  428. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  429. b = append(b, af.timeSeparator...)
  430. if t.Second() < 10 {
  431. b = append(b, '0')
  432. }
  433. b = strconv.AppendInt(b, int64(t.Second()), 10)
  434. return string(b)
  435. }
  436. // FmtTimeLong returns the long time representation of 't' for 'af_ZA'
  437. func (af *af_ZA) FmtTimeLong(t time.Time) string {
  438. b := make([]byte, 0, 32)
  439. if t.Hour() < 10 {
  440. b = append(b, '0')
  441. }
  442. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  443. b = append(b, af.timeSeparator...)
  444. if t.Minute() < 10 {
  445. b = append(b, '0')
  446. }
  447. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  448. b = append(b, af.timeSeparator...)
  449. if t.Second() < 10 {
  450. b = append(b, '0')
  451. }
  452. b = strconv.AppendInt(b, int64(t.Second()), 10)
  453. b = append(b, []byte{0x20}...)
  454. tz, _ := t.Zone()
  455. b = append(b, tz...)
  456. return string(b)
  457. }
  458. // FmtTimeFull returns the full time representation of 't' for 'af_ZA'
  459. func (af *af_ZA) FmtTimeFull(t time.Time) string {
  460. b := make([]byte, 0, 32)
  461. if t.Hour() < 10 {
  462. b = append(b, '0')
  463. }
  464. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  465. b = append(b, af.timeSeparator...)
  466. if t.Minute() < 10 {
  467. b = append(b, '0')
  468. }
  469. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  470. b = append(b, af.timeSeparator...)
  471. if t.Second() < 10 {
  472. b = append(b, '0')
  473. }
  474. b = strconv.AppendInt(b, int64(t.Second()), 10)
  475. b = append(b, []byte{0x20}...)
  476. tz, _ := t.Zone()
  477. if btz, ok := af.timezones[tz]; ok {
  478. b = append(b, btz...)
  479. } else {
  480. b = append(b, tz...)
  481. }
  482. return string(b)
  483. }