Add i18n support and translations (ko, ja, zh_CN, zh_TW)#1511
Add i18n support and translations (ko, ja, zh_CN, zh_TW)#1511NEWBIE0413 wants to merge 4 commits into
Conversation
|
Really excited to see this! Native i18n support would be a huge improvement — especially for Chinese users who'd love to get proper translations without relying on external scripts. Looking forward to seeing this land. Thanks for the great work! |
QuickShell drives the shell with a bare QQmlEngine and never installs a QTranslator, so qsTr() strings always rendered in English regardless of locale. This adds the missing piece: - TranslationLoader: installs a QTranslator for the system locale, searching the per-user data dir then the system install dir. - A custom QQmlEngineExtensionPlugin for Caelestia.Internal overriding initializeEngine() to load translations at startup. - CMake: compile translations/*.ts to .qm via lrelease and install them where the loader looks; qml_module gains an optional PLUGIN_SOURCE arg. - Wrap previously-hardcoded UI strings (weather, lyrics, kb layout) in qsTr() so they become translatable. The infrastructure is language-agnostic and a graceful no-op when no matching .qm exists.
Translates 638 strings across the shell (bar, dashboard, network/VPN/ bluetooth settings, launcher, lock screen, weather, audio).
Machine-translated drafts covering all 638 strings; community review by native speakers is welcome to refine wording. The i18n infrastructure loads each automatically based on system locale.
b4f2e06 to
7c4e941
Compare
- Format translationloader.cpp per project .clang-format. - Make LinguistTools optional (QUIET) guarded by 'if(TARGET Qt6::lrelease)'; the CI arch-env image lacks it and REQUIRED broke configure. - Store translationDirs() result in a const local to avoid clazy range-loop-detach on the QStringList.
|
Thank you! As a Korean user myself, I'd love to see this PR land too 🙂 Quick status update: I've just rebased onto the latest On the translations: Korean (ko) is reviewed by me as a native speaker, while Japanese and both Chinese variants (zh_CN, zh_TW) are machine-translated drafts — native-speaker review is very welcome to refine the wording. The infrastructure itself is language-agnostic, so adding more languages is just dropping in another |
7c4e941 to
626fdc9
Compare
|
Hi! I'm really excited about this i18n infrastructure. I'd love to contribute by creating and maintaining the official Spanish (es) translation for the shell once this lands! Let me know if I can start working on it. 😄 |
Summary
The shell already wraps user-facing strings in
qsTr(), but there was nomechanism to actually load translations — QuickShell drives the shell with a
bare
QQmlEngineand never installs aQTranslator, soqsTr()strings alwaysrendered in English regardless of locale, and there were no translation files.
This PR adds the missing i18n infrastructure plus initial translations.
Infrastructure (language-agnostic)
TranslationLoaderinstalls aQTranslatorfor the current system locale,searching the per-user data dir (
~/.local/share/caelestia/translations) thenthe system install dir.
QQmlEngineExtensionPluginforCaelestia.InternaloverridesinitializeEngine()to load translations at startup (thenretranslate()).translations/*.ts→.qmvialreleaseand installs themwhere the loader looks.
qml_modulegains an optionalPLUGIN_SOURCEarg so amodule can supply a hand-written plugin entry point.
tooltip) are now wrapped in
qsTr().Graceful no-op when no matching
.qmexists — untranslated locales keep theEnglish source strings. Adding a language is just dropping in
translations/caelestia_<locale>.ts.Translations (638 strings each)
— machine-translated drafts. Community review by native speakers is very
welcome to refine wording; these are functional but not yet natively proofread.
Maintainers: if you'd prefer to merge only the reviewed Korean + infrastructure
and take the other languages separately (or wait for native review), happy to
split — just let me know.
Test Plan
extras;plugin;shell) succeeds; all fourcaelestia_*.qmare produced.qs -p) loads the matching.qmfor the system locale (verified ko + ja),reaches
Configuration Loaded, no crash.en_US) logs a graceful fallback to source strings..tscompile cleanly withlrelease(638 finished, 0 unfinished each).