ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
	Gerben Wierda via ntg-context <ntg-context@ntg.nl>
Cc: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>
Subject: Re: Simple question
Date: Tue, 10 May 2022 17:21:04 +0200	[thread overview]
Message-ID: <0ef5e6ed-ac10-9ce9-88ed-7f28c6a41a05@gmail.com> (raw)
In-Reply-To: <C19B2BDB-40A3-4B46-91F4-FF1D66E0230F@rna.nl>


[-- Attachment #1.1: Type: text/plain, Size: 2373 bytes --]

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


[-- Attachment #1.2: Type: text/html, Size: 3836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  parent reply	other threads:[~2022-05-10 15:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-09 22:15 Gerben Wierda via ntg-context
2022-05-10  7:10 ` Henning Hraban Ramm via ntg-context
2022-05-10  7:16 ` Database of translations (was: Simple question) Marco Patzer via ntg-context
2022-05-10 15:21 ` Wolfgang Schuster via ntg-context [this message]
2022-05-10 16:47   ` Simple question Gerben Wierda via ntg-context
2022-05-10 18:05     ` Denis Maier via ntg-context
     [not found] <009338BB68A541498BE072F8D0E602FA01ECA3@sbsserver.hoofdkant oor.lokaal>
2002-09-16 14:20 ` simple question Hans Hagen
  -- strict thread matches above, loose matches on Subject: below --
2002-09-16 13:53 Michel van Ast
2002-09-16 18:00 ` Tobias Burnus
2002-09-16 18:11 ` Willi Egger

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=0ef5e6ed-ac10-9ce9-88ed-7f28c6a41a05@gmail.com \
    --to=ntg-context@ntg.nl \
    --cc=wolfgang.schuster.lists@gmail.com \
    /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).