Author :
Pierre Le Marre
Date :
2025-08-16 12:59:20
Hash :135b3204 Message :compose: Add fallback for custom locales
Before this commit, loading a Compose file based on the locale would fail
if the locale is not in the X11 Compose locale registry. While there are
workarounds (e.g. `~/.XCompose` file or `$XCOMPOSEFILE`), it does not
work if the corresponding file has `include "%L"`.
This commit adds the fallback `en_US.UTF-8` in case the locale is
installed but not registered in the X11 Compose locale registry. The
choice is motivated by the fact that most locales use `en_US.UTF-8`
anyway.
Ideally we should have a mechanism to extend the Compose locale registry
at the *system* level. Mechanisms at the user level (e.g. custom Compose
file, environment variable) are deemed sufficient.
We could still improve it by first trying to fallback to the locale
without the country bits, but there is no function to do such function
in the stdlib and we do not want to mess with locales manually.
Unfortunately is not possible to test it in our test suite. One can
still check it works following these instructions:
1. Create a custom locale, e.g. `en_XX.UTF-8`. `glibc-i18ndata` or
similar package may be required to get the required files in
`/usr/share/i18n/`.
`sudo localedef -i en_US -f UTF-8 en_XX.UTF-8`
2. `xkbcli compile-compose --verbose --locale en_XX.UTF-8`