On 07/11/2011 01:57 PM, Patrick Gundlach wrote:
Hi,
I am thinking of using GNU gettext together with LuaTeX. Two questions:
1) (off topic) which environment variable should I check for the current language? LANG?
Or is this a "it depends" answer?
It depends on what do you want to know / do. The IEEE specification
basically has this to say:
The values of locale categories shall be determined by a precedence
order; the first condition met below determines the value:
* If the LC_ALL environment variable is defined and is not null, the
value of LC_ALL shall be used.
* If the LC_* environment variable ( LC_COLLATE , LC_CTYPE ,
LC_MESSAGES , LC_MONETARY , LC_NUMERIC , LC_TIME ) is defined and is not
null, the value of the environment variable shall be used to initialize
the category that corresponds to the environment variable.
* If the LANG environment variable is defined and is not null, the
value of the LANG environment variable shall be used.
* If the LANG environment variable is not set or is set to the empty
string, the implementation-defined default locale shall be used.
2) can I safely assume that this variable from question 1 is not cleared by
LuaTeX? The following section in the LuaTeX documentation makes me a bit
nervous:
Current luatex does exactly what is documented below. If (when) luatex
switches to luatex 5.2, some of these will likely go away (LC_NUMERIC
may have to stay, depending on the exact details of luatex 5.2).
It is highly unlikely (but I dare not say 'impossible') that any new
environment variables will need to be altered to counteract odd lua
behaviour.
"In stock Lua, many things depend on the current locale. In LuaTEX, we can't do
that, because it makes documents unportable. While LuaTEX is running if forces the
following locale settings:
LC_CTYPE=C
LC_COLLATE=C
LC_NUMERIC=C
"
Best wishes,
Taco