With @zyga-snapd’s work on adding desktop notifications for cases where pending refreshes are blocked by running apps, the issue of localisation becomes a even more important, since these will be visible to non technical users.
While snapd has made some effort towards localisation via Launchpad, there are a few important gaps:
- The translation template uploaded to Launchpad was generated in April 2018. Any strings added since then are not being translated. The templates for the Ubuntu packages are more up to date, and getting close to twice the size.
- The in-tree translations were last synchronised from LP in November 2019.
- The snapd build process does not install translations. Translations are distributed through Ubuntu’s language packs, but that doesn’t help anyone on other distributions.
- We extract strings from the polkit
.actionsfile, but do not merge them back in.
- We don’t extract or merge strings from
And some minor issues:
- The translation domain is called
snappy, which is a deprecated name for the project.
- The template generated by
update-potdoes not contain file name information, which would be useful to translators looking for context.
snapditself generates translations. It’s not uncommon for it to be running with different locale settings to the user, which could result in the wrong language being displayed to the user in some cases.
Here are some ideas about how we could improve matters:
Import templates to Launchpad
It looks like the only automated translation import process LP supports right now is to extract templates from the default Bazaar branch of a project. Currently the default branch is set to a Git mirror of our Github branch, and I’m not sure how much relies on that being set as default.
If we could change it, or if it was possible to concurrently set a default Git and Bazaar branches, one option would be to create a bzr branch containing only translation template. We could then have a Github Actions workflow that triggered on pushes to snapd master that would run
update-pot and commit the resulting template to the Bazzar branch on LP.
Exporting translations from Launchpad
It is possible to configure Launchpad to automatically commit translation updates to a Bazaar branch. We could configure a second Bazaar branch to receive translations from Launchpad, and then have a scheduled Github Actions workflow to check out the Bazaar branch and update the translations in Git. This could either directly commit to master (risky), or generate pull requests (e.g. using
update-pot script currently builds the in-tree translations. It shouldn’t be difficult to have it (or a related script) install them too. In the specific case of Ubuntu packages, the translations should be stripped out of the
.deb packages. We probably want them included for all other distros.
We probably want translations included in the snapd and core snaps.
Translations in polkit and desktop files
msgfmt utility can merge translations into XML and desktop files. We’d just need to integrate the appropriate calls into the Makefiles. Of course, this relies on having up to date translations in tree.