locale – How to Use a New en_** Locale

locale

I want to use an en_IL.UTF-8 locale – but I can't locale-gen it. I can choose this value in /etc/default/locale but that's apparently not enough for all apps. It seems like I need to get locale-gen to generate some files for en_IL.UTF-8 … How do I do that? And what else do I need to setup?

Best Answer

Generating a locale requires two files, a locale definition and a character map. In your case you'll need to create the former; you can probably adapt en_GB and he_IL to produce your own en_IL matching your requirements. The latter will just be the standard UTF-8.

Once you have both files, run localedef to compile the locale; something like

mkdir en_IL.utf8
localedef -f UTF-8 -i en_IL en_IL.utf8/

That should produce LC_ADDRESS, LC_COLLATE etc. in the en_IL.utf8 folder. You should copy that folder to /usr/local/lib/locale, so it ends up as /usr/local/lib/locale/en_IL.utf8. Once that's done,

LANG=en_IL.UTF-8 locale

should produce the expected output, and you can use your new locale.

Depending on your exact distribution you may need to add en_IL.UTF-8 to /usr/local/share/i18n/SUPPORTED, or perhaps copy the folder to /usr/lib/locale instead of /usr/local/lib/locale.

Related Question