Skip to content

Add i18n support and translations (ko, ja, zh_CN, zh_TW)#1511

Open
NEWBIE0413 wants to merge 4 commits into
caelestia-dots:mainfrom
NEWBIE0413:feat/i18n-korean
Open

Add i18n support and translations (ko, ja, zh_CN, zh_TW)#1511
NEWBIE0413 wants to merge 4 commits into
caelestia-dots:mainfrom
NEWBIE0413:feat/i18n-korean

Conversation

@NEWBIE0413

@NEWBIE0413 NEWBIE0413 commented Jun 4, 2026

Copy link
Copy Markdown

Summary

The shell already wraps user-facing strings in qsTr(), but there was no
mechanism to actually load translations — QuickShell drives the shell with a
bare QQmlEngine and never installs a QTranslator, so qsTr() strings always
rendered in English regardless of locale, and there were no translation files.

This PR adds the missing i18n infrastructure plus initial translations.

Infrastructure (language-agnostic)

  • TranslationLoader installs a QTranslator for the current system locale,
    searching the per-user data dir (~/.local/share/caelestia/translations) then
    the system install dir.
  • A custom QQmlEngineExtensionPlugin for Caelestia.Internal overrides
    initializeEngine() to load translations at startup (then retranslate()).
  • CMake compiles translations/*.ts.qm via lrelease and installs them
    where the loader looks. qml_module gains an optional PLUGIN_SOURCE arg so a
    module can supply a hand-written plugin entry point.
  • A few previously-hardcoded UI strings (weather tab, lyric menu, keyboard-layout
    tooltip) are now wrapped in qsTr().

Graceful no-op when no matching .qm exists — untranslated locales keep the
English source strings. Adding a language is just dropping in
translations/caelestia_<locale>.ts.

Translations (638 strings each)

  • Korean (ko) — reviewed by a native speaker.
  • Japanese (ja), Simplified Chinese (zh_CN), Traditional Chinese (zh_TW)
    — 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

  • Clean full build (extras;plugin;shell) succeeds; all four caelestia_*.qm are produced.
  • Placeholder integrity checked across all 4 files (0 mismatches, 0 unfinished, 0 empty).
  • Isolated run (qs -p) loads the matching .qm for the system locale (verified ko + ja),
    reaches Configuration Loaded, no crash.
  • Non-translated locale (e.g. en_US) logs a graceful fallback to source strings.
  • All .ts compile cleanly with lrelease (638 finished, 0 unfinished each).

@NEWBIE0413 NEWBIE0413 changed the title Add i18n support and Korean translation Add i18n support and translations (ko, ja, zh_CN, zh_TW) Jun 4, 2026
@hdcy

hdcy commented Jun 12, 2026

Copy link
Copy Markdown

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.
- 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.
@NEWBIE0413

Copy link
Copy Markdown
Author

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 main (it had moved quite a bit) and fixed the CI failures — the branch is now mergeable and checks are re-running.

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 .ts file.

@MiguxJS

MiguxJS commented Jun 20, 2026

Copy link
Copy Markdown

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. 😄

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.

3 participants