AppData and the gettext locale

Richard Hughes hughsient at gmail.com
Mon Jan 25 21:57:33 CET 2016


tl;dr: Please add <translation
type="gettext">your_gettext_domain_here</translation> to your AppData
files.

Longer version:

When users are searching for software it is very important to answer
the the question "Is this localized in my language?" The way we
calculate this in the AppStream builder is to look at the compiled .mo
files, breaking them apart and then using statistics to work out what
locales are included.

When we're processing distro packages we usually extract them one at a
time. We first try for a gettext domain (the .mo file name) of the
distro package name, and if that's not found then we just try and find
the first .mo file in any of the locale directories. This works about
70% of the time. For xdg-app we build the application in a special
prefix, along with any dependent libraries. We don't have a distro
package name for the bundle (only the application ID) and so the
"first .mo file we can find" heuristic fails more often that it works.
We clearly need some more information about the gettext domain from
the upstream project.

AppData to the rescue. By adding this in the AppData file informs the
AppStream generation code in the xdg-app builder what gettext domain
to use for an application. To use this you just need to add:

<translation type="gettext">the_gettext_domain_here</translation>

under the <component> tag. The gettext domain is normally set in the
configure.ac file with the GETTEXT_PACKAGE define for GNOME projects,
but I'm not terribly familiar with typical XFCE projects. If you don't
have this extra data in your application then `appstream-util
validate` is soon going to fail, and your application isn't going to
get the language metadata and so will be lower in the search results
for users using software centers in a non-C locale.
Although it seems I'm asking people to do more things again and again
I can assure you that slowly we're putting the foundations in place
for an awesome software installer experience shared between GNOME, KDE
and XFCE.

I'm happy to help if anyone has any questions, thanks.

Richard


More information about the Xfce4-dev mailing list