feat(i18n): add missing zh-CN core translations#8910
feat(i18n): add missing zh-CN core translations#8910vincent067 wants to merge 1 commit intomakeplane:previewfrom
Conversation
Add complete Chinese (Simplified) translation for core.ts: - Sidebar navigation labels - Authentication forms and messages - Password validation and error messages - Toast notifications Also update index.ts to include zh-CN core import. Related to the missing core.ts file identified in zh-CN locale.
|
Alex Chen seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
📝 WalkthroughWalkthroughAdded Chinese (Simplified) locale support for core UI elements by creating a new i18n resource file with sidebar and authentication strings, then registering it as a lazily-loaded entry in the locales index. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/i18n/src/locales/zh-CN/core.ts (1)
7-179: Validate the locale object withsatisfies ITranslationfor compile-time type safety.The zh-CN/core.ts file should explicitly validate against the
ITranslationinterface to catch invalid nested values at compile time. Currently, onlyas constis used, which preserves literal types but does not validate structure. Addingsatisfiesensures all nested values conform to the translation contract without widening the types.♻️ Proposed type-validation change
+import type { ITranslation } from "../../types/translation.ts"; + export default { sidebar: { projects: "项目", @@ }, -} as const; +} as const satisfies ITranslation;The project's TypeScript configuration (
verbatimModuleSyntax: true) fully supports.tsextensions in type-only import statements, aligning with the coding guidelines for modern TypeScript patterns.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/i18n/src/locales/zh-CN/core.ts` around lines 7 - 179, Replace the final "export default { ... } as const" with a compile-time validation against the ITranslation interface: import the ITranslation type (type-only import) and apply "satisfies ITranslation" to the exported object while keeping "as const" so the literal types are preserved; update the default export line that currently uses "as const" to additionally use "satisfies ITranslation" and ensure the ITranslation identifier is imported if not already (verbatimModuleSyntax permits a .ts type-only import).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/i18n/src/locales/zh-CN/core.ts`:
- Around line 7-179: Replace the final "export default { ... } as const" with a
compile-time validation against the ITranslation interface: import the
ITranslation type (type-only import) and apply "satisfies ITranslation" to the
exported object while keeping "as const" so the literal types are preserved;
update the default export line that currently uses "as const" to additionally
use "satisfies ITranslation" and ensure the ITranslation identifier is imported
if not already (verbatimModuleSyntax permits a .ts type-only import).
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: da34333a-05b1-4456-bebd-4fe6f4944948
📒 Files selected for processing (2)
packages/i18n/src/locales/index.tspackages/i18n/src/locales/zh-CN/core.ts
There was a problem hiding this comment.
Pull request overview
Adds a new Simplified Chinese (zh-CN) core locale module and wires it into the locales registry, intended to fill missing “core” translations (sidebar + auth-related strings).
Changes:
- Added
packages/i18n/src/locales/zh-CN/core.tswithsidebarandauthtranslation keys. - Registered the
zh-CNcorefile inpackages/i18n/src/locales/index.tsfor dynamic import.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/i18n/src/locales/zh-CN/core.ts | Introduces a new zh-CN “core” translation bundle (sidebar/auth strings). |
| packages/i18n/src/locales/index.ts | Adds a core loader entry for the zh-CN locale. |
Comments suppressed due to low confidence (1)
packages/i18n/src/locales/index.ts:46
zh-CNnow declares acoreloader, but the translation loader never imports it:TranslationStore.importLanguageFile()only imports files listed inETranslationFiles(translations/accessibility/editor/empty-state), andcoreTranslationsonly containsen. As a result,./zh-CN/corewon’t be merged/used and this PR likely won’t fix missing core strings at runtime. To make this effective, either (a) includecorein the files imported/merged for each language (e.g., add a CORE entry toETranslationFilesand ensurelocales[lang].coreexists where applicable), or (b) statically import the zh-CN core module and add it tocoreTranslations.
"zh-CN": {
core: () => import("./zh-CN/core"),
translations: () => import("./zh-CN/translations"),
accessibility: () => import("./zh-CN/accessibility"),
editor: () => import("./zh-CN/editor"),
"empty-state": () => import("./zh-CN/empty-state"),
| export default { | ||
| sidebar: { | ||
| projects: "项目", | ||
| pages: "页面", | ||
| new_work_item: "新工作项", | ||
| home: "主页", | ||
| your_work: "我的工作", | ||
| inbox: "收件箱", | ||
| workspace: "工作区", | ||
| views: "视图", | ||
| analytics: "分析", | ||
| work_items: "工作项", |
There was a problem hiding this comment.
This new zh-CN/core.ts largely duplicates keys that already exist in zh-CN/translations.ts (e.g., sidebar.*, auth.*). Keeping the same keys in two files increases drift risk (and there are already differences, like unique_code.label being "验证码" here vs "唯一码" in translations.ts). Consider consolidating so each key lives in exactly one source (either move these keys out of translations.ts into core.ts, or remove core.ts and keep them in translations.ts), and ensure the loader merges them deterministically.
Add complete Chinese (Simplified) translation for core.ts which was missing from zh-CN locale. This includes sidebar navigation labels, authentication forms, password validation messages, and toast notifications.
Summary by CodeRabbit