From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/114911 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Wolfgang Schuster via ntg-context Newsgroups: gmane.comp.tex.context Subject: Re: Simple question Date: Tue, 10 May 2022 17:21:04 +0200 Message-ID: <0ef5e6ed-ac10-9ce9-88ed-7f28c6a41a05@gmail.com> References: Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7241673663974139441==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40874"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 PostboxApp/7.0.56 Cc: Wolfgang Schuster To: mailing list for ConTeXt users , Gerben Wierda via ntg-context Original-X-From: ntg-context-bounces@ntg.nl Tue May 10 17:22:00 2022 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane-mx.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1noRgW-000AKR-EP for gctc-ntg-context-518@m.gmane-mx.org; Tue, 10 May 2022 17:22:00 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 490B0289DFF; Tue, 10 May 2022 17:21:14 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5WR_7b27sk6o; Tue, 10 May 2022 17:21:10 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id BA3EF28044A; Tue, 10 May 2022 17:21:10 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 47BDC28044A for ; Tue, 10 May 2022 17:21:09 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FnSKyKRCmVcJ for ; Tue, 10 May 2022 17:21:08 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.218.51; helo=mail-ej1-f51.google.com; envelope-from=wolfgang.schuster.lists@gmail.com; receiver= Original-Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 371FE28041C for ; Tue, 10 May 2022 17:21:08 +0200 (CEST) Original-Received: by mail-ej1-f51.google.com with SMTP id i19so33633983eja.11 for ; Tue, 10 May 2022 08:21:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=eGlfvhdevMGO7srzrL74/JI6MkVTSfyy8xJa0u3XlRs=; b=GBqWA/93fmR9XPQoCZ3DSb2xKZkRQeuqS4/zzIPTCu0h48nS2fjPYW09mZsg3O/YPL KJp6kWAd6Z9k5xtdlvkSNJsUmulebnJGVFvtUrZyC2i/PguaJV34+2cDA81VeTOFE6fN +rvEDiBb7Y8F4F27gO5PcddDWHNGFSRZFHpq4TyCqUHHoXbX/R2HVgEOKcqJ7j3xVaGI apyLIhyIgtFBxSgQoQkOEYZQHskhl2C/RNRb76GZXNzH3/W7EosLVwuTJSLf7OSsVJUe GWW2nEjcWHSAzpmISYkblWPlgMjpbPfoaZcAAAtQ+mUcN0oG2hXqTw/nRfXpMrl/GS0C t6Xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=eGlfvhdevMGO7srzrL74/JI6MkVTSfyy8xJa0u3XlRs=; b=Nl54JqrVOcoWi/1jd4KV04W9ebg3Vr8g06DsmQ3MjTESAM2gvym3dYEFn7oggPqbfB 8r7aKUIak/igRl70RnTr/VKc06Q28+re/E3LNsFCUijSIo8G0ZSVVSQUL6Znizm4SzU+ EcYPbfkGrfeTVCNtHx7jj8+sRsgR1cNy3dZ4oWy6/NbAv2BxZ0ZgBizuKPrwBUbXxr9S Yf6gjidWOqlVSrY6Ki4YmzuWyUgYvnMo0KEUTf+bP4okaucj+lQSo23yDoMO5M99OoDh 3ej+l5T/nVHyVMk+E2uK+WQHMdhUoPbVXJ4R3CGRLOGbgXxEllICjOfFW0uOSIbMlnT0 WzDA== X-Gm-Message-State: AOAM532h7DXORlio2yTPUf+de2L8zDfRHxJmXDFQ68yC8BOR7lWl6a19 MXLdAnOzvhFm2wUqSS1ViZg= X-Google-Smtp-Source: ABdhPJzvSmop5hJCs85lnNQd4X7MCZihZJDh2PRur129J03Llf0XoER1wKOW7dcvhOw40kPry+adDg== X-Received: by 2002:a17:907:72ca:b0:6f9:8675:6a2a with SMTP id du10-20020a17090772ca00b006f986756a2amr12328843ejc.98.1652196066663; Tue, 10 May 2022 08:21:06 -0700 (PDT) Original-Received: from [192.168.0.227] (ip1f10fab0.dynamic.kabel-deutschland.de. [31.16.250.176]) by smtp.gmail.com with ESMTPSA id gz17-20020a170907a05100b006f3ef214e72sm6230623ejc.216.2022.05.10.08.21.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 May 2022 08:21:06 -0700 (PDT) In-Reply-To: Content-Language: en-US X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.io gmane.comp.tex.context:114911 Archived-At: This is a multi-part message in MIME format. --===============7241673663974139441== Content-Type: multipart/alternative; boundary="------------FF9B5E6FD7DC44EEBA29C520" Content-Language: en-US This is a multi-part message in MIME format. --------------FF9B5E6FD7DC44EEBA29C520 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit 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 --------------FF9B5E6FD7DC44EEBA29C520 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit 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

--------------FF9B5E6FD7DC44EEBA29C520-- --===============7241673663974139441== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --===============7241673663974139441==--