One of the issues that came up at the Snapcraft Summit is that many snaps of GTK based applications only displayed in English, even when the user’s locale was set to something else.
As an example, I looked at @kenvandine’s snap of iagno. The snap contains gettext message catalogues for many languages in
$SNAP/usr/share/locale, and it looks like the executable is passing the correct path to gettext:
$ strings /snap/iagno/current/usr/bin/iagno | grep share/locale /snap/iagno/current/usr/share/locale
However, when I try to run the app, I get a warning on the console and the game displays in English:
$ LANG=fr_FR.UTF-8 LANGUAGES=fr_FR:fr iagno (iagno:489): Gtk-WARNING **: Locale not supported by C library. Using the fallback 'C' locale.
Looking into the source, this warning indicates that the C library
setlocale call failed, so when gettext checks the current locale for translation it is still in the C locale.
This seems to be due to the core snap only containing a definition for
C.UTF-8. If I manually compile a French locale and make it available in a location the snap can see it, and run the app again I get a correctly translated UI:
$ localedef -i fr_FR -f UTF-8 ~/snap/iagno/common/fr_FR.UTF-8 $ snap run --shell iagno (inside snap environment) $ export LOCPATH=$SNAP_USER_COMMON $ export LANG=fr_FR.UTF-8 LANGUAGE=fr_FR $ $SNAP/command-iagno.wrapper
To make the app work for all languages, we’d need access to compiled versions of all locales. That presents the question of who should provide them?
To get a feel for the size of this data, the Ubuntu
locales-all package has an installed size of 130 MB, and compressed size of ~ 3.4 MB (which is probably a good measure of the squashfs size increase). It might slim down slightly with the data packaged into a
locale-archive file, but probably not hugely.
That seems like quite a lot to add to each individual snap package that uses the C locale system. We might be able to avoid that for some apps by providing the data in the GNOME platform snap, but there are a lot of snaps that don’t make use of it.
Could this kind of thing be seen as important enough to put in the core snap? Or is it an impetus to start work on creating base snaps?