Skip to content

feat(mobile): add Simplified Chinese localization - #11587

Closed
Gyarados4157 wants to merge 16 commits into
stablyai:mainfrom
Gyarados4157:fix/mobile-i18n-followup
Closed

Gyarados4157 wants to merge 16 commits into
stablyai:mainfrom
Gyarados4157:fix/mobile-i18n-followup

Conversation

@Gyarados4157

@Gyarados4157 Gyarados4157 commented Jul 30, 2026 •

Copy link
Copy Markdown

Summary

  • add Simplified Chinese (zh-Hans) localization across the Orca mobile UI while preserving the existing English, Spanish, Japanese, and Korean catalogs
  • localize native iOS metadata and permission prompts through Expo mixed localizations
  • keep protocol sentinels, grouping identities, and machine-facing source-control values independent from translated display text
  • correct confirmed Simplified Chinese catalog contamination and Git/source-control/review/terminal mistranslations
  • harden the catalog bootstrapper with bounded requests, validated translation payloads, fresh abort signals per retry, and deterministic timer cleanup
  • merge the latest upstream main and resolve the DaemonPtyRouter conflict using upstream's subscription-fanout architecture

This PR now targets main directly and supersedes #11446, whose source branch remains conflicted and is not writable by this contributor.

Relates to #9536.

Validation

  • pnpm run typecheck
  • mobile/pnpm run typecheck
  • pnpm run verify:mobile-localization-catalog — 2,564 translation calls and 2,171 keys across 5 locales
  • bootstrap catalog tests — 7 passed
  • daemon focused tests — 94 passed
  • mobile focused tests — 33 passed
  • mobile full suite under Node 24 — 359 files passed; 2,651 tests passed; 2 skipped
  • oxlint on conflict/follow-up files
  • oxfmt --check on conflict/follow-up files
  • isolated Expo iOS prebuild — generated and registered zh-Hans.lproj/InfoPlist.strings

The root full suite under Node 24 reached 3,920 passing files / 41,348 passing tests, but is not fully green on this host: three suites could not install the Electron binary after download failures, and six unrelated existing test cases failed or timed out. Details are recorded in the latest validation comment.

"qE1-68U": "正在创建审阅...",
"JokOS5o": "用租约强制推送...",
"0BMXLfE": "推送 commits...",
"PnL-W2o": "出版分社...",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 This entry still uses "出版分社" (publishing company/branch office), which is a machine-translation error for "Publishing branch…". The neighbouring entries JokOS5o and 0BMXLfE were corrected from "推动" → "推送" in this PR; the in-progress "Publish branch…" label warrants the same pass.

Suggested change
"PnL-W2o": "出版分社...",
"PnL-W2o": "正在发布分支...",

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@@ -458,7 +458,7 @@
"SzcIpKs": "舞台文件",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 "舞台文件" uses "舞台" (theatrical stage) rather than the git staging area term "暂存". Every other occurrence of "stage" in this file was corrected to "暂存" (e.g. a1hiCFE → "暂存已审阅内容", WTkbKTE → "暂存 {{value0}}") — this entry appears to have been missed.

Suggested change
"SzcIpKs": "舞台文件",
"SzcIpKs": "暂存文件",

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@greptile-apps

greptile-apps Bot commented Jul 30, 2026 •

Copy link
Copy Markdown

Greptile Summary

This PR hardens the mobile i18n infrastructure across four independent axes: keeping the GitHub SSH remote sentinel locale-independent, preventing missing-repository grouping from colliding with real repo names, correcting ~60 Simplified Chinese catalog mistranslations, and adding timeout + payload validation to the Google Translate bootstrap script.

  • mobile-work-items.ts: Replaces t('m.oBMMuM8') with the hardcoded English backend sentinel so isGitHubWorkItemsSshRemoteRequiredError works in all locales; a new test file confirms both the match and the rejection of the Chinese-translated string.
  • workspace-list-sections.ts: Introduces MISSING_REPO_IDENTITY (a Symbol) as the Map key for worktrees with no repo, eliminating the previous risk of a repo literally named with the old string sentinel producing an identical section key; a new test covers the collision scenario.
  • bootstrap-mobile-locale-catalog.mjs: Each fetch attempt now runs under a 10-second AbortController timeout with clearTimeout in the finally block, the retry delay is moved to fire only between attempts, and the exported parseTranslationPayload validates response structure before extracting text — all covered by new timer-based and unit tests.

Confidence Score: 5/5

Safe to merge — all three logic changes are well-tested and self-contained.

Each changed code path is covered by new or updated tests that pass. The SSH sentinel fix, Symbol-keyed missing-repo grouping, and bootstrap fetch hardening are all targeted, non-breaking changes with no cross-cutting side effects.

Files Needing Attention: No files require special attention. The zh.json corrections are numerous but mechanical; the logic files have matching test coverage.

Important Files Changed

Filename Overview
config/scripts/bootstrap-mobile-locale-catalog.mjs Adds AbortController timeout (10s) per fetch attempt, extracts and exports parseTranslationPayload with structured validation, and fixes retry-delay placement to only run between attempts. Logic is correct and well-covered by new tests.
config/scripts/bootstrap-mobile-locale-catalog.test.mjs Adds tests for parseTranslationPayload edge cases and two timer-based integration tests for translateText covering abort-and-retry and successful-retry paths with fake timers.
mobile/app.json Adds CFBundleAllowMixedLocalizations: true to iOS infoPlist to enable native permission string catalogs alongside the JS bundle locale.
mobile/src/i18n/locales/zh.json Corrects ~60 Simplified Chinese mistranslations: '控制' → '管理' for source control, '推动/拉动' → '推送/拉取' for git push/pull, '阶段' → '暂存' for staging, '评论' → '审阅' for review contexts, '线程' → '讨论串' for threads, and several other machine-translation artifacts.
mobile/src/tasks/mobile-work-items.ts Replaces t('m.oBMMuM8') with the hardcoded English backend sentinel string so isGitHubWorkItemsSshRemoteRequiredError works correctly regardless of the active UI locale.
mobile/src/tasks/mobile-work-items.test.ts New test file verifying that isGitHubWorkItemsSshRemoteRequiredError matches the canonical English sentinel and rejects the Chinese-translated form.
mobile/src/worktree/workspace-list-sections.ts Uses a Symbol('missing-repo') as the Map identity key for worktrees with no repo, preventing collision with a repo literally named with the old string sentinel; section key is now the stable constant 'missing-repo' while display title remains localized.
mobile/src/worktree/workspace-list-sections.test.ts Adds a targeted test proving that a worktree with an empty repo and a repo literally named 'missing_repo' produce distinct, correctly-keyed sections.

Reviews (2): Last reviewed commit: "test(i18n): cover translation request ti..." | Re-trigger Greptile

@greptile-apps

greptile-apps Bot commented Jul 30, 2026

Copy link
Copy Markdown

Too many files changed for review. (151 files found, 100 file limit)

Bypass the limit by tagging @greptile-apps to review.

@Gyarados4157

Gyarados4157 commented Jul 30, 2026 •

Copy link
Copy Markdown
Author

Resolved the upstream main conflict in merge commit 9c811a306 and pushed the result to this PR branch. GitHub now reports the PR as MERGEABLE.

Conflict resolution:

  • accepted upstream's DaemonPtyAdapterSubscriptionFanout state in src/main/daemon/daemon-pty-router.ts
  • removed the superseded local listener-array fields/imports
  • preserved the mobile Simplified Chinese catalog and source-control/review display-key fixes

Validation after the merge:

  • pnpm run typecheck: pass
  • mobile/pnpm run typecheck: pass
  • localization catalog verifier: 2,564 calls / 2,171 keys across 5 locales, pass
  • config/scripts/bootstrap-mobile-locale-catalog.test.mjs: 7 pass
  • daemon focused tests: 94 pass
  • mobile focused tests: 33 pass
  • mobile full suite under the required Node 24 runtime: 359 files, 2,651 pass, 2 skip
  • oxlint: pass
  • oxfmt --check: pass

The root full suite under Node 24 reached 3,920 passing files / 41,348 passing tests, but is not fully green on this host: 3 suites could not install Electron because the binary download failed, and 6 unrelated existing test cases failed or timed out (runner-command-exec, two grok-fetcher cases, orca-runtime, filesystem-watcher, parcel-watcher-process). The focused changed-path tests and all type/catalog checks are green.

@Gyarados4157
Gyarados4157 changed the base branch from brennanb2025/mobile-i18n-audit to main July 30, 2026 18:04
@Gyarados4157 Gyarados4157 changed the title fix(mobile): harden Chinese localization feat(mobile): add Simplified Chinese localization Jul 30, 2026
@AmethystLiang
AmethystLiang requested review from OrcaWin and removed request for brennanb2025 July 31, 2026 16:50
@nwparker nwparker removed the P2 label Aug 19, 2026
@OrcaWin

OrcaWin commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Thank you @Gyarados4157, and @brennanb2025 for #11446 before it. Orca Mobile localization has now landed in #35399 and the follow-up PRs linked from it, and it builds directly on your work. These ideas came from here:

  • localizing iOS permission prompts through Expo locales, plus CFBundleAllowMixedLocalizations
  • running the coverage audit over the mobile tree
  • keeping protocol sentinels and grouping identities separate from display text, e.g. the Unknown repo section key and matching English backend error sentinels; the same class of bug turned up again during the migration

The final version differs in a few places. It uses readable keys with the desktop translate(key, fallback) call shape and loads catalogs lazily. Languages switch live instead of reloading the app. A plural polyfill covers Hermes, which has no Intl.PluralRules. And it ships all 11 desktop languages.

Since this branch is superseded and far behind main, I'm closing it. Thanks again for pushing this forward. Simplified Chinese, Japanese, Korean and Spanish all shipped with it.

@OrcaWin OrcaWin closed this Oct 29, 2026
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.

5 participants