Skip to content

i18n: make package category names translatable, add Russian translation - #65

Open
wehrwolfmann wants to merge 2 commits into
CachyOS:developfrom
wehrwolfmann:i18n-translatable-categories
Open

i18n: make package category names translatable, add Russian translation#65
wehrwolfmann wants to merge 2 commits into
CachyOS:developfrom
wehrwolfmann:i18n-translatable-categories

Conversation

@wehrwolfmann

Copy link
Copy Markdown

What is broken

Everything in the Popular Applications tab is translated except the thing the
user reads first: the category names. Even with a fully translated locale the
tree still shows Audio, Browsers, Communication, Development, Games,
Graphics, Hardware Tools, Internet, Mail, Multimedia, Office,
Other, Video, Virtualization in English.

The reason is that those names are not string literals in the source. They are
data: they come from pkglist.yaml, are carried through processMap() /
MainWindow::processFile() and end up in the tree verbatim via
QString::fromStdString(category). lupdate never sees them, so they are
absent from all 18 .ts catalogs and no translator could have fixed this.

The same applies to group names (subgroups in the yaml), which are shown as
the top-level tree items.

What this change does

  • src/mainwindow.cpp: adds a small translate_category() helper and runs the
    category and group names through it in MainWindow::displayPopularApps(), at
    the point where they are put into the tree.
  • The names are translated in a dedicated "Category" context, so they stay
    separate from the UI strings in MainWindow and translators immediately see
    what they are.
  • Because fetch_net_pkglist() downloads pkglist.yaml from the repository at
    runtime, the names cannot be marked up at the data source — the file that
    ships in /usr/lib/cachyos-pi/pkglist.yaml is not necessarily the file that
    is displayed. So the currently known names are listed once in the source with
    QT_TRANSLATE_NOOP purely so that lupdate can extract them.
  • A name that has no translation — for example a category added to the remote
    pkglist.yaml after a release — is returned unchanged by
    QCoreApplication::translate() and is displayed exactly as before. Nothing
    can disappear from the tree.
  • Grouping and lookup are unaffected: displayPopularApps() is the only place
    that uses the category/group fields, and both the "find existing top-level
    item" and the "create it" paths now see the same translated string.
    Install/uninstall logic keys off the package name, not the category.

The code change is language-neutral: it opens the categories to all 18 existing
translations at once. Only lang/cachyos-packageinstaller_ru.ts is filled in
here (lupdate was run for it); the other catalogs pick the new strings up the
next time lupdate is run and their maintainers can translate them.

Testing

Built with ./configure.sh && ./build.sh (Qt 6, gcc) and run with
LANG=ru_RU.UTF-8. All 14 categories, including Hardware Tools which comes
from the network-fetched pkglist.yaml rather than the installed one, are
shown translated, and the tree is sorted correctly with the translated names.
Running with LANG=C shows the previous English behaviour unchanged.


Wehrwolfmann added 2 commits August 9, 2026 16:59
Category and group names shown in the popular apps tree are read from
pkglist.yaml and were put into the tree verbatim, so they stayed English
in every locale even though the rest of the UI was translated.

Translate them on display through the "Category" context. The pkglist is
also fetched from the network at runtime, so the names cannot be marked
up at the data source: the known ones are listed with QT_TRANSLATE_NOOP
for lupdate to extract, and any name without a translation is displayed
unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant