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

未关闭
#62 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

@wehrwolfmann 已经在做这个了。

开始于 2026年8月8日。

  • #63 来自 @wehrwolfmann —— 未关闭
  • #64 来自 @wehrwolfmann —— 未关闭

评估

难度
4/5
预计耗时
3-5 天
新手友好度
58/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
冷清
技术栈
cmake, cpp

调研方向

从 src/mainwindow.cpp 中的 MainWindow::processFile()、findPopular()、PacmanCache::refresh_list() 以及 CMakeLists.txt 中的依赖设置开始;相关声明位于 mainwindow.hpp。检查 pkg.desc() 当前如何提供描述,然后验证两个选项卡在 locale-aware catalogue 可用时都使用它,在不可用时回退到 pkgdesc,并支持俄语“музык”这样的搜索。

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
C++
星标
26
派生
31
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

CachyOS/packageinstaller 的其他 Issue

查看 CachyOS/packageinstaller 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。