Configure Locale on Arch Linux

Objective:

Configure the Locale setting on Arch Linux.

Difficulty:

Easy

Note:

The locale setting is important for displaying fonts properly on a Linux system, especially if you are using curses/terminal based applications with unusual symbols. Your locale setting can change after being set at install if you later add a window manager, or if it wasn’t configured fully.

Prerequisites:

  • Install of Arch Linux.
  • Text editor. (I use micro, but if you don’t have a window manager installed yet, you could use nano or vim)

Steps:

1. Edit the ‘locale.gen’ File:

first you have to un-comment the line in locale.gen that corresponds with your locale.

The file can be found at /etc/locale.gen :

micro /etc/locale.gen

Then find the locale that applies to you and remove the hashtag to un-comment it:

Notes:

  • Although there are many different locales you can use, not all programs support all locales.
  • It’s usually enough to just have the UTF-8 version of whatever locale your using.

2. Generate the locale

Once you have the .gen file saved with your configuration you need to actually generate the locale from that file. You can run:

sudo locale-gen

and you should get an output like this:

3. Set the locale

After the locale has been generated you have to actually set it in a configuration file. There are a few ways you can go about this:

A.) locally for one user:

Create a file ‘locale.conf’ in the users home/.config directory:

micro ~/.config/locale.conf

and add

LANG=en_US.UTF-8

where ‘en_US.UTF-8’ is replaced with the locale that you want to use.

B.) Globally for the whole system:

Create a file ‘locale.conf’ in the /etc/ directory:

micro /etc/locale.conf

and add

LANG=en_US.UTF-8

where ‘en_US.UTF-8’ is replaced with the locale that you want to use. You will most likely need root privileges.

C.) Globally for the whole system (easy way):

you can run the command:

sudo localectl set-locale LANG=en_US.UTF-8

where ‘en_US.UTF-8’ is replaced with the locale that you want to use.

4. Check it

to check that your locale settings were properly configured you can run:

locale -a

or

locale 

you should get an output like this (where ‘en_US.UTF-8’ is the locale you set):

[top][home]