Adjust locale settings for local usage

This commit is contained in:
Alexander Hess 2026-08-28 15:03:34 +02:00
commit 417ed15f47
Signed by: alexander
GPG key ID: B46EDB4DFC26805D
6 changed files with 187 additions and 22 deletions

View file

@ -1,24 +1,42 @@
#!/bin/sh
# Locale settings for headless machines
# Locale settings for desktop machines
# as run by the author of this `dotfiles` repository
# Requires the en_US.UTF-8, en_DK.UTF-8, en_IE.UTF-8, and de_DE.UTF-8
# locales be installed which is checked by ~/.local/bin/ensure-locales
# Other hosts (e.g., servers) usually lack some of these locales,
# and Debian's /etc/ssh/ssh_config forwards all of them via `SendEnv LANG LC_*`
# => ~/.local/bin/ssh, ~/.local/bin/scp, and ~/.local/bin/sftp
# send `LC_ALL=C.UTF-8` on top to mask them on remote hosts
# Drop what a client may forward over `ssh`,
# because `AcceptEnv LANG LC_*` may be set in /etc/ssh/sshd_config
unset \
LC_ALL \
LC_ADDRESS \
LC_COLLATE \
LC_CTYPE LC_IDENTIFICATION \
LC_MEASUREMENT \
LC_MESSAGES \
LC_MONETARY \
LC_NAME \
LC_NUMERIC \
LC_PAPER \
LC_TELEPHONE \
LC_TIME
export LANG=en_US.UTF-8 # Fallback for any (future) LC_* not set below
# Set every LC_* category implicitly with the `$LANG` fallback
export LANG=C.UTF-8
# Base: US English for language, text handling, and sorting
export LC_COLLATE=en_US.UTF-8 # Dictionary sort order => Ignore punctuation
export LC_CTYPE=en_US.UTF-8 # UTF-8 character classification
export LC_MESSAGES=en_US.UTF-8
export LC_NUMERIC=en_US.UTF-8 # 1,234.56 rather than 1.234,56
# Exceptions: European conventions with English number formatting
export LC_MEASUREMENT=en_IE.UTF-8 # Use the metric system
export LC_MONETARY=en_IE.UTF-8 # Euro with 1,234.56
export LC_PAPER=en_IE.UTF-8 # Use DIN-A4 for a page
export LC_TIME=en_DK.UTF-8 # ISO dates, 24h clock, Monday first
# (German) metadata
export LC_ADDRESS=de_DE.UTF-8 # German postal layout
export LC_IDENTIFICATION=en_US.UTF-8
export LC_NAME=en_US.UTF-8
export LC_TELEPHONE=de_DE.UTF-8 # For "+49" and "030 12345"
export TZ="Europe/Berlin"