ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Can I simplify this to some sort of logic so it scales better?
@ 2022-06-06 11:34 Gerben Wierda via ntg-context
  2022-06-06 12:18 ` Wolfgang Schuster via ntg-context
  0 siblings, 1 reply; 2+ messages in thread
From: Gerben Wierda via ntg-context @ 2022-06-06 11:34 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Gerben Wierda


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

I have this:

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

But for every language added this becomes more and more complex. I was wondering what would be a good approach to simplify it. 

I want to make sure that one and only one of these modes is active and that if no mode is entered on the command line the mode is EN.

Gerben Wierda (LinkedIn <https://www.linkedin.com/in/gerbenwierda>)
R&A IT Strategy <https://ea.rna.nl/> (main site)
Book: Chess and the Art of Enterprise Architecture <https://ea.rna.nl/the-book/>
Book: Mastering ArchiMate <https://ea.rna.nl/the-book-edition-iii/>


[-- Attachment #1.2: Type: text/html, Size: 8356 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Can I simplify this to some sort of logic so it scales better?
  2022-06-06 11:34 Can I simplify this to some sort of logic so it scales better? Gerben Wierda via ntg-context
@ 2022-06-06 12:18 ` Wolfgang Schuster via ntg-context
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Schuster via ntg-context @ 2022-06-06 12:18 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Wolfgang Schuster


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

Gerben Wierda via ntg-context schrieb am 06.06.2022 um 13:34:
> I have this:
>
> \definemode[EN,FR,RU,PT][keep]
> \doifmodeelse{EN}
> {
>     \disablemode[FR]
>     \disablemode[RU]
>   \disablemode[PT]
>   }
>   {
> \doifmodeelse{FR}
>     {
>       \disablemode[EN]
>       \disablemode[RU]
>       \disablemode[PT]
>     }
>     {
>       \doifmodeelse{RU}
>       {
>       \disablemode[EN]
> \disablemode[FR]
> \disablemode[PT]
>       }
>       {
>       \doifmodeelse{PT}
>         {
>           \disablemode[EN]
>           \disablemode[FR]
>           \disablemode[RU]
>         }
>       {
> \enablemode[EN]
>         }
>       }
>   }
>   }
>
> But for every language added this becomes more and more complex. I was 
> wondering what would be a good approach to simplify it.
>
> I want to make sure that one and only one of these modes is active and 
> that if no mode is entered on the command line the mode is EN.

%\enablemode[EN]
\enablemode[FR]
%\enablemode[RU]
%\enablemode[PT]

\definemode[EN,FR,RU,PT][keep]

\startmodeset
     [EN]      {\disablemode[FR,RU,PT]}
     [FR]      {\disablemode[EN,RU,PT]}
     [RU]      {\disablemode[EN,FR,PT]}
     [PT]      {\disablemode[EN,FR,RU]}
     [default] {\enablemode[EN]}
\stopmodeset

\starttext
\doifmode{EN}{english}
\doifmode{FR}{french}
\doifmode{RU}{russian}
\doifmode{PT}{portuguese}
\stoptext

Wolfgang


[-- Attachment #1.2: Type: text/html, Size: 5845 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-06 12:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-06 11:34 Can I simplify this to some sort of logic so it scales better? Gerben Wierda via ntg-context
2022-06-06 12:18 ` Wolfgang Schuster via ntg-context

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).