feat(i18n): add Simplified Chinese (zh-CN) localization (#219)#239
Merged
Conversation
Closes #219. ## What Adds Simplified Chinese alongside existing English and Traditional Chinese. The reporter assumed React, but the app is Svelte and already has a working i18n framework with `zh-TW` — this just adds the third locale. ## How - New `locales/zh-CN.ts` with all 721 strings. Initial pass is a mechanical Traditional → Simplified character conversion with CN-specific vocabulary swaps applied: 项目 (vs 專案), 设置 (vs 設定), 文件 (vs 檔案), 加载 (vs 載入), 刷新 (vs 重新整理), 默认 (vs 預設), 软件 (vs 軟體), 视频 (vs 影片), 仓库 (vs 儲存庫), 服务器 (vs 伺服器), 消息 (vs 訊息), 命令 (vs 指令 for slash commands kept as 命令 to match CN convention), 默认 (vs 預設), 重启 (vs 重新啟動), etc. - Locale switcher labels updated from `EN` / `中文` (ambiguous) to `EN` / `简` / `繁` so users can distinguish the two Chinese options at a glance. `zh-CN` listed before `zh-TW` since CN has the larger user base; cycle order is EN → 简 → 繁 → EN. - `Locale` type union extended with `'zh-CN'`. The existing detect logic already handles bare `zh` browser preferences via prefix matching — `zh-CN` browsers will now match directly instead of falling through to `zh-TW`. - TypeScript validates 1:1 key coverage via `type Translations = Record<TranslationKey, string>` where `TranslationKey = keyof typeof en`. `npm run check` confirms zero missing keys (still at 11-error main baseline, no new errors). ## Native-speaker review wanted This is a translator-as-second-language pass. Some phrasing may feel stiff or use slightly off vocabulary for the context. Inviting follow-up PRs from native zh-CN speakers (especially the issue reporter) — file is structured in section comments mirroring the en/zh-TW files so spot-fixes are easy. ## Test plan - [x] `npm run check` — 11 errors (same as main; Translations type validated all 721 keys present) - [x] `npx vitest run` — 1567/1567 pass - [ ] Manual: launch app on a `zh-CN` system, confirm UI renders Simplified Chinese, test language switcher cycles EN → 简 → 繁 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Closes #219.
What
Adds Simplified Chinese alongside existing English and Traditional Chinese. The reporter assumed React, but the app is Svelte and already has a working i18n framework with
zh-TW— this just adds the third locale.How
New
locales/zh-CN.tswith all 721 strings. Initial pass is a mechanical Traditional → Simplified character conversion with CN-specific vocabulary swaps applied:…plus standard Traditional → Simplified character conversion throughout.
Locale switcher labels updated from
EN/中文(ambiguous) toEN/简/繁so users can distinguish the two Chinese options at a glance.zh-CNlisted beforezh-TWsince CN has the larger user base; cycle order isEN → 简 → 繁 → EN.Localetype union extended with'zh-CN'. The existing detect logic already handles barezhbrowser preferences via prefix matching —zh-CNbrowsers will now match directly instead of falling through tozh-TW.Type system validates 1:1 key coverage via
type Translations = Record<TranslationKey, string>whereTranslationKey = keyof typeof en.npm run checkconfirms zero missing keys.Native-speaker review wanted
This is a translator-as-second-language pass. Some phrasing may feel stiff or use slightly off vocabulary for the technical context. Inviting follow-up PRs from native zh-CN speakers — especially the reporter @Jedeiah who opened the original issue. The file is structured with section comments mirroring
en.ts/zh-TW.tsso spot-fixes are trivial.Test plan
npm run check— 11 errors (same as main baseline; theTranslationstype validated all 721 keys are present and correctly typed)npx vitest run— 1567/1567 passzh-CNsystem, confirm UI renders Simplified Chinese, test language switcher cyclesEN → 简 → 繁cc @Jedeiah — would love your review of the translations.
🤖 Generated with Claude Code