I use the legacy snapcraft-desktop-helpers as I do custom build of Qt framework. Since some time, apparently updating to core22, I noticed I see error messages like
** (telegram-desktop:3286): WARNING **: 16:32:30.856: Can't set the global locale to the user's preferred locale.
locale::facet::_S_create_c_locale name not valid
The environment variable LANG may be wrong.
(telegram-desktop:3286): Gtk-WARNING **: 16:32:30.951: Locale not supported by C library.
Using the fallback 'C' locale.
If I do locale
, I see the following error messages:
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
My first guess was that glibc no longer reads LOCPATH for some reason as locale -a
is not aware of any locale:
locale: Cannot set LC_CTYPE to default locale: No such file or directory
warning: The LOCPATH variable is set to "/snap/telegram-desktop/4534/usr/lib/locale"
C
C.utf8
POSIX
So I tried to use layout $SNAP/usr/lib/locale to /usr/lib/locale. As a result, locale -a
lists all the locales, but the app itself and locale
continue to throw error messages. Between various attempts to make locales work, I tried to unset LOCPATH while not using layout and I noticed a difference in error messages:
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
So, it also errors about LC_MESSAGES now. Does this means something is wrong with the locale files that setting LC_CTYPE doesn’t work, what consequently makes entire setlocale(LC_ALL, "")
fail?
I also noticed that core22 has C.utf8 locale file in /usr/lib/locale. I tried to set C.UTF-8 locale and there’s no error, so this locale file works. When I tried to use C.UTF-8 locale while using layout, it errored out with the 3 errors (LC_CTYPE, LC_MESSAGES, LC_ALL), then I checked and found that $SNAP/usr/lib/locale has no C.utf8 file. I also can’t find any package providing the file on packages.ubuntu.com.
I really need help on this as I’m out of ideas how to make locales work now, maybe there’s a glibc bug?