ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Re: checking mainlanguage setup
       [not found] <mailman.1.1306576802.24208.ntg-context@ntg.nl>
@ 2011-05-28 12:26 ` Jeong Dalyoung
  2011-05-28 13:45   ` Hans Hagen
  2011-05-31  6:48   ` Procházka Lukáš Ing. - Pontex s. r. o.
  0 siblings, 2 replies; 17+ messages in thread
From: Jeong Dalyoung @ 2011-05-28 12:26 UTC (permalink / raw)
  To: ntg-context

Dear Aditya,

Here are the test result.

> context.setvalue("lang", "English")

It is working.

> 
> 
> context([[\\def\\lang{English}]])

It is not working. It just prints "def langEnglish".

Now, I got two solutions, using luacode and using \doifelse.

Thank you.

Best regards,

Dalyoung

___________________________________________________________________________________
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] 17+ messages in thread

* Re: checking mainlanguage setup
  2011-05-28 12:26 ` checking mainlanguage setup Jeong Dalyoung
@ 2011-05-28 13:45   ` Hans Hagen
  2011-05-31  6:48   ` Procházka Lukáš Ing. - Pontex s. r. o.
  1 sibling, 0 replies; 17+ messages in thread
From: Hans Hagen @ 2011-05-28 13:45 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Jeong Dalyoung

On 28-5-2011 2:26, Jeong Dalyoung wrote:
> Dear Aditya,
>
> Here are the test result.
>
>> context.setvalue("lang", "English")
>
> It is working.
>
>>
>>
>> context([[\\def\\lang{English}]])
>
> It is not working. It just prints "def langEnglish".

context.language('en')

-----------------------------------------------------------------
                                           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] 17+ messages in thread

* Re: checking mainlanguage setup
  2011-05-28 12:26 ` checking mainlanguage setup Jeong Dalyoung
  2011-05-28 13:45   ` Hans Hagen
@ 2011-05-31  6:48   ` Procházka Lukáš Ing. - Pontex s. r. o.
  1 sibling, 0 replies; 17+ messages in thread
From: Procházka Lukáš Ing. - Pontex s. r. o. @ 2011-05-31  6:48 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Sat, 28 May 2011 14:26:47 +0200, Jeong Dalyoung <haksan@me.com> wrote:

>> context([[\\def\\lang{English}]])
>
> It is not working. It just prints "def langEnglish".

BTW, are not there too many backslashes?

Shouldn't it be (untested):

context("\\def\\lang{English}")

or

context([[\def\lang{English}]])

Lukas

___________________________________________________________________________________
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] 17+ messages in thread

* Re: checking mainlanguage setup
  2011-06-01  7:45 ` Jeong Dalyoung
@ 2011-06-01 12:54   ` Wolfgang Schuster
  0 siblings, 0 replies; 17+ messages in thread
From: Wolfgang Schuster @ 2011-06-01 12:54 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 01.06.2011 um 09:45 schrieb Jeong Dalyoung:

> I summerize it as a test file. The first 5 methods are working well, but the last one using \noexpand cause the error.

What exactly do you plan to do with the language check, for simple texts your method is overkill and labeltexts are better suited, even a command which prints a text can be written in TeX without problems:

\def\LangOne
  {\doifelse{\currentmainlanguage}{en}
     {English 1}
     {\doifelse{\currentmainlanguage}{nl}
        {Dutch 1}
        {Unknown 1}}}

\def\LangTwo
  {\processaction
     [\currentmainlanguage]
     [     en=>English 2,
	       nl=>Dutch 2,
      unknown=>Unknown 2]}

\setuplabeltext[en][langthree=English 3]
\setuplabeltext[nl][langthree=Dutch 3]
\setuplabeltext    [langthree=Unknown 3]

\starttext

\LangOne:\LangTwo:\labeltext{langthree}:\translate[en=English 4,nl=Dutch 4]

\mainlanguage[nl]

\LangOne:\LangTwo:\labeltext{langthree}:\translate[en=English 4,nl=Dutch 4]

\mainlanguage[fr]

\LangOne:\LangTwo:\labeltext{langthree}:\translate[en=English 4,nl=Dutch 4]

\stoptext

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


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

* Re: checking mainlanguage setup
  2011-06-01  8:14     ` Hans Hagen
@ 2011-06-01  8:22       ` Hans Hagen
  0 siblings, 0 replies; 17+ messages in thread
From: Hans Hagen @ 2011-06-01  8:22 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 1-6-2011 10:14, Hans Hagen wrote:

> [[ ]] vs " " is a lua thing ... but when you pass things from within
> tex, expansions happens the same in both; you can try
>
> context("\detokenize{...}")

Sorry, that should have been

\ctxlua{"\detokenize{...}"}

which takes care of things at the tex end. When at the lua end, you need 
to use \\ (or indeed [[with regular \'s]].

Anyhow, it does not hurt to always to take good look at \'s because 
commands might end up in cycles (or for instance can end up in auxiliary 
files). This is why many commands are defined using \unexpanded.  Even 
if you pass something using context at the lua end. You can see what 
gets passed to tex using:

\enabletrackers[context.trace]

What you see there should look like regular context.

(btw, context.setvalue{"Lang","English") also works well and has no 
backslashes)

Hans


-----------------------------------------------------------------
                                           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] 17+ messages in thread

* Re: checking mainlanguage setup
  2011-05-31 14:33   ` Procházka Lukáš Ing. - Pontex s. r. o.
@ 2011-06-01  8:14     ` Hans Hagen
  2011-06-01  8:22       ` Hans Hagen
  0 siblings, 1 reply; 17+ messages in thread
From: Hans Hagen @ 2011-06-01  8:14 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 31-5-2011 4:33, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
> On Tue, 31 May 2011 12:45:00 +0200, Jeong Dalyoung <haksan@me.com> wrote:
>
>> Dear Lucas,
>>
>>
>>>
>>> Shouldn't it be (untested):
>>>
>>> context("\\def\\lang{English}")
>>>
>>>
>>
>> It is working.
>>
>>>
>>> context([[\def\lang{English}]])
>>
>> It is not working. It prints "def lang English".
>>
>> Thank you.
>>
>> Best regards,
>>
>> Dalyoung
>
> OK.
>
> I meant just the way how strings in Lua are entered
>
> - if inside quotation marks, escaping is required, thus "\\" yields to
> backslash,
> - if inside [[ ... ]], single \ gives backslash, and of course \\ gives
> TWO backslashes.
>
> I guessed that your original
>
> [[\\def\\lang{English}]]
>
> could have caused the problem, so I corrected it to
>
> [[\def\lang{English}]]

[[ ]] vs " " is a lua thing ... but when you pass things from within 
tex, expansions happens the same in both; you can try

context("\detokenize{...}")



-----------------------------------------------------------------
                                           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] 17+ messages in thread

* Re: checking mainlanguage setup
       [not found] <mailman.1275.1306911210.4231.ntg-context@ntg.nl>
@ 2011-06-01  7:45 ` Jeong Dalyoung
  2011-06-01 12:54   ` Wolfgang Schuster
  0 siblings, 1 reply; 17+ messages in thread
From: Jeong Dalyoung @ 2011-06-01  7:45 UTC (permalink / raw)
  To: ntg-context

Dear Aditya,


> 
> context([[\def\noexpand\Lang{...}]])

not working
> 
> or
> 
> context([[\def\string\Lang{...}]])

working

> 
> I don't understand why
> 
> context([[\def\\Lang{...}]])
working, too


You are right. [[\def\\Lang{English}]] method works.

I summerize it as a test file. The first 5 methods are working well, but the last one using \noexpand cause the error.

Thank you.

Best regards,

Dalyoung

\mainlanguage[en]
\starttext
\startitemize[n]
\head Using \type{context.setvalue("Lang","English")}

\startluacode
if languages.current() == "en" then
  context.setvalue("Lang","English")
else
  context.setvalue("Lang","Not English")
end
\stopluacode
Current language: \Lang

\head Using \type{context("\\def\\Lang{English}")}

\startluacode
if languages.current() == "en" then
  context("\\def\\Lang{English}")
else
  context("\\def\\Lang{Not English}")
end
\stopluacode
Current language: \Lang

\head Using \type{context([[\def\string\Lang{English}]])}

\startluacode
if languages.current() == "en" then
  context([[\def\string\Lang{English}]])
else
  context([[\def\string\Lang{Not English}]])
end
\stopluacode
Current language: \Lang

\head Using \type{context([[\def\\Lang{English}]])}

\startluacode
if languages.current() == "en" then
  context([[\def\\Lang{English}]])
else
  context([[\def\\Lang{Not English}]])
end
\stopluacode
Current language: \Lang

\head Using \type{\doifelse\currentmainlanguage{en}...}

\doifelse\currentmainlanguage{en}
 {\def\Lang{English}}{\def\Lang{Not English}}
 Current language: \Lang

\head Using \type{context([[\def\noexpand\Lang{English}]])}

%\startluacode
% if languages.current() == "en" then
% context([[\def\noexpand\Lang{English}]])
% else
% context([[\def\noexpand\Lang{Not English}]])
% end
%\stopluacode
%Current language: \Lang
\stopitemize
\stoptext
___________________________________________________________________________________
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] 17+ messages in thread

* Re: checking mainlanguage setup
  2011-06-01  1:16 ` Jeong Dalyoung
@ 2011-06-01  1:32   ` Aditya Mahajan
  0 siblings, 0 replies; 17+ messages in thread
From: Aditya Mahajan @ 2011-06-01  1:32 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Wed, 1 Jun 2011, Jeong Dalyoung wrote:

> Dear Lukas,
>
> Thank you for the explanation.
>
>>
>> I guessed that your original
>>
>> [[\\def\\lang{English}]]
>
> No errors message, but it's not working as the way as  I want. It just print "def langEnglish".
>
>>
>> [[\def\lang{English}]]
>>
>
> This cause the error message and halt the compiling.

context([[\def\noexpand\Lang{...}]])

or

context([[\def\string\Lang{...}]])

I don't understand why

context([[\def\\Lang{...}]])

does not work. I thought that when TeX code is exapnded inside lua 
environment \\ was equal to \string\.

Aditya

PS: \lang macro is defined by bib module.
___________________________________________________________________________________
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] 17+ messages in thread

* Re: checking mainlanguage setup
       [not found] <mailman.1266.1306859874.4231.ntg-context@ntg.nl>
@ 2011-06-01  1:16 ` Jeong Dalyoung
  2011-06-01  1:32   ` Aditya Mahajan
  0 siblings, 1 reply; 17+ messages in thread
From: Jeong Dalyoung @ 2011-06-01  1:16 UTC (permalink / raw)
  To: ntg-context

Dear Lukas,

Thank you for the explanation.

> 
> I guessed that your original
> 
> [[\\def\\lang{English}]]

No errors message, but it's not working as the way as  I want. It just print "def langEnglish".

> 
> [[\def\lang{English}]]
> 

This cause the error message and halt the compiling.

Best regards,

Dalyoung

metapost > loading 'metafun.mp' (experimental metapost version two)
! Undefined control sequence.
system > tex > error on line 84 in file test-font.tex: Undefined control sequence ...
74
75
76 \startluacode
77 if languages.current() == "kr" then
78 -- context.setvalue("lang","한글")
79 context([[\def\lang{한글}]])
80 else
81 -- context.setvalue("lang","English")
82 context("\\def\\lang{English}")
83 end
84 >> \stopluacode
85
86 currentlanguage: \lang
87
88 \section{one.two}
89
90 \doifelse\currentmainlanguage{en}{\def\lang{English}}{\def\lang{영어가 아님}}\par
91
92 currentlanguage: \lang
93 %currentmainlanguage:
94 %\doifelse\currentmainlanguage{kr}{Korean}{Not Korean}\par
\lang #1->\edef \biblanguage
{#1}\ifcsname \??pb \s!language #1\endcsname \l...
<argument> ...,"한글")
context([[\def \lang {
한글}]])
else
-- conte...
\dodostartluacode ...and \directlua \zerocount {#1
}}
l.84 \stopluacode
? 
___________________________________________________________________________________
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] 17+ messages in thread

* Re: checking mainlanguage setup
  2011-05-31 10:45 ` Jeong Dalyoung
@ 2011-05-31 14:33   ` Procházka Lukáš Ing. - Pontex s. r. o.
  2011-06-01  8:14     ` Hans Hagen
  0 siblings, 1 reply; 17+ messages in thread
From: Procházka Lukáš Ing. - Pontex s. r. o. @ 2011-05-31 14:33 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Tue, 31 May 2011 12:45:00 +0200, Jeong Dalyoung <haksan@me.com> wrote:

> Dear Lucas,
>
>
>>
>> Shouldn't it be (untested):
>>
>> context("\\def\\lang{English}")
>>
>>
>
> It is working.
>
>>
>> context([[\def\lang{English}]])
>
> It is not working. It prints "def lang English".
>
> Thank you.
>
> Best regards,
>
> Dalyoung

OK.

I meant just the way how strings in Lua are entered

- if inside quotation marks, escaping is required, thus "\\" yields to backslash,
- if inside [[ ... ]], single \ gives backslash, and of course \\ gives TWO backslashes.

I guessed that your original

[[\\def\\lang{English}]]

could have caused the problem, so I corrected it to

[[\def\lang{English}]]

Cheers,

Lukas


-- 
Ing. Lukáš Procházka [mailto:LPr@pontex.cz]
Pontex s. r. o.      [mailto:pontex@pontex.cz] [http://www.pontex.cz]
Bezová 1658
147 14 Praha 4

Tel: +420 244 062 238
Fax: +420 244 461 038

___________________________________________________________________________________
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] 17+ messages in thread

* Re: checking mainlanguage setup
       [not found] <mailman.1.1306836001.18520.ntg-context@ntg.nl>
@ 2011-05-31 10:45 ` Jeong Dalyoung
  2011-05-31 14:33   ` Procházka Lukáš Ing. - Pontex s. r. o.
  0 siblings, 1 reply; 17+ messages in thread
From: Jeong Dalyoung @ 2011-05-31 10:45 UTC (permalink / raw)
  To: ntg-context

Dear Lucas,


> 
> Shouldn't it be (untested):
> 
> context("\\def\\lang{English}")
> 
> 

It is working.

> 
> context([[\def\lang{English}]])

It is not working. It prints "def lang English".

Thank you.

Best regards,

Dalyoung
___________________________________________________________________________________
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] 17+ messages in thread

* Re: checking mainlanguage setup
  2011-05-28  2:41 ` Jeong Dalyoung
@ 2011-05-28  3:04   ` Aditya Mahajan
  0 siblings, 0 replies; 17+ messages in thread
From: Aditya Mahajan @ 2011-05-28  3:04 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Sat, 28 May 2011, Jeong Dalyoung wrote:

> \startluacode
> if languages.current() == "kr" then
> context([[\def\lang{Korean}]]) %("\def\lang{Korean}")
> else
> context([[\def\lang{English}]]) %("\def\lang{Korean}")
> end
> \stopluacode
>
> currentlanguage: \lang
>
> is not working. (undifined control sequence error)

(Untested) try

context.setvalue("lang", "English")

or

context([[\\def\\lang{English}]])

Aditya
___________________________________________________________________________________
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] 17+ messages in thread

* Re: checking mainlanguage setup
       [not found] <mailman.1220.1306501767.4231.ntg-context@ntg.nl>
@ 2011-05-28  2:41 ` Jeong Dalyoung
  2011-05-28  3:04   ` Aditya Mahajan
  0 siblings, 1 reply; 17+ messages in thread
From: Jeong Dalyoung @ 2011-05-28  2:41 UTC (permalink / raw)
  To: ntg-context

Dear Pontus, Marco, and Peter,

Thank you for replies.

I tested the following codes:

1)
\startluacode
if languages.current() == "kr" then
context("Korean")
else
context("Not Korean")
end
\stopluacode

2)
\doifelse\currentlanguage{en}{\def\lang{English}}{\def\lang{Not English}}\par
currentlanguage: \lang

are working well. 

But, the code

\startluacode
if languages.current() == "kr" then
context([[\def\lang{Korean}]]) %("\def\lang{Korean}")
else
context([[\def\lang{English}]]) %("\def\lang{Korean}")
end
\stopluacode

currentlanguage: \lang

is not working. (undifined control sequence error)

I think that there is a simple way to use lua code for this which I don't know. I have to read CLD manual.

Thanks again.

Best regards,

Dalyoung


On 2011. 5. 27., at 오후 10:09, ntg-context-request@ntg.nl wrote:

> Send ntg-context mailing list submissions to
> 	ntg-context@ntg.nl
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://www.ntg.nl/mailman/listinfo/ntg-context
> or, via email, send a message with subject or body 'help' to
> 	ntg-context-request@ntg.nl
> 
> You can reach the person managing the list at
> 	ntg-context-owner@ntg.nl
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of ntg-context digest..."
> 
> 
> Today's Topics:
> 
>   1. Re: checking mainlanguage setup (Pontus Lurcock)
>   2. Re: checking mainlanguage setup (Marco)
>   3. Re: checking mainlanguage setup (Peter =?utf-8?Q?M=C3=BCnster?=)
>   4. [metafun] graphictext in mkiv (Marco)
>   5. Re: compresslevel and png graphics (mkiv) (Peter Rolf)
>   6. Re: \asciimode and cld (Hans Hagen)
>   7. Re: compresslevel and png graphics (mkiv) (Hartmut Henkel)
>   8. Re: compresslevel and png graphics (mkiv) (Hartmut Henkel)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Fri, 27 May 2011 22:11:24 +1200
> From: Pontus Lurcock <pont@talvi.net>
> To: ntg-context@ntg.nl
> Subject: Re: [NTG-context] checking mainlanguage setup
> Message-ID: <20110527101124.GO20248@rae.vm.bytemark.co.uk>
> Content-Type: text/plain; charset=us-ascii
> 
> On Fri 27 May 2011, Jeong Dalyoung wrote:
> 
>> Is it possible to check what is the mainlanguage set in document?
>> Now, I use \enablemode[kr] to do something A. But, I'd like to do it
>> automatically if possible.
> 
> According to http://wiki.contextgarden.net/Modes#System_modes , 
> the mode **kr should be automatically set if kr is the main language
> (I haven't tried it, though).
> 
> Pont
> 
> 
> ------------------------------
> 
> Message: 2
> Date: Fri, 27 May 2011 12:22:38 +0200
> From: Marco <netuse@lavabit.com>
> To: ntg-context@ntg.nl
> Subject: Re: [NTG-context] checking mainlanguage setup
> Message-ID: <20110527122238.4c709eb2@glyph>
> Content-Type: text/plain; charset=US-ASCII
> 
>> I'd like to do the following type of setup.
>> 
>> 
>> if mainlanguage == kr then
>> 
>> 	do something A
>> 
>> elseif mainlanguage == en then
>> 
>> 	do something B
>> 
>> else
>> 	do something C
>> 
>> endif
> 
> \starttext
> \startluacode
>  if languages.current() == "kr" then
>    context("Something A")
>  elseif languages.current() == "en" then
>     context("Something B")
>  else
>     context("Something C")
>  end
> \stopluacode
> \stoptext
> 
> Marco
> 
> 
> 
> 
> ------------------------------
> 
> Message: 3
> Date: Fri, 27 May 2011 12:41:46 +0200
> From: pmlists@free.fr (Peter =?utf-8?Q?M=C3=BCnster?=)
> To: mailing list for ConTeXt users <ntg-context@ntg.nl>
> Subject: Re: [NTG-context] checking mainlanguage setup
> Message-ID: <87ei3kifx1.fsf@micropit.couberia.bzh>
> Content-Type: text/plain; charset=utf-8
> 
> On Fri, May 27 2011, Jeong Dalyoung wrote:
> 
>> Is it possible to check what is the mainlanguage set in document?
> 
> Yes. Example:
> 
> %\mainlanguage[fr]
> %\language[fr]
> \starttext
> currentlanguage:
> \doifelse\currentlanguage{fr}{French}{Not French}\par
> currentmainlanguage:
> \doifelse\currentmainlanguage{fr}{French}{Not French}\par
> translate: \translate[fr=Fran?ais, en=French]
> \stoptext
> 
> -- 
>           Peter
> 
> 
> ------------------------------
> 
> Message: 4
> Date: Fri, 27 May 2011 12:45:58 +0200
> From: Marco <netuse@lavabit.com>
> To: ntg-context@ntg.nl
> Subject: [NTG-context] [metafun] graphictext in mkiv
> Message-ID: <20110527124558.19b42ca1@glyph>
> Content-Type: text/plain; charset=UTF-8
> 
> The ?graphictext? makro does not work in mkiv, is it a bug
> or intended? This example works in mkii:
> 
> \starttext
> \startMPcode
> draw image(graphictext "FooBar" scaled 8);
> \stopMPcode
> \stoptext
> 
> Marco
> 
> 
> 
> 
> ------------------------------
> 
> Message: 5
> Date: Fri, 27 May 2011 13:57:51 +0200
> From: Peter Rolf <indiego@gmx.net>
> To: ntg-context@ntg.nl
> Subject: Re: [NTG-context] compresslevel and png graphics (mkiv)
> Message-ID: <4DDF91BF.8030806@gmx.net>
> Content-Type: text/plain; charset=UTF-8
> 
> Am 26.05.2011 18:17, schrieb Peter Rolf:
>> Am 26.05.2011 12:52, schrieb Peter Rolf:
>>> Am 25.05.2011 21:54, schrieb Hartmut Henkel:
>> [..]
>>>> 
>>>> no. There is a "PNG Copy" function for literal embedding of the PNG
>>>> file, but that triggers only, if the file simultaneously satisfies quite
>>>> a few conditions, which are about: non-interlaced, no palette, no
>>>> transparency, no gamma coming with it, no gamma modification requested,
>>>> no white adjustment in the PNG, and a few more rare others. Else it's
>>>> de-compressed and then re-compressed to the \pdfcompresslevel, and
>>>> additional streams and dicts are added. You see in the log if it finally
>>>> was "PNG Copy" or not.
>>>> 
>> [..]
>>>> 
>>>> These are about the factors affecting the PNG to PDF size. For your big
>>>> PNG graphic you may find a preprocessing (e. g., pngtopnm | pnmtopng
>>>> will definitely remove all fat) that makes it compliant with the "PNG
>>>> copy".
>>>> 
>>> I will give that a try. But I doubt that there is much 'fat' on that
>>> graphic. Anyhow, you never know before you have tried it. :-)
>>> 
>> 
>> No luck. I used imagemagick to convert to pnm and back.
>> Transparency was removed before by adding a white background, also all
>> not critical chunks (ICC profile, backgroundcolor, resolution, creation
>> and modify date, comment) were removed. The graphic is a valid PNG
>> (TweakPNG) and aside from the size, there is nothing special with this
>> graphic. Still no '(PNG copy)'.
>> 
>> @luigi: an ICC profile definitely breaks the <png copy> rules
>> 
>> The only chunks left are
>> 
>> IHDR    PNG image header: 5900x4094, 8bits/sample, truecolor, noninterlaced
>> IDAT    PNG image data
>> ..
>> IDAT    PNG image data
>> IEND    end-of-image marker
>> 
>> Mh, where is the show stopper? The compression method?
>> 
> Looks like some of ConTeXt PDF/X-related settings is causing this. If I
> reduce the code to the pure picture, the '(PNG copy)' is triggered.
> Probably the active color management (default color space) is breaking
> the copy process here.
> 
> Sorry for any inconvenience. I should have tested this case before...
> 
> Best wishes, Peter
> 
> 
>> Regards, Peter
>> ___________________________________________________________________________________
>> 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
>> ___________________________________________________________________________________
>> 
> 
> 
> 
> ------------------------------
> 
> Message: 6
> Date: Fri, 27 May 2011 15:07:33 +0200
> From: Hans Hagen <pragma@wxs.nl>
> To: mailing list for ConTeXt users <ntg-context@ntg.nl>
> Cc: Peter M?nster <pmlists@free.fr>
> Subject: Re: [NTG-context] \asciimode and cld
> Message-ID: <4DDFA215.3060000@wxs.nl>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> 
> On 27-5-2011 11:00, Peter M?nster wrote:
>> Hello,
>> 
>> How can one use \asciimode in cld syntax?
>> 
>> This does not seem to work:
>> 
>> context.starttext()
>> context.asciimode()
>> context"bla % bla"
>> context.stoptext()
> 
> \starttext
> 
>     \startluacode
>         context.startTEXpage()
>             context.starttext()
>             context.pushcatcodes("txtcatcodes")
>             context("bla % bla")
>             context.popcatcodes()
>             context.stoptext()
>         context.stopTEXpage()
>     \stopluacode
> 
> \stoptext
> 
> 
> -----------------------------------------------------------------
>                                           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
> -----------------------------------------------------------------
> 
> 
> ------------------------------
> 
> Message: 7
> Date: Fri, 27 May 2011 15:09:14 +0200
> From: "Hartmut Henkel" <hartmut_henkel@gmx.de>
> To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
> 	ntg-context@ntg.nl
> Subject: Re: [NTG-context] compresslevel and png graphics (mkiv)
> Message-ID: <20110527130914.171040@gmx.net>
> Content-Type: text/plain; charset="utf-8"
> 
>>> @luigi: an ICC profile definitely breaks the <png copy> rules
>>> 
>>> The only chunks left are
>>> 
>>> IHDR    PNG image header: 5900x4094, 8bits/sample, truecolor,
>> noninterlaced
>>> IDAT    PNG image data
>>> ..
>>> IDAT    PNG image data
>>> IEND    end-of-image marker
>>> 
>>> Mh, where is the show stopper? The compression method?
>>> 
>> Looks like some of ConTeXt PDF/X-related settings is causing this. If I
>> reduce the code to the pure picture, the '(PNG copy)' is triggered.
>> Probably the active color management (default color space) is breaking
>> the copy process here.
> 
> must be some \pdfimageapplygamma > 0, only this and the \pdfimagehicolor
> primitive can influence this low level stuff.
> 
> Btw, just \pdfimageapplygamma > 0 (without setting \pdfgamma and \pdfimagegamma) already changes the PNG image, since the luatex (and pdftex) internal defaults are not gamma-neutral. No idea if (and then
> to which value) this should be fixed.
> 
> Regards, Hartmut
> -- 
> Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
> belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de
> 
> 
> ------------------------------
> 
> Message: 8
> Date: Fri, 27 May 2011 15:09:14 +0200
> From: "Hartmut Henkel" <hartmut_henkel@gmx.de>
> To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
> 	ntg-context@ntg.nl
> Subject: Re: [NTG-context] compresslevel and png graphics (mkiv)
> Message-ID: <20110527130914.171040@gmx.net>
> Content-Type: text/plain; charset="utf-8"
> 
>>> @luigi: an ICC profile definitely breaks the <png copy> rules
>>> 
>>> The only chunks left are
>>> 
>>> IHDR    PNG image header: 5900x4094, 8bits/sample, truecolor,
>> noninterlaced
>>> IDAT    PNG image data
>>> ..
>>> IDAT    PNG image data
>>> IEND    end-of-image marker
>>> 
>>> Mh, where is the show stopper? The compression method?
>>> 
>> Looks like some of ConTeXt PDF/X-related settings is causing this. If I
>> reduce the code to the pure picture, the '(PNG copy)' is triggered.
>> Probably the active color management (default color space) is breaking
>> the copy process here.
> 
> must be some \pdfimageapplygamma > 0, only this and the \pdfimagehicolor
> primitive can influence this low level stuff.
> 
> Btw, just \pdfimageapplygamma > 0 (without setting \pdfgamma and \pdfimagegamma) already changes the PNG image, since the luatex (and pdftex) internal defaults are not gamma-neutral. No idea if (and then
> to which value) this should be fixed.
> 
> Regards, Hartmut
> -- 
> Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
> belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de
> 
> 
> ------------------------------
> 
> ___________________________________________________________________________________
> 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  : https://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
> 
> End of ntg-context Digest, Vol 83, Issue 123
> ********************************************

___________________________________________________________________________________
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] 17+ messages in thread

* Re: checking mainlanguage setup
  2011-05-27  9:49 Jeong Dalyoung
  2011-05-27 10:11 ` Pontus Lurcock
  2011-05-27 10:22 ` Marco
@ 2011-05-27 10:41 ` Peter Münster
  2 siblings, 0 replies; 17+ messages in thread
From: Peter Münster @ 2011-05-27 10:41 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Fri, May 27 2011, Jeong Dalyoung wrote:

> Is it possible to check what is the mainlanguage set in document?

Yes. Example:

%\mainlanguage[fr]
%\language[fr]
\starttext
currentlanguage:
\doifelse\currentlanguage{fr}{French}{Not French}\par
currentmainlanguage:
\doifelse\currentmainlanguage{fr}{French}{Not French}\par
translate: \translate[fr=Français, en=French]
\stoptext

-- 
           Peter
___________________________________________________________________________________
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] 17+ messages in thread

* Re: checking mainlanguage setup
  2011-05-27  9:49 Jeong Dalyoung
  2011-05-27 10:11 ` Pontus Lurcock
@ 2011-05-27 10:22 ` Marco
  2011-05-27 10:41 ` Peter Münster
  2 siblings, 0 replies; 17+ messages in thread
From: Marco @ 2011-05-27 10:22 UTC (permalink / raw)
  To: ntg-context

> I'd like to do the following type of setup.
> 
> 
> if mainlanguage == kr then
> 
> 	do something A
> 
> elseif mainlanguage == en then
> 
> 	do something B
> 
> else
> 	do something C
> 
> endif

\starttext
\startluacode
  if languages.current() == "kr" then
    context("Something A")
  elseif languages.current() == "en" then
     context("Something B")
  else
     context("Something C")
  end
\stopluacode
\stoptext

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


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

* Re: checking mainlanguage setup
  2011-05-27  9:49 Jeong Dalyoung
@ 2011-05-27 10:11 ` Pontus Lurcock
  2011-05-27 10:22 ` Marco
  2011-05-27 10:41 ` Peter Münster
  2 siblings, 0 replies; 17+ messages in thread
From: Pontus Lurcock @ 2011-05-27 10:11 UTC (permalink / raw)
  To: ntg-context

On Fri 27 May 2011, Jeong Dalyoung wrote:

> Is it possible to check what is the mainlanguage set in document?
> Now, I use \enablemode[kr] to do something A. But, I'd like to do it
> automatically if possible.

According to http://wiki.contextgarden.net/Modes#System_modes , 
the mode **kr should be automatically set if kr is the main language
(I haven't tried it, though).

Pont
___________________________________________________________________________________
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] 17+ messages in thread

* checking mainlanguage setup
@ 2011-05-27  9:49 Jeong Dalyoung
  2011-05-27 10:11 ` Pontus Lurcock
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Jeong Dalyoung @ 2011-05-27  9:49 UTC (permalink / raw)
  To: ntg-context

Dear all,

Is it possible to check what is the mainlanguage set in document?
Now, I use \enablemode[kr] to do something A. But, I'd like to do it automatically if possible.

For example,

I'd like to do the following type of setup.


if mainlanguage == kr then

	do something A

elseif mainlanguage == en then

	do something B

else
	do something C

endif

So, if \mainlanguage[kr] is set, then do A, and etc.

Thank you for reading.

Best regards,

Dalyoung



___________________________________________________________________________________
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] 17+ messages in thread

end of thread, other threads:[~2011-06-01 12:54 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <mailman.1.1306576802.24208.ntg-context@ntg.nl>
2011-05-28 12:26 ` checking mainlanguage setup Jeong Dalyoung
2011-05-28 13:45   ` Hans Hagen
2011-05-31  6:48   ` Procházka Lukáš Ing. - Pontex s. r. o.
     [not found] <mailman.1275.1306911210.4231.ntg-context@ntg.nl>
2011-06-01  7:45 ` Jeong Dalyoung
2011-06-01 12:54   ` Wolfgang Schuster
     [not found] <mailman.1266.1306859874.4231.ntg-context@ntg.nl>
2011-06-01  1:16 ` Jeong Dalyoung
2011-06-01  1:32   ` Aditya Mahajan
     [not found] <mailman.1.1306836001.18520.ntg-context@ntg.nl>
2011-05-31 10:45 ` Jeong Dalyoung
2011-05-31 14:33   ` Procházka Lukáš Ing. - Pontex s. r. o.
2011-06-01  8:14     ` Hans Hagen
2011-06-01  8:22       ` Hans Hagen
     [not found] <mailman.1220.1306501767.4231.ntg-context@ntg.nl>
2011-05-28  2:41 ` Jeong Dalyoung
2011-05-28  3:04   ` Aditya Mahajan
2011-05-27  9:49 Jeong Dalyoung
2011-05-27 10:11 ` Pontus Lurcock
2011-05-27 10:22 ` Marco
2011-05-27 10:41 ` Peter Münster

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