Complete Simplified Chinese (zh-Hans) localization

Closed
ME
2mo ago
+24093-754

Summary

This brings zh-Hans in the macOS string catalogs from partial to effectively
complete, and makes the pre-existing Chinese translations terminologically
consistent with each other.

Catalogzh-Hans beforezh-Hans afterKeys
Resources/Localizable.xcstrings183757075890
Resources/InfoPlist.xcstrings132929
Packages/macOS/CmuxSwiftRenderUI/.../Localizable.xcstrings033

In the main catalog: 3870 keys newly translated, 367 existing values
revised
, and 146 entries promoted out of a non-final state (137
needs_review, 9 new) to translated. No entry is left in needs_review
or new.

Nothing but zh-Hans is touched. No en, ja or other locale value, and no
entry-level metadata, differs from the previous revision.

Coverage and what is deliberately left in English

183 of 5890 keys carry no zh-Hans entry on purpose, because a "translation"
would only duplicate the English and would read as a placeholder:

  • Product and brand names — Claude Code, Codex, OpenCode, Kimi Code, Ollama, Cursor, Copilot, Gemini, Grok, Ghostty,
    Tailscale, Iroh, Discord, cmux Pro.
  • Technical acronyms and identifiers — UDID, PID, CPU, URL,
    LTE, 5G, Wi-Fi, Face ID, HomeKit, Siri, VoiceOver,
    WebView, AppKit, SwiftUI, React, Solid.
  • Format-only strings — %1$@: %2$@, %@ • %@, %@ px, PID %lld,
    :%lld, ⌘↩.
  • Price and plan literals — $0, $50, $0.40, 4 vCPU / 16 GB,
    SOC 2.
  • CLI usage fragments that are pure syntax — e.g.
    viewport <width> <height> | reset.

This follows the repo's own review rule against "placeholder, copied
English, machine marker, TODO, or empty translations used to satisfy a
locale slot" (.github/review-bot-rules/full-internationalization.md).

Terminology

The catalog previously used several Chinese words interchangeably for the
same cmux concept — pane appeared as both 窗格 and 面板, split as both
拆分 and 分屏, surface as 表面, 界面 and an untranslated Surface. Since
panel is its own distinct concept in cmux, pane→面板 was actively
misleading. This PR
settles on one word per concept and rewrites the 47 entries that disagreed:

Englishzh-HansNote
workspace工作区
tab标签页
pane窗格
panel面板kept distinct from pane
surface表面
split拆分
sidebar侧边栏
agent代理
browser浏览器
remove移除vs. delete → 删除
OK / Cancel确定 / 取消macOS convention

Other conventions applied throughout:

  • Ellipsis follows the English source character for character. A source
    … stays …; a source ... stays .... Menu items and CLI output in
    this repo use both, and they now match one-to-one.
  • CLI help text translates the prose and leaves the machine parts alone.
    Flag names, subcommands, option columns, env vars, config keys and example
    command lines stay verbatim; only descriptions and section headers are
    translated (用法: / 标志: / 示例:), matching the style of the CLI
    help strings that were already translated.
  • Keyboard shortcut text, bundle ids, socket names and file paths are
    never translated.
  • InfoPlist.xcstrings keeps its own register. The 13 pre-existing
    entries address the user as 您; the 16 added ones do the same, rather
    than importing the 你 used in the app UI.
  • settings.search.* alias strings keep their English keywords and append
    Chinese ones
    , which is what the 110 already-translated alias entries in
    this catalog do — Chinese users can then find a setting by either.

Keys whose English changed upstream

65 keys had their English source edited since the previous zh-Hans pass —
most of them the Stack → cmux rename in the sign-in flow (e.g.
account.signIn.error.network.title: "Couldn't reach Stack" → "Couldn't
reach cmux"). Those were re-translated from the current English rather than
carried over, so no stale product name survives in Chinese.

How to verify

No Xcode build is required to check this diff.

  1. All three catalogs still parse.

    for f in Resources/Localizable.xcstrings Resources/InfoPlist.xcstrings \
      Packages/macOS/CmuxSwiftRenderUI/Sources/CmuxSwiftRenderUI/Resources/Localizable.xcstrings; do
      python3 -c "import json,sys; json.load(open(sys.argv[1])); print('ok', sys.argv[1])" "$f"
    done
    
  2. Nothing outside zh-Hans moved. For each catalog, compare every
    locale except zh-Hans, plus the entry metadata and the top-level keys,
    against origin/main:

    python3 - <<'EOF'
    import json, subprocess
    for f in ["Resources/Localizable.xcstrings", "Resources/InfoPlist.xcstrings",
              "Packages/macOS/CmuxSwiftRenderUI/Sources/CmuxSwiftRenderUI/Resources/Localizable.xcstrings"]:
        old = json.loads(subprocess.check_output(["git", "show", f"origin/main:{f}"]))
        new = json.load(open(f))
        bad = [(k, loc)
               for k, v in old["strings"].items()
               for loc in set(v["localizations"]) | set(new["strings"][k]["localizations"])
               if loc != "zh-Hans"
               and v["localizations"].get(loc) != new["strings"][k]["localizations"].get(loc)]
        meta = set(old) == set(new) and all(old[k] == new[k] for k in old if k != "strings")
        print(f, "non-zh-Hans diffs:", len(bad), "| metadata identical:", meta)
    EOF
    
  3. Placeholders and line breaks match English. Every zh-Hans value this
    PR writes has the same printf placeholder multiset (%@, %lld,
    %1$@, %d, %s, %.0f) and the same \n count as its English source:

    python3 - <<'EOF'
    import json, re, collections
    PH = re.compile(r"%(\d+\$)?[0-9.]*(l{0,2}[@dfsuxi]|@)")
    for f in ["Resources/Localizable.xcstrings", "Resources/InfoPlist.xcstrings",
              "Packages/macOS/CmuxSwiftRenderUI/Sources/CmuxSwiftRenderUI/Resources/Localizable.xcstrings"]:
        bad = []
        for k, v in json.load(open(f))["strings"].items():
            z = v["localizations"].get("zh-Hans")
            if not z:
                continue
            e = v["localizations"]["en"]["stringUnit"]["value"]
            c = z["stringUnit"]["value"]
            if (collections.Counter(m.group(0) for m in PH.finditer(e))
                    != collections.Counter(m.group(0) for m in PH.finditer(c))
                    or e.count("\n") != c.count("\n")):
                bad.append(k)
        print(f, "mismatches:", len(bad))
    EOF
    

    This reports 38 keys in Resources/Localizable.xcstrings, and all 38
    are pre-existing values this PR does not touch
    (see "Pre-existing
    issues" below). Every value the PR writes matches.

  4. Formatting. The catalogs were edited by splicing only the zh-Hans
    members, so indentation, key order and every other byte are unchanged;
    git diff shows added/replaced "zh-Hans" blocks and nothing else.

Pre-existing issues found but not changed here

These are left alone to keep this PR translation-only. Happy to send
separate PRs if you want them fixed.

  1. 127 string entries in Resources/Localizable.xcstrings sit outside the
    "strings" object.
    From line 292853 the file closes "strings" and
    then continues with entries such as
    "browser.chromium.automation.commandTimedOut" as siblings of
    "sourceLanguage" / "strings" / "version", in compact one-line JSON
    rather than the file's indented style. A String Catalog only reads
    strings, so these 127 keys — the Chromium browser engine errors, the
    split-button debug menu, the Cloud VM tunnel and cmux vpn status
    strings, and the settings.browser.* engine rows — are invisible to
    Xcode and ship untranslated in every locale, English included. They look
    like the output of a script that appended to the wrong nesting level.

  2. 38 existing zh-Hans values drift from their English source. 32 are
    settings.search.alias.* entries carrying a trailing • %@ that the
    English does not have; 6 are CLI help strings
    (cli.help.mosh, cli.help.ssh.mosh, cli.help.clearNotifications,
    cli.help.reorderWorkspaces, cli.comments.usage, cli.restore.help)
    whose Chinese has a different line count from the English, so their
    wrapped help output does not line up.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Ea6L3DAe659mCmXwU4T7Hu


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Summary by cubic

Completes zh-Hans localization across all three macOS string catalogs, raising the main catalog from 1,837 to 5,707 translated keys and unifying previously inconsistent Chinese terminology. Only zh-Hans values change; no other locale or entry-level metadata is touched.

Coverage

  • 3,870 keys newly translated, 367 revised, and 146 promoted from needs_review/new to translated; no entries remain in a non-final state.
  • Resources/InfoPlist.xcstrings and the CmuxSwiftRenderUI package catalog are now complete (29 and 3 keys respectively).
  • 183 keys intentionally carry no zh-Hans: brand names, technical acronyms, format-only strings, and price/plan literals where a translation would only duplicate English.

Terminology and conventions

  • Unifies previously conflicting terms: pane→窗格, panel→面板, split→拆分, surface→表面, sidebar→侧边栏, agent→代理.
  • Ellipsis characters, printf placeholders, and newline counts match the English source one-to-one.
  • Product names, CLI flags, subcommands, env vars, and file paths stay untranslated.
  • 65 keys whose English source changed upstream were re-translated from the current text.
  • Found pre-existing issues (127 keys outside the strings object and 38 zh-Hans values drifting from English) but left them for separate PRs.

Summary by CodeRabbit

  • Localization
    • Added Simplified Chinese translations for sidebar messages.
    • Added Simplified Chinese translations for app permission and resource access descriptions.