fa_AF.go 20 KB

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