Dear Aditya,
>
> context([[\def\noexpand\Lang{...}]])
not working
>
> or
>
> context([[\def\string\Lang{...}]])
working
>
> I don't understand why
>
> context([[\def\\Lang{...}]])
working, too
You are right. [[\def\\Lang{English}]] method works.
I summerize it as a test file. The first 5 methods are working well, but the last one using \noexpand cause the error.
Thank you.
Best regards,
Dalyoung
\mainlanguage[en]
\starttext
\startitemize[n]
\head Using \type{context.setvalue("Lang","English")}
\startluacode
if languages.current() == "en" then
context.setvalue("Lang","English")
else
context.setvalue("Lang","Not English")
end
\stopluacode
Current language: \Lang
\head Using \type{context("\\def\\Lang{English}")}
\startluacode
if languages.current() == "en" then
context("\\def\\Lang{English}")
else
context("\\def\\Lang{Not English}")
end
\stopluacode
Current language: \Lang
\head Using \type{context([[\def\string\Lang{English}]])}
\startluacode
if languages.current() == "en" then
context([[\def\string\Lang{English}]])
else
context([[\def\string\Lang{Not English}]])
end
\stopluacode
Current language: \Lang
\head Using \type{context([[\def\\Lang{English}]])}
\startluacode
if languages.current() == "en" then
context([[\def\\Lang{English}]])
else
context([[\def\\Lang{Not English}]])
end
\stopluacode
Current language: \Lang
\head Using \type{\doifelse\currentmainlanguage{en}...}
\doifelse\currentmainlanguage{en}
{\def\Lang{English}}{\def\Lang{Not English}}
Current language: \Lang
\head Using \type{context([[\def\noexpand\Lang{English}]])}
%\startluacode
% if languages.current() == "en" then
% context([[\def\noexpand\Lang{English}]])
% else
% context([[\def\noexpand\Lang{Not English}]])
% end
%\stopluacode
%Current language: \Lang
\stopitemize
\stoptext