fa_AF.go 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  1. package fa_AF
  2. import (
  3. "math"
  4. "strconv"
  5. "time"
  6. "github.com/go-playground/locales"
  7. "github.com/go-playground/locales/currency"
  8. )
  9. type fa_AF 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. currencyPositivePrefix string
  23. currencyNegativePrefix 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 'fa_AF' locale
  41. func New() locales.Translator {
  42. return &fa_AF{
  43. locale: "fa_AF",
  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", "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", "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. currencyPositivePrefix: " ",
  56. currencyNegativePrefix: " ",
  57. monthsAbbreviated: []string{"", "جنو", "فبروری", "مارچ", "اپریل", "می", "جون", "جول", "اگست", "سپتمبر", "اکتوبر", "نومبر", "دسم"},
  58. monthsNarrow: []string{"", "ج", "ف", "م", "ا", "م", "ج", "ج", "ا", "س", "ا", "ن", "د"},
  59. monthsWide: []string{"", "جنوری", "فبروری", "مارچ", "اپریل", "می", "جون", "جولای", "اگست", "سپتمبر", "اکتوبر", "نومبر", "دسمبر"},
  60. daysAbbreviated: []string{"یکشنبه", "دوشنبه", "سه\u200cشنبه", "چهارشنبه", "پنجشنبه", "جمعه", "شنبه"},
  61. daysNarrow: []string{"ی", "د", "س", "چ", "پ", "ج", "ش"},
  62. daysShort: []string{"۱ش", "۲ش", "۳ش", "۴ش", "۵ش", "ج", "ش"},
  63. daysWide: []string{"یکشنبه", "دوشنبه", "سه\u200cشنبه", "چهارشنبه", "پنجشنبه", "جمعه", "شنبه"},
  64. periodsAbbreviated: []string{"", ""},
  65. periodsNarrow: []string{"", ""},
  66. periodsWide: []string{"", ""},
  67. erasAbbreviated: []string{"ق.م.", "م."},
  68. erasNarrow: []string{"ق", "م"},
  69. erasWide: []string{"قبل از میلاد", "میلادی"},
  70. timezones: map[string]string{"ARST": "وقت تابستانی آرژانتین", "LHST": "وقت عادی لردهو", "CHADT": "وقت تابستانی چت\u200cهام", "SGT": "وقت سنگاپور", "∅∅∅": "وقت تابستانی آمازون", "ACDT": "وقت تابستانی مرکز استرالیا", "AWDT": "وقت تابستانی غرب استرالیا", "HKST": "وقت تابستانی هنگ\u200cکنگ", "AST": "وقت عادی آتلانتیک", "GYT": "وقت گویان", "ACWDT": "وقت تابستانی مرکز-غرب استرالیا", "WITA": "وقت مرکز اندونزی", "MST": "وقت عادی ماکائو", "HADT": "وقت تابستانی هاوایی‐الوشن", "ACWST": "وقت عادی مرکز-غرب استرالیا", "ART": "وقت عادی آرژانتین", "CLST": "وقت تابستانی شیلی", "OESZ": "وقت تابستانی شرق اروپا", "CST": "وقت عادی مرکز امریکا", "WIB": "وقت غرب اندونزی", "PDT": "وقت تابستانی غرب امریکا", "HECU": "وقت تابستانی کوبا", "NZST": "وقت عادی زلاند نو", "VET": "وقت ونزوئلا", "IST": "وقت هند", "JDT": "وقت تابستانی ژاپن", "BT": "وقت بوتان", "SRT": "وقت سورینام", "WEZ": "وقت عادی غرب اروپا", "AWST": "وقت عادی غرب استرالیا", "HEPM": "وقت تابستانی سنت\u200cپیر و میکلون", "MEZ": "وقت عادی مرکز اروپا", "TMST": "وقت تابستانی ترکمنستان", "HNNOMX": "وقت عادی شمال غرب مکزیک", "HENOMX": "وقت تابستانی شمال غرب مکزیک", "EDT": "وقت تابستانی شرق امریکا", "LHDT": "وقت تابستانی لردهو", "WAT": "وقت عادی غرب افریقا", "MDT": "وقت تابستانی ماکائو", "ADT": "وقت تابستانی آتلانتیک", "HAST": "وقت عادی هاوایی‐الوشن", "MESZ": "وقت تابستانی مرکز اروپا", "GFT": "وقت گویان فرانسه", "ACST": "وقت عادی مرکز استرالیا", "ECT": "وقت اکوادور", "WESZ": "وقت تابستانی غرب اروپا", "HAT": "وقت تابستانی نیوفاندلند", "HEOG": "وقت تابستانی غرب گرینلند", "AEDT": "وقت تابستانی شرق استرالیا", "JST": "وقت عادی ژاپن", "ChST": "وقت عادی چامورو", "CAT": "وقت مرکز افریقا", "COT": "وقت عادی کلمبیا", "HNPMX": "وقت عادی شرق مکزیک", "HEPMX": "وقت تابستانی شرق مکزیک", "MYT": "وقت مالزی", "NZDT": "وقت تابستانی زلاند نو", "HEEG": "وقت تابستانی شرق گرینلند", "WARST": "وقت تابستانی غرب آرژانتین", "COST": "وقت تابستانی کلمبیا", "HNCU": "وقت عادی کوبا", "EST": "وقت عادی شرق امریکا", "UYT": "وقت عادی اروگوئه", "UYST": "وقت تابستانی اروگوئه", "CDT": "وقت تابستانی مرکز امریکا", "WIT": "وقت شرق اندونزی", "PST": "وقت عادی غرب امریکا", "HKT": "وقت عادی هنگ\u200cکنگ", "CLT": "وقت عادی شیلی", "HNEG": "وقت عادی شرق گرینلند", "TMT": "وقت عادی ترکمنستان", "AKST": "وقت عادی آلاسکا", "HNT": "وقت عادی نیوفاندلند", "HNOG": "وقت عادی غرب گرینلند", "CHAST": "وقت عادی چت\u200cهام", "SAST": "وقت عادی جنوب افریقا", "WART": "وقت عادی غرب آرژانتین", "AKDT": "وقت تابستانی آلاسکا", "GMT": "وقت گرینویچ", "AEST": "وقت عادی شرق استرالیا", "HNPM": "وقت عادی سنت\u200cپیر و میکلون", "BOT": "وقت بولیوی", "EAT": "وقت شرق افریقا", "WAST": "وقت تابستانی غرب افریقا", "OEZ": "وقت عادی شرق اروپا"},
  71. }
  72. }
  73. // Locale returns the current translators string locale
  74. func (fa *fa_AF) Locale() string {
  75. return fa.locale
  76. }
  77. // PluralsCardinal returns the list of cardinal plural rules associated with 'fa_AF'
  78. func (fa *fa_AF) PluralsCardinal() []locales.PluralRule {
  79. return fa.pluralsCardinal
  80. }
  81. // PluralsOrdinal returns the list of ordinal plural rules associated with 'fa_AF'
  82. func (fa *fa_AF) PluralsOrdinal() []locales.PluralRule {
  83. return fa.pluralsOrdinal
  84. }
  85. // PluralsRange returns the list of range plural rules associated with 'fa_AF'
  86. func (fa *fa_AF) PluralsRange() []locales.PluralRule {
  87. return fa.pluralsRange
  88. }
  89. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'fa_AF'
  90. func (fa *fa_AF) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
  91. n := math.Abs(num)
  92. i := int64(n)
  93. if (i == 0) || (n == 1) {
  94. return locales.PluralRuleOne
  95. }
  96. return locales.PluralRuleOther
  97. }
  98. // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'fa_AF'
  99. func (fa *fa_AF) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
  100. return locales.PluralRuleOther
  101. }
  102. // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'fa_AF'
  103. func (fa *fa_AF) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
  104. return locales.PluralRuleOther
  105. }
  106. // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
  107. func (fa *fa_AF) MonthAbbreviated(month time.Month) string {
  108. return fa.monthsAbbreviated[month]
  109. }
  110. // MonthsAbbreviated returns the locales abbreviated months
  111. func (fa *fa_AF) MonthsAbbreviated() []string {
  112. return fa.monthsAbbreviated[1:]
  113. }
  114. // MonthNarrow returns the locales narrow month given the 'month' provided
  115. func (fa *fa_AF) MonthNarrow(month time.Month) string {
  116. return fa.monthsNarrow[month]
  117. }
  118. // MonthsNarrow returns the locales narrow months
  119. func (fa *fa_AF) MonthsNarrow() []string {
  120. return fa.monthsNarrow[1:]
  121. }
  122. // MonthWide returns the locales wide month given the 'month' provided
  123. func (fa *fa_AF) MonthWide(month time.Month) string {
  124. return fa.monthsWide[month]
  125. }
  126. // MonthsWide returns the locales wide months
  127. func (fa *fa_AF) MonthsWide() []string {
  128. return fa.monthsWide[1:]
  129. }
  130. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  131. func (fa *fa_AF) WeekdayAbbreviated(weekday time.Weekday) string {
  132. return fa.daysAbbreviated[weekday]
  133. }
  134. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  135. func (fa *fa_AF) WeekdaysAbbreviated() []string {
  136. return fa.daysAbbreviated
  137. }
  138. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  139. func (fa *fa_AF) WeekdayNarrow(weekday time.Weekday) string {
  140. return fa.daysNarrow[weekday]
  141. }
  142. // WeekdaysNarrow returns the locales narrow weekdays
  143. func (fa *fa_AF) WeekdaysNarrow() []string {
  144. return fa.daysNarrow
  145. }
  146. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  147. func (fa *fa_AF) WeekdayShort(weekday time.Weekday) string {
  148. return fa.daysShort[weekday]
  149. }
  150. // WeekdaysShort returns the locales short weekdays
  151. func (fa *fa_AF) WeekdaysShort() []string {
  152. return fa.daysShort
  153. }
  154. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  155. func (fa *fa_AF) WeekdayWide(weekday time.Weekday) string {
  156. return fa.daysWide[weekday]
  157. }
  158. // WeekdaysWide returns the locales wide weekdays
  159. func (fa *fa_AF) WeekdaysWide() []string {
  160. return fa.daysWide
  161. }
  162. // FmtNumber returns 'num' with digits/precision of 'v' for 'fa_AF' and handles both Whole and Real numbers based on 'v'
  163. func (fa *fa_AF) FmtNumber(num float64, v uint64) string {
  164. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  165. l := len(s) + 8 + 2*len(s[:len(s)-int(v)-1])/3
  166. count := 0
  167. inWhole := v == 0
  168. b := make([]byte, 0, l)
  169. for i := len(s) - 1; i >= 0; i-- {
  170. if s[i] == '.' {
  171. for j := len(fa.decimal) - 1; j >= 0; j-- {
  172. b = append(b, fa.decimal[j])
  173. }
  174. inWhole = true
  175. continue
  176. }
  177. if inWhole {
  178. if count == 3 {
  179. for j := len(fa.group) - 1; j >= 0; j-- {
  180. b = append(b, fa.group[j])
  181. }
  182. count = 1
  183. } else {
  184. count++
  185. }
  186. }
  187. b = append(b, s[i])
  188. }
  189. if num < 0 {
  190. for j := len(fa.minus) - 1; j >= 0; j-- {
  191. b = append(b, fa.minus[j])
  192. }
  193. }
  194. // reverse
  195. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  196. b[i], b[j] = b[j], b[i]
  197. }
  198. return string(b)
  199. }
  200. // FmtPercent returns 'num' with digits/precision of 'v' for 'fa_AF' and handles both Whole and Real numbers based on 'v'
  201. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
  202. func (fa *fa_AF) FmtPercent(num float64, v uint64) string {
  203. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  204. l := len(s) + 13
  205. b := make([]byte, 0, l)
  206. for i := len(s) - 1; i >= 0; i-- {
  207. if s[i] == '.' {
  208. for j := len(fa.decimal) - 1; j >= 0; j-- {
  209. b = append(b, fa.decimal[j])
  210. }
  211. continue
  212. }
  213. b = append(b, s[i])
  214. }
  215. if num < 0 {
  216. for j := len(fa.minus) - 1; j >= 0; j-- {
  217. b = append(b, fa.minus[j])
  218. }
  219. }
  220. // reverse
  221. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  222. b[i], b[j] = b[j], b[i]
  223. }
  224. b = append(b, fa.percent...)
  225. return string(b)
  226. }
  227. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'fa_AF'
  228. func (fa *fa_AF) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  229. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  230. symbol := fa.currencies[currency]
  231. l := len(s) + len(symbol) + 10 + 2*len(s[:len(s)-int(v)-1])/3
  232. count := 0
  233. inWhole := v == 0
  234. b := make([]byte, 0, l)
  235. for i := len(s) - 1; i >= 0; i-- {
  236. if s[i] == '.' {
  237. for j := len(fa.decimal) - 1; j >= 0; j-- {
  238. b = append(b, fa.decimal[j])
  239. }
  240. inWhole = true
  241. continue
  242. }
  243. if inWhole {
  244. if count == 3 {
  245. for j := len(fa.group) - 1; j >= 0; j-- {
  246. b = append(b, fa.group[j])
  247. }
  248. count = 1
  249. } else {
  250. count++
  251. }
  252. }
  253. b = append(b, s[i])
  254. }
  255. for j := len(symbol) - 1; j >= 0; j-- {
  256. b = append(b, symbol[j])
  257. }
  258. for j := len(fa.currencyPositivePrefix) - 1; j >= 0; j-- {
  259. b = append(b, fa.currencyPositivePrefix[j])
  260. }
  261. if num < 0 {
  262. for j := len(fa.minus) - 1; j >= 0; j-- {
  263. b = append(b, fa.minus[j])
  264. }
  265. }
  266. // reverse
  267. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  268. b[i], b[j] = b[j], b[i]
  269. }
  270. if int(v) < 2 {
  271. if v == 0 {
  272. b = append(b, fa.decimal...)
  273. }
  274. for i := 0; i < 2-int(v); i++ {
  275. b = append(b, '0')
  276. }
  277. }
  278. return string(b)
  279. }
  280. // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fa_AF'
  281. // in accounting notation.
  282. func (fa *fa_AF) FmtAccounting(num float64, v uint64, currency currency.Type) string {
  283. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  284. symbol := fa.currencies[currency]
  285. l := len(s) + len(symbol) + 10 + 2*len(s[:len(s)-int(v)-1])/3
  286. count := 0
  287. inWhole := v == 0
  288. b := make([]byte, 0, l)
  289. for i := len(s) - 1; i >= 0; i-- {
  290. if s[i] == '.' {
  291. for j := len(fa.decimal) - 1; j >= 0; j-- {
  292. b = append(b, fa.decimal[j])
  293. }
  294. inWhole = true
  295. continue
  296. }
  297. if inWhole {
  298. if count == 3 {
  299. for j := len(fa.group) - 1; j >= 0; j-- {
  300. b = append(b, fa.group[j])
  301. }
  302. count = 1
  303. } else {
  304. count++
  305. }
  306. }
  307. b = append(b, s[i])
  308. }
  309. if num < 0 {
  310. for j := len(symbol) - 1; j >= 0; j-- {
  311. b = append(b, symbol[j])
  312. }
  313. for j := len(fa.currencyNegativePrefix) - 1; j >= 0; j-- {
  314. b = append(b, fa.currencyNegativePrefix[j])
  315. }
  316. for j := len(fa.minus) - 1; j >= 0; j-- {
  317. b = append(b, fa.minus[j])
  318. }
  319. } else {
  320. for j := len(symbol) - 1; j >= 0; j-- {
  321. b = append(b, symbol[j])
  322. }
  323. for j := len(fa.currencyPositivePrefix) - 1; j >= 0; j-- {
  324. b = append(b, fa.currencyPositivePrefix[j])
  325. }
  326. }
  327. // reverse
  328. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  329. b[i], b[j] = b[j], b[i]
  330. }
  331. if int(v) < 2 {
  332. if v == 0 {
  333. b = append(b, fa.decimal...)
  334. }
  335. for i := 0; i < 2-int(v); i++ {
  336. b = append(b, '0')
  337. }
  338. }
  339. return string(b)
  340. }
  341. // FmtDateShort returns the short date representation of 't' for 'fa_AF'
  342. func (fa *fa_AF) FmtDateShort(t time.Time) string {
  343. b := make([]byte, 0, 32)
  344. if t.Year() > 0 {
  345. b = strconv.AppendInt(b, int64(t.Year()), 10)
  346. } else {
  347. b = strconv.AppendInt(b, int64(t.Year()*-1), 10)
  348. }
  349. b = append(b, []byte{0x2f}...)
  350. b = strconv.AppendInt(b, int64(t.Month()), 10)
  351. b = append(b, []byte{0x2f}...)
  352. b = strconv.AppendInt(b, int64(t.Day()), 10)
  353. return string(b)
  354. }
  355. // FmtDateMedium returns the medium date representation of 't' for 'fa_AF'
  356. func (fa *fa_AF) FmtDateMedium(t time.Time) string {
  357. b := make([]byte, 0, 32)
  358. b = strconv.AppendInt(b, int64(t.Day()), 10)
  359. b = append(b, []byte{0x20}...)
  360. b = append(b, fa.monthsAbbreviated[t.Month()]...)
  361. b = append(b, []byte{0x20}...)
  362. if t.Year() > 0 {
  363. b = strconv.AppendInt(b, int64(t.Year()), 10)
  364. } else {
  365. b = strconv.AppendInt(b, int64(t.Year()*-1), 10)
  366. }
  367. return string(b)
  368. }
  369. // FmtDateLong returns the long date representation of 't' for 'fa_AF'
  370. func (fa *fa_AF) FmtDateLong(t time.Time) string {
  371. b := make([]byte, 0, 32)
  372. b = strconv.AppendInt(b, int64(t.Day()), 10)
  373. b = append(b, []byte{0x20}...)
  374. b = append(b, fa.monthsWide[t.Month()]...)
  375. b = append(b, []byte{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()*-1), 10)
  380. }
  381. return string(b)
  382. }
  383. // FmtDateFull returns the full date representation of 't' for 'fa_AF'
  384. func (fa *fa_AF) FmtDateFull(t time.Time) string {
  385. b := make([]byte, 0, 32)
  386. b = append(b, fa.daysWide[t.Weekday()]...)
  387. b = append(b, []byte{0x20}...)
  388. b = strconv.AppendInt(b, int64(t.Day()), 10)
  389. b = append(b, []byte{0x20}...)
  390. b = append(b, fa.monthsWide[t.Month()]...)
  391. b = append(b, []byte{0x20}...)
  392. if t.Year() > 0 {
  393. b = strconv.AppendInt(b, int64(t.Year()), 10)
  394. } else {
  395. b = strconv.AppendInt(b, int64(t.Year()*-1), 10)
  396. }
  397. return string(b)
  398. }
  399. // FmtTimeShort returns the short time representation of 't' for 'fa_AF'
  400. func (fa *fa_AF) FmtTimeShort(t time.Time) string {
  401. b := make([]byte, 0, 32)
  402. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  403. b = append(b, fa.timeSeparator...)
  404. if t.Minute() < 10 {
  405. b = append(b, '0')
  406. }
  407. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  408. return string(b)
  409. }
  410. // FmtTimeMedium returns the medium time representation of 't' for 'fa_AF'
  411. func (fa *fa_AF) FmtTimeMedium(t time.Time) string {
  412. b := make([]byte, 0, 32)
  413. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  414. b = append(b, fa.timeSeparator...)
  415. if t.Minute() < 10 {
  416. b = append(b, '0')
  417. }
  418. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  419. b = append(b, fa.timeSeparator...)
  420. if t.Second() < 10 {
  421. b = append(b, '0')
  422. }
  423. b = strconv.AppendInt(b, int64(t.Second()), 10)
  424. return string(b)
  425. }
  426. // FmtTimeLong returns the long time representation of 't' for 'fa_AF'
  427. func (fa *fa_AF) FmtTimeLong(t time.Time) string {
  428. b := make([]byte, 0, 32)
  429. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  430. b = append(b, fa.timeSeparator...)
  431. if t.Minute() < 10 {
  432. b = append(b, '0')
  433. }
  434. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  435. b = append(b, fa.timeSeparator...)
  436. if t.Second() < 10 {
  437. b = append(b, '0')
  438. }
  439. b = strconv.AppendInt(b, int64(t.Second()), 10)
  440. b = append(b, []byte{0x20, 0x28}...)
  441. tz, _ := t.Zone()
  442. b = append(b, tz...)
  443. b = append(b, []byte{0x29}...)
  444. return string(b)
  445. }
  446. // FmtTimeFull returns the full time representation of 't' for 'fa_AF'
  447. func (fa *fa_AF) FmtTimeFull(t time.Time) string {
  448. b := make([]byte, 0, 32)
  449. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  450. b = append(b, fa.timeSeparator...)
  451. if t.Minute() < 10 {
  452. b = append(b, '0')
  453. }
  454. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  455. b = append(b, fa.timeSeparator...)
  456. if t.Second() < 10 {
  457. b = append(b, '0')
  458. }
  459. b = strconv.AppendInt(b, int64(t.Second()), 10)
  460. b = append(b, []byte{0x20, 0x28}...)
  461. tz, _ := t.Zone()
  462. if btz, ok := fa.timezones[tz]; ok {
  463. b = append(b, btz...)
  464. } else {
  465. b = append(b, tz...)
  466. }
  467. b = append(b, []byte{0x29}...)
  468. return string(b)
  469. }