I have a GTK4/Rust app and my translation .mo files are not ending up inside the Flatpak bundle at /app/share/locale, which means the app fails to get localized. This is my first GNOME app and my first time trying to add i18n support, so I’m probably missing something obvious, so apologies in advance if the solution here is obvious!
When I run:
flatpak run --command=sh net.trowell.typesetter -c "find /app/share/locale -name '*.mo'"
I only see libspelling’s .mo file, not my app’s.
However, when I do a local build and install with DESTDIR=/tmp/test meson install -C _build, the files install correctly:
Thanks for this! I found an .mo file at /app/share/runtime/locale/fr/share/fr/LC_MESSAGES/typesetter.mo (there should be others; I assume Flathub only installs the locale(s) used by the system?). However, my app isn’t actually displaying the translated strings, defaulting to the base English.
For context, my setup:
LOCALEDIR in my app is hardcoded to /app/share/locale (set by Meson at build time via get_option('prefix') / get_option('localedir'))
po/meson.build is just i18n.gettext('typesetter', preset: 'glib')
A local DESTDIR install puts the files in the correct structure: share/locale/fr/LC_MESSAGES/typesetter.mo
In main.rs I call bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR) where GETTEXT_PACKAGE is "typesetter" and LOCALEDIR is /app/share/locale
Am I setting the wrong LOCALEDIR path? Is there something specific I need to do in my Flatpak manifest or my Meson setup to get the translations installed to the right path? The app repo is at haydn/typesetter: Minimalist Typst editor - Codeberg.org if that helps.
The flatpak you are testing is the Flathub stable version or a locally built version?
I’m a user of Typesetter (thanks btw for the nice app!) and I may contribute the Italian translation when I have some spare time. It could be a chance to test if it works for me.
I’ve started translating Typesetter into Italian in the git repository (not Weblate) and I’ve modified the manifest to build the flatpak from my local branch. Everything works fine here: the interface is Italian.
The mo files are in /app/share/locale, maybe because it’s a local flatpak build?
Thanks for your help on this! I managed to get it working by adding "separate-locales": false to the manifest, which puts the .mo files into /app/share/locale directly rather than the runtime locale path. It’s possible the issue was with my test environment rather than the manifest itself, but at least this approach definitely works.
I’d love an Italian translation when you get the chance! Feel free to contribute via Weblate or a PR on Codeberg, whichever you prefer!