ps_AF.go 21 KB

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