[NTG-context] Language dependency in environment-project file

Wolfgang Schuster wolfgang.schuster.lists at gmail.com
Tue Nov 27 22:41:25 CET 2018



Marco Patzer schrieb am 27.11.18 um 22:23:
> On Tue, 27 Nov 2018 22:05:27 +0100
> Wolfgang Schuster <wolfgang.schuster.lists at gmail.com> wrote:
>
>>> But even your solution doesn't work here. Did you try it in the
>>> example project file?
>> \startenvironment [*]
>>
>> \startsetups [itemgroup:en]
>>     \setupitemgroup [itemize] [i]
>> \stopsetups
>>
>> \startsetups [itemgroup:sv]
>>     \setupitemgroup [itemize] [a]
>> \stopsetups
>>
>> \setuplanguage
>>     [en]
>>     [setups=itemgroup:en]
>>
>> \setuplanguage
>>     [sv]
>>     [setups=itemgroup:sv]
>>
>> \appendtoks
>> \doifdocumentvariable{language}{\mainlanguage[\documentvariable{language}]}
>> \to \everysetupdocument
>>
>> \stopenvironment
> That works, thanks.
>
> One more question: I used to use modes, since I could just
>
>    \startmode[*en]
>>    \stopmode
>
> any number of times. There are many language dependent settings in
> the environment files.
>
> With named setups I need to specify a name for each occurrence and
> gather them at the end. This is not as clean. Is it possible e.g. to
> add something to an already existing setup instead of creating a new
> one every time?

No, this is only possible with a token list.


\startenvironment [*]

\newtoks\EnglishSettings
\newtoks\SwedishSettings

\appendtoks
   \setupitemgroup [itemize] [i]
\to \EnglishSettings

\appendtoks
   \setupitemgroup [itemize] [a]
\to \SwedishSettings

% the order of the following settings is important because you have
% to set the language before you can make the language dependant
% mode setting

\appendtoks
\doifdocumentvariable{language}{\mainlanguage[\documentvariable{language}]}
\to \everysetupdocument

\appendtoks
   \startmodeset
     [**en] {\flushtoks\EnglishSettings}
     [**sv] {\flushtoks\SwedishSettings}
   \stopmodeset
\to \everysetupdocument

\stopenvironment


Wolfgang


More information about the ntg-context mailing list