Skip to content

fix: drop Traditional Chinese locale support#99

Merged
Astro-Han merged 2 commits into
devfrom
codex/fix-drop-zht-locale
Apr 21, 2026
Merged

fix: drop Traditional Chinese locale support#99
Astro-Han merged 2 commits into
devfrom
codex/fix-drop-zht-locale

Conversation

@Astro-Han

@Astro-Han Astro-Han commented Apr 21, 2026

Copy link
Copy Markdown
Owner

Summary

Remove Traditional Chinese as a PawWork product-supported locale. PawWork now exposes only English and Simplified Chinese in app and Electron locale surfaces, while legacy Traditional Chinese values and Traditional Chinese language tags fall back to Simplified Chinese.

Why

Traditional Chinese is a separate language support commitment, and PawWork's current product goal is to maintain only English and Simplified Chinese. This keeps localization scope smaller while preserving a reasonable fallback for existing zht users and zh-Hant / zh-TW / zh-HK / zh-MO environments.

Related Issue

None.

How To Verify

bun --cwd packages/app test:unit
bun --cwd packages/desktop-electron test
bun --cwd packages/app typecheck
bun --cwd packages/desktop-electron typecheck
rg -n "zht|zh-Hant|language\.zht|isTraditionalChinese" packages/app/src packages/desktop-electron/src
rg --files packages/app/src packages/desktop-electron/src | rg '/zht\.ts$'

The final rg content check is expected to find only compatibility code and tests for legacy zht / zh-Hant; the product zht.ts file check should return no app or desktop files.

Screenshots or Recordings

Not included. This is a locale support scope change covered by unit tests and typechecks.

Checklist

  • I ran the relevant verification steps
  • I tested visible changes manually when needed
  • I am targeting the dev branch

Summary by CodeRabbit

  • Chores
    • Removed the separate Traditional Chinese ("zht") locale; language selection and resources now use "zh" only.
  • Bug Fixes
    • Improved locale normalization: legacy/variant inputs (including mixed-case or underscore forms) now map consistently to "zh", unsupported or non-string values default to "en", and uppercase "EN" is recognized as "en".

@Astro-Han Astro-Han added enhancement New feature or request P2 Medium priority app Application behavior and product flows platform Electron shell, OS integration, packaging, updater, signing, paths, and permissions labels Apr 21, 2026
@coderabbitai

coderabbitai Bot commented Apr 21, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR removes the separate Traditional Chinese ("zht") locale and related detectors, collapses all zh-* inputs to the single zh locale (with non-string inputs falling back to en), and deletes the zht i18n dictionaries and tests that referenced zht.

Changes

Cohort / File(s) Summary
Language context
packages/app/src/context/language.tsx, packages/app/src/context/language.test.ts
Removed "zht" from Locale and loaders, deleted isTraditionalChinese, changed normalizeLocale(value: unknown): Locale to normalize any zh* (case-insensitive) to "zh" and return "en" for non-strings; updated tests to assert normalizeLocale behavior.
App i18n dictionaries
packages/app/src/i18n/en.ts, packages/app/src/i18n/zh.ts, packages/app/src/i18n/zht.ts
Deleted zht.ts module; removed language.zht keys from en and zh dictionaries.
App i18n parity test
packages/app/src/i18n/parity.test.ts
Removed zht import and references so parity checks run only against remaining locales (e.g., zh, en).
Desktop renderer i18n core
packages/desktop-electron/src/renderer/i18n/index.ts, packages/desktop-electron/src/renderer/i18n/index.test.ts
Removed zht imports and isTraditionalChinese logic; narrowed Locale to `"en"
Desktop renderer zht dictionary
packages/desktop-electron/src/renderer/i18n/zht.ts
Deleted zht i18n dictionary (Traditional Chinese strings for desktop UI).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Poem

🐰 Hopping through code with a joyful squeak,
Zht folds its map and hops off the peak.
One zh to guide the language trail,
Simpler carrots on a single trail,
Thump-thump — rabbit says: neat! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: drop Traditional Chinese locale support' directly and clearly summarizes the main change of removing Traditional Chinese (zht) as a supported locale across the codebase.
Description check ✅ Passed The description covers all template sections: Summary explains the locale removal, Why provides rationale, Related Issue is addressed, How To Verify includes comprehensive test/typecheck commands and grep verification, and Checklist items are appropriately marked (verification and dev branch targeting confirmed).
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-drop-zht-locale

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request removes Traditional Chinese (zht) as a distinct locale, consolidating all Chinese language variants into Simplified Chinese (zh). The changes involve deleting translation files, updating locale type definitions, and refactoring detection and normalization logic across both the web and desktop applications. Review feedback identified redundant checks and potential case-sensitivity bugs in the updated normalizeLocale and parseLocale functions, where uppercase locale strings might fail to match supported values.

Comment thread packages/app/src/context/language.tsx Outdated
Comment thread packages/desktop-electron/src/renderer/i18n/index.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fa90c59636

ℹ️ 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".

Comment thread packages/app/src/context/language.tsx
@Astro-Han

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Apr 21, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/desktop-electron/src/renderer/i18n/index.ts`:
- Around line 30-35: The parseLocale implementation duplicates logic in
normalizeLocale—extract a single shared normalization helper (e.g., export
function normalizeLocaleShared) into a common/shared module and have both
parseLocale and the existing normalizeLocale import and delegate to that helper;
ensure the shared helper keeps the same behavior (string check, toLowerCase, zh
prefix -> "zh", membership check against LOCALES), export the Locale type or
reuse the existing type so parseLocale (and normalizeLocale in packages/app)
return the same Locale | null shape, and update imports in parseLocale and
normalizeLocale to reference the new shared function.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: e0e69682-e1d3-4172-8402-e88b73e710f9

📥 Commits

Reviewing files that changed from the base of the PR and between fa90c59 and 22dfeaf.

📒 Files selected for processing (4)
  • packages/app/src/context/language.test.ts
  • packages/app/src/context/language.tsx
  • packages/desktop-electron/src/renderer/i18n/index.test.ts
  • packages/desktop-electron/src/renderer/i18n/index.ts

Comment thread packages/desktop-electron/src/renderer/i18n/index.ts
@Astro-Han Astro-Han merged commit 6296764 into dev Apr 21, 2026
16 checks passed
@Astro-Han Astro-Han deleted the codex/fix-drop-zht-locale branch April 21, 2026 13:46
@coderabbitai coderabbitai Bot mentioned this pull request Apr 22, 2026
7 tasks
@coderabbitai coderabbitai Bot mentioned this pull request Apr 30, 2026
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app Application behavior and product flows enhancement New feature or request P2 Medium priority platform Electron shell, OS integration, packaging, updater, signing, paths, and permissions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant