Locale settings: Difference between revisions

From HPCwiki
Jump to navigation Jump to search
Haars0011 (talk | contribs)
No edit summary
Tag: Manual revert
Haars0011 (talk | contribs)
Undo revision 2474 by Haars0011 (talk)
Tag: Undo
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:
# Set everything to English with Danish settings
export LC_ALL=en_DK.utf8
# Unset (clear) LC_ALL, as that overrides the rest
unset LC_ALL
# 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

Revision as of 08:57, 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:

# Set everything to English with Danish settings
export LC_ALL=en_DK.utf8
# Unset (clear) LC_ALL, as that overrides the rest
unset LC_ALL
# 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