multi language (with module)
Hi, to finish my first module I like to make it also available for non-german users (remove the hardcoded german text). But I could not figure out how in a way that works. So I wrote down a minimal example in pseudo-tex to point out my goal. Can you give me an idea/solution how to implement it in a correct way? Thanks, P. --8<------t-welcome.tex------------ \startmodule[welcome] \unprotect \setupmodule[atPageText=] %these two lines are properly totally wrong but should show the idea \define[atPageText[en]={Welcome}] \define[atPageText[de]={Willkommen}] \def\welcome{\moduleparameter{welcome}{atPageText}} \protect \stopmodule \endinput --8<-------welcome.tex--------------- %this line is properly totally wrong but should show the idea \usemodule[welcome][atPageText[eo]={Bonvenon},atPageText[de]={Guten Tag}]] \starttext \language[en] Should be Welcome: \welcome \language[de] Should be Guten Tag: \welcome \language[eo] Should be Bonvenon: \welcome \stoptext
Am 16.05.2012 um 14:17 schrieb Peter Schorsch:
Hi,
to finish my first module I like to make it also available for non-german users (remove the hardcoded german text). But I could not figure out how in a way that works. So I wrote down a minimal example in pseudo-tex to point out my goal. Can you give me an idea/solution how to implement it in a correct way?
Thanks, P.
--8<------t-welcome.tex------------ \startmodule[welcome] \unprotect
\setupmodule[atPageText=]
%these two lines are properly totally wrong but should show the idea \define[atPageText[en]={Welcome}] \define[atPageText[de]={Willkommen}]
\def\welcome{\moduleparameter{welcome}{atPageText}}
\protect \stopmodule \endinput
--8<-------welcome.tex--------------- %this line is properly totally wrong but should show the idea \usemodule[welcome][atPageText[eo]={Bonvenon},atPageText[de]={Guten Tag}]]
\starttext
\language[en] Should be Welcome: \welcome
\language[de] Should be Guten Tag: \welcome
\language[eo] Should be Bonvenon: \welcome
\stoptext
Method 1 (mkii/mkiv): \def\welcome{\translate[en=Welcome,de=Guten Tag]} \starttext \language[en]Welcome: \welcome \language[de]Welcome: \welcome \stoptext Method 2 (mkiv only): \definelabelclass[testlabel] \setuptestlabeltext[en][welcome=Welcome] \setuptestlabeltext[de][welcome=Willkommen] \starttext \mainlanguage[en]Welcome: \testlabeltext{welcome} \mainlanguage[de]Welcome: \testlabeltext{welcome} \stoptext Wolfgang
Thanks Wolfgang, your post helped me a lot! I am wondering if only a subset of languages is able to be defined as I got following result: Should be Welcome: Welcome Should be Guten Tag: Guten Tag Should be Bonvenon: Guten Tag The Esperanto text is not displayed. It does not matter wether I put the eo definition into the module or normal tex file. This source I used: --8<----t-welcome.tex--------------- \startmodule[welcome] \unprotect \definelabelclass[welcome] \setupwelcometext[en][welcome=Welcome] \setupwelcometext[de][welcome=Willkommen] \def\welcome{\welcometext{welcome}} \protect \stopmodule \endinput --8<----welcome.tex----------------- \usemodule[welcome] \setupwelcometext[eo][welcome=Bonvenon] \setupwelcometext[de][welcome=Guten Tag] \starttext \mainlanguage[en]Should be Welcome: \welcome \mainlanguage[de]Should be Guten Tag: \welcome \mainlanguage[eo]Should be Bonvenon: \welcome \stoptext
Am 16.05.2012 um 15:42 schrieb Peter Schorsch:
Thanks Wolfgang, your post helped me a lot! I am wondering if only a subset of languages is able to be defined as I got following result:
Should be Welcome: Welcome Should be Guten Tag: Guten Tag Should be Bonvenon: Guten Tag
The Esperanto text is not displayed. It does not matter wether I put the eo definition into the module or normal tex file.
Esperanto isn’t a valid language for ConTeXt but you can ask Hans to add it. Wolfgang
participants (2)
-
Peter Schorsch
-
Wolfgang Schuster