Thank you.

Is it possible to change the name of the resulting PDF file based on the language and a mode?

So that with a command

context language=fr mode=simple file.tex

the result is in

file-simple-fr.pdf

and with 

context language=ru mode=none file.tex (or no mode given)

the result is

file-ru.pdf

G

On 10 May 2022, at 17:21, Wolfgang Schuster <wolfgang.schuster.lists@gmail.com> wrote:

Gerben Wierda via ntg-context schrieb am 10.05.2022 um 00:15:
What is the easiest way to have a ‘database’ of translations for strings and maybe links?

I now have 4 languages and 2 versions so 8 documents, but I’d like to have all translatable strings together so I can maintain these in a single file. Ideally I can do a file where the key of the translation is one language (say English) and the translations are part of that. 

Something I can call like this

\translatephrase[English phrase][nl]
\translatelocation[../LMTX-Output/without-ids/en/file.pdf][nl][simple]

and where I can maintain all the translations a bit like this:

\translationentry[English phrase]{
\definetranslatephrase[nl]Nederlandse frase]
\definetranslatephrase[fr][Phrase français]
}
}

\translatelocation[../LMTX-Output/without-ids/en/file.pdf][simple][nl][../LMTX-Output/without-ids/nl/file-simple.pdf]]
\translatelocation[../LMTX-Output/without-ids/en/file.pdf][none][nl][../LMTX-Output/without-ids/nl/file.pdf]]


Where the \translatelocation command can be used inside an \externalfigure command and \translatephrase can be used as as text.

In the end I’d like to compile with 

context language=fr mode=simple mainfile.tex

Doable?

To set language dependent texts you can use the labeltext mechanism which is used by ConTeXt to change the captions for floats etc.

Besides the default \labeltext and \setuplabeltext commands you can create your own instance of the mechanism for your texts.

%%%% begin example
\definelabelclass [gerben]

\setupgerbentext [en] [phrase=English phrase]
\setupgerbentext [nl] [phrase=Nederlandse frase]
\setupgerbentext [fr] [phrase=Phrase français]

%\mainlanguage[nl]
%\mainlanguage[fr]

\starttext
\gerbentext{phrase}
\stoptext
%%%% end example

To change images you use multiple sub folders where each folder has images which the same name. In ConTeXt you can use a mode to choose which directory is used to load the image. Another method is to map the file names of the images to symbolic names and use only the symbolic names in your document.

%%%% begin example
\setupexternalfigures [location={local,global,default}]

\useexternalfigure [simple] [cow.pdf]
%\useexternalfigure [simple] [hacker.png]

\starttext
\externalfigure[simple]
\stoptext
%%%% end example

Wolfgang