[NTG-context] Simple question

denis.maier at unibe.ch denis.maier at unibe.ch
Tue May 10 20:05:26 CEST 2022


Don't know how if there's an automatic way, perhaps look into ctx processing instructions.
Anyway you can use
--result=name
As you have to set quite a few options on the command line (modes, language) you'll perhaps want to use a makefile anyway.



________________________________________
Von: ntg-context <ntg-context-bounces at ntg.nl> im Auftrag von Gerben Wierda via ntg-context <ntg-context at ntg.nl>
Gesendet: Dienstag, 10. Mai 2022 18:47:32
An: mailing list for ConTeXt users
Cc: Gerben Wierda
Betreff: Re: [NTG-context] Simple question

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 at gmail.com<mailto:wolfgang.schuster.lists at 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



More information about the ntg-context mailing list