Diverted from ESS-help.
It is really about R's LANGUAGE, locales and
then a wish for sessionInfo() :
>>>>> Sparapani, Rodney <rsparapa@mcw.edu>
>>>>> on Thu, 20 Feb 2014 19:39:33 +0000 writes:
>> Just guessing: perhaps this is something that is set when
>> R is initialized and not queried every time something is
>> printed?
>>
>> Kasper
> Hi Kasper:
> Good guess, but wrong ;o) Actually, the problem is in
> Sys.getlocale() Recent versions of R have this in its
> help...
> Note that the ‘LANGUAGE’ environment variable has
> precedence over ‘"LC_MESSAGES"’ in selecting the language
> for message translation on most R platforms.
> However, the function itself just ignores LANGUAGE. I
> searched bugzilla, but did not find anything related to
> LANGUAGE or Sys.getlocale() I guess this is a feature :o)
Note that 'locale' is general OS / system term,
which R cannot define.
On a Unix alike (e.g., here, Fedora Linux), if you have defined the
LC_* plus LANG plus LANGUAGE
variables,
locale
only prints the LC_* stuff and LANG, but not LANGUAGE.
I did not dig, but I'm pretty sure LANGUAGE is R's own way to specify
the messages language *in addition* to locale settings,
and with higher precedence, as you've mentioned above.
Hence Sys.getlocale() should clearly *not* report LANGUAGE.
OTOH,
> Sys.getlocale()
[1]
"LC_CTYPE=de_CH.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=de_CH.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=de_CH.UTF-8;LC_PAPER=de_CH.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=de_CH.UTF-8;LC_IDENTIFICATION=C"
> Sys.getenv("LANG")
[1] "de_CH.UTF-8"
> Sys.getenv("LANGUAGE")
[1] "en"
>
So, Sys.getlocale() also does not report LANG,
even though, 'locale' does report that for me.
--------------------------------------
After all the above, and a bit independent of that :
I believe you are right, and R's sessionInfo()
should report something like LANGUAGE,
as that "hides" the setting of LC_MESSAGES.
Where "something like" could mean one of several possibilities:
a) in spite of the above, add "LANGUAGE=.." to the locale part
of sessionInfo()'s result.
b) A new entry LANGUAGE as part of the result.
And 'b)' typically should be combined with a tweak to the
print.sessionInfo() method. It could say
"Language for messages:" instead of "LANGUAGE"
Martin
-
Martin Maechler, ETH Zurich
______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel