How to set locale in Arch Linux
If you currently live outside of the English speaking countries, or you are learning a new language, chances are high that you might need to deal with another language interface on your system.
Think about all the problems you might come across if you mess up your system locale. For example, your terminal (konsole, gnome-terminal, etc…) will not open, and your keyboard could be broken lol. You don’t want this to happen, right?
In this tutorial, I will show you how to correctly set your locale on your own Archlinux to keep that kind of disasters at bay.
What is locale?
Let me quote this on the arch wiki:
Locales are used by glibc and other locale-aware programs or libraries for rendering text, correctly displaying regional monetary values, time and date formats, alphabetic idiosyncrasies, and other locale-specific standards.
In short, try to think locale as a series of configurations and related files of your system language, in order to help your system decide what language(s) it can recognize and use.
Checking current enables locales
Open your terminal, run:
$ locale -a
Then the currently enabled locales will show up. You might already set a language when you install the system. Let’s assume it to be American-English, so your locale might look like this:
en_US en_US.iso88591 en_US.utf8 POSIX C ...
A locale name usually has the form ll_CC, where ll is an ISO 639 two-letter language code and CC is an ISO 3166 two-letter country code. For instance, for English in the US, ll is
en, and CC is
Note that you might have several
en_US locales. They are for different encoding method. Since we want to work with different languages, I will recommend that you always enable the
utf8 one (utf8-encoding is widely used nowadays) to prevent unnecessary nuisance.
Cis a Special locale. When it is used, it disables all localization. That is, if you set
LC_ALL=C, it will override all your previous settings. And All the programs standardized by POSIX will use English messages and an unspecified character encoding(often US-ASCII).
If the languages(or specific encoding methods)you want are not available on your system, open
/etc/locale.gen and uncomment the language you want.
For example, uncomment
en_US.UTF-8 UTF-8 for American-English:
... #en_SG ISO_8859-1 en_US.UTF-8 UTF-8 #en_US ISO-8859-1 ...
Save the file, and generate locales with the command(you might need sudo privileges):
$ locale-gen # or sudo locale-gen
Setting system-wise locale
If you would like to change the system language, run this command(you might need sudo privileges):
$ localectl set-locale LANG=<your_language> # for example: localectl set-locale LANG=en_US.UTF-8
Overwriting locale per user session
If you only want to change the language interface for a specific user, create or edit
Caution! If you have changed the $XDG_CONFIG_HOME or $HOME variable, you should substitute
~/.configto your $XDG_CONFIG_HOME or $HOME
# ~/.config/locale.conf LANG=<your_language>
Re-login to a new use session and you should see the change.
Useful environment variables
Here are some useful environment variables defined by
locale.conf you might also want to give them a check. Those variables can help you with some special regional settings (time, currency, etc…).
LANGUAGE: used by GNU gettext
This variable is not standardized by
POSIX, but many programs that resort to GNU gettext as their
i18n method use this variable as well. And GNU gettext gives preference to
That’s say if you are a Swedish user who wants to read messages in German when Swedish is not available. You can set this variable like this:
# locale.conf ... LANGUAGE=sv:de ...
However, if you are a Swedish and German user who wants to read messages in English, do not set
LANGUAGE=en:sv:en, since programs usually won’t provide localization for
en, so you might see the wrong messages(like those in German).
LANGUAGE like this:
# locale.conf ... LANGUAGE=C ...
This is important because desktop environments will mess with
LANGUAGE variable when you set the regional settings from the GUI they provide.
LC_TIME: date and time format
# locale.conf ## To use the ISO 8601 date format(aka "YYYY-MM-DD"), set this variable to be: LC_TIME=en_DK.UTF-8 ## To use 24-hour format, use: LC_TIME= en_GB.UTF-8
Caution! Programs do not necessarily respect this variable. For example, the common date program in UNIX like systems.
However, you can still try command
dateto see how the output will be affected by the change of this variable.
LC_MEASUREMENT: measurement format
# locale.conf ## Metric system LC_MEASUREMENT=1 ## US system LC_MEASUREMENT=2
LC_MONETARY: currency format
# locale.conf # this is an example configuration LC_MONETARY int_curr_symbol "<U><S><D>" currency_symbol "<dollar-sign>" mon_decimal_point "<period>" mon_thousands_sep "<comma>" mon_grouping 3;-1 positive_sign "<plus-sign>" negative_sign "<hyphen>" int_frac_digits 2 frac_digits 2 p_cs_precedes 1 p_sep_by_space 2 n_cs_precedes 1 n_sep_by_space 2 p_sign_posn 3 n_sign_posn 3 END LC_MONETARY # cc: https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_72/nls/rbagslcmonetarycategory.htm
More variables, see: locale(5)- Locale category sections.
Still wasn’t working?
This may be caused by the desktop environment or display server you used setting the variables(as we mentioned above) under the hood.
For example, if you are using KDE plasma and set the display language from “System Settings”, it will create a file call
plasma-localerc(you can find it at
~/.config/). Then, it automatically generates a script called
plasma-locale-settings.sh and runs it when you start plasma on the purpose of helping you set the locales. You should try to manually delete the
plasma-localerc file to solve the issue.
If you are using other desktop, you may need to refer to your desktop manual to see how they set the locales.
For more information, check these web-pages: