Locale Configuration
On this page
Description
What are Locales ?
Locales determine how your system displays system language, date and time, number formats, and currency symbols.
In this lesson we are setting up a hybrid locale configuration:
- System language: English (US) so error messages and system output are in English
- Regional formats: Belgian (BE) so dates, numbers, and currency match Belgian standards
Step 1: Check Current Locale Status
Display what's currently configured.
localeWhat this does:
- locale = displays all current locale environment variables
- Shows which language and regional settings are active
- You are now using the default locale
"C"
Output.
root@angelo:/# locale
LANG=C
LANGUAGE=
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_PAPER="C"
LC_NAME="C"
LC_ADDRESS="C"
LC_TELEPHONE="C"
LC_MEASUREMENT="C" LC_IDENTIFICATION="C"
LC_ALL=Step 2: Check Available Locales
Display which locales are currently on your system.
locale -aWhat this does:
- locale -a = list all available locales
- Shows which local combinations you can currently use
- These are the default locales as we have not configured any yet
Output.
root@angelo:/# llocale -a
C
C.utf8
POSIXStep 3: Generate Required Locales
We need to generate two locales en_US.UTF-8 and nl_BE.UTF-8.
sudo dpkg-reconfigure localesWhat this does:
- sudo = run this command with administrator privileges
- dpkg-reconfigure = reconfigure and already installed package
- locales = the package that manages system locales
In the menu that appears:
- Spacebar to select:
en_US.UTF-8 UTF-8 - Spacebar to select:
n1_BE.UTF-8 UTF-8 - Press Tab to move to "OK", then Enter
- Choose
en_US.UTF-8as the default locale - Press Enter
Step 4: Check Available Locales Again
Display which locales are currently on your system.
locale -aOutput.
root@angelo:/# locale -a
C
C.utf8
POSIX
en_US.UTF-8
nl_BE.UTF-8Step 5: Configure Locale Settings
Now we need to set the proper locale configuration.
sudo update-locale LANG=en_US.UTF-8 LANGUAGE=en_US LC_NUMERIC=nl_BE.UTF-8 LC_TIME=nl_BE.UTF-8 LC_MONETARY=nl_BE.UTF-8 LC_PAPER=nl_BE.UTF-8 LC_NAME=nl_BE.UTF-8 LC_ADDRESS=nl_BE.UTF-8 LC_TELEPHONE=nl_BE.UTF-8 LC_MEASUREMENT=nl_BE.UTF-8 LC_IDENTIFICATION=nl_BE.UTF-8What this does:
- update-locale = updates the
/etc/default/localefile - LANG=en_US.UTF-8 = sets primary language to English (US)
- LANGUAGE=en_US = sets fallback language hierarchy
- LC_NUMERIC = sets the number format to 1.000,50
- LC_TIME = sets the date and time format to DD/MM/YYYY
- LC_MONETARY = sets currency format to €
- LC_PAPER = paper size (A4)
- LC_NAME, LC_ADDRESS, LC_TELEPHONE = sets name and address
- LC_MEASUREMENT = sets measurement system to metric
- LC_IDENTIFICATION = sets locale metadata
Step 6: Verify Configuration File
Check your configuration.
cat /etc/default/localeWhat this does:
- cat = concatenate and display file contents
- Shows the locale configuration that was just get in step 5
Step 7: Verify Current Locale Status
Log out of your server.
exitLog back into your server.
ssh -p 22345 root@193.191.176.212Display what you configured.
localeOutput.
root@angelo:/# locale
LANG=en_US. UTF-8
LANGUAGE=en_US
LC_CTYPE="en_US. UTF-8"
LC_NUMERIC=n1_BE.UTF-8
LC_TIME=n L_BE. UTF-8
LC_COLLATE="en_US. UTF-8"
LC_MONETARY=n 1_BE. UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=nL_BE- UTF-8
LC_NAME=n 1_BE. UTF-8
LC_ADDRESS=nL_BE.UTF-8
LC_TELEPHONE=n1_BE. UTF-8
LC_MEASUREMENT=nL_BE. UTF-8
LC_IDENTIFICATION=nL_BE. UTF-8
LC ALL=