CachyOS / CachyOS/packageinstaller

Descriptions are always English even when a translation is available on the system

Open
#62 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
23
Forks
30
PR merge metrics
No merged PRs in 30d

Description

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`:

```xml
Play local music and listen to online radio
Воспроизведение хранящейся локально музыки и прослушивание интернет-радиостанций
```

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

```cpp
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 `` (the pacman package name) together with a
`` 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/.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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with MainWindow::processFile() in src/mainwindow.cpp, findPopular(), PacmanCache::refresh_list(), and the dependency setup in CMakeLists.txt; the related declarations are in mainwindow.hpp. Review how pkg.desc() currently supplies descriptions, then verify that both tabs use the locale-aware catalogue when available, fall back to pkgdesc when it is not, and allow searches such as Russian “музык”.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp
Domain
desktop, internationalization, search
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.