How to change Linux language without reinstalling my OS
March 5, 2021
When installing Linux, you can select the system language (locale) - and in the future this language will be used in Linux programs and windows (except for those applications for which no translation has been made).
If you decide to change the Linux language, then you do not need to reinstall it - just follow the simple steps.
To find out the current language settings, type the command:
locale
Output example:
To view the available language settings (locales), use the command
locale -a
To change the system language, it is necessary that the locale to which you want to change the language is already present in the system. If it is not there, then you need to add it.
To add a new locale, open the /etc/locale.gen file:
sudo gedit /etc/locale.gen
And uncomment the lines with the desired new locales there. Then run the command:
sudo locale-gen
Now you can see the new language settings (new locale) in the list of available locales.
locale -a
Changing the locale for the current session
To change the language for the current session, you need to set the LANG environment variable, this can be done with the export command:
# Set English locale export LANG=en_US.UTF-8 # Set the Russian locale export LANG=ru_RU.UTF-8 # Set the French locale export LANG=fr_FR.UTF-8
If this did not work on your system, then replace the LANG variable with the LANGUAGE variable, for example:
export LANGUAGE=en_US.UTF-8
Change language settings permanently for one user
Add a line with the export of the desired locale (for example, “export LANG=en_US.utf-8”) to the ~/.bashrc file
The changes will take effect after logging out/logging in and will take effect after every reboot.
Changing the default system locale
There are two alternative methods for changing the locale.
The first is to run the following command (specify the locale you need):
sudo localectl set-locale LANG=en_US.UTF-8
Or:
sudo localectl set-locale LANG=ru_RU.UTF-8
The second method is to register the language in the /etc/locale.conf file, open it:
sudo gedit /etc/locale.conf
and add the line with the desired locale there:
LANG=en_US.utf-8
Related articles:
- Error “trid: loadlocale.c:129: _nl_intern_locale_data: Assertion `cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))' failed” (SOLVED) (81.3%)
- How to translate Linux with Cinnamon into my language (81.3%)
- How to use Kali Linux to check web-sites (50%)
- How to run small Python code in Bash (50%)
- How to completely uninstall a package along with dependencies on Arch Linux (as well as BlackArch and Manjaro) (50%)
- How to use OpenVPN with TCP protocol (RANDOM - 50%)