Skip to content

Changing locale?

3 messages · Michael Rutter, Matthieu Stigler

#
Hi

I need for a specific application to change the locale of R 2.9.2 in 
Ubuntu 9.04. Trying the example in ?Sys.setlocale:
Sys.setlocale("LC_TIME", "de_DE.utf8")
[1] ""
Warning message:
In Sys.setlocale("LC_TIME", "de_DE.utf8") :
  la requ?te OS pour sp?cifier la localisation ? "de_DE.utf8" n'a pas pu 
?tre honor?e

I tried the code line for windows on R windows (Sys.setlocale("LC_TIME", 
"German")) and it worked. Does it mean that the basic installation (from 
ubuntu repo) does not provide those locales? Or did I do something wrong?

Thanks a lot!

Matthieu

 sessionInfo()
R version 2.9.2 (2009-08-24)
i486-pc-linux-gnu

locale:
LC_CTYPE=C;LC_NUMERIC=C;LC_TIME=C;LC_COLLATE=C;LC_MONETARY=C;LC_MESSAGES=fr_FR.UTF-8;LC_PAPER=fr_FR.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=fr_FR.UTF-8;LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base    

other attached packages:
[1] Revobase_0.2-1
2 days later
#
Matthieu,

Finally found the solution.  This is an Ubuntu issue, so this would
effect other programs as well, but I was able to change the locale in
R by doing the following:

sudo gedit /var/lib/locales/supported.d/local

Add "de_DE.utf8 UTF-8" to the file.  Save and exit.

Then execute:

sudo dpkg-reconfigure locales

This will take a minute or so.  I was then able to change locales in R
without being root.  Full credit goes to this webpage:

http://blog.andrewbeacock.com/2007/01/how-to-change-your-default-locale-on.html

Michael

On Thu, Apr 15, 2010 at 9:57 AM, Matthieu Stigler
<matthieu.stigler at gmail.com> wrote:

  
    
#
Thanks a lot Michael, it works! Really nice you searched for this 
problem, thanks!

Mat

Michael Rutter a ?crit :