i18n: make package category names translatable, add Russian translation - #65
Open
wehrwolfmann wants to merge 2 commits into
Open
i18n: make package category names translatable, add Russian translation#65wehrwolfmann wants to merge 2 commits into
wehrwolfmann wants to merge 2 commits into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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,Virtualizationin English.The reason is that those names are not string literals in the source. They are
data: they come from
pkglist.yaml, are carried throughprocessMap()/MainWindow::processFile()and end up in the tree verbatim viaQString::fromStdString(category).lupdatenever sees them, so they areabsent from all 18
.tscatalogs and no translator could have fixed this.The same applies to group names (
subgroupsin the yaml), which are shown asthe top-level tree items.
What this change does
src/mainwindow.cpp: adds a smalltranslate_category()helper and runs thecategory and group names through it in
MainWindow::displayPopularApps(), atthe point where they are put into the tree.
"Category"context, so they stayseparate from the UI strings in
MainWindowand translators immediately seewhat they are.
fetch_net_pkglist()downloadspkglist.yamlfrom the repository atruntime, the names cannot be marked up at the data source — the file that
ships in
/usr/lib/cachyos-pi/pkglist.yamlis not necessarily the file thatis displayed. So the currently known names are listed once in the source with
QT_TRANSLATE_NOOPpurely so thatlupdatecan extract them.pkglist.yamlafter a release — is returned unchanged byQCoreApplication::translate()and is displayed exactly as before. Nothingcan disappear from the tree.
displayPopularApps()is the only placethat 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.tsis filled inhere (
lupdatewas run for it); the other catalogs pick the new strings up thenext time
lupdateis run and their maintainers can translate them.Testing
Built with
./configure.sh && ./build.sh(Qt 6, gcc) and run withLANG=ru_RU.UTF-8. All 14 categories, includingHardware Toolswhich comesfrom the network-fetched
pkglist.yamlrather than the installed one, areshown translated, and the tree is sorted correctly with the translated names.
Running with
LANG=Cshows the previous English behaviour unchanged.