How to set up a new locale?

Until quite recently I didn’t know this locale existed, but I use the ‘en_NL’ locale in KDE Plasma. It’s exactly what I needed and it’s amazing.

However, I can only use it in Plasma, and after I’ve logged in. I can’t figure out how to set it up system wide so that SDDM and all the other systems can use it.

locale -a does not list the locale. It does list a few *_NL, nl_*, and en_* locales, but those either translate things into Dutch or change things using weird formats (such as dates and time).

find / -type f -name "*en_US*". Searching for files that define locales also didn’t do much for me. Trying to find something that defined en_US.UTF-8, for example, resulted in nothing I could use.

I think the main problem is is that it isn’t an officially supported locale, see: 14085 – en_NL: new locale (English language for the Netherlands). But, the locale I use exists and it exists somewhere on my system. Does anyone of you know how I use this locale system wide?

Edit: I forgot to mention I use Fedora 35 KDE spin.

If you are in a Debian based distro you can simply set the default locale by running [sudo] dpkg-reconfigure locales and selecting the ones you want. Then select the default for the system.

Caveat: If possible, set it to a -UTF8 locale as default, or you might get unreadable characters depending on the text.

Edit:
You will need to restart all services and/or reboot for it to take effect.

If only it were that simple. :slight_smile:

(1) I don’t use a Debian based distro, and (2) the locale I want to use is only available in Plasma’s regional settings and nowhere else–as far as I can tell. I pretty much use a locale that does not exist.

TL;DR: I’m trying to figure out how to export the locale only Plasma knows about and use it system wide. No luck so far.

In the meanwhile I have found that Plasma saves locale info in ~/.config/plasma-localerc:

$ cat ~/.config/plasma-localerc
[Formats]
LANG=en_NL.UTF-8

However, if I type locale in the terminal:

$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

And requesting a list of available locales tells me the locale I’m actively using is not available:

$ locale -a | grep en_
...
en_IN
en_IN.utf8
en_NG
en_NG.utf8
en_NZ
en_NZ.iso88591
en_NZ.utf8
en_PH
en_PH.iso88591
en_PH.utf8
...

Which means I can’t select it through something like localectl. I assume dpkg-reconfigure locales and localctl do something similar.

I have downloaded some locale definition files (I think, I’m actually not all too sure on how to use them) from here and tried to compile them with localedef, but localedef complains about not being able to find charmap files, which isn’t too crazy because /usr/share/i18n/charmaps is empty.

$ localedef -f UTF-8 -i en_NL en_NL.UTF-8
[error] character map file `UTF-8' not found: No such file or directory
[error] default character map file `ANSI_X3.4-1968' not found: No such file or directory

These are from my notes, not sure if they’ll be of use or if this will apply to Plasma:

# Get desired parameters
localectl list-x11-keymap-layouts # for <map>
localectl list-x11-keymap-models # for <model>
localectl list-x11-keymap-variants # for <variant>
localectl list-x11-keymap-options # for <options>

# Apply keymap
# Optional: <model>, <variant>, <options>
localectl set-x11-keymap <map> <model> <variant> <options>
1 Like

The reason you can’t install it because it was never generated properly. You set the locales for the system in /etc/locale.gen just uncomment the ones you need and re-run locale-gen

Edit:

To have a custom locale put it in /usr/local/share/i18n/SUPPORTED and copy the locale to /usr/local/share/i18n/locales/ then re-reun locale-gen

Edit2:

Ok so you can find the locale files here drop them where I said , regenerate the locales and you will have it available system wide.

Good luck

Keyboard settings aren’t an issue. I don’t think I’ve ever seen a non-US keyboard since the 90s. It’s mainly SDDM displaying the date/time in the wrong format and me thinking “ugh, that needs to be fixed,” every single time I log in.

You’re definitely onto something. However, on Fedora locale-gen isn’t available; Fedora systems use localedef instead.

I’m also starting to think that maybe this whole topic should be about why language, region, and format settings are so rigidly connected. In my quest to fix SDDM I have found several people trying to use non-standard locales, like en_DE, or en_FI. I’m certainly not the only one who’s struggling to get a system that displays info in a language and/or formats that aren’t 100% in line with what local people in the area traditionally use (in everyday life)–and that includes Americans in the US who prefer to use a 24-hour clock, for example.

It took a bit too much time figuring stuff out to not share this so future me can find this later here, or it might help someone else. Especially finding out how to get the character maps took way too long. Most search results told me how to download Fedora Linux, how localedef works, or what the default location for the character maps is, but how to get them was near impossible to find.

I made it a tutorial.

P.S. When you search for ‘fedora mirrors’ you might find this:

Fedora Mirror