ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* another cld question!
@ 2010-12-23 15:37 Thomas A. Schmitz
  2010-12-23 15:56 ` Hans Hagen
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas A. Schmitz @ 2010-12-23 15:37 UTC (permalink / raw)
  To: mailing ConTeXt users list for

Since y'all are playing with cld, here's my little question: how can I write me a language test? Here is what I've been playing with:

\mainlanguage[fr]

\starttext

\startluacode
function doit(s)
  if tex.language == 2 then
    context("ENGLISH: ") context.currentmainlanguage() context(s)
  else
     context("NOT ENGLISH:")  context.currentmainlanguage() context(s)
  end
end
\stopluacode

\define[1]\Test%
 {\ctxlua{doit("#1")}}

\Test{French}

\language[en] \Test{English}

\stoptext

But that doesn't seem quite right...

Thomas
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: another cld question!
  2010-12-23 15:37 another cld question! Thomas A. Schmitz
@ 2010-12-23 15:56 ` Hans Hagen
  2010-12-23 16:12   ` Thomas A. Schmitz
  0 siblings, 1 reply; 6+ messages in thread
From: Hans Hagen @ 2010-12-23 15:56 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 23-12-2010 4:37, Thomas A. Schmitz wrote:
> Since y'all are playing with cld, here's my little question: how can I write me a language test? Here is what I've been playing with:
>
> \mainlanguage[fr]
>
> \starttext
>
> \startluacode
> function doit(s)
>    if tex.language == 2 then

   if languages.current() == "en" then


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: another cld question!
  2010-12-23 15:56 ` Hans Hagen
@ 2010-12-23 16:12   ` Thomas A. Schmitz
  2010-12-23 16:18     ` luigi scarso
  2010-12-23 16:19     ` Taco Hoekwater
  0 siblings, 2 replies; 6+ messages in thread
From: Thomas A. Schmitz @ 2010-12-23 16:12 UTC (permalink / raw)
  To: mailing list for ConTeXt users


On Dec 23, 2010, at 4:56 PM, Hans Hagen wrote:

> if languages.current() == "en" then

Thanks Hans, but it still doesn't work properly:


\starttext

\startluacode
function doit(s)
  if languages.current == "en" then
    context("ENGLISH: ")  context(s)
  else
     context("NOT ENGLISH:") context(s)
  end
end
\stopluacode

\define[1]\Test%
 {\ctxlua{doit("#1")}}

{\language[fr] \Test{French}}

{\language[en] \Test{English}}

\stoptext

Thomas
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: another cld question!
  2010-12-23 16:12   ` Thomas A. Schmitz
@ 2010-12-23 16:18     ` luigi scarso
  2010-12-23 16:19     ` Taco Hoekwater
  1 sibling, 0 replies; 6+ messages in thread
From: luigi scarso @ 2010-12-23 16:18 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Thu, Dec 23, 2010 at 5:12 PM, Thomas A. Schmitz
<thomas.schmitz@uni-bonn.de> wrote:
>
> On Dec 23, 2010, at 4:56 PM, Hans Hagen wrote:
>
>> if languages.current() == "en" then
>
> Thanks Hans, but it still doesn't work properly:
>
>
> \starttext
>
> \startluacode
> function doit(s)
>  if languages.current == "en" then
perhaps
if languages.current() == "en" then
as hans wrote ?
-- 
luigi
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: another cld question!
  2010-12-23 16:12   ` Thomas A. Schmitz
  2010-12-23 16:18     ` luigi scarso
@ 2010-12-23 16:19     ` Taco Hoekwater
  2010-12-23 16:24       ` Thomas A. Schmitz
  1 sibling, 1 reply; 6+ messages in thread
From: Taco Hoekwater @ 2010-12-23 16:19 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Thomas A. Schmitz

On 12/23/2010 05:12 PM, Thomas A. Schmitz wrote:
>
> On Dec 23, 2010, at 4:56 PM, Hans Hagen wrote:

Compare:

>> if languages.current() == "en" then

and

>    if languages.current == "en" then

The first is testing the result of a function call, the second
is testing the function variable itself.

Best wishes,
Taco
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: another cld question!
  2010-12-23 16:19     ` Taco Hoekwater
@ 2010-12-23 16:24       ` Thomas A. Schmitz
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas A. Schmitz @ 2010-12-23 16:24 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Taco Hoekwater


On Dec 23, 2010, at 5:19 PM, Taco Hoekwater wrote:

> On 12/23/2010 05:12 PM, Thomas A. Schmitz wrote:
>> 
>> On Dec 23, 2010, at 4:56 PM, Hans Hagen wrote:
> 
> Compare:
> 
>>> if languages.current() == "en" then
> 
> and
> 
>>   if languages.current == "en" then
> 
> The first is testing the result of a function call, the second
> is testing the function variable itself.
> 
Arrgh, that was really stupid. I need to drink more or something...

Thanks, and sorry for the noise...

Thomas
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

end of thread, other threads:[~2010-12-23 16:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-23 15:37 another cld question! Thomas A. Schmitz
2010-12-23 15:56 ` Hans Hagen
2010-12-23 16:12   ` Thomas A. Schmitz
2010-12-23 16:18     ` luigi scarso
2010-12-23 16:19     ` Taco Hoekwater
2010-12-23 16:24       ` Thomas A. Schmitz

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