[NTG-context] 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 ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] multi language (with module)
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 ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] multi language (with module)
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: --8t-welcome.tex--- \startmodule[welcome] \unprotect \definelabelclass[welcome] \setupwelcometext[en][welcome=Welcome] \setupwelcometext[de][welcome=Willkommen] \def\welcome{\welcometext{welcome}} \protect \stopmodule \endinput --8welcome.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 ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___