Re: [NTG-context] Does \startnotallmodes work?

2022-05-10 Thread Rik Kabel via ntg-context

On 2022-05-10 17:39, Gerben Wierda via ntg-context wrote:

Example. Call with

context —mode=FR

- Uncomment the first commented lines. Compilation fails because mode 
FR is on so that works


But I get English anyway. Uncomment the second commented part and it 
fails, but it should not because mode=EN is not turned on.


%\startmode[FR]
%  \BLURBONE
%  \stopmode

\startnotallmodes[FR,RU]% english is the default
\enablemode[EN]
\stopnotallmodes

\startmode[EN]
%  \BLURBTWO
\setuplanguage[en][patterns={en}]
\setupexternalfigure[directory=../LMTX-Output/without-ids/en/ArchiMate 
3.1 Metamodel ESv4]

\stopmode
\startmode[FR]
\setuplanguage[fr][patterns={en,fr}]
\setupexternalfigure[directory=../LMTX-Output/without-ids/fr/ArchiMate 
3.1 Metamodel ESv4]

\stopmode
\startmode[RU]
\setuplanguage[ru][patterns={en,ru}]
\setupexternalfigure[directory=../LMTX-Output/without-ids/ru/ArchiMate 
3.1 Metamodel ESv4]

\stopmode

Gerben Wierda (LinkedIn )
R IT Strategy  (main site)
Book: Chess and the Art of Enterprise Architecture 


Book: Mastering ArchiMate 


Gerben,

\startnotallmodes is behaving as it should. Here, it is not the case 
that RU and FR (all the listed modes) are set, so EN is enabled, and you 
actually have both FR and EN set.


Try the following with

   context —mode=FR

and make sure you understand the result.

   \starttext
   \doifmode{EN}{EN is enabled\par}
   \doifmode{FR}{FR is enabled\par}
   \doifmode{RU}{RU is enabled\par}
   \doifmode{FR,RU}{at least one of FR and RU modes is enabled\par}
   \doifmode{EN,RU}{at least one of EN and RU modes is enabled\par}
   \doifmode{EN,FR}{at least one of EN and FR modes is enabled\par}
   \doifmode{EN,FR,RU}{at least one of EN, FR, and RU modes is enabled\par}
   \doifnotmode{EN}{EN is not enabled\par}
   \doifnotmode{FR}{FR is not enabled\par}
   \doifnotmode{RU}{RU is not enabled\par}
   \doifnotmode{EN,RU}{neither EN nor RU is enabled\par}
   \doifnotmode{EN,FR}{neither EN nor FR is enabled\par}
   \doifnotmode{RU,FR}{neither RU nor FR is enabled\par}
   \doifnotallmodes{FR,RU}{all of FR and RU modes are not enabled\par}
   \doifnotallmodes{EN,RU}{all of EN and RU modes are not enabled\par}
   \doifnotallmodes{EN,FR}{all of EN and FR modes are not enabled\par}
   \doifnotallmodes{EN,FR,RU}{all of EN, FR, and RU modes are not
   enabled\par}
   \stoptext

Then, add the following block to the beginning of the file and try again.

   \definemode[EN,FR,RU][keep]
   \doifmodeelse{EN}
  {    \disablemode[FR]
   \disablemode[RU]}
  {\doifmodeelse{FR}
   {   \disablemode[EN]
   \disablemode[RU]}
   {\doifmodeelse{RU}
 { \disablemode[EN]
   \disablemode[FR]}}
 { \enablemode[EN]}}

I find it useful to add such a block to the environment of every file 
that uses mutually-exclusive modes. This version pf the block sets a 
default value if none is on the command line.


--
Rik



___
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
___


Re: [NTG-context] Can I use language as a mode (set on the command line) and simplify this?

2022-05-10 Thread Gerben Wierda via ntg-context
Fix

> On 10 May 2022, at 22:41, Gerben Wierda via ntg-context  
> wrote:
> 
> I currently have:
> 
> \startnotallmodes[FR,RU]% english is the default
> \enablemode[EN]
> \stopnotallmodes
> \startmode[EN]
> \setuplanguage[en][patterns={en}]
> \setupexternalfigure[directory=../LMTX-Output/without-ids/en/ArchiMate 3.1 
> Metamodel ESv4]
> \stopmode
> \startmode[FR]
> \setuplanguage[fr][patterns={en,fr}]
> \setupexternalfigure[directory=../LMTX-Output/without-ids/fr/ArchiMate 3.1 
> Metamodel ESv4]
> \stopmode
> \startmode[RU]
> \setuplanguage[ru][patterns={en,ru}]
> \setupexternalfigure[directory=../LMTX-Output/without-ids/ru/ArchiMate 3.1 
> Metamodel ESv4]
> \stopmode
> 
> I was wondering if this can be simplified, e.g. by setting language on the 
> command line instead, enable a mode derived from a language set on the 
> command line, and if I would have a single command 
> \setupexternalfigure[directory= that reacts to the language by using the name 
> of the language as part of the directory?
> 
> Gerben Wierda (LinkedIn )
> R IT Strategy  (main site)
> Book: Chess and the Art of Enterprise Architecture 
> 
> Book: Mastering ArchiMate 
> 
> ___
> 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
> ___

___
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
___


[NTG-context] Does \startnotallmodes work?

2022-05-10 Thread Gerben Wierda via ntg-context
Example. Call with 

context —mode=FR

- Uncomment the first commented lines. Compilation fails because mode FR is on 
so that works

But I get English anyway. Uncomment the second commented part and it fails, but 
it should not because mode=EN is not turned on.

%\startmode[FR]
%  \BLURBONE
%  \stopmode

\startnotallmodes[FR,RU]% english is the default
\enablemode[EN]
\stopnotallmodes

\startmode[EN]
%  \BLURBTWO
\setuplanguage[en][patterns={en}]
\setupexternalfigure[directory=../LMTX-Output/without-ids/en/ArchiMate 3.1 
Metamodel ESv4]
\stopmode
\startmode[FR]
\setuplanguage[fr][patterns={en,fr}]
\setupexternalfigure[directory=../LMTX-Output/without-ids/fr/ArchiMate 3.1 
Metamodel ESv4]
\stopmode
\startmode[RU]
\setuplanguage[ru][patterns={en,ru}]
\setupexternalfigure[directory=../LMTX-Output/without-ids/ru/ArchiMate 3.1 
Metamodel ESv4]
\stopmode

Gerben Wierda (LinkedIn )
R IT Strategy  (main site)
Book: Chess and the Art of Enterprise Architecture 
Book: Mastering ArchiMate 

___
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
___


[NTG-context] Can I use language as a mode (set on the command line) and simplify this?

2022-05-10 Thread Gerben Wierda via ntg-context
I currently have:

\startnotallmodes[FR,RU]% english is the default
\enablemode[EN]
\stopmode
\startmode[EN]
\setuplanguage[en][patterns={en}]
\setupexternalfigure[directory=../LMTX-Output/without-ids/en/ArchiMate 3.1 
Metamodel ESv4]
\stopmode
\startmode[FR]
\setuplanguage[fr][patterns={en,fr}]
\setupexternalfigure[directory=../LMTX-Output/without-ids/fr/ArchiMate 3.1 
Metamodel ESv4]
\stopmode
\startmode[RU]
\setuplanguage[ru][patterns={en,ru}]
\setupexternalfigure[directory=../LMTX-Output/without-ids/ru/ArchiMate 3.1 
Metamodel ESv4]
\stopmode

I was wondering if this can be simplified, e.g. by setting language on the 
command line instead, enable a mode derived from a language set on the command 
line, and if I would have a single command \setupexternalfigure[directory= that 
reacts to the language by using the name of the language as part of the 
directory?

Gerben Wierda (LinkedIn )
R IT Strategy  (main site)
Book: Chess and the Art of Enterprise Architecture 
Book: Mastering ArchiMate 

___
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
___


Re: [NTG-context] Simple question

2022-05-10 Thread Denis Maier via ntg-context
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  im Auftrag von Gerben Wierda via 
ntg-context 
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 
mailto:wolfgang.schuster.li...@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

___
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
___


[NTG-context] Cron /var/www/aanhet.net/context/bin/cron/context-mirror

2022-05-10 Thread Cron Daemon via ntg-context
receiving incremental file list
 ./
 ctan.lsr
 document-2.htm
 download-1.htm
 download-2.htm
 logo-ade.png
 logo-cts.png
 logo-pod.png
 rss.xml
 
 sent 1,492 bytes  received 135,306 bytes  273,596.00 bytes/sec
 total size is 456,808,110  speedup is 3,339.29
___
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
___


Re: [NTG-context] Simple question

2022-05-10 Thread Gerben Wierda via ntg-context
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 
>  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

___
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
___


Re: [NTG-context] Simple question

2022-05-10 Thread Wolfgang Schuster via ntg-context

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

___
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
___


[NTG-context] \placenotes ends up in wrong place when mixing one- and two- column layouts.

2022-05-10 Thread Zhichu Chen via ntg-context

Thanks Hans, works perfectly.


Sorry for the late reply. Still working on the template and got another 
one. Again, sorry.



The journal is in two-column form and the title, authors, and addresses 
are spanned to


the full width. Very common. But the title may acknowledge to some 
fund(s) and the


authors may have email addresses. If I use \note[thanks] and 
\note[email] to do that,


only the markers are shown. That's expected. So I tried to put 
\postponenotes before


the title and insert\placenotes[thanks] and \placenotes[email] after 
\startcolumns. The


notes did show up but in wrong position.


I hope there's another magic switch, or I have to put the marks in the 
title head and


put "real" but invisible notes in the two-column texts.



Thanks again, Hans.


Yours,

Zhichu


MWE (not that minimal):

===

\definenote[address]
\setupnote[address][rule=off,location=text]

\definenote[thanks]
\setupnote[thanks][location=firstcolumn]
\setupnotation[thanks][numberconversion=set 2]
\definenote[email][thanks]


\definenamespace
   [addr]
   [type=module,
    name=address,
    command=yes,
    setup=list,
    parent=addr,
  ]

\define[1]\useaddress
    {\edef\currentaddress{#1}%
 {\setnotetext[address][#1]{\addressparameter{name}}}%
    \endgraf
    }

\starttext


\setupaddress[style=italic]
\defineaddress[fst][name={Name of Institute or Affiliation, City, Country}]
\defineaddress[snd][name={Name of Secondary Institute or Affiliation, 
City, Country}]


\processcommacommand[fst,snd]\useaddress

\postponenotes

The Title\thanks{Work supported by somebody.}

%\startlocalnotes[address]
Me\email{myemail@some.where}\high{,}\note[address][fst]\high{,}\note[address][snd]
%\placelocalnotes[address]
%\stoplocalnotes

\placenotes[address]

\startcolumns

\placenotes[thanks]
\placenotes[email]


\input knuth
\stopcolumns

\stoptext

===


On 5/8/22 17:20, Hans Hagen via ntg-context wrote:

On 5/8/2022 6:55 AM, Zhichu via ntg-context wrote:

Hi,

I am going to convince the Board of a journal to consider ConTeXt as 
an additional option.
I want to make a module before I say anything. Right now I have this 
title problem.


The journal requires the titles to be CAPITALISED, except for the 
acronyms. I'm currently
using backticks`...`to wrap it and replace it with\egroup 
...\WORD\bgroup{} with
lpeg. This kinda works, but that's so ugly. Besides, the actual story 
is that I also want to

add markdown as an option, so the backticks actually have meanings.

I also checked thetypo-cap.luafile to get a clue. But I used to use 
TeX exclusively

and I have to admit that it's so overwhelming for a newbie.

I really like the way wherebibtextreats words enclosed in curly 
braces are ignored.
Or are there something that's less aggressive than\WORDso the LaTeX 
trick works:

\def\NoCaseChange#1{\noexpand\NoCaseChange{\noexpand#1}}

\starttext

\protected\def\casing[#1]{\groupedcommand{\setcharactercasing[#1]}{}}
    \protected\def\nocasing 
{\groupedcommand{\setcharactercasing[reset]}{}}


    \setuphead[chapter][textstyle=\WORD]

    \chapter{some \nocasing{kept} text or \casing[Word]{more} text}

\stoptext

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___ 

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
___ 


___
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
___


[NTG-context] Database of translations (was: Simple question)

2022-05-10 Thread Marco Patzer via ntg-context
On Tue, 10 May 2022 00:15:30 +0200
Gerben Wierda via ntg-context  wrote:

> What is the easiest way to have a ‘database’ of translations for
> strings and maybe links?

Here's an idea:

\usemodule [translate]

%% \mainlanguage [nl]

\assigntranslation [en=alpha, nl=beta]\to\TRfoo
\translateinput [foo] [\TRfoo]

\assigntranslation [en=gamma, nl=delta]\to\TRbar
\translateinput [bar] [\TRbar]

\enableinputtranslation

\starttext
  foo bar
\stoptext

It's not a good solution, but it's a start. There's also

  \translate [en=foo, nl=bar]

But I don't know how to combine it with \translateinput. That would
remove the need of the \TR… macros.

Marco
___
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
___


Re: [NTG-context] Simple question

2022-05-10 Thread Henning Hraban Ramm via ntg-context

Am 10.05.22 um 00:15 schrieb Gerben Wierda via ntg-context:
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?

Gerben Wierda (LinkedIn )
R IT Strategy  (main site)
Book: Chess and the Art of Enterprise Architecture 


Book: Mastering ArchiMate 



Hi Gerben,

a lot is doable, it depends on by whom ;)
But this looks like a quite easy case.

Of course the answer is always “Lua tables”, but I guess the 
translations would be most easy to maintain in a CSV file (you can edit 
it in LibreOffice or Excel, while the latter often botches the encoding).


It could look like:

key;en;de;nl
yes;yes;ja;ja
LANG;English;Deutsch;Nederlands

i.e. the first column is the keyword and the other columns contain the 
translated term (so you can also change the “original” version).


(We’re using the same in a LaTeX3 project made by Marei.)

Without researching I assume there are already Lua functions to read a 
CSV file into a Lua table, and the lookup is easy – since I’m not fluent 
in Lua, I won’t provide the function(s) for you.


BTW there is already \translate 
(https://wiki.contextgarden.net/Command/translate) that changes text 
depending on the current language.


And there is the translate module that changes terms within the whole 
text: 
https://source.contextgarden.net/tex/context/modules/mkiv/m-translate.mkiv


Other options like .po files might be more versatile but also much more 
involved.


This covers \translatephrase; for your figures I’d just just a language 
variable in the path, like \externalfigure[images/\LANG/cow.pdf]

If this is always the current language, use \currentlanguage.
You can also setup the language dependent directory in 
\setupexternalfigures.


Regarding modes, the current language is set as a system mode (*en, 
*nl), and of course you can query modes with one of the many \doif 
macros. (https://wiki.contextgarden.net/Modes)
Since it doesn’t make sense to try 
\externalfigure[path/\currentmode/cow] (you never know how many modes 
are active), you can set a macro or variable depending on a mode:


\doifmode{simple}{\setvariable{gerben}{level}{simple}}
and then
\externalfigure[images/\getvariable{gerben}{level}/\currentlanguage/cow]

Hraban
___
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
___


Re: [NTG-context] a cross-reference query

2022-05-10 Thread jbf via ntg-context
Thanks Hraban, Taco. It is very helpful to get these hints. I will work 
through them calmly over the next day or so. Not sure why the spaces 
disappeared in the message (1 età came out as 1età etc.). Probably 
because I copy-pasted from the text editor but all spacing is correct in 
the editor I can assure you.


It's a very big document, hundreds of pages, so I even wondered if the 
size of the document was a factor. But Taco's warning about possible 
duplicates definitely becomes a possibility in a very large doc! Anyway, 
I'll work through those hints and see where things are at after that.


Julian

On 10/5/22 16:47, Henning Hraban Ramm via ntg-context wrote:

Hi Julian,

while I can’t help you with the real issue, a few hints:

* Look into the .tuc file for the references. Do you find differences 
between working and not-working examples?


* Do the examples work if you take them out of your big document or if 
you change the order?


* There are “strange” space characters in your message, they disappear 
in the quoted version below. That might cause troubles in typesetting 
and referencing.


* You don’t need to set "marking" if it’s the same as the title.

* It might make sense to use \about instead of \in – \about[eta] would 
render as “1a età“


* I would define a few macros, e.g. for the \in where both parameters 
are the same and for stuff like \bullet\enspace – probably you just 
left these out to simplify the example.


Hraban


Am 10.05.22 um 04:03 schrieb jbf via ntg-context:

Hi list,

In an attempt to make a dictionary interactive in certain ways, 
perhaps I am misusing the \in{}[] command here, but sometimes a 
reference works and sometimes it doesn't. I have no idea why it 
doesn't. Here is the situation:


Each dictionary entry is a section that has been defined as 'entry', 
hence we have a \startentry[title=,marking=,reference=]...\stopentry 
structure. Many entries can refer to other entries in the dictionary 
(in most cases the headword is in Italian, but the definitions, 
explanations are in English in all cases). in 90% of cases my 
referencing is working, so here is an example of one that works when 
\setupinteraction[state=start] is set:


\startentry[title={1aetà},marking={1aetà},reference={eta}]\\

1. youth. 2. first age. {\emnp.} \bullet\enspaceThe age between 
adolescence and maturity and by extension all of the human 
being’sfirst age (as opposed to old age).


Different cultures distinguish} age groupings in different ways. One 
would be unlikely to find, in English, terms like first age, second 
age etc. as recorded here. In fact there are probably only three 
general groupings in English: young, middle-aged, elderly, and the 
boundaries are rather flexible for these. Among the young category, 
English might distinguish infants, children, adolescents young 
adults. \rightarrow\enspace \in{giovani}[giovani]


\stopentry

In other words, there is an entry called 'giovani' and it begins 
\startentry[title={giovani},marking={giovani},reference={giovani}]. 
That correctly gives me a bold green clickable link which takes me to 
'giovani'. There is no number or page reference involved. I simply 
want the link to take me to the entry concerned.


But it does not always work. I have another entry called 'ad nutum' 
(Latin, not Italian in this case) with a reference to 'segretario' 
many pages on. I am absolutely sure I have the reference for 
segretario properly set up, both in its own entry and by calling it 
as I did for 'giovani', namely this time as 
\in{segretario}[segretario] but it is not recognized. This is not the 
only non-working case. There are several.


Can anyone give me a hint as to what I might be doing wrong? I 
realise that usually these references call on page numbers or section 
numbers, but I don't want/need (or do I?) to use those. I simply the 
reader to be able to click on a hyperlink which takes them to the 
referenced entry.


Julian
___ 

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
___ 


___
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
___


Re: [NTG-context] a cross-reference query

2022-05-10 Thread Taco Hoekwater via ntg-context


> On 10 May 2022, at 04:03, jbf via ntg-context  wrote:
> 
> Can anyone give me a hint as to what I might be doing wrong? I realise that 
> usually these references call on page numbers or section numbers, but I don't 
> want/need (or do I?) to use those. I simply the reader to be able to click on 
> a hyperlink which takes them to the referenced entry.

Check for duplicates (referenced definitions with the same key). That problem 
has hit me a number of times.

Best wishes,
Taco

— 
Taco Hoekwater  E: t...@bittext.nl
genderfluid (all pronouns)



___
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
___


Re: [NTG-context] a cross-reference query

2022-05-10 Thread Henning Hraban Ramm via ntg-context

Hi Julian,

while I can’t help you with the real issue, a few hints:

* Look into the .tuc file for the references. Do you find differences 
between working and not-working examples?


* Do the examples work if you take them out of your big document or if 
you change the order?


* There are “strange” space characters in your message, they disappear 
in the quoted version below. That might cause troubles in typesetting 
and referencing.


* You don’t need to set "marking" if it’s the same as the title.

* It might make sense to use \about instead of \in – \about[eta] would 
render as “1a età“


* I would define a few macros, e.g. for the \in where both parameters 
are the same and for stuff like \bullet\enspace – probably you just left 
these out to simplify the example.


Hraban


Am 10.05.22 um 04:03 schrieb jbf via ntg-context:

Hi list,

In an attempt to make a dictionary interactive in certain ways, perhaps 
I am misusing the \in{}[] command here, but sometimes a reference works 
and sometimes it doesn't. I have no idea why it doesn't. Here is the 
situation:


Each dictionary entry is a section that has been defined as 'entry', 
hence we have a \startentry[title=,marking=,reference=]...\stopentry 
structure. Many entries can refer to other entries in the dictionary (in 
most cases the headword is in Italian, but the definitions, explanations 
are in English in all cases). in 90% of cases my referencing is working, 
so here is an example of one that works when 
\setupinteraction[state=start] is set:


\startentry[title={1aetà},marking={1aetà},reference={eta}]\\

1. youth. 2. first age. {\emnp.} \bullet\enspaceThe age between 
adolescence and maturity and by extension all of the human being’sfirst 
age (as opposed to old age).


Different cultures distinguish} age groupings in different ways. One 
would be unlikely to find, in English, terms like first age, second age 
etc. as recorded here. In fact there are probably only three general 
groupings in English: young, middle-aged, elderly, and the boundaries 
are rather flexible for these. Among the young category, English might 
distinguish infants, children, adolescents young adults. 
\rightarrow\enspace \in{giovani}[giovani]


\stopentry

In other words, there is an entry called 'giovani' and it begins 
\startentry[title={giovani},marking={giovani},reference={giovani}]. That 
correctly gives me a bold green clickable link which takes me to 
'giovani'. There is no number or page reference involved. I simply want 
the link to take me to the entry concerned.


But it does not always work. I have another entry called 'ad nutum' 
(Latin, not Italian in this case) with a reference to 'segretario' many 
pages on. I am absolutely sure I have the reference for segretario 
properly set up, both in its own entry and by calling it as I did for 
'giovani', namely this time as \in{segretario}[segretario] but it is not 
recognized. This is not the only non-working case. There are several.


Can anyone give me a hint as to what I might be doing wrong? I realise 
that usually these references call on page numbers or section numbers, 
but I don't want/need (or do I?) to use those. I simply the reader to be 
able to click on a hyperlink which takes them to the referenced entry.


Julian

___
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
___