Re: [NTG-context] checking mainlanguage setup
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
Am 01.06.2011 um 09:45 schrieb Jeong Dalyoung:
I summerize it as a test file. The first 5 methods are working well, but the last one using \noexpand cause the error.
What exactly do you plan to do with the language check, for simple texts your method is overkill and labeltexts are better suited, even a command which prints a text can be written in TeX without problems: \def\LangOne {\doifelse{\currentmainlanguage}{en} {English 1} {\doifelse{\currentmainlanguage}{nl} {Dutch 1} {Unknown 1}}} \def\LangTwo {\processaction [\currentmainlanguage] [ en=>English 2, nl=>Dutch 2, unknown=>Unknown 2]} \setuplabeltext[en][langthree=English 3] \setuplabeltext[nl][langthree=Dutch 3] \setuplabeltext [langthree=Unknown 3] \starttext \LangOne:\LangTwo:\labeltext{langthree}:\translate[en=English 4,nl=Dutch 4] \mainlanguage[nl] \LangOne:\LangTwo:\labeltext{langthree}:\translate[en=English 4,nl=Dutch 4] \mainlanguage[fr] \LangOne:\LangTwo:\labeltext{langthree}:\translate[en=English 4,nl=Dutch 4] \stoptext Wolfgang
participants (2)
-
Jeong Dalyoung
-
Wolfgang Schuster