Repository navigation
feat(i18n): add typed i18n scaffolding, language picker, and zh-CN Settings - #57
Draft
BubuWang-996 wants to merge 1 commit into
Draft
BubuWang-996 wants to merge 1 commit into
BubuWang-996 wants to merge 1 commit into
Conversation
BubuWang-996
force-pushed
the
feat/i18n-scaffolding-settings
branch
from
December 2, 2026 12:19
e73a3d1 to
aa3d22f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Opening an early draft PR as suggested so you can take a look at the shape before I move on to the remaining areas (sidebar, new thread, session view, Crew, etc.).
Approach (Option A)
t(key, "English fallback", vars?)insrc/client/i18n/index.ts, with canonical keys insrc/client/i18n/keys.ts.zh-CN.tsis typed asPartial<Record<MessageKey, string>>).zh-CNcatalog:src/client/i18n/zh-CN.tsis only loaded whenzh-CNis active, so English users pay zero extra first-load bundle bytes (test/client-bundle.test.tsstays well under budget).Intlformatting: plurals (Intl.PluralRules), numbers (Intl.NumberFormat), dates (Intl.DateTimeFormat), and relative times (Intl.RelativeTimeFormat) go throughIntlhelpers while preserving regional formats (e.g.en-GB) when following the system locale.Scope in this PR
src/client/i18n/):zh,zh-CN,zh-Hans,zh-SG→zh-CN; everything else falls back toen), plusstorage/languagechangesync across tabs and in-memory fallback when storage is blocked.useLocale()/useT()hooks viauseSyncExternalStoreso switching language updates the UI immediately without a reload.mpa.localeinsrc/client/prefs.ts(included in Settings export/import/reset;systemclears the override).Selectdropdown (Systemwith detected language hint /English/简体中文).zh-CN:test/i18n.test.tscovering system locale detection, English fallback, lazyzh-CNloading & failure recovery,Intlhelpers & regional format preservation, blocked storage fallback, cross-tab sync, and bilingual Settings search.Verification
npm run typecheckpasses with 0 errors.test/i18n.test.ts,test/settings-search.test.ts,test/client-bundle.test.ts,test/health.test.ts, andtest/palette.test.tspass (31/31).Happy to tweak the naming, file structure, or key conventions before continuing with the next PR.
P.S. Just wanted to say I really love your taste and aesthetic — the UI feels super crisp, cohesive, and thoughtfully crafted!