feat: add multilingual localization support with in-app language switching#557
feat: add multilingual localization support with in-app language switching#557eachann1024 wants to merge 4 commits intosteipete:mainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 93ede3af1b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| "Show both percentage and pace (e.g. 45%% · +5%%)" = "Show both percentage and pace (e.g. 45%% · +5%%)"; | ||
| "Show pace indicator (e.g. +5%%)" = "Show pace indicator (e.g. +5%%)"; | ||
| "Show remaining/used percentage (e.g. 45%%)" = "Show remaining/used percentage (e.g. 45%%)"; |
There was a problem hiding this comment.
Correct percent signs in display-mode localization keys
AppStrings.menuBarDisplayModeDescription looks up keys with single % (e.g. "Show pace indicator (e.g. +5%)"), but the entries here are stored with escaped %%, so these lookups never hit and non-English users fall back to the English source text for all three descriptions in the Display settings pane. Using single % in the string keys/values fixes the localization path.
Useful? React with 👍 / 👎.
|
Please click here to view the final video. It seems GitHub no longer allows files larger than 10 MB. |
|
This PR looks strong overall. I only noticed a few Simplified Chinese terminology details that may be worth tightening before merge:
Optional: |
Understood, I'm happy to improve this part of the content |
|
Addressed the terminology feedback in commit 145effa: Simplified Chinese (zh-Hans):
Traditional Chinese (zh-Hant):
|
|
Hey @steipete 👋 Just a heads-up that PR #557 is ready for review whenever you get a chance. Validated with swift build + swift test. Happy to address any feedback before merge. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 145effaee2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ProviderErrorView( | ||
| title: "Last \(self.store.metadata(for: self.provider).displayName) fetch failed:", | ||
| title: AppStrings.fmt( | ||
| "Last %@ fetch failed:", |
There was a problem hiding this comment.
Add missing localization entry for fetch-failure heading
This string is now routed through AppStrings.fmt, but the key "Last %@ fetch failed:" is not present in Sources/CodexBar/Resources/en.lproj/Localizable.strings or the two Chinese Localizable.strings files. Because AppStringResources falls back to the raw key when lookup fails, this heading stays English for non-English app language selections, so provider error UI is not actually localized.
Useful? React with 👍 / 👎.
| formatter.maximumFractionDigits = 0 | ||
| let raw = formatter.string(from: NSNumber(value: value)) ?? "\(value)" | ||
| return "\(raw) tokens" | ||
| return WidgetStrings.fmt("%@ tokens", raw) |
There was a problem hiding this comment.
Add widget localization key for token-count suffix
The widget now formats token counts via WidgetStrings.fmt("%@ tokens", raw), but "%@ tokens" is missing from all widget localization tables (Sources/CodexBarWidget/Resources/{en,zh-Hans,zh-Hant}.lproj/Localizable.strings). That makes WidgetStrings.tr fall back to the raw English template, so token-count labels in the widget remain English in Chinese locales.
Useful? React with 👍 / 👎.
- Simplified Chinese: Use lowercase "tokens" for technical term consistency - Traditional Chinese: Standardize "Cookies" plural form and conjunctions, clarify "Token 额度" phrasing, simplify "额外用量花费" Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix display-mode localization keys using single % instead of double %% so lookups actually match the keys used in AppStrings - Add missing "Last %@ fetch failed:" key to all three app locales so provider error headings are properly localized - Add missing "%@ tokens" key to all three widget locales so token count labels in the widget are properly localized Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
145effa to
4b64e4e
Compare
Summary
AppStrings,AppStringResources, andAppLanguage) so menus, settings, provider details, status text, and widgets share the same string and formatting pipelineTechnical Approach
.lprojresources for both app and widget targets so localized assets ship consistently across surfacesBoundaries
.gitignorewas not changedValidation
pnpm checkswift buildswift test --filter AppStringsLocalizationTestsswift test --filter UsagePaceTextTests