appstream-glib
appstream-glib copied to clipboard
Maintain localised elements
More flatpaks are starting to include appdata files with localised elements, which is great. However these tags do not seem to be preserved in the final appstream file.
The endless photos page has multiple screenshots that lose their locale tags when processed and the same for gimp's localised release notes. These tickets are also being tracked at: https://github.com/flathub/linux-store-frontend/issues/121#issuecomment-396471570
How is flatpak-builder merging the appdata files?
That is a fascinating question. @alexlarsson is the person who did this I believe.
Its using the FlatpakXml stuff which is a GMarkup helper.
So, the original eos-photos appdata have localized screenshots:
<screenshots>
<screenshot>
<image type="source" xml:lang="es">https://raw.githubusercontent.com/endlessm/eos-photos/master/data/assets/screenshot1-es.png</image>
<image type="source" xml:lang="pt">https://raw.githubusercontent.com/endlessm/eos-photos/master/data/assets/screenshot1-pt.png</image>
<image type="source">https://raw.githubusercontent.com/endlessm/eos-photos/master/data/assets/screenshot1-C.png</image>
</screenshot>
...
And it has other localized things too:
<name>Photo Editor</name>
<name xml:lang="ar">محرر الصور</name>
<name xml:lang="bn">ফটো সম্পাদনা</name>
<name xml:lang="de">Foto-Editor</name>
...
Looking at the flathub appstream the name is still localized, so we're not losing all the i18n. However, the screenshot part is completely different:
<screenshot type="default">
<image type="source">https://raw.githubusercontent.com/endlessm/eos-photos/master/data/assets/screenshot1-es.png</image>
<image type="thumbnail" height="351" width="624">https://flathub.org/repo/screenshots/com.endlessm.photos-stable/624x351/com.en
dlessm.photos-4ba1969595153deb52d30027a2287df5.png</image>
<image type="thumbnail" height="702" width="1248">https://flathub.org/repo/screenshots/com.endlessm.photos-stable/1248x702/com.
endlessm.photos-4ba1969595153deb52d30027a2287df5.png</image>
<image type="thumbnail" height="63" width="112">https://flathub.org/repo/screenshots/com.endlessm.photos-stable/112x63/com.endl
essm.photos-4ba1969595153deb52d30027a2287df5.png</image>
<image type="thumbnail" height="126" width="224">https://flathub.org/repo/screenshots/com.endlessm.photos-stable/224x126/com.en
dlessm.photos-4ba1969595153deb52d30027a2287df5.png</image>
<image type="thumbnail" height="423" width="752">https://flathub.org/repo/screenshots/com.endlessm.photos-stable/752x423/com.en
dlessm.photos-4ba1969595153deb52d30027a2287df5.png</image>
<image type="thumbnail" height="846" width="1504">https://flathub.org/repo/screenshots/com.endlessm.photos-stable/1504x846/com.
endlessm.photos-4ba1969595153deb52d30027a2287df5.png</image>
</screenshot>
<screenshot>
<image type="source">https://raw.githubusercontent.com/endlessm/eos-photos/master/data/assets/screenshot1-pt.png</image>
<image type="thumbnail" height="351" width="624">https://flathub.org/repo/screenshots/com.endlessm.photos-stable/624x351/com.en
dlessm.photos-dda0971ebb1786bf54f7a5cf26940153.png</image>
<image type="thumbnail" height="702" width="1248">https://flathub.org/repo/screenshots/com.endlessm.photos-stable/1248x702/com.
endlessm.photos-dda0971ebb1786bf54f7a5cf26940153.png</image>
<image type="thumbnail" height="63" width="112">https://flathub.org/repo/screenshots/com.endlessm.photos-stable/112x63/com.endl
essm.photos-dda0971ebb1786bf54f7a5cf26940153.png</image>
<image type="thumbnail" height="126" width="224">https://flathub.org/repo/screenshots/com.endlessm.photos-stable/224x126/com.en
dlessm.photos-dda0971ebb1786bf54f7a5cf26940153.png</image>
<image type="thumbnail" height="423" width="752">https://flathub.org/repo/screenshots/com.endlessm.photos-stable/752x423/com.en
dlessm.photos-dda0971ebb1786bf54f7a5cf26940153.png</image>
<image type="thumbnail" height="846" width="1504">https://flathub.org/repo/screenshots/com.endlessm.photos-stable/1504x846/com.
endlessm.photos-dda0971ebb1786bf54f7a5cf26940153.png</image>
</screenshot>
<screenshot>
<image type="source">https://raw.githubusercontent.com/endlessm/eos-photos/master/data/assets/screenshot1-C.png</image>
<image type="thumbnail" height="351" width="624">https://flathub.org/repo/screenshots/com.endlessm.photos-stable/624x351/com.en
dlessm.photos-f95b90b3f2b326a6ff039e4494852ab3.png</image>
<image type="thumbnail" height="702" width="1248">https://flathub.org/repo/screenshots/com.endlessm.photos-stable/1248x702/com.endlessm.photos-f95b90b3f2b326a6ff039e4494852ab3.png</image>
<image type="thumbnail" height="63" width="112">https://flathub.org/repo/screenshots/com.endlessm.photos-stable/112x63/com.endlessm.photos-f95b90b3f2b326a6ff039e4494852ab3.png</image>
<image type="thumbnail" height="126" width="224">https://flathub.org/repo/screenshots/com.endlessm.photos-stable/224x126/com.endlessm.photos-f95b90b3f2b326a6ff039e4494852ab3.png</image>
<image type="thumbnail" height="423" width="752">https://flathub.org/repo/screenshots/com.endlessm.photos-stable/752x423/com.endlessm.photos-f95b90b3f2b326a6ff039e4494852ab3.png</image>
<image type="thumbnail" height="846" width="1504">https://flathub.org/repo/screenshots/com.endlessm.photos-stable/1504x846/com.endlessm.photos-f95b90b3f2b326a6ff039e4494852ab3.png</image>
</screenshot>
...
I.e. a screenshot with several images (one per language) have been converted to multiple screenshots each with multiple images which are thumbnailed versions of the per-language image.
I believe this is happening because flathub uses flatpak-builder '--mirror-screenshots-url=URL which launches: appstream-util mirror-screenshots on the xml.
Possible issues are either, mirror-screenshots still being broken, or the old version of it on the flathub builders not having the fix for this.
Aha, mirror screenshots is indeed doing something dumb.