Skip to content

Add i18n support to KWin KCM: translate all strings, add translation infrastructure#169

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/make-kcm-app-i18n-capable
Draft

Add i18n support to KWin KCM: translate all strings, add translation infrastructure#169
Copilot wants to merge 3 commits intomainfrom
copilot/make-kcm-app-i18n-capable

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 27, 2026

The KCM app had no i18n support — strings were a mix of bare QStringLiteral, Qt's tr(), and KDE's i18n(), with no translation catalog, no tooling, and no translator workflow.

C++ source fixes

  • Set KDE i18n domainKLocalizedString::setApplicationDomain("breezy_desktop_kwin") added at the top of the constructor, before setupUi(), so UI strings rendered by ki18n_wrap_ui use the correct catalog
  • Convert all tr()i18n() — 38 call sites: QObject::tr(), BreezyDesktopEffectConfig::tr(), and bare tr() in lambdas; .arg() chains rewritten as i18n("…%1", arg)
  • Wrap missing strings"%1 %2 connected", "No device connected", and the version label were bare QStringLiteral with no i18n at all

shortcuts.h — shortcut action labels

Changed actionText from QString to const char*, wrapped values with I18N_NOOP() for extraction, and call site uses i18n(shortcut.actionText):

// shortcuts.h
const char *actionText = I18N_NOOP("Toggle XR Effect");

// breezydesktopeffectkcm.cpp
action->setText(i18n(shortcut.actionText));

UI files — notr="true" for dynamic placeholders

Strings that C++ immediately overwrites at runtime don't belong in the catalog. Added notr="true" to:

  • Version label in breezydesktopeffectkcm.ui (overridden in constructor)
  • comboAddVirtualDisplay items 1080p, 1440p, Add custom… (combo is cleared and repopulated by populateResolutionCombo)
  • Numeric labels 1920/1080 in customresolutiondialog.ui (set by slider valueChanged)
  • ID/WxH placeholders in virtualdisplayrow.ui (overwritten by setInfo())

Translation infrastructure

Mirrors the structure used by the Python/GTK UI:

File Purpose
kwin/po/LINGUAS Same 12 languages as the Python UI
kwin/po/breezy_desktop_kwin.pot POT template, ~80 strings with translator comments
kwin/po/<lang>/breezy_desktop_kwin.po Stub PO files, all msgid populated, msgstr pre-filled where translations already exist in the Python/GTK UI
kwin/bin/update_pot_files Dev script: extractrcxgettextmsgmergemsgfmt
kwin/TRANSLATING.md Workflow docs for translators and maintainers

The dev script uses extractrc (from kdesdk-scripts) to convert Qt Designer .ui files into extractable C++ before running xgettext with full KDE keyword flags. Compiled .mo files are excluded from git (kwin/po/*/LC_MESSAGES/ in .gitignore) — ki18n_install(po) in CMake handles compilation at build time.

TRANSLATING.md covers: how to translate a .po file, how to add a new language, what to do after adding strings, and the do/don't for string marking in C++ and .ui files.

Pre-filled translations from the Python/GTK UI

20 strings are identical between the KCM and the Python/GTK UI. Existing translations for those strings have been copied into each language's KCM PO file so translators don't need to re-translate them:

1 day, 1 hour, All displays follow mode, Curved display, Default, Disabled, Enable multi-tap detection, Flat, Follow mode, Height, Horizontal, No device connected, Rearrange displays, Remove custom resolution, Remove virtual displays on disable, Request a token, Verify token, Vertical, Width, less than an hour

Coverage varies by language depending on what was already translated in the Python/GTK PO files (de, es, fr, it, ja, zh_CN got all 20; pt_BR got all 20; ru, sv, uk_UA got 10; pl got 0).


⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.

Copilot AI changed the title [WIP] Add i18n support for KCM app and translator files Add i18n support to KWin KCM: translate all strings, add translation infrastructure Mar 27, 2026
Copilot AI requested a review from wheaney March 27, 2026 18:00
Copy link
Copy Markdown
Owner

@wheaney wheaney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For any strings that are identical to their python/GTK counterparts, please copy over the existing translations.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 27, 2026

For any strings that are identical to their python/GTK counterparts, please copy over the existing translations.

Done in e84dee7. Found 20 strings shared between the KCM and Python/GTK PO files and copied all existing translations. Results by language:

  • de, es, fr, it, ja, zh_CN — all 20 strings copied
  • pt_BR — all 20 strings copied (note: the Python PO file has "All displays follow mode" and "Remove virtual displays on disable" mapped to the "Curved display" translation — that's a pre-existing issue in the Python translations)
  • ru, sv, uk_UA — 10 strings copied; the other 10 had empty/fuzzy entries in the Python PO so were left blank
  • pl — 0 strings available in the Python PO; all entries remain empty

The matched strings are: 1 day, 1 hour, All displays follow mode, Curved display, Default, Disabled, Enable multi-tap detection, Flat, Follow mode, Height, Horizontal, No device connected, Rearrange displays, Remove custom resolution, Remove virtual displays on disable, Request a token, Verify token, Vertical, Width, less than an hour.

Copilot AI requested a review from wheaney March 27, 2026 18:12
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.

2 participants