Martin Maechler maechler at stat.math.ethz.ch
Thu Feb 27 11:50:04 CET 2014

Diverted from  ESS-help.

It is really about R's LANGUAGE, locales  and
then a wish for   sessionInfo() :

>>>>> Sparapani, Rodney <rsparapa at 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   


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.


  > Sys.getlocale()
  > 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 Maechler, ETH Zurich

More information about the ESS-help mailing list