From: Wolfgang Schuster <schuster.wolfgang@googlemail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: multi language (with module)
Date: Wed, 16 May 2012 14:28:07 +0200 [thread overview]
Message-ID: <BFA488C0-9A99-478A-85ED-1333511D4480@googlemail.com> (raw)
In-Reply-To: <20120516141711.1467a75a@freenet.de>
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
___________________________________________________________________________________
next prev parent reply other threads:[~2012-05-16 12:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-16 12:17 Peter Schorsch
2012-05-16 12:28 ` Wolfgang Schuster [this message]
2012-05-16 13:42 ` Peter Schorsch
2012-05-16 14:24 ` Esperanto (was: multi language (with module)) Wolfgang Schuster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BFA488C0-9A99-478A-85ED-1333511D4480@googlemail.com \
--to=schuster.wolfgang@googlemail.com \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).