How to change language using localectl set-locale
Locales consist of a set of environment variables to define language, country, and character encoding for applications and shell sessions on a Linux system. These environment variables are used by system libraries and country-specific applications on the system.
The locale affects the time and date format, first day of the week, numbers, currency, and many other values formatted according to the language or region (country) set on a Linux system.
The locale and localectl utility provides information about the currently installed locale and changes it when needed.
locale LANG=en_US. UTF-8 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=
Output a list of all available locales.
locale -a aa_DJ aa_DJ.iso88591 aa_DJ.utf8 aa_ER aa_ER@ aa_ER.utf8 aa_ER.utf8 aa_ET aa_ET.utf8 ..
Change system locale
If you want to change the locale, the update-locale and localectl command is used. The LANG variable can be used to set the locale for the entire system.
The following command sets LANG to de_DE.UTF-8
sudo localectl set-locale LANG=de_DE.UTF-8
To set a locale for a single user, you can simply open the file .bash_profile and add the following lines.
LANG = "de_DE.utf8" Export LANG
For Debian 10 (Buster), the dpkg-reconfigure service program is a good way to set the system locale.
sudo dpkg-reconfigure locales
The locale settings are located in the following files.
- /etc/default/locale – Ubuntu/Debian
- /etc/locale.conf – CentOS/RHEL
These files can also be edited manually using a preferred command line editor, such as Vim or Nano, to configure the system locale.
Further help can be found in the man pages.
man locale man update-locale man localectl
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?