Making this page since I’ve set up too many computers recently and I forget quickly
System Locale
There are a few environment variables which control system locale parts:
ENV Variable | Use | Recommended Value | Comment |
---|---|---|---|
LANG | Language | en_US.UTF-8 | Not setting this to english will cause some scripts to not work |
LANGUAGE | Language | en_US.UTF-8 | Not sure why there are two of these |
LC_ADDRESS | Address formatting | Whatevery you want | I’ve never seen this used by an application |
LC_COLLATE | Collation (Sorting) | C | You can get some exotic bugs when not setting this to C |
LC_CTYPE | I don’t remember | C | You can get some exotic bugs when not setting this to C |
LC_IDENTIFICATION | I don’t remember | Whatevery you want | I’ve never seen this used by an application |
LC_MONETARY | Currencies and stuff | Whatevery you want | Unsure when this is used |
LC_MESSAGES | I don’t remember | en_US.UTF-8 | I’ve had parsing bugs when not set to english |
LC_MEASUREMENT | I don’t remember | Whatevery you want | Unsure when this is used |
LC_NAME | I don’t remember | Whatevery you want | Unsure when this is used |
LC_NUMERIC | How to write numbers | en_US.UTF-8 | I’ve had bugs when not set to english due to , vs . in numbers |
LC_PAPER | I don’t remember | Whatevery you want | Unsure when this is used |
LC_TELEPHONE | I don’t remember | Whatevery you want | Unsure when this is used |
LC_TIME | I don’t remember | Whatevery you want | Unsure when this is used |
Locale configuration (init / sysV)
## Show active locale
locale
## Show active charmap
locale charmap
## Show available (installed) locales
locale -a
## Change locale (for local use)
export LANG=en_US.UTF-8
## Change locale (for global use)
update-locale LANG=en_US.UTF-8
## Change X11 keyboard layout (for local use)
setxkbmap -layout us -variant intl
## Change X11 keyboard layout (for global use)
sudo dpkg-reconfigure keyboard-configuration
Locale configuration (systemd)
## Show active locale
localectl status
## Show active charmap
locale charmap
## Show available (installed) locales
localectl list-locales
## Change locale
localectl set-locale LANG=en_US.UTF-8
## Change X11 keyboard layout
localectl set-x11-keymap us
Preferrable configuration
- Use en_US as much as possible. It will avoid bugs and in general work best
- Best X11 layout is keymap=
us
, layout=us
, variant=altgr-intl