another cld question!
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
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 -----------------------------------------------------------------
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
On Thu, Dec 23, 2010 at 5:12 PM, Thomas A. Schmitz
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
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
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
participants (4)
-
Hans Hagen
-
luigi scarso
-
Taco Hoekwater
-
Thomas A. Schmitz