Skip to content

Add Simplified Chinese localization support - #177

Open
wang93wei wants to merge 3 commits into
Homebrew:mainfrom
wang93wei:feat/simplified-chinese-i18n
Open

wang93wei wants to merge 3 commits into
Homebrew:mainfrom
wang93wei:feat/simplified-chinese-i18n

Conversation

@wang93wei

@wang93wei wang93wei commented Sep 14, 2026

Copy link
Copy Markdown

Summary

Add Simplified Chinese (zh-Hans) support to the Homebrew GUI, following the macOS application language preference with English fallback. For example, Installed package counts, upgrade actions, errors and the Doctor task label now render in Chinese when the app launches in Chinese.

Refs #164. This implements the localization contribution requested in the issue discussion; it does not add an in-app language selector.

Changes

  • Add an application-owned String Catalog with 269 Chinese translations, shared by the feature packages through the existing main-bundle lookup path. Document how to maintain package and custom-component strings.
  • Localize navigation, package metadata labels, actions, empty/error states, relative times, counts, accessibility text, console chrome and self-upgrade notices. Disable unused catalog symbol generation to avoid collisions between existing case-distinct keys.
  • Translate known Doctor prose after parsing, including wrapped paragraphs followed by package names. Keep issue identity, runnable commands, raw output, unknown diagnostics, package descriptions/caveats and configuration fields unchanged.
  • Raise the main-pane/window minimum heights together after the existing measured Upgrades layout test required 525pt against the previous 520pt floor on the local toolchain.
  • Add catalog argument/completeness checks, diagnostic translation regressions and Chinese UI scenarios; pin the existing fixture UI suite to English.

Testing

  • GitHub Actions on 66a9453: all 48 UI tests pass, including both Chinese localization scenarios. Build/unit/integration tests, Swift Quality and live E2E canaries also pass. CI run.

  • scripts/test — both Swift packages pass, including the new catalog and diagnostic translation tests.

  • mint run swiftformat --lint ., mint run swiftlint lint --strict, and BrewUILint over the full Homebrew + Sources production tree.

  • Xcode application build and UI-test build succeed using local development signing.

  • Direct fixture-backed native UI smoke: Chinese navigation, package counts/details, upgrades, Discover, configuration chrome, missing-Homebrew errors, console controls and translated Doctor paragraphs. Checked rendered screenshots and accessibility text; commands and raw logs remain intact.

  • XCTest UI execution: the local runner is terminated by Gatekeeper before connecting, including after its development signature validates. No system security policy was changed. The new UI tests are compiled but have not executed successfully locally.

Live scripts/test-e2e was not run; manual smoke used the repository's fake Homebrew fixtures, not real package mutations.

PR checklist

  • Followed the repository contribution and workflow guidance.
  • Explained the behavior, scope and relation to Feature request: localization (i18n) support, including Simplified Chinese #164.
  • Ran the relevant local checks and disclosed the UI-runner limitation.
  • Kept changes focused on localization and its layout/verification requirements.
  • AI assisted with this PR: Codex implemented the localization wiring, Chinese translations, tests and documentation, and performed fixture-backed native UI inspection. The contributor also inspected a local build and supplied screenshots and terminology corrections during development. Translation review by other Chinese speakers is welcome.

Follow-ups

An in-app language selector is outside this change. Homebrew may introduce or reword diagnostics; unmatched prose remains in its original language until a corresponding translation is added.

新增应用级英文源与简体中文词条,覆盖导航、数量、时间、错误、辅助功能和控制台诊断标签,并让已知 brew doctor 文案在展示层翻译。保留包名、配置字段、命令及原始输出,补充目录完整性、诊断行为和中文界面测试,同时调整最小窗口尺寸以满足实际内容布局。
将中文界面数量、诊断状态和配置标题的查询改为匹配直接元素。
避免 containing 查询后代元素导致 CI UI 测试误判失败,恢复测试对目标文本的正确定位。
按 macOS AX 快照同时匹配静态文本的 label 与 value,并复用页面对象和诊断信息,提升本地化 UI 测试在实际可访问性树上的稳定性。E2E 启动固定英语环境,避免共享英文断言受机器语言设置影响。

@MikeMcQuaid MikeMcQuaid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We now have 4 initial localisation PRs. No more than one of them (perhaps zero) will be merged.

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