af_NA.go 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615
  1. package af_NA
  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_NA 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_NA' locale
  41. func New() locales.Translator {
  42. return &af_NA{
  43. locale: "af_NA",
  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", "$", "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{"AWDT": "Westelike Australiese dagligtyd", "AST": "Atlantiese standaardtyd", "EDT": "Noord-Amerikaanse oostelike dagligtyd", "ACWDT": "Sentraal-westelike Australiese dagligtyd", "MESZ": "Sentraal-Europese somertyd", "HEPM": "Sint-Pierre en Miquelon-dagligtyd", "ART": "Argentinië-standaardtyd", "ChST": "Chamorro-standaardtyd", "SRT": "Suriname-tyd", "CLT": "Chili-standaardtyd", "AEST": "Oostelike Australiese standaardtyd", "AEDT": "Oostelike Australiese dagligtyd", "WAT": "Wes-Afrika-standaardtyd", "BOT": "Bolivia-tyd", "HENOMX": "Noordwes-Meksiko-dagligtyd", "MST": "MST", "ACWST": "Sentraal-westelike Australiese standaard-tyd", "HKST": "Hongkong-somertyd", "CDT": "Noord-Amerikaanse sentrale dagligtyd", "ECT": "Ecuador-tyd", "HEEG": "Oos-Groenland-somertyd", "WIT": "Oos-Indonesië-tyd", "OESZ": "Oos-Europese somertyd", "EST": "Noord-Amerikaanse oostelike standaardtyd", "HEPMX": "Meksikaanse Pasifiese dagligtyd", "NZDT": "Nieu-Seeland-dagligtyd", "HNPMX": "Meksikaanse Pasifiese standaardtyd", "WESZ": "Wes-Europese somertyd", "HEOG": "Wes-Groenland-somertyd", "MEZ": "Sentraal-Europese standaardtyd", "HKT": "Hongkong-standaardtyd", "GMT": "Greenwich-tyd", "HECU": "Kuba-dagligtyd", "AKST": "Alaska-standaardtyd", "COT": "Colombië-standaardtyd", "CHAST": "Chatham-standaardtyd", "PST": "Pasifiese standaardtyd", "AWST": "Westelike Australiese standaardtyd", "ADT": "Atlantiese dagligtyd", "SAST": "Suid-Afrika-standaardtyd", "WARST": "Wes-Argentinië-somertyd", "CLST": "Chili-somertyd", "TMT": "Turkmenistan-standaardtyd", "SGT": "Singapoer-standaardtyd", "HADT": "Hawaii-Aleoete-dagligtyd", "GYT": "Guyana-tyd", "WIB": "Wes-Indonesië-tyd", "HNEG": "Oos-Groenland-standaardtyd", "LHST": "Lord Howe-standaardtyd", "WART": "Wes-Argentinië-standaardtyd", "OEZ": "Oos-Europese standaardtyd", "∅∅∅": "Amasone-somertyd", "CST": "Noord-Amerikaanse sentrale standaardtyd", "CHADT": "Chatham-dagligtyd", "HNCU": "Kuba-standaardtyd", "ACDT": "Sentraal-Australiese dagligtyd", "HAT": "Newfoundland-dagligtyd", "VET": "Venezuela-tyd", "UYST": "Uruguay-somertyd", "BT": "Bhoetan-tyd", "WAST": "Wes-Afrika-somertyd", "JST": "Japan-standaardtyd", "MYT": "Maleisië-tyd", "HNOG": "Wes-Groenland-standaardtyd", "IST": "Indië-standaardtyd", "LHDT": "Lord Howe-dagligtyd", "HNNOMX": "Noordwes-Meksiko-standaardtyd", "CAT": "Sentraal-Afrika-tyd", "HNPM": "Sint-Pierre en Miquelon-standaardtyd", "PDT": "Pasifiese dagligtyd", "EAT": "Oos-Afrika-tyd", "HAST": "Hawaii-Aleoete-standaardtyd", "ARST": "Argentinië-somertyd", "HNT": "Newfoundland-standaardtyd", "MDT": "MDT", "TMST": "Turkmenistan-somertyd", "NZST": "Nieu-Seeland-standaardtyd", "WITA": "Sentraal-Indonesiese tyd", "COST": "Colombië-somertyd", "WEZ": "Wes-Europese standaardtyd", "GFT": "Frans-Guiana-tyd", "AKDT": "Alaska-dagligtyd", "ACST": "Sentraal-Australiese standaardtyd", "UYT": "Uruguay-standaardtyd", "JDT": "Japan-dagligtyd"},
  71. }
  72. }
  73. // Locale returns the current translators string locale
  74. func (af *af_NA) Locale() string {
  75. return af.locale
  76. }
  77. // PluralsCardinal returns the list of cardinal plural rules associated with 'af_NA'
  78. func (af *af_NA) PluralsCardinal() []locales.PluralRule {
  79. return af.pluralsCardinal
  80. }
  81. // PluralsOrdinal returns the list of ordinal plural rules associated with 'af_NA'
  82. func (af *af_NA) PluralsOrdinal() []locales.PluralRule {
  83. return af.pluralsOrdinal
  84. }
  85. // PluralsRange returns the list of range plural rules associated with 'af_NA'
  86. func (af *af_NA) PluralsRange() []locales.PluralRule {
  87. return af.pluralsRange
  88. }
  89. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'af_NA'
  90. func (af *af_NA) 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_NA'
  98. func (af *af_NA) 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_NA'
  102. func (af *af_NA) 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_NA) MonthAbbreviated(month time.Month) string {
  107. return af.monthsAbbreviated[month]
  108. }
  109. // MonthsAbbreviated returns the locales abbreviated months
  110. func (af *af_NA) MonthsAbbreviated() []string {
  111. return af.monthsAbbreviated[1:]
  112. }
  113. // MonthNarrow returns the locales narrow month given the 'month' provided
  114. func (af *af_NA) MonthNarrow(month time.Month) string {
  115. return af.monthsNarrow[month]
  116. }
  117. // MonthsNarrow returns the locales narrow months
  118. func (af *af_NA) MonthsNarrow() []string {
  119. return af.monthsNarrow[1:]
  120. }
  121. // MonthWide returns the locales wide month given the 'month' provided
  122. func (af *af_NA) MonthWide(month time.Month) string {
  123. return af.monthsWide[month]
  124. }
  125. // MonthsWide returns the locales wide months
  126. func (af *af_NA) MonthsWide() []string {
  127. return af.monthsWide[1:]
  128. }
  129. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  130. func (af *af_NA) WeekdayAbbreviated(weekday time.Weekday) string {
  131. return af.daysAbbreviated[weekday]
  132. }
  133. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  134. func (af *af_NA) WeekdaysAbbreviated() []string {
  135. return af.daysAbbreviated
  136. }
  137. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  138. func (af *af_NA) WeekdayNarrow(weekday time.Weekday) string {
  139. return af.daysNarrow[weekday]
  140. }
  141. // WeekdaysNarrow returns the locales narrow weekdays
  142. func (af *af_NA) WeekdaysNarrow() []string {
  143. return af.daysNarrow
  144. }
  145. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  146. func (af *af_NA) WeekdayShort(weekday time.Weekday) string {
  147. return af.daysShort[weekday]
  148. }
  149. // WeekdaysShort returns the locales short weekdays
  150. func (af *af_NA) WeekdaysShort() []string {
  151. return af.daysShort
  152. }
  153. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  154. func (af *af_NA) WeekdayWide(weekday time.Weekday) string {
  155. return af.daysWide[weekday]
  156. }
  157. // WeekdaysWide returns the locales wide weekdays
  158. func (af *af_NA) WeekdaysWide() []string {
  159. return af.daysWide
  160. }
  161. // Decimal returns the decimal point of number
  162. func (af *af_NA) Decimal() string {
  163. return af.decimal
  164. }
  165. // Group returns the group of number
  166. func (af *af_NA) Group() string {
  167. return af.group
  168. }
  169. // Group returns the minus sign of number
  170. func (af *af_NA) Minus() string {
  171. return af.minus
  172. }
  173. // FmtNumber returns 'num' with digits/precision of 'v' for 'af_NA' and handles both Whole and Real numbers based on 'v'
  174. func (af *af_NA) 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_NA' 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_NA) 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_NA'
  231. func (af *af_NA) 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_NA'
  277. // in accounting notation.
  278. func (af *af_NA) 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_NA'
  331. func (af *af_NA) 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_NA'
  351. func (af *af_NA) FmtDateMedium(t time.Time) string {
  352. b := make([]byte, 0, 32)
  353. b = strconv.AppendInt(b, int64(t.Day()), 10)
  354. b = append(b, []byte{0x20}...)
  355. b = append(b, af.monthsAbbreviated[t.Month()]...)
  356. b = append(b, []byte{0x20}...)
  357. if t.Year() > 0 {
  358. b = strconv.AppendInt(b, int64(t.Year()), 10)
  359. } else {
  360. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  361. }
  362. return string(b)
  363. }
  364. // FmtDateLong returns the long date representation of 't' for 'af_NA'
  365. func (af *af_NA) FmtDateLong(t time.Time) string {
  366. b := make([]byte, 0, 32)
  367. b = strconv.AppendInt(b, int64(t.Day()), 10)
  368. b = append(b, []byte{0x20}...)
  369. b = append(b, af.monthsWide[t.Month()]...)
  370. b = append(b, []byte{0x20}...)
  371. if t.Year() > 0 {
  372. b = strconv.AppendInt(b, int64(t.Year()), 10)
  373. } else {
  374. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  375. }
  376. return string(b)
  377. }
  378. // FmtDateFull returns the full date representation of 't' for 'af_NA'
  379. func (af *af_NA) FmtDateFull(t time.Time) string {
  380. b := make([]byte, 0, 32)
  381. b = append(b, af.daysWide[t.Weekday()]...)
  382. b = append(b, []byte{0x20}...)
  383. b = strconv.AppendInt(b, int64(t.Day()), 10)
  384. b = append(b, []byte{0x20}...)
  385. b = append(b, af.monthsWide[t.Month()]...)
  386. b = append(b, []byte{0x20}...)
  387. if t.Year() > 0 {
  388. b = strconv.AppendInt(b, int64(t.Year()), 10)
  389. } else {
  390. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  391. }
  392. return string(b)
  393. }
  394. // FmtTimeShort returns the short time representation of 't' for 'af_NA'
  395. func (af *af_NA) FmtTimeShort(t time.Time) string {
  396. b := make([]byte, 0, 32)
  397. if t.Hour() < 10 {
  398. b = append(b, '0')
  399. }
  400. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  401. b = append(b, af.timeSeparator...)
  402. if t.Minute() < 10 {
  403. b = append(b, '0')
  404. }
  405. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  406. return string(b)
  407. }
  408. // FmtTimeMedium returns the medium time representation of 't' for 'af_NA'
  409. func (af *af_NA) FmtTimeMedium(t time.Time) string {
  410. b := make([]byte, 0, 32)
  411. if t.Hour() < 10 {
  412. b = append(b, '0')
  413. }
  414. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  415. b = append(b, af.timeSeparator...)
  416. if t.Minute() < 10 {
  417. b = append(b, '0')
  418. }
  419. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  420. b = append(b, af.timeSeparator...)
  421. if t.Second() < 10 {
  422. b = append(b, '0')
  423. }
  424. b = strconv.AppendInt(b, int64(t.Second()), 10)
  425. return string(b)
  426. }
  427. // FmtTimeLong returns the long time representation of 't' for 'af_NA'
  428. func (af *af_NA) FmtTimeLong(t time.Time) string {
  429. b := make([]byte, 0, 32)
  430. if t.Hour() < 10 {
  431. b = append(b, '0')
  432. }
  433. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  434. b = append(b, af.timeSeparator...)
  435. if t.Minute() < 10 {
  436. b = append(b, '0')
  437. }
  438. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  439. b = append(b, af.timeSeparator...)
  440. if t.Second() < 10 {
  441. b = append(b, '0')
  442. }
  443. b = strconv.AppendInt(b, int64(t.Second()), 10)
  444. b = append(b, []byte{0x20}...)
  445. tz, _ := t.Zone()
  446. b = append(b, tz...)
  447. return string(b)
  448. }
  449. // FmtTimeFull returns the full time representation of 't' for 'af_NA'
  450. func (af *af_NA) FmtTimeFull(t time.Time) string {
  451. b := make([]byte, 0, 32)
  452. if t.Hour() < 10 {
  453. b = append(b, '0')
  454. }
  455. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  456. b = append(b, af.timeSeparator...)
  457. if t.Minute() < 10 {
  458. b = append(b, '0')
  459. }
  460. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  461. b = append(b, af.timeSeparator...)
  462. if t.Second() < 10 {
  463. b = append(b, '0')
  464. }
  465. b = strconv.AppendInt(b, int64(t.Second()), 10)
  466. b = append(b, []byte{0x20}...)
  467. tz, _ := t.Zone()
  468. if btz, ok := af.timezones[tz]; ok {
  469. b = append(b, btz...)
  470. } else {
  471. b = append(b, tz...)
  472. }
  473. return string(b)
  474. }