Table of Content

107.3 Localisation and internationalisation

Weight: 3

Description: Candidates should be able to localize a system in a different language than English. As well, an understanding of why LANG=C is useful when scripting.

Key Knowledge Areas:

  • Configure locale settings and environment variables
  • Configure timezone settings and environment variables

Terms and Utilities:

/etc/timezone
/etc/localtime
/usr/share/zoneinfo/
LC_*
LC_ALL
LANG
TZ
/usr/bin/locale
tzselect
timedatectl
date
iconv
UTF-8
ISO-8859
ASCII
Unicode

locale

locale option name
option
-a all locales
-m list of all character mapping
-c specified locale category, LC_TIME
-k get name, value of keyword

locale LANG=C

locale LC_CTYPE

oldhorse@dclab-u1504s:~$ export LANG=en_GB.UTF-8
oldhorse@dclab-u1504s:~$ export LC_ALL=en_GB.UTF-8

permanent change
~/.bashrc or /etc/profile

timezone

linux time since Jan 1 1970

/usr/share/zoneinfo
/etc/localtime
/etc/timezone

change tz to EST

rm /etc/localtime
cd /etc
ln -s /usr/share/zoneinfo/Canada/Eastern localtime

update /etc/timezone to
Canada/Eastern

root@dclab-u1504s:/etc# date
Mon Nov 16 07:29:18 EST 2015

tz

tzselect
tzsetup
tzconfig

set UTC

/etc/sysconfig/clock
UTC=true

timedatectl

oldhorse@dclab:/etc/lightdm$ timedatectl
Local time: Mon 2016-03-21 15:31:02 EDT
Universal time: Mon 2016-03-21 19:31:02 UTC
RTC time: Mon 2016-03-21 19:31:02
Time zone: Canada/Eastern (EDT, -0400)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: yes
Last DST change: DST began at
Sun 2016-03-13 01:59:59 EST
Sun 2016-03-13 03:00:00 EDT
Next DST change: DST ends (the clock jumps one hour backwards) at
Sun 2016-11-06 01:59:59 EDT
Sun 2016-11-06 01:00:00 EST