dh_translations should handle AppStream metadata also

Bug #1763471 reported by Jeremy Bícha
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pkgbinarymangler (Ubuntu)
New
Wishlist
Unassigned

Bug Description

I had to add AppStream metadata to software-properties and update-manager so that we could mark these two packages as unremovable in the Ubuntu/GNOME Software app.

AppStream metadata is translatable but I suspect that we don't really have a system for the Launchpad translations to be made available to Ubuntu users.

The metadata are .xml files stored in /usr/share/metainfo/ (or the legacy /usr/share/appdata/ )

Tags: bionic
Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

I added the Swedish translation of "Software & Updates" to software-properties.mo manually.

$ echo $(gettext -d software-properties 'Software & Updates')
Program & uppdateringar

The name of the app is still shown in English for me in Ubuntu Software. Also tried to replace <name> in /usr/share/metainfo/software-properties-gtk.appdata.xml with <name gettext-domain "software-properties">, as is done in .policy files, but it didn't help.

Do we have the mechanism in place to make use of .mo files at runtime to translate strings in such files?

Revision history for this message
Jeremy Bícha (jbicha) wrote :

This gets a bit complicated.

I think the strings for the packages and descriptions in GNOME Software comes from the DEP-11 metadata you see when you run sudo apt update.

That metadata is generated from the packages that have been uploaded to Ubuntu. As far as I know, you can't currently test metadata updates with a PPA.

See also http://appstream.ubuntu.com/

Revision history for this message
Jeremy Bícha (jbicha) wrote :

Hmm, the summary field for /usr/share/metainfo/software-properties-gtk.appdata.xml is translated into Swedish (and shows up in GNOME Software that way; you might need to restart GNOME Software for changes to be recognized). It's already translated because I reused the string from the .desktop for it and there are .po files in the package (but they are ancient!).

I don't know why the Name field isn't similar translated.

So we can manually import the .po files for these packages to the package itself to get translations but it would be nice if we could use language packs instead since we haven't really been manually importing translations recently and it's easy to forget to do even if we started doing it.

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

So the info in the appdata file is passed to DEP-11, Ubuntu Software fetches already localized strings from the latter, and there is a time factor. Did I get that (approximately) right?

That would explain why all my efforts to make Ubuntu Software show something different when running under a Swedish locale failed. The summary is shown in Swedish for me too, but the name and description are in English. That does not change whatever I do to manipulate software-properties.mo and/or /usr/share/metainfo/software-properties-gtk.appdata.xml. (I even edited the English description, and that didn't make a difference either.)

But if that is how it works, is it at all possible to apply translations from .mo files at runtime?

What you want to achieve sounds highly desirable to me. But it would be nice if we could confirm somehow that it will work without inline translations before we let dh_translations strip them.

Jeremy Bícha (jbicha)
Changed in pkgbinarymangler (Ubuntu):
importance: Undecided → Wishlist
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.