ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* multi language (with module)
@ 2012-05-16 12:17 Peter Schorsch
  2012-05-16 12:28 ` Wolfgang Schuster
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Schorsch @ 2012-05-16 12:17 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: multi language (with module)
  2012-05-16 12:17 multi language (with module) Peter Schorsch
@ 2012-05-16 12:28 ` Wolfgang Schuster
  2012-05-16 13:42   ` Peter Schorsch
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfgang Schuster @ 2012-05-16 12:28 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: multi language (with module)
  2012-05-16 12:28 ` Wolfgang Schuster
@ 2012-05-16 13:42   ` Peter Schorsch
  2012-05-16 14:24     ` Esperanto (was: multi language (with module)) Wolfgang Schuster
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Schorsch @ 2012-05-16 13:42 UTC (permalink / raw)
  To: ntg-context

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
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Esperanto (was: multi language (with module))
  2012-05-16 13:42   ` Peter Schorsch
@ 2012-05-16 14:24     ` Wolfgang Schuster
  0 siblings, 0 replies; 4+ messages in thread
From: Wolfgang Schuster @ 2012-05-16 14:24 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-05-16 14:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-16 12:17 multi language (with module) Peter Schorsch
2012-05-16 12:28 ` Wolfgang Schuster
2012-05-16 13:42   ` Peter Schorsch
2012-05-16 14:24     ` Esperanto (was: multi language (with module)) Wolfgang Schuster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).