From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/63917 Path: news.gmane.org!not-for-mail From: Taco Hoekwater Newsgroups: gmane.comp.tex.context Subject: Re: Ctx & Lua: determination of the language being used Date: Thu, 25 Nov 2010 13:31:36 +0100 Message-ID: <4CEE5728.4010706@elvenkind.com> References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="windows-1252"; Format="flowed" Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1290688318 17899 80.91.229.12 (25 Nov 2010 12:31:58 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 25 Nov 2010 12:31:58 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Thu Nov 25 13:31:54 2010 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PLazS-0006I8-Ct for gctc-ntg-context-518@m.gmane.org; Thu, 25 Nov 2010 13:31:54 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id DFABDCA890; Thu, 25 Nov 2010 13:31:53 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id dVusfxbstRbV; Thu, 25 Nov 2010 13:31:42 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 2092DCA880; Thu, 25 Nov 2010 13:31:42 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 371DACA880 for ; Thu, 25 Nov 2010 13:31:41 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id NR42XtAMV37b for ; Thu, 25 Nov 2010 13:31:38 +0100 (CET) Original-Received: from filter4-nij.mf.surf.net (filter4-nij.mf.surf.net [195.169.124.155]) by balder.ntg.nl (Postfix) with ESMTP id 47F65CA87F for ; Thu, 25 Nov 2010 13:31:38 +0100 (CET) Original-Received: from smtp-vbr5.xs4all.nl (smtp-vbr5.xs4all.nl [194.109.24.25]) by filter4-nij.mf.surf.net (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id oAPCVbJj010582 for ; Thu, 25 Nov 2010 13:31:37 +0100 Original-Received: from boo.fritz.box (boo.demon.nl [83.163.247.99]) (authenticated bits=0) by smtp-vbr5.xs4all.nl (8.13.8/8.13.8) with ESMTP id oAPCVacv064821; Thu, 25 Nov 2010 13:31:36 +0100 (CET) (envelope-from taco@elvenkind.com) User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101030 Mandriva/3.1.6-1mdv2011.0 (2011.0) Thunderbird/3.1.6 In-Reply-To: X-Virus-Scanned: by XS4ALL Virus Scanner X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=194.109.24.25; country=NL; latitude=52.5000; longitude=5.7500; http://maps.google.com/maps?q=52.5000,5.7500&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 04DzovBnQ - fee5e1875a02 - 20101125 X-Scanned-By: CanIt (www . roaringpenguin . com) on 195.169.124.155 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:63917 Archived-At: On 11/25/2010 01:13 PM, Wolfgang Schuster wrote: > > Am 25.11.2010 um 12:49 schrieb Proch=E1zka Luk=E1=9A Ing. - Pontex s. r. = o.: > >> Hello, >> >> how to determine the current language being used in Ctx source via Lua? = I mean soumething like: >> >> --- >> \mainlanguage[cz] >> >> \starttext >> AAA >> >> \startluacode >> if context.mainlanguage =3D=3D "cz" then -- Do something specific >> context("Ahoj!") >> elseif context.mainlanguage =3D=3D "en" then -- Do something specific >> context("Hello!") >> else >> end >> \stopluacode >> \stoptext >> --- >> >> So is there something like 'context.mainlanguage' or 'context.mainlangua= ge()' or 'tex.mainlanguage' or ...? > > \mainlanguage[...] -> \currentmainlanguage > \language[...] -> \currentlanguage For the benefit of the mailing list archive, this means you can write in lua: if "\currentmainlanguage"=3D=3D"cz" then Except that that will not work because 'cz' is just an alias for 'cs', so you should test for that instead: if "\currentmainlanguage"=3D=3D"cs" then context("Ahoj!") elseif "\currentmainlanguage"=3D=3D"en" then context("Hello!") Best wishes, Taco ___________________________________________________________________________= ________ If your question is of interest to others as well, please add an entry to t= he Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-cont= ext webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________= ________