Setting Locales, Keymap, Papersize, etc
I use GNU/Linux in english language. The shell is in english, all programs are in english, the user interface is in english too. I do that because i really dislike the localized output of error- and statusmessages of most programs. That just doesn’t sound right to me.
I am native german. So my keyboard (i.e. y and z swapped) has a german layout, my default papersize is not letter but A4. We use a 24 hour time format without am/pm.
Let me summarize what i want:
- locale: english
- charset: utf-8
- keymap: german
- papersize: a4
- dateformat: day.month.year as numbers
- timeformat: 24 hour without am/pm
- number thousand separator: . (dot)
- number decimal symbol: , (comma)
Lets obtain the current state of my system:
# locale
LANG=en_US.utf8
LANGUAGE=
LC_CTYPE="en_US.utf8"
LC_NUMERIC="en_US.utf8"
LC_TIME="en_US.utf8"
LC_COLLATE="en_US.utf8"
LC_MONETARY="en_US.utf8"
LC_MESSAGES="en_US.utf8"
LC_PAPER="en_US.utf8"
LC_NAME="en_US.utf8"
LC_ADDRESS="en_US.utf8"
LC_TELEPHONE="en_US.utf8"
LC_MEASUREMENT="en_US.utf8"
LC_IDENTIFICATION="en_US.utf8"
LC_ALL=
# cat /etc/papersize
letter
See
# man locale
for more information.
Make sure you have installed the proper languages for en_US and de_DE:
# locale -a
C
C.UTF-8
de_DE.utf8
en_US.utf8
POSIX
If there is a missing language, re-install them via the following command and select the language you want:
# locale-gen en_US.UTF-8 de_DE.UTF-8
# dpkg-reconfigure locales
In order to achive the goal describe in my introduction, we need to edit the ‘/etc/environment’ file with the following content:
LANG=en_US.utf8
LANGUAGE=
LC_CTYPE="en_US.utf8"
LC_NUMERIC="de_DE.utf8"
LC_TIME="de_DE.utf8"
LC_COLLATE="en_US.utf8"
LC_MONETARY="de_DE.utf8"
LC_MESSAGES="en_US.utf8"
LC_PAPER="de_DE.utf8"
LC_NAME="en_US.utf8"
LC_ADDRESS="en_US.utf8"
LC_TELEPHONE="en_US.utf8"
LC_MEASUREMENT="de_DE.utf8"
LC_IDENTIFICATION="en_US.utf8"
LC_ALL=
Also ‘/etc/papersize’ needs to be modified:
a4
Set the keyboard keymap by editing the file ‘/etc/default/keyboard’:
...
XKBMODEL="pc105"
XKBLAYOUT="de"
XKBVARIANT=""
XKBOPTIONS=""
...
BACKSPACE="guess"
...
Reboot and you’re done.
Update: modern GNU/Linux userspace tools claim ‘/etc/environment’ to be deprecated, well then lets use ‘/etc/default/locale’ instead.