Running the installer with a non-English locale, the Description column stays
in English, in both the Popular Applications and the Repository tab. This
happens even for applications that are fully translated and whose translated
description is already present on the machine.
Example with LANG=ru_RU.UTF-8 and elisa:
- what the installer shows —
A simple music player aiming to provide a nice experience for its users
- what is on disk, in
/usr/share/swcatalog/xml/extra.xml.gz:
<summary>Play local music and listen to online radio</summary>
<summary xml:lang="ru">Воспроизведение хранящейся локально музыки и прослушивание интернет-радиостанций</summary>
KDE Discover, on the same machine, shows the Russian one.
Where the string comes from
The description is read from the pacman database. MainWindow::processFile()
takes it from the ALPM package view:
https://github.com/cachyos/packageinstaller/blob/0c33b27/src/mainwindow.cpp#L459-L461
if (auto pkg = m_alpm_manager->get_package_view(names[0])) {
description = QString(pkg->desc.data());
}
which is pkg.desc() from libalpm (backend-rustlib/src/pacman_cache.rs:34), and
PacmanCache::refresh_list() fills the repository tab from the same field. So the
string is pkgdesc from the package database.
This is not something a translation can fix: pkgdesc is a single string per
package in PKGBUILD, with no language variants, so there is nowhere for a
translated version to live. grep -ri appstream over the repository only matches
flatpak update --appstream; the AppStream catalogue is never read.
Worth noting the two texts are independent, not a translation of one another —
AppStream says "Play local music and listen to online radio", pkgdesc says
"A simple music player aiming to provide a nice experience for its users".
The data is already there
archlinux-appstream-data installs /usr/share/swcatalog/xml/{core,extra,multilib}.xml.gz,
where each component carries a <pkgname> (the pacman package name) together with a
<summary xml:lang="…"> for every language it has been translated into. libappstream
picks the right language from the current locale by itself. On this machine
appstreamcli status reports 5633 components.
It covers packages that are not installed, which is the case that matters here —
lollypop, ardour, kwave are all absent from this system and all resolve to a
Russian summary.
Measured against the 147 packages currently in pkglist.yaml:
|
|
in pkglist.yaml |
147 |
| present in the AppStream catalogue |
112 |
| have a Russian summary available today |
52 |
A few of them:
| package |
shown now (pkgdesc) |
available (ru summary) |
elisa |
A simple music player aiming to provide a nice experience for its users |
Воспроизведение хранящейся локально музыки и прослушивание интернет-радиостанций |
lollypop |
Music player for GNOME |
Воспроизведение и упорядочивание вашей фонотеки |
ardour |
Professional-grade digital audio workstation |
Цифровая звуковая рабочая станция |
kwave |
A sound editor |
Аудиоредактор |
kdevelop |
C++ IDE using KDE technologies |
Интегрированная среда разработки с широкими функциональными возможностями и поддержкой расширений для C/C++ и других языков программирования |
Russian is only the language I can check; the same catalogue carries the other
languages the installer is already translated into.
Side effect: search does not work in the user's language
findPopular() matches against the Description column, so with English-only
descriptions a Russian user typing музык ("music") gets no results at all,
even though elisa is right there in the list.
How other package front-ends handle it
- pamac loads
/usr/share/swcatalog/xml/<repo>.xml.gz through AppStream.Metadata
(libpamac/src/appstream_plugin.vala:178-182), builds a pkgname_apps_cache
hash table (same file, line 150), and falls back to alpm_pkg.desc whenever the
AppStream summary is missing (libpamac/src/alpm_package.vala:148-164).
- KDE Discover builds a
packageToApp hash the same way
(libdiscover/backends/PackageKitBackend/PackageKitBackend.cpp:407) and also uses
componentsByBundleId(AppStream::Bundle::KindPackage, pkg_name, false)
(same file, line 590).
- GNOME Software queries its libxmlb silo with
components/component[@type='desktop-application']/pkgname[text()='%s']/..
(plugins/core/gs-plugin-appstream.c:1025).
All three keep the pkgdesc as a fallback. None of them set the locale explicitly —
libappstream derives it from the environment.
Suggestion
Read the summary from the AppStream catalogue and keep pkgdesc as the fallback.
AppStreamQt is Qt6 and integrates into the existing CMake setup as an optional
dependency, so builds without it would behave exactly as today.
I have this working locally against develop — roughly 60 lines across
CMakeLists.txt, mainwindow.hpp and mainwindow.cpp. It builds and runs, both
tabs show translated descriptions, and Russian search works. Cost is one pass over
the OS catalogue at start-up, measured at about 75 ms.
Happy to open a PR if that is a direction you would consider.
Related
This is a concrete answer to #12 ("description and package information display should be changed"), which has been open without details since 2024.
Running the installer with a non-English locale, the Description column stays
in English, in both the Popular Applications and the Repository tab. This
happens even for applications that are fully translated and whose translated
description is already present on the machine.
Example with
LANG=ru_RU.UTF-8andelisa:A simple music player aiming to provide a nice experience for its users/usr/share/swcatalog/xml/extra.xml.gz:KDE Discover, on the same machine, shows the Russian one.
Where the string comes from
The description is read from the pacman database.
MainWindow::processFile()takes it from the ALPM package view:
https://github.com/cachyos/packageinstaller/blob/0c33b27/src/mainwindow.cpp#L459-L461
which is
pkg.desc()from libalpm (backend-rustlib/src/pacman_cache.rs:34), andPacmanCache::refresh_list()fills the repository tab from the same field. So thestring is
pkgdescfrom the package database.This is not something a translation can fix:
pkgdescis a single string perpackage in
PKGBUILD, with no language variants, so there is nowhere for atranslated version to live.
grep -ri appstreamover the repository only matchesflatpak update --appstream; the AppStream catalogue is never read.Worth noting the two texts are independent, not a translation of one another —
AppStream says "Play local music and listen to online radio",
pkgdescsays"A simple music player aiming to provide a nice experience for its users".
The data is already there
archlinux-appstream-datainstalls/usr/share/swcatalog/xml/{core,extra,multilib}.xml.gz,where each component carries a
<pkgname>(the pacman package name) together with a<summary xml:lang="…">for every language it has been translated into. libappstreampicks the right language from the current locale by itself. On this machine
appstreamcli statusreports 5633 components.It covers packages that are not installed, which is the case that matters here —
lollypop,ardour,kwaveare all absent from this system and all resolve to aRussian summary.
Measured against the 147 packages currently in
pkglist.yaml:pkglist.yamlA few of them:
pkgdesc)rusummary)elisalollypopardourkwavekdevelopRussian is only the language I can check; the same catalogue carries the other
languages the installer is already translated into.
Side effect: search does not work in the user's language
findPopular()matches against the Description column, so with English-onlydescriptions a Russian user typing
музык("music") gets no results at all,even though
elisais right there in the list.How other package front-ends handle it
/usr/share/swcatalog/xml/<repo>.xml.gzthroughAppStream.Metadata(
libpamac/src/appstream_plugin.vala:178-182), builds apkgname_apps_cachehash table (same file, line 150), and falls back to
alpm_pkg.descwhenever theAppStream summary is missing (
libpamac/src/alpm_package.vala:148-164).packageToApphash the same way(
libdiscover/backends/PackageKitBackend/PackageKitBackend.cpp:407) and also usescomponentsByBundleId(AppStream::Bundle::KindPackage, pkg_name, false)(same file, line 590).
components/component[@type='desktop-application']/pkgname[text()='%s']/..(
plugins/core/gs-plugin-appstream.c:1025).All three keep the
pkgdescas a fallback. None of them set the locale explicitly —libappstream derives it from the environment.
Suggestion
Read the summary from the AppStream catalogue and keep
pkgdescas the fallback.AppStreamQtis Qt6 and integrates into the existing CMake setup as an optionaldependency, so builds without it would behave exactly as today.
I have this working locally against
develop— roughly 60 lines acrossCMakeLists.txt,mainwindow.hppandmainwindow.cpp. It builds and runs, bothtabs show translated descriptions, and Russian search works. Cost is one pass over
the OS catalogue at start-up, measured at about 75 ms.
Happy to open a PR if that is a direction you would consider.
Related
This is a concrete answer to #12 ("description and package information display should be changed"), which has been open without details since 2024.