Configure Locales in Ubuntu
This article will describe how locales (language settings) can be configured for Ubuntu from the command line. There is a similar article for Debian: Perl warning Setting locale failed in Debian. The following information has been tested under Ubuntu 11.10.
Displaying the Current Settings
$ locale LANG=en_US.UTF-8 LANGUAGE= LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL=
Displaying the Available Locales
$ locale -a C C.UTF-8 de_AT.utf8 de_BE.utf8 de_CH.utf8 de_DE.utf8 de_LI.utf8 de_LU.utf8 en_AG en_AG.utf8 ... POSIX
If a locale does not appear in the list, it will have to be additionally installed.
# locale-gen fr_FR.UTF-8 Generating locales... fr_FR.UTF-8... done Generation complete.
The following file contains a list of all available locales:
The default settings are stored in the
$ cat /etc/default/locale LANG=en_US.UTF-8
This file can either be adjusted manually or updated using the tool,
# update-locale LANG=de_DE.UTF-8
You will find a list of all LC_* environment variables at .
This becomes useful for example, when a system should be operated in German, however the error and system messages should be displayed in English. This is often helpful, when searching for errors. In this case, the following settings can be made to
LC_MESSAGES variable also influences the language of the user interface or the window manager. Date and number specifications are not affected by a change from
No locale set
It may occur that no locales are set on systems.
This can be recognized by the fact that
/etc/default/locale does not exist.
locale -a command returns following:
locale -a C C.UTF-8 POSIX
In this case, proceed as follows:
- Generate locale
sudo locale-gen de_DE.UTF-8
- Set locale, this generates also the
- Then restart the system or open a new terminal.