Add localization infrastructure and Simplified Chinese translation#646
Add localization infrastructure and Simplified Chinese translation#646serenNan wants to merge 4 commits into
Conversation
|
@sbertix reopened here as a fresh PR — the previous #643 couldn't be reopened after I force-pushed the branch. Removed the in-app language switcher (model, relaunch, tests, and its catalog strings) as requested; localization now relies entirely on the native system per-app language. Ready for review whenever you have time. |
sbertix
left a comment
There was a problem hiding this comment.
Really appreciate this, and the zh-Hans itself is clean, the placeholders line up and it reads idiomatic 🙇♂️
One blocker though: as it stands, running the app in Chinese comes out half-translated, and imho we can't ship a UI that's part English part Chinese, it reads more broken than staying English-only. So I'd rather hold until every user-facing surface is covered, instead of landing it partial and chasing the gaps after.
The bits still falling back to English today:
- Settings panes (their framework strings never got into the catalog,
SWIFT_EMIT_LOC_STRINGSis only on the app target) - Command palette + the enum-backed settings labels (they render via
Text(someString), so verbatim) - The 3 concatenated-literal sentences (
Text("a" + "b")) - Info.plist permission dialogs (need an
InfoPlist.xcstrings)
Once those all resolve in Chinese (and we drop the dead entries, the Language switcher leftovers etc.), I'm happy to take it 🚀 How does it feel, doable in this PR?
|
Thanks for the detailed review 🙏 Pushed a follow-up (7c3d887) that covers every surface you flagged so the app now runs in Chinese with no English fallback:
Aligned the new translations on the existing Worktree term. Debug build passes and both catalogs compile into the bundle (verified the permission dialogs and settings render in Chinese). I could not flip the PR out of draft from the CLI (permission error) — will toggle it in the UI. Ready for another look when you have a moment 🚀 |
Wire up the String Catalog toolchain so UI strings can be translated: - Enable SWIFT_EMIT_LOC_STRINGS to extract LocalizedStringKey literals - Declare en and zh-Hans in CFBundleLocalizations - Add an empty Localizable.xcstrings as the translation source of truth No translations yet; this is the scaffolding for subsequent batches. (cherry picked from commit e4f252c)
Populate Localizable.xcstrings with zh-Hans translations for the app's user-facing strings (450 entries), covering settings, sidebar, toolbar, onboarding, notifications, and the command palette.
Run the app in Chinese without English fallback on the surfaces that previously escaped the catalog: - Enable SWIFT_EMIT_LOC_STRINGS on the settings framework targets so their LocalizedStringKey literals reach the catalog. - Localize enum-backed labels and command-palette strings via String(localized:), keeping proper nouns (app names, $EDITOR, system sound names, color hex) verbatim. - Localize lifecycle-script section titles/subtitles. - Add InfoPlist.xcstrings translating the permission-usage strings. - Drop the dead language-switcher catalog entries. - Translate the newly extracted keys, aligning on the existing 'Worktree' term.
Cover the zh-Hans strings introduced by the features merged into main since this branch forked (worktree switcher, Kimi hooks developer note).
|
Rebased onto latest The localization work is now complete — every surface you flagged is covered and the app runs fully in Chinese with no English fallback:
I also translated the strings from features merged since (worktree switcher, Kimi hooks note). String-catalog extraction confirms zero untranslated user-facing keys. One thing on my side: I can't flip this out of draft — GitHub shows an "open pull request limit" on my account and greys out the Ready for review button. Could you mark it ready for review (or review as-is) when you have a moment? Happy to rebase again if anything else lands. 🙏 |
Closes #629
Summary
Implements #629: adds Apple localization infrastructure and ships Simplified Chinese (
zh-Hans) as the first translation. Localization is resolved the native way — from the macOS system / per-app language setting, with no in-app switcher.SWIFT_EMIT_LOC_STRINGSto extractLocalizedStringKeyliterals at build time, declaresen+zh-HansinCFBundleLocalizations, and addsLocalizable.xcstrings(English source of truth) wired into the Tuist project. Existing SwiftUIText/Labelcall sites keep working unchanged.zh-Hansfor the user-facing strings across settings, sidebar, toolbar, onboarding, notifications, and the command palette. Anything untranslated falls back to English.Commits are split so each is easy to review in isolation:
Add Simplified Chinese localization infrastructure— catalog + project wiring only.Translate UI to Simplified Chinese— thezh-Hanscatalog entries.Type of change
ready)How was this tested?
make checkpasses (format + lint) —swift-format lint --strictover the changed files is clean;swiftlint(repo config) is clean.make testpasses — leaving the full suite to CI.xcodebuild buildsucceeds after removing the switcher; the UI renders in Simplified Chinese under a Chinese system language.AI tool disclosure (optional)
Checklist
Closes #above.ready.