Linux locales


You might encounter some locales errors on a server, especially if your users are from different countries.


Example of an error message:

perl: warning: Please check that your locale settings:
	LANGUAGE = "en_GB:en",
	LC_ALL = (unset),
	LC_PAPER = "sv_SE.UTF-8",
	LC_ADDRESS = "sv_SE.UTF-8",
	LC_MONETARY = "sv_SE.UTF-8",
	LC_NUMERIC = "sv_SE.UTF-8",
	LC_TELEPHONE = "sv_SE.UTF-8",
	LC_IDENTIFICATION = "sv_SE.UTF-8",
	LC_MEASUREMENT = "sv_SE.UTF-8",
	LC_TIME = "sv_SE.UTF-8",
	LC_NAME = "sv_SE.UTF-8",
	LANG = "en_GB.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_ALL to default locale: No such file or directory


Install / update locales

1. List the language you'd like to use. Example: sv_SE.UTF-8 en_GB.UTF-8 fr_FR.UTF-8

You can have the list of supported languages:

less /usr/share/i18n/SUPPORTED
  • zh_CN = Chinese
    • zh_CN.UTF-8
  • fr_FR = French (France)
    • fr_FR.UTF-8
  • sv_SE = Swedish
    • sv_SE.UTF-8


2. If you can, run as an user using sudo:

# Step 1: regenerate cache
sudo locale-gen sv_SE.UTF-8 en_GB.UTF-8 fr_FR.UTF-8

# Step 2: download all the locales you need
sudo dpkg-reconfigure locales

♦ Note: you don't need to set a default locale. You can let default locale: NONE when asked.


Change the lang of Linux shell

To switch the console to English:

sudo apt-get install language-pack-en language-pack-en-base manpages


References

Good thread: http://askubuntu.com/questions/162391/how-do-i-fix-my-locale-issue