Skip to content

feat: add Simplified Chinese UI localization - #10776

Closed
yatstudio wants to merge 2 commits into
omacom:quattrofrom
yatstudio:feat/chinese-ui
Closed

yatstudio wants to merge 2 commits into
omacom:quattrofrom
yatstudio:feat/chinese-ui

Conversation

@yatstudio

Copy link
Copy Markdown

Summary

This pull request adds initial Simplified Chinese localization support for the Omarchy shell.

  • Translate common Omarchy menu labels and titles into Simplified Chinese.
  • Automatically use Chinese when LANG or LANGUAGE starts with zh.
  • Allow users to override the language with OMARCHY_UI_LANGUAGE=zh-CN or OMARCHY_UI_LANGUAGE=en.
  • Localize confirmation dialog actions and calendar month/weekday names.
  • Keep command IDs, actions, application IDs, and extension compatibility unchanged.
  • Document how to enable and extend the Chinese translation map.

Backward compatibility

The default English UI remains unchanged for non-Chinese locales.

Verification

  • bash test/shell.d/menu-test.sh
  • git diff --check

@linyiru

linyiru commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

I have been working on a zh-TW localization for Omarchy, so I tested this against the Traditional Chinese locales. One issue is worth fixing before this lands, and one change looks broader in scope than the PR title suggests.

indexOf("zh") === 0 matches every Chinese locale, so Traditional Chinese users get Simplified Chinese. The check appears twice — shell/Ui/ConfirmDialog.qml and shell/plugins/menu/Menu.qml:

readonly property bool chineseUi: uiLanguage.toLowerCase().indexOf("zh") === 0

zh_TW.UTF-8, zh_HK, zh_MO and zh-Hant-TW all satisfy it, so a Taiwan, Hong Kong or Macau desktop loads shell/i18n/zh_CN.js and renders Simplified Chinese. Those are different written forms, not variants of one — this is closer to serving de content to a Dutch user than to en_GB vs en_US. docs/chinese-ui.md documents the current behaviour accurately (「当 LANG 或 LANGUAGE 以 zh 开头时」), so the doc would need the same change.

Keying on the script rather than on the zh prefix is a small patch. I ran this over the spellings that actually occur:

function isSimplified(v) {
  var s = String(v || "").toLowerCase().split(":")[0].split(".")[0].replace(/-/g, "_")
  return s === "zh" || /^zh_(cn|sg|hans)\b/.test(s) || /^zh_hans_/.test(s)
}
zh_CN.UTF-8  Simplified      zh_TW.UTF-8  not Simplified
zh_SG        Simplified      zh_HK        not Simplified
zh-Hans      Simplified      zh_MO        not Simplified
zh-Hans-CN   Simplified      zh-Hant      not Simplified
zh           Simplified      zh-Hant-TW   not Simplified

Traditional users then see English, which is the correct outcome until a zh_TW.js exists — I would be glad to contribute one on top of this.

Note also that Quickshell.env("LANGUAGE") is a colon-separated list, so LANGUAGE=en_US:zh_CN currently yields English and LANGUAGE=zh_CN:en yields Chinese; splitting on : before testing makes that explicit either way.

labelLocale: Qt.locale() in clock/Panel.qml changes behaviour for every locale, not only Chinese. The line it replaces carried a comment explaining that the English day names were deliberate:

The interface is English throughout, so day names are not taken from the system locale. Where the week starts still is: that is a regional convention rather than a translation, and it stays overridable above.

After this change a French or German desktop gets localized month and weekday names in the calendar while the rest of the shell stays English — a mixed-language panel for users this PR does not otherwise touch. That may well be desirable — and in fact #10955 by @sbelcl proposes exactly this change on its own, covering clock/BarWidget.qml and weather/Panel.qml too and updating clock-test.sh with it. Dropping the hunk here and letting that PR carry it would make both easier to review, and would let this one land on the strength of the language pack alone.

On the parts that are right: translating at the last hop before display is the correct direction. openDmenu translates only dmenuPrompt and leaves dmenuOptions alone, so the value omarchy-menu-select hands back to the calling script stays untranslated — that boundary matters, and several bash callers compare the returned string against a literal. Worth stating in docs/chinese-ui.md so it is preserved deliberately.

For what it's worth, I also checked that this does not collide with #12338 (which makes the menu search line a real text input, for CJK input method support): git apply --check is clean both on quattro and on that branch, even though both touch Menu.qml around line 861.

@jandrusk

Copy link
Copy Markdown

Appreciate the zh-CN pass. There's a broader i18n cluster (#8765 / #10083 / #15151 / #11010 / #15117) — product should pick one framework direction before landing partial hard-coded maps.

Also +1 to @linyiru: indexOf("zh") === 0 will treat zh_TW as Simplified. Prefer an explicit locale allowlist / prefix check for zh_CN/zh-CN/zh.

- Add ZhCN.isSimplified() keyed on script/region (zh, zh_CN, zh_SG, zh_Hans)
  so zh_TW/zh_HK/zh_MO/zh_Hant no longer get Simplified Chinese.
- Revert clock Panel.qml labelLocale change; leave it to omacom#10955.
- Update docs/chinese-ui.md to document the Simplified-only behavior.
@omarchybot

Copy link
Copy Markdown
Collaborator

Thank you for this. What it does is now on quattro, so I am closing it.

Simplified Chinese (zh-CN) is now one of Omarchy's 50 languages on quattro (#15326), with full menu, shell and CLI catalogs and a translated manual, chosen under Setup > Language.

This was checked against quattro by Claude, with Codex at medium effort verifying the claims above. If something here is still missing, say so and this can be reopened.

@omarchybot omarchybot closed this Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants