Improve Simplified Chinese (zh-Hans) localization for visible UI#1145
Conversation
|
Codex review: needs maintainer review before merge. Reviewed May 26, 2026, 4:40 AM ET / 08:40 UTC. Summary Reproducibility: not applicable. as a bug reproduction; this is a localization polish PR. The changed behavior is source-reviewable and the contributor provided a redacted real-app zh-Hans screenshot after the fix. Review metrics: 3 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge Security Review detailsBest possible solution: Land the localization sweep after CI finishes and a maintainer accepts the broad UI wording/compatibility risk, preserving provider semantics and keeping any further polish as narrow follow-ups. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug reproduction; this is a localization polish PR. The changed behavior is source-reviewable and the contributor provided a redacted real-app zh-Hans screenshot after the fix. Is this the best way to solve the issue? Yes, this is a maintainable direction because it reuses the existing L(...) resource-bundle path and adds focused formatter/label tests. The remaining decision is whether maintainers accept the broad wording and compatibility surface in one PR. AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 7c751570b7e9. Label changesLabel justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 253c0499cf
ℹ️ 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".
|
|
||
| public enum UsageFormatter { | ||
| private static func localized(_ key: String) -> String { | ||
| NSLocalizedString(key, tableName: "Localizable", bundle: .main, value: key, comment: "") |
There was a problem hiding this comment.
Resolve localized strings from the CodexBar resource bundle
UsageFormatter.localized now calls NSLocalizedString with bundle: .main, but this repo’s UI localization path uses CodexBar_CodexBar.bundle (via L(...)) and an appLanguage override. In app-language modes like zh-Hans, updatedString/resetLine/creditsString can fall back to English keys because they bypass that bundle selection logic, so this change leaves visible strings untranslated in those paths.
Useful? React with 👍 / 👎.
| if provider == .bedrock { | ||
| let label = Self.bedrockLatestBillingDayLabel(from: snapshot) | ||
| if let sessionTokens { | ||
| return "\(label): \(sessionCost) · \(sessionTokens) tokens" | ||
| return String(format: L("Today: %@ · %@ tokens"), sessionCost, sessionTokens) | ||
| } | ||
| return "\(label): \(sessionCost)" | ||
| return String(format: L("Today: %@"), sessionCost) |
There was a problem hiding this comment.
Keep Bedrock session label tied to latest billing day
For Bedrock, sessionCost comes from the latest available billing entry, which can lag behind today; replacing the Bedrock-specific label with a hardcoded Today misdates the number whenever AWS Cost Explorer is delayed. That makes the shown daily spend inaccurate from the user’s perspective even though the numeric value is from an earlier day.
Useful? React with 👍 / 👎.
| return String(format: L("Last 30 days: %@ · %@ tokens"), monthCost, monthTokens) | ||
| } | ||
| return "\(windowLabel): \(monthCost)" | ||
| return String(format: L("Last 30 days: %@"), monthCost) |
There was a problem hiding this comment.
Respect configured history window in token usage summary
The month summary line is now hardcoded to Last 30 days, but this snapshot already carries a configurable historyDays window (1–365). When users set a non-30-day history window, the label no longer matches the aggregated cost/token values, which is misleading for usage analysis.
Useful? React with 👍 / 👎.
Added redacted real UI proof for the zh-Hans visible UI localization pass.
The screenshot was captured from a freshly built local app with appLanguage = zh-Hans; the running app path was confirmed as the PR worktree build, not /Applications/CodexBar.app. It shows the visible menu/card UI rendered in Simplified Chinese, including usage/pace labels, cost/storage/menu actions, and chart-related UI. Private account/session/usage details were redacted. Recent validation after the latest fixes:
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Thanks for the review. I’ll stop making changes on this PR unless maintainers request anything else. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8bdac15cef
ℹ️ 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".
|
|
||
| func codexBarLocalizedLocale() -> Locale { | ||
| let language = appLanguageDefaults().string(forKey: "appLanguage") ?? "" | ||
| guard !language.isEmpty else { return .current } |
There was a problem hiding this comment.
Align fallback locale with selected localization
When appLanguage is unset, codexBarLocalizedLocale() now returns .current, but localizedBundle() falls back to available app localizations (often English). On systems whose preferred locale is unsupported (for example de-DE), this produces mixed-language output like English labels with German relative-time/date fragments in UsageFormatter and chart/detail text. This is a regression from the prior stable-English formatter behavior and will affect users running in system-language mode without an explicit app-language override.
Useful? React with 👍 / 👎.

Summary
Improve Simplified Chinese (
zh-Hans) localization quality for visible CodexBar UI.This PR focuses on user-visible zh-Hans polish in menu/card/dashboard areas:
It fixes mixed Chinese/English labels in visible UI paths by routing labels through localization, adding missing keys, and polishing Simplified Chinese terminology.
Scope
zh-Hantuntouchedtoken; API/auth contexts use令牌Files
21 files changed, centered on:
Sources/CodexBar/Resources/en.lproj/Localizable.stringsSources/CodexBar/Resources/zh-Hans.lproj/Localizable.stringsValidation
plutil -lint Sources/CodexBar/Resources/en.lproj/Localizable.strings✅plutil -lint Sources/CodexBar/Resources/zh-Hans.lproj/Localizable.strings✅./Scripts/lint.sh lint✅swift build --target CodexBarCore✅swift test --filter Localization✅git diff --check✅Local proof
Tested with a freshly built local app using
appLanguage = zh-Hans.The app process path was confirmed as the local PR worktree build:
/Users/yuxinqiao/Developer/CodexBar-zh-hans-visible-ui/CodexBar.appand not
/Applications/CodexBar.app.Local proof screenshots were captured under
artifacts/for manual review. They contain local account/session/usage details, so they were not committed or uploaded unredacted.