the following outputs "farsi" instead of "fa". is this the reason the translation of jalali month does not kick in?------\mainlanguage[fa]\currentlanguage------strangely either of the following two lines changes the month name.------\setuplabeltext[en][february:jalali=test]\setuplabeltext[fa][february:jalali=test]\currentlanguage[month:jalali]------I'm confused. why isn't the data in lang-txt.lua used?strangely, the following outputs the correct translation of second jalali month in farsi regardless of the above \setuplabeltext commands:----\ctxlua{context(languages.data.labels.texts['february:jalali'].labels.fa)}----On Thu, Feb 27, 2025 at 6:30 AM Mohammad Hossein Bateni <bateni@gmail.com> wrote: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-----On Fri, Feb 21, 2025 at 12:13 PM Wolfgang Schuster <wolfgang.schuster.lists@gmail.com> wrote:Am 20.02.2025 um 19:53 schrieb Mohammad Hossein Bateni:
> Any thoughts why the following doesn't work?
>
> \currentdate[d:persiannumerals]
>
> It just outputs the normal digits.
>
> In contrast, these work:
>
> \currentdate[d:abjadnumerals]
> \convertnumber{persiannumerals}{\normalday}
persiannumerals aren't considered a conversion method for the underlying
Lua mechanism while there exists a method for \convertnumber on the TeX
side.
Both system are separate (to a certain degree) but the TeX side borrows
the conversion vectors from the Lua mechanism.
Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________