Locale settings: Difference between revisions
Created page with "= How to change language settings = Language settings are used within Linux to decide things like the language of prompts, date and monetary settings, and how to handle "special" characters. As the HPC is used by people with very diverse backgrounds, we do not set a default setting for this. Of course, the OS still has defaults, so everything still works. If you want to change the default, the best way is to add your preferred setting to your .bashrc, and also to run..." |
No edit summary |
||
| (6 intermediate revisions by the same user not shown) | |||
| Line 20: | Line 20: | ||
To see what the active settings are for a certain category, you can (e.g. MONETARY) do this: | To see what the active settings are for a certain category, you can (e.g. MONETARY) do this: | ||
locale -k LC_MONETARY | locale -k LC_MONETARY | ||
If you want to mix and match locales (use en_IE.utf8 for MONETARY and NUMERIC, and the rest is en_DK.utf8), do this: | |||
# Unset (clear) LC_ALL, as that overrides the changes | |||
unset LC_ALL | |||
# Set everything to English with Danish settings (correct dates) | |||
for item in $(locale | grep LC | grep -v LC_ALL | cut -f1 -d'='); do export ${item}=en_DK.UTF-8;done | |||
# Now we can set NUMERIC and MONETARY to en_IE.utf8 so we get a dot as the decimal separator | |||
export LC_NUMERIC=en_IE.utf8 | |||
export LC_MONETARY=en_IE.utf8 | |||
My locale (haars001) looks like this: | |||
LANG=en_IE.UTF-8 | |||
LANGUAGE= | |||
LC_CTYPE=en_DK.UTF-8 | |||
LC_NUMERIC=en_IE.UTF-8 | |||
LC_TIME=en_DK.UTF-8 | |||
LC_COLLATE=en_DK.UTF-8 | |||
LC_MONETARY=en_IE.UTF-8 | |||
LC_MESSAGES=en_DK.UTF-8 | |||
LC_PAPER=en_DK.UTF-8 | |||
LC_NAME=nl_NL.utf8 | |||
LC_ADDRESS=nl_NL.utf8 | |||
LC_TELEPHONE=nl_NL.utf8 | |||
LC_MEASUREMENT=en_DK.UTF-8 | |||
LC_IDENTIFICATION=en_DK.UTF-8 | |||
LC_ALL= | |||
Latest revision as of 09:08, 1 April 2025
How to change language settings
Language settings are used within Linux to decide things like the language of prompts, date and monetary settings, and how to handle "special" characters.
As the HPC is used by people with very diverse backgrounds, we do not set a default setting for this. Of course, the OS still has defaults, so everything still works.
If you want to change the default, the best way is to add your preferred setting to your .bashrc, and also to run scripts, as they usually don't load your .bashrc .
To see the available categories and the language they use, use this:
locale
To see the available language options, use this:
locale -a
As you saw, there are two main categories, LANG and LC_*. If you want to change them, you will have to change them separately, like this:
export LANG=nl_NL.utf8 export LC_ALL=nl_NL.utf8
After the above, you will have error messages in Dutch, and the currency symbol will be the Euro sign. To see what the active settings are for a certain category, you can (e.g. MONETARY) do this:
locale -k LC_MONETARY
If you want to mix and match locales (use en_IE.utf8 for MONETARY and NUMERIC, and the rest is en_DK.utf8), do this:
# Unset (clear) LC_ALL, as that overrides the changes
unset LC_ALL
# Set everything to English with Danish settings (correct dates)
for item in $(locale | grep LC | grep -v LC_ALL | cut -f1 -d'='); do export ${item}=en_DK.UTF-8;done
# Now we can set NUMERIC and MONETARY to en_IE.utf8 so we get a dot as the decimal separator
export LC_NUMERIC=en_IE.utf8
export LC_MONETARY=en_IE.utf8
My locale (haars001) looks like this:
LANG=en_IE.UTF-8 LANGUAGE= LC_CTYPE=en_DK.UTF-8 LC_NUMERIC=en_IE.UTF-8 LC_TIME=en_DK.UTF-8 LC_COLLATE=en_DK.UTF-8 LC_MONETARY=en_IE.UTF-8 LC_MESSAGES=en_DK.UTF-8 LC_PAPER=en_DK.UTF-8 LC_NAME=nl_NL.utf8 LC_ADDRESS=nl_NL.utf8 LC_TELEPHONE=nl_NL.utf8 LC_MEASUREMENT=en_DK.UTF-8 LC_IDENTIFICATION=en_DK.UTF-8 LC_ALL=