For Jalali dates and Persian numbering, I can get the following to work:
\persiandecimals{\rawdate[jalali:to,d]}/\persiandecimals{\rawdate[jalali:to,M]}/\persiandecimals{\rawdate[jalali:to,y]}
but the following does not work and throws an error:
\persiandecimals{\currentdate[jalali:to,d]}
If I want to get the output for different date, option 2 below works and option 1 does not.
---------
% option 1
\persiandecimals{\begingroup\setdate[m=5]\rawdate[jalali:to,y]\endgroup}
% option 2
{\begingroup\setdate[m=5]\persiandecimals{\rawdate[jalali:to,y]}\endgroup}
----------
does \setdate expand to something non-empty?
note that with the above ideas, we cannot get "mm" with leading zeros to work because
\persiandecimals drops the leading zero. the following ugly hack works if I insist on using
\currentdate to format the output and I want Indic digits.
--------
\startluacode
function persmap(s)
local stream = tostring(s)
local mapping = languages.decimals.persian
local gsub = string.gsub
return mapping and gsub(stream, ".", mapping) or stream
end
\stopluacode
\def\persmap#1{\ctxlua{context(persmap("#1"))}}
\def\mycurrentdate[#1]{\persmap{\rawdate[#1]}}
\mycurrentdate[jalali:to,dd,/,mm,/,y]
--------
even with \mainlanguage[fa] and \language[fa] I don't get the month names translated to persian labels. why?
------
\mainlanguage[fa]
\language[fa]
\starttext
\currentdate[month:jalali]
\stoptext
-----