Localisation of snaps

I hate to bring this up again, but I’m still unable to get any sort of localisation to work on the snaps that I publish. Has anybody actually got a snap that correctly localises to non-English locales? I have confirmed that the translation files are present in the snap but they fail to be picked-up by libc/gettext. Running locale -a inside the snap, through the desktop-launch wrapper reports:

$ desktop-launch locale -a
ln: failed to create symbolic link '/home/dllewellyn/snap/gimp/61/.config/gtk-2.0/gtkfilechooser.ini': File exists
C
C.UTF-8
POSIX

And running gimp, as an example, with LANG set to fr_FR I get:

$ env LANG=fr gimp
ln: failed to create symbolic link '/home/dllewellyn/snap/gimp/61/.config/gtk-2.0/gtkfilechooser.ini': File exists

(gimp:30076): Gtk-WARNING **: 21:05:06.204: Locale not supported by C library.
	Using the fallback 'C' locale.
Gtk-Message: 21:05:06.406: Failed to load module "gail"
Gtk-Message: 21:05:06.406: Failed to load module "atk-bridge"
/snap/gimp/61/usr/bin/gimp: Gimp-Widgets-WARNING: parse_iso_codes: error parsing '/build/gimp/parts/gimp/install/usr/share/xml/iso-codes/iso_639.xml': No such file or directory

I also tested Gnome Calculator on Ubuntu 18.10 and that is also not localised in any way when run with LANG=fr_FR gnome-calculator.

3 Likes

Hey Daniel,

I just tested the gimp and gnome-calculator snaps on my 18.10 system (French is my default locale), and both are correctly localised.

I wonder why this is not working for you. Note that running $SNAP/bin/desktop-launch locale -a inside the gimp snap gets me the same output as you shared, so this is not an issue.

1 Like

Although it shouldn’t be a problem for any graphical applications using the desktop-launch launcher, I’ve implemented a launcher to fix-up I18N for CLI apps: Lack of compiled locales breaks gettext based localisation

Demo: GNU Hello (again, for snapcrafters)

The executable is searching for the wrong location of iso-639 data, not sure if it’s related but I’ve worked on something similar to this:

odd. it only translates when I change my gnome language, which requires restarting my session. it doesn’t work when starting GIMP with English set in my gnome session, but exporting LANG=fr_FR for example.

Odd indeed. I ran LANG=de_DE snap run gimp in my French session, and gimp was correctly localized in German.

1 Like