Repository navigation
i18n: add a language setting - #145
Open
Aceared0829 wants to merge 3 commits into
Open
Aceared0829 wants to merge 3 commits into
Aceared0829 wants to merge 3 commits into
Conversation
Aceared0829
force-pushed
the
i18n/language-setting-develop
branch
2 times, most recently
from
November 27, 2026 01:58
5817646 to
3756143
Compare
The interface strings were already extracted, but there was no way to pick a language. Localization is a small QML singleton that owns the chosen language, the translator and the locale, so the rest of the application only reacts to languageChanged(). It is installed before the engine loads its first string and re-installs the translator at runtime, so a language change needs no restart. "Follow the system" asks Qt for the session's preferred UI languages (QLocale::system().uiLanguages(), which already covers LANGUAGE, LC_ALL, LC_MESSAGES and LANG), takes the first one we ship a catalogue for and falls back to English. LANG is a second hint for the LC_ALL=C case. It is resolved when the application starts, so a language change in the desktop's settings applies at the next start. The settings page lists every catalogue embedded by the build, so a new language needs no UI change. The navigation, the settings rows and the browse categories move from ListModel to plain arrays: qsTr() inside a ListElement is evaluated once, so those labels would never follow a language change.
QT_CONFIG(vulkan) says that Qt was built with Vulkan, not that the application has <vulkan/vulkan.h>. Qt's headers provide dummy typedefs in that case, but QVulkanInstance is not defined, so the probe failed to compile on systems without vulkan-headers, including CI. Use the same __has_include guard as Qt's own QVulkanInstance header, so the app falls back to Qt's default renderer when the headers are missing.
Add the Language and Follow the system strings to every shipped catalogue so the new settings row is translated instead of falling back to English.
Aceared0829
force-pushed
the
i18n/language-setting-develop
branch
from
November 30, 2026 07:58
fce4fc4 to
227bac2
Compare
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.
Summary
This is the same work as #85, rebased onto
developafterfreshwas merged, as requested.#85 targeted
freshand was closed (not merged) once that branch landed indevelop. The three commits have been rebased again onto currentdevelop(5796928). There were no conflicts: the only new upstream commit was a CI runner change (.github/workflows/ci.yml) that does not overlap this PR. An earlier rebase onto2ad88fbhad aREADME.mdconflict (this PR inserts the Translations section wheredevelophad removed the Packaging section in5f83020); that was resolved by keeping the Translations section and not restoring Packaging. The layout table still hassrc/localization.*, and the removedpackaging/row stays gone.Adds a language setting to the settings page. The translation catalogues are already on
develop(including Greek#176, Japanese#187, Spanish#134, Catalan#161, Italian#164, Turkish#139and Portuguese (Portugal)#138); this PR adds the selector, runtime switching, translations for the two new strings, and a small Vulkan build fix that is still useful ondevelop.Localization(src/localization.*) is a QML singleton that owns the chosen language, the application/Qt translators and the defaultQLocale.main.cpponly wireslanguageChangedtoengine.retranslate(), so the setting stays independent of the UI, the look and the backend.QSettings([language] language=) and installed before QML evaluates its first string, then re-installed at runtime — no restart needed.cachyos-pi_<code>.tsfile is enough; no UI change is needed. On currentdevelopthat includesca,de,el,en,es,it,ja,pt_BR,pt_PT,ru,tr_TR,zh_CNandzh_TW.Follow the systemusesQLocale::system().uiLanguages()(which coversLANGUAGE,LC_ALL,LC_MESSAGESandLANG), takes the first embedded catalogue it matches and falls back to English.LANGis a second hint for theLC_ALL=Ccase. Exact regional catalogues such aspt_BRare preferred, then the base language such asde.Flow, so the pills wrap instead of being clipped at the 760 px minimum window width.ListModelto plain arrays:qsTr()inside aListElementis evaluated once, so those labels never followed a language change.Vulkan compile fix
The second commit is the same
__has_includeguard as in #85:QT_CONFIG(vulkan)means Qt was built with Vulkan, not that<vulkan/vulkan.h>is present. CI now installsvulkan-headers(#163), so the official workflow can compile the Vulkan probe. The guard is still useful when building locally without those headers: the app then falls back to Qt's default renderer, instead of failing to compile. It rebases cleanly onto the GNOME session skip (03b086b); both checks remain inselectBackend().Notes
develop(5796928). No conflict resolution was required for this rebase;CMakeLists.txtandsrc/graphics.cppwere unaffected.I18N_TRANSLATED_LANGUAGESis not touched;developalready globsi18n/cachyos-pi_*.tsand embeds them.src/localization.hpp/src/localization.cppstay inqt_add_executable; they are needed to compile and register the QML singleton.Language,Follow the system) are translated in every shipped catalogue in227bac2.Testing
desktop-file-validateandappstreamcli validate --no-netpass on this branch (those files are unchanged by this PR).Build and teston this head (227bac2) passed: configure, build, and100% tests passed out of 17.