Author Topic: Locale settings for non-english locale  (Read 13192 times)

Svein Wisnaes

  • Zen Samurai
  • ****
  • Posts: 325
  • Karma: +5/-0
  • A Norwegian living in Brazil
    • View Profile
    • Oceanwatcher Media | Svein Wisnaes
Locale settings for non-english locale
« on: June 25, 2010, 02:30:52 am »
If you install Ubuntu Server 10.04 with English as language, but with a time zone for a country that do not have English as main language, you might end up with some warnings about locale when you access the server via command line.

I got a lot of the following message on my server:

Code: [Select]
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LC_PAPER = "pt_BR.UTF-8",
        LC_ADDRESS = "pt_BR.UTF-8",
        LC_MONETARY = "pt_BR.UTF-8",
        LC_NUMERIC = "pt_BR.UTF-8",
        LC_TELEPHONE = "pt_BR.UTF-8",
        LC_MESSAGES = "en_US.UTF-8",
        LC_COLLATE = "C",
        LC_IDENTIFICATION = "pt_BR.UTF-8",
        LC_MEASUREMENT = "pt_BR.UTF-8",
        LC_TIME = "en_GB.UTF-8",
        LC_NAME = "en_US.UTF-8",
        LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

To check what locale you have available, issue the locale -a command. Here is what I had:

Code: [Select]
locale -a
C
POSIX
en_AG
en_AU.utf8
en_BW.utf8
en_CA.utf8
en_DK.utf8
en_GB.utf8
en_HK.utf8
en_IE.utf8
en_IN
en_NG
en_NZ.utf8
en_PH.utf8
en_SG.utf8
en_US.utf8
en_ZA.utf8
en_ZW.utf8

To fix this, you need to either install or create the missing locale. I used this command:

Code: [Select]
sudo localedef -i pt_BR -f UTF-8 pt_BR.UTF-8
After doing a new locale -a I am now getting this:

Code: [Select]
locale -a
C
POSIX
en_AG
en_AU.utf8
en_BW.utf8
en_CA.utf8
en_DK.utf8
en_GB.utf8
en_HK.utf8
en_IE.utf8
en_IN
en_NG
en_NZ.utf8
en_PH.utf8
en_SG.utf8
en_US.utf8
en_ZA.utf8
en_ZW.utf8
pt_BR.utf8

The errors I was getting are gone :)



Regards,

Oceanwatcher
Do NOT use PM for support. This is a community forum and support is not on a one-on-one basis.
READ BEFORE POSTING - How to make a good post - click here

Marcus

  • Forum Moderator
  • Zen Samurai
  • *****
  • Posts: 395
  • Karma: +12/-0
    • View Profile
    • Professional IT Service
Re: Locale settings for non-english locale
« Reply #1 on: December 19, 2012, 03:03:30 pm »
Hello,

You may also simply run this command:
Code: [Select]
sudo apt-get install language-pack-<language>
** Replacing <language> with your own language.  For exemple, french would be "fr".
More precisely, it would look like this:
Code: [Select]
sudo apt-get install language-pack-fr
Best,

Marcus