2

When I installed Linux I set my locale to en_US.UTF-8. However I want to override some but not all of the settings in that locale. Specifically, I would like the Measurement to be Metric instead of Imperial and the Date to be DD/MM/YYYY instead of MM/DD/YYYY. How can I do this?

bch6595
  • 21
  • 1

2 Answers2

1

You can set the LANG, LANGUAGE, and any of the LC_* environment variables individually.

e.g. my system defaults to LANG=en_AU.UTF8, but I want YYYY-MM-DD dates (in English) so I have LC_TIME=en_DK.UTF8.

You can see a list of the variables and their current values by running locale:

$ locale
LANG=en_AU.UTF8
LANGUAGE=en_AU:en
LC_CTYPE=en_AU.UTF-8
LC_NUMERIC="en_AU.UTF8"
LC_TIME=en_DK.UTF8
LC_COLLATE="en_AU.UTF8"
LC_MONETARY="en_AU.UTF8"
LC_MESSAGES="en_AU.UTF8"
LC_PAPER="en_AU.UTF8"
LC_NAME="en_AU.UTF8"
LC_ADDRESS="en_AU.UTF8"
LC_TELEPHONE="en_AU.UTF8"
LC_MEASUREMENT="en_AU.UTF8"
LC_IDENTIFICATION="en_AU.UTF8"
LC_ALL=

See man locale for more details.

cas
  • 1
  • 7
  • 119
  • 185
1

If only running some Desktop Environment and related applications then chances are high that the DE offers some system-settings graphical facility enabling to tune the language settings you want (measurement and date) (*1).

If sometimes login in from some tty console (not X-terminal) you will need to explicitly export some variables in your shell profile file as in my .bash_profile :

export LC_TIME="fr_FR.UTF-8"
export LC_MEASUREMENT="fr_FR.UTF-8"

Of course, if you launch your DE from the shell, its own settings will override these shell preferences.

Also be aware that many applications including some X terminal emulators, mail clients, libreoffice… comply with their own settings the user can manage via some dedicated preferences graphical utility. These settings will (locally) override settings made elsewhere.


1 : There are other locale preferences users can wish setting individually that cannot be changed via some DE system-settings and that will be more or less correctly inferred from other settings.

Those LC_* variables can be exported and honored as session environment variables at the condition they are exported in the DE specific environment setting file or directory.
In particular regarding kde-Plasma : $HOME/.config/plasma-workspace/env
Refer to your specific DE's manual in order to discover where its session environment variables should be set.

MC68020
  • 6,281
  • 2
  • 13
  • 44