AppStream::Pool pool;
pool.load();
AppStream::Component c = pool.componentsById("org.kde.krita.desktop").first();
qDebug() << c.description();
Gets the description (of Krita, in this case) in whatever the default language is; setting the environment variable LANGUAGE to fr, for instance, gets the French description.
There doesn't seem to be a way to get the description for any other language, though: setActiveLocale() on the component doesn't change the text that is returned. Calling it on the pool before load does load the other language -- but only that one.
So how does one get the description of a component, in all the languages for which a description is available for that component?
(something similar might be said about appstreamcli dump .. it only dumps the name and description in the current language, not all of them)
The text was updated successfully, but these errors were encountered:
This is possible: as_pool_set_locale (pool, "ALL") or pool.setLocale(QStringLiteral("ALL")) for the Qt version.
Please be aware though that as soon as you load all locale, you loose access to the system metadata cache and you will also actually load all locale into memory. The first thing means a slower pool loading speed, and the second one will mean a slight increase in memory consumption (should not be as notable as before though, due to unconditional caching).
So, depending on what you need, watching for system locale changes and reloading the pool then may be a batter plan. If you want all locale for e.g. further analysis, QA, or any other purpose, then using "ALL" is the way to go.
The following code (with appstream-qt):
Gets the description (of Krita, in this case) in whatever the default language is; setting the environment variable
LANGUAGEto fr, for instance, gets the French description.There doesn't seem to be a way to get the description for any other language, though:
setActiveLocale()on the component doesn't change the text that is returned. Calling it on the pool before load does load the other language -- but only that one.So how does one get the description of a component, in all the languages for which a description is available for that component?
(something similar might be said about
appstreamcli dump.. it only dumps the name and description in the current language, not all of them)The text was updated successfully, but these errors were encountered: