Skip to content

Add localization infrastructure and Simplified Chinese translation#646

Draft
serenNan wants to merge 4 commits into
supabitapp:mainfrom
serenNan:pr-629
Draft

Add localization infrastructure and Simplified Chinese translation#646
serenNan wants to merge 4 commits into
supabitapp:mainfrom
serenNan:pr-629

Conversation

@serenNan

Copy link
Copy Markdown
Contributor

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.

  • Infrastructure — enables SWIFT_EMIT_LOC_STRINGS to extract LocalizedStringKey literals at build time, declares en + zh-Hans in CFBundleLocalizations, and adds Localizable.xcstrings (English source of truth) wired into the Tuist project. Existing SwiftUI Text/Label call sites keep working unchanged.
  • Translationszh-Hans for the user-facing strings across settings, sidebar, toolbar, onboarding, notifications, and the command palette. Anything untranslated falls back to English.

Follow-up from the earlier review (#643): per maintainer feedback, the in-app language switcher has been removed from General settings, along with its AppLanguage model, relaunch handling, tests, and its catalog strings. The app now relies solely on the system per-app language override.

Commits are split so each is easy to review in isolation:

  1. Add Simplified Chinese localization infrastructure — catalog + project wiring only.
  2. Translate UI to Simplified Chinese — the zh-Hans catalog entries.

Type of change

  • Bug fix (the linked issue is a bug report)
  • Feature (the linked issue is a feature request marked ready)
  • Documentation
  • Other (please describe)

How was this tested?

  • make check passes (format + lint) — swift-format lint --strict over the changed files is clean; swiftlint (repo config) is clean.
  • make test passes — leaving the full suite to CI.
  • I built the app to confirm the change works — xcodebuild build succeeds after removing the switcher; the UI renders in Simplified Chinese under a Chinese system language.

AI tool disclosure (optional)

  • Model(s): Claude Opus 4.8
  • Harness / tools: Claude Code

Checklist

  • This pull request is linked to an issue with Closes # above.
  • For a feature, the linked issue is labeled ready.
  • I am the author of this work and accountable for it; no commit is authored or co-authored by an AI agent.
  • I have read the Contributing guide and the Code of Conduct.

@serenNan

Copy link
Copy Markdown
Contributor Author

@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 sbertix left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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_STRINGS is 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?

@sbertix sbertix marked this pull request as draft July 13, 2026 19:43
@serenNan

Copy link
Copy Markdown
Contributor Author

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:

  • Settings panes — enabled SWIFT_EMIT_LOC_STRINGS on the SupacodeSettingsShared and SupacodeSettingsFeature framework targets, so their strings now extract into the catalog (~140 previously-missing keys).
  • Command palette + enum-backed labels — the enum displayName/title/label/subtitle values and the command-palette titles/subtitles/badges now go through String(localized:). Proper nouns stay verbatim (app names, $EDITOR, macOS system sound names, color hex).
  • Concatenated-literal sentences — these were already single interpolated keys (Use the %@ button…, Auto %@, Global %@); they just needed the framework extraction above, now translated.
  • Info.plist permission dialogs — added InfoPlist.xcstrings translating every NS*UsageDescription.
  • Dead entries — dropped the leftover Language switcher strings.

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 🚀

serenNan and others added 4 commits July 14, 2026 20:56
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).
@serenNan

Copy link
Copy Markdown
Contributor Author

Rebased onto latest main and resolved the conflict (the command-palette subtitle that upstream changed from an em-dash to a comma — kept the localization wrapper on the new wording).

The localization work is now complete — every surface you flagged is covered and the app runs fully in Chinese with no English fallback:

  • Settings panes (enabled SWIFT_EMIT_LOC_STRINGS on the settings framework targets)
  • Command palette + enum-backed labels (via String(localized:), proper nouns kept verbatim)
  • The concatenated-literal sentences
  • Info.plist permission dialogs (new InfoPlist.xcstrings)
  • Dropped the dead language-switcher entries

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. 🙏

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.

Localization support with Simplified Chinese as the first translation

2 participants