-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat(i18n): add zh-CN locale #1188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. 📝 WalkthroughWalkthroughAdds Simplified Chinese (zh-CN) support: expands SupportedLanguage and AVAILABLE_LANGUAGES, registers zh-CN resources in the i18n registry, adds comprehensive zh-CN locale JSONs, and updates settings migration to convert legacy 'zh' → 'zh-CN' and persist migrated fields. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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 |
Summary of ChangesHello @g1331, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the frontend application's internationalization capabilities by introducing full support for Simplified Chinese (zh-CN). It expands the range of available language options for users and integrates extensive translation files to ensure a localized experience across the user interface, improving accessibility for Chinese-speaking users. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
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 adds support for Simplified Chinese (zh-CN) to the application. The changes include updating the language configuration, adding the new locale to the i18n resources, and providing the translation files.
The implementation is mostly correct, but I have a few suggestions for improvement:
- Language Code Consistency: The PR title and description use
zh-CN, but the code and file structure usezh. It would be better to consistently use the more specificzh-CNtag, which aligns with BCP 47 standards. I've left comments with suggestions on how to apply this change. - Redundant Pluralization Keys: The Chinese translation files contain several keys for pluralization (e.g.,
key_plural,key_other) that have the same value as their singular counterparts. Since Chinese doesn't have grammatical plurals in the same way as English, these keys are redundant and can be removed to simplify the translation files. I've pointed out a few examples.
Overall, this is a great addition. Addressing these points will improve the consistency and maintainability of the internationalization setup.
| export type SupportedLanguage = 'en' | 'fr' | 'zh'; | ||
|
|
||
| export const AVAILABLE_LANGUAGES = [ | ||
| { value: 'en' as const, label: 'English', nativeLabel: 'English' }, | ||
| { value: 'fr' as const, label: 'French', nativeLabel: 'Français' } | ||
| { value: 'fr' as const, label: 'French', nativeLabel: 'Français' }, | ||
| { value: 'zh' as const, label: 'Chinese (Simplified)', nativeLabel: '简体中文' } | ||
| ] as const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency with the PR title (feat(i18n): add zh-CN locale) and to follow the BCP 47 standard for language tags, it's better to use the more specific zh-CN for Simplified Chinese instead of the generic zh. This improves clarity and maintainability. This change should be applied consistently across all related files (i18n resource registration, folder names, etc.).
| export type SupportedLanguage = 'en' | 'fr' | 'zh'; | |
| export const AVAILABLE_LANGUAGES = [ | |
| { value: 'en' as const, label: 'English', nativeLabel: 'English' }, | |
| { value: 'fr' as const, label: 'French', nativeLabel: 'Français' } | |
| { value: 'fr' as const, label: 'French', nativeLabel: 'Français' }, | |
| { value: 'zh' as const, label: 'Chinese (Simplified)', nativeLabel: '简体中文' } | |
| ] as const; | |
| export type SupportedLanguage = 'en' | 'fr' | 'zh-CN'; | |
| export const AVAILABLE_LANGUAGES = [ | |
| { value: 'en' as const, label: 'English', nativeLabel: 'English' }, | |
| { value: 'fr' as const, label: 'French', nativeLabel: 'Français' }, | |
| { value: 'zh-CN' as const, label: 'Chinese (Simplified)', nativeLabel: '简体中文' } | |
| ] as const; |
| // Import Chinese translation resources | ||
| import zhCommon from './locales/zh/common.json'; | ||
| import zhNavigation from './locales/zh/navigation.json'; | ||
| import zhSettings from './locales/zh/settings.json'; | ||
| import zhTasks from './locales/zh/tasks.json'; | ||
| import zhWelcome from './locales/zh/welcome.json'; | ||
| import zhOnboarding from './locales/zh/onboarding.json'; | ||
| import zhDialogs from './locales/zh/dialogs.json'; | ||
| import zhGitlab from './locales/zh/gitlab.json'; | ||
| import zhTaskReview from './locales/zh/taskReview.json'; | ||
| import zhTerminal from './locales/zh/terminal.json'; | ||
| import zhErrors from './locales/zh/errors.json'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To align with the suggested change from zh to zh-CN, these import paths should be updated. This also implies that the locale directory zh should be renamed to zh-CN.
| // Import Chinese translation resources | |
| import zhCommon from './locales/zh/common.json'; | |
| import zhNavigation from './locales/zh/navigation.json'; | |
| import zhSettings from './locales/zh/settings.json'; | |
| import zhTasks from './locales/zh/tasks.json'; | |
| import zhWelcome from './locales/zh/welcome.json'; | |
| import zhOnboarding from './locales/zh/onboarding.json'; | |
| import zhDialogs from './locales/zh/dialogs.json'; | |
| import zhGitlab from './locales/zh/gitlab.json'; | |
| import zhTaskReview from './locales/zh/taskReview.json'; | |
| import zhTerminal from './locales/zh/terminal.json'; | |
| import zhErrors from './locales/zh/errors.json'; | |
| // Import Chinese translation resources | |
| import zhCommon from './locales/zh-CN/common.json'; | |
| import zhNavigation from './locales/zh-CN/navigation.json'; | |
| import zhSettings from './locales/zh-CN/settings.json'; | |
| import zhTasks from './locales/zh-CN/tasks.json'; | |
| import zhWelcome from './locales/zh-CN/welcome.json'; | |
| import zhOnboarding from './locales/zh-CN/onboarding.json'; | |
| import zhDialogs from './locales/zh-CN/dialogs.json'; | |
| import zhGitlab from './locales/zh-CN/gitlab.json'; | |
| import zhTaskReview from './locales/zh-CN/taskReview.json'; | |
| import zhTerminal from './locales/zh-CN/terminal.json'; | |
| import zhErrors from './locales/zh-CN/errors.json'; |
| zh: { | ||
| common: zhCommon, | ||
| navigation: zhNavigation, | ||
| settings: zhSettings, | ||
| tasks: zhTasks, | ||
| welcome: zhWelcome, | ||
| onboarding: zhOnboarding, | ||
| dialogs: zhDialogs, | ||
| gitlab: zhGitlab, | ||
| taskReview: zhTaskReview, | ||
| terminal: zhTerminal, | ||
| errors: zhErrors | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To align with the suggested change from zh to zh-CN, the resource key should be updated to 'zh-CN'.
| zh: { | |
| common: zhCommon, | |
| navigation: zhNavigation, | |
| settings: zhSettings, | |
| tasks: zhTasks, | |
| welcome: zhWelcome, | |
| onboarding: zhOnboarding, | |
| dialogs: zhDialogs, | |
| gitlab: zhGitlab, | |
| taskReview: zhTaskReview, | |
| terminal: zhTerminal, | |
| errors: zhErrors | |
| } | |
| 'zh-CN': { | |
| common: zhCommon, | |
| navigation: zhNavigation, | |
| settings: zhSettings, | |
| tasks: zhTasks, | |
| welcome: zhWelcome, | |
| onboarding: zhOnboarding, | |
| dialogs: zhDialogs, | |
| gitlab: zhGitlab, | |
| taskReview: zhTaskReview, | |
| terminal: zhTerminal, | |
| errors: zhErrors | |
| } |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@apps/frontend/src/renderer/stores/settings-store.ts`:
- Around line 348-362: When persisting migrated settings, don't let save
failures abort the rest of the load flow: wrap the await
window.electronAPI.saveSettings(updates) call in its own try/catch, log the
error (e.g., console.error or an existing logger), and continue so that
store.setSettings(...) and markSettingsLoaded() still run; locate this around
migrateLanguageCode/migrateOnboardingCompleted, where updates is built, and
ensure the catch only handles/logs the persistence error without rethrowing.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (14)
apps/frontend/src/renderer/stores/settings-store.tsapps/frontend/src/shared/constants/i18n.tsapps/frontend/src/shared/i18n/index.tsapps/frontend/src/shared/i18n/locales/zh-CN/common.jsonapps/frontend/src/shared/i18n/locales/zh-CN/dialogs.jsonapps/frontend/src/shared/i18n/locales/zh-CN/errors.jsonapps/frontend/src/shared/i18n/locales/zh-CN/gitlab.jsonapps/frontend/src/shared/i18n/locales/zh-CN/navigation.jsonapps/frontend/src/shared/i18n/locales/zh-CN/onboarding.jsonapps/frontend/src/shared/i18n/locales/zh-CN/settings.jsonapps/frontend/src/shared/i18n/locales/zh-CN/taskReview.jsonapps/frontend/src/shared/i18n/locales/zh-CN/tasks.jsonapps/frontend/src/shared/i18n/locales/zh-CN/terminal.jsonapps/frontend/src/shared/i18n/locales/zh-CN/welcome.json
🧰 Additional context used
📓 Path-based instructions (5)
apps/frontend/src/shared/i18n/locales/**/*.json
📄 CodeRabbit inference engine (CLAUDE.md)
Translation file locations use namespaces:
common.json,navigation.json,settings.json,dialogs.json,tasks.json,errors.json,onboarding.json,welcome.jsoninapps/frontend/src/shared/i18n/locales/{language}/
Files:
apps/frontend/src/shared/i18n/locales/zh-CN/terminal.jsonapps/frontend/src/shared/i18n/locales/zh-CN/taskReview.jsonapps/frontend/src/shared/i18n/locales/zh-CN/gitlab.jsonapps/frontend/src/shared/i18n/locales/zh-CN/onboarding.jsonapps/frontend/src/shared/i18n/locales/zh-CN/navigation.jsonapps/frontend/src/shared/i18n/locales/zh-CN/settings.jsonapps/frontend/src/shared/i18n/locales/zh-CN/dialogs.jsonapps/frontend/src/shared/i18n/locales/zh-CN/errors.jsonapps/frontend/src/shared/i18n/locales/zh-CN/tasks.jsonapps/frontend/src/shared/i18n/locales/zh-CN/welcome.jsonapps/frontend/src/shared/i18n/locales/zh-CN/common.json
apps/frontend/src/**/*.{tsx,ts}
📄 CodeRabbit inference engine (CLAUDE.md)
apps/frontend/src/**/*.{tsx,ts}: All user-facing text in the frontend MUST use i18n translation keys fromreact-i18next, not hardcoded strings
Use translation key formatnamespace:section.key(e.g.,navigation:items.githubPRs) when referencing translations in code
For error messages with dynamic content, use i18n interpolation with syntax liket('errors:task.parseError', { error: errorMessage })
Files:
apps/frontend/src/shared/constants/i18n.tsapps/frontend/src/renderer/stores/settings-store.tsapps/frontend/src/shared/i18n/index.ts
**/*.{ts,tsx,js,py}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx,js,py}: Do not checkprocess.platformdirectly in code - always import platform detection functions from the platform abstraction module
Never hardcode platform-specific paths likeC:\Program Files\,/opt/homebrew/bin/, or/usr/local/bin/directly in code
Files:
apps/frontend/src/shared/constants/i18n.tsapps/frontend/src/renderer/stores/settings-store.tsapps/frontend/src/shared/i18n/index.ts
apps/frontend/**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (CLAUDE.md)
Frontend code must be built with Electron, React, and TypeScript
Files:
apps/frontend/src/shared/constants/i18n.tsapps/frontend/src/renderer/stores/settings-store.tsapps/frontend/src/shared/i18n/index.ts
apps/frontend/**/*.{ts,tsx}
⚙️ CodeRabbit configuration file
apps/frontend/**/*.{ts,tsx}: Review React patterns and TypeScript type safety.
Check for proper state management and component composition.
Files:
apps/frontend/src/shared/constants/i18n.tsapps/frontend/src/renderer/stores/settings-store.tsapps/frontend/src/shared/i18n/index.ts
🧠 Learnings (8)
📓 Common learnings
Learnt from: MikeeBuilds
Repo: AndyMik90/Auto-Claude PR: 661
File: apps/frontend/src/renderer/components/onboarding/OllamaModelSelector.tsx:176-189
Timestamp: 2026-01-04T23:59:48.743Z
Learning: In the AndyMik90/Auto-Claude repository, pre-existing i18n issues (hardcoded user-facing strings that should be localized) can be deferred to future i18n cleanup passes rather than requiring immediate fixes in PRs that don't introduce new i18n violations.
Learnt from: taniar88
Repo: AndyMik90/Auto-Claude PR: 883
File: apps/frontend/src/main/agent/agent-process.ts:21-21
Timestamp: 2026-01-10T15:30:25.649Z
Learning: In the AndyMik90/Auto-Claude repository, new languages should only be added to AVAILABLE_LANGUAGES constant in apps/frontend/src/shared/constants/i18n.ts once their UI translations are complete in apps/frontend/src/shared/i18n/locales/. This avoids implying official support for incomplete translations and prevents user-facing issues.
Learnt from: CR
Repo: AndyMik90/Auto-Claude PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-16T09:10:31.701Z
Learning: Applies to apps/frontend/src/shared/i18n/locales/**/*.json : Translation file locations use namespaces: `common.json`, `navigation.json`, `settings.json`, `dialogs.json`, `tasks.json`, `errors.json`, `onboarding.json`, `welcome.json` in `apps/frontend/src/shared/i18n/locales/{language}/`
Learnt from: CR
Repo: AndyMik90/Auto-Claude PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-16T09:10:31.701Z
Learning: Applies to apps/frontend/src/**/*.{tsx,ts} : Use translation key format `namespace:section.key` (e.g., `navigation:items.githubPRs`) when referencing translations in code
📚 Learning: 2026-01-16T09:10:31.701Z
Learnt from: CR
Repo: AndyMik90/Auto-Claude PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-16T09:10:31.701Z
Learning: Applies to apps/frontend/src/shared/i18n/locales/**/*.json : Translation file locations use namespaces: `common.json`, `navigation.json`, `settings.json`, `dialogs.json`, `tasks.json`, `errors.json`, `onboarding.json`, `welcome.json` in `apps/frontend/src/shared/i18n/locales/{language}/`
Applied to files:
apps/frontend/src/shared/i18n/locales/zh-CN/terminal.jsonapps/frontend/src/shared/i18n/locales/zh-CN/taskReview.jsonapps/frontend/src/shared/i18n/locales/zh-CN/gitlab.jsonapps/frontend/src/shared/i18n/locales/zh-CN/onboarding.jsonapps/frontend/src/shared/i18n/locales/zh-CN/navigation.jsonapps/frontend/src/shared/i18n/locales/zh-CN/settings.jsonapps/frontend/src/shared/i18n/locales/zh-CN/dialogs.jsonapps/frontend/src/shared/i18n/locales/zh-CN/errors.jsonapps/frontend/src/shared/i18n/locales/zh-CN/tasks.jsonapps/frontend/src/shared/i18n/locales/zh-CN/welcome.jsonapps/frontend/src/shared/constants/i18n.tsapps/frontend/src/shared/i18n/locales/zh-CN/common.jsonapps/frontend/src/shared/i18n/index.ts
📚 Learning: 2026-01-10T15:30:12.808Z
Learnt from: taniar88
Repo: AndyMik90/Auto-Claude PR: 883
File: apps/frontend/src/main/agent/agent-process.ts:21-21
Timestamp: 2026-01-10T15:30:12.808Z
Learning: Before adding a new language to AVAILABLE_LANGUAGES, ensure UI translations exist and are complete in apps/frontend/src/shared/i18n/locales. Do not advertise official support for a language until its locale files are fully translated and validated, to avoid user-facing issues.
Applied to files:
apps/frontend/src/shared/i18n/locales/zh-CN/terminal.jsonapps/frontend/src/shared/i18n/locales/zh-CN/taskReview.jsonapps/frontend/src/shared/i18n/locales/zh-CN/gitlab.jsonapps/frontend/src/shared/i18n/locales/zh-CN/onboarding.jsonapps/frontend/src/shared/i18n/locales/zh-CN/navigation.jsonapps/frontend/src/shared/i18n/locales/zh-CN/settings.jsonapps/frontend/src/shared/i18n/locales/zh-CN/dialogs.jsonapps/frontend/src/shared/i18n/locales/zh-CN/errors.jsonapps/frontend/src/shared/i18n/locales/zh-CN/tasks.jsonapps/frontend/src/shared/i18n/locales/zh-CN/welcome.jsonapps/frontend/src/shared/i18n/locales/zh-CN/common.jsonapps/frontend/src/shared/i18n/index.ts
📚 Learning: 2026-01-16T09:10:31.701Z
Learnt from: CR
Repo: AndyMik90/Auto-Claude PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-16T09:10:31.701Z
Learning: Applies to apps/frontend/src/**/*.{tsx,ts} : Use translation key format `namespace:section.key` (e.g., `navigation:items.githubPRs`) when referencing translations in code
Applied to files:
apps/frontend/src/shared/i18n/locales/zh-CN/navigation.jsonapps/frontend/src/shared/i18n/locales/zh-CN/common.jsonapps/frontend/src/shared/i18n/index.ts
📚 Learning: 2026-01-16T09:10:31.701Z
Learnt from: CR
Repo: AndyMik90/Auto-Claude PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-16T09:10:31.701Z
Learning: Applies to apps/frontend/src/**/*.{tsx,ts} : For error messages with dynamic content, use i18n interpolation with syntax like `t('errors:task.parseError', { error: errorMessage })`
Applied to files:
apps/frontend/src/shared/i18n/locales/zh-CN/errors.jsonapps/frontend/src/shared/i18n/index.ts
📚 Learning: 2026-01-10T15:30:25.649Z
Learnt from: taniar88
Repo: AndyMik90/Auto-Claude PR: 883
File: apps/frontend/src/main/agent/agent-process.ts:21-21
Timestamp: 2026-01-10T15:30:25.649Z
Learning: In the AndyMik90/Auto-Claude repository, new languages should only be added to AVAILABLE_LANGUAGES constant in apps/frontend/src/shared/constants/i18n.ts once their UI translations are complete in apps/frontend/src/shared/i18n/locales/. This avoids implying official support for incomplete translations and prevents user-facing issues.
Applied to files:
apps/frontend/src/shared/constants/i18n.ts
📚 Learning: 2026-01-16T09:10:31.701Z
Learnt from: CR
Repo: AndyMik90/Auto-Claude PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-16T09:10:31.701Z
Learning: Applies to apps/frontend/src/**/*.{tsx,ts} : All user-facing text in the frontend MUST use i18n translation keys from `react-i18next`, not hardcoded strings
Applied to files:
apps/frontend/src/shared/constants/i18n.tsapps/frontend/src/shared/i18n/locales/zh-CN/common.jsonapps/frontend/src/shared/i18n/index.ts
📚 Learning: 2026-01-04T23:59:48.743Z
Learnt from: MikeeBuilds
Repo: AndyMik90/Auto-Claude PR: 661
File: apps/frontend/src/renderer/components/onboarding/OllamaModelSelector.tsx:176-189
Timestamp: 2026-01-04T23:59:48.743Z
Learning: In the AndyMik90/Auto-Claude repository, pre-existing i18n issues (hardcoded user-facing strings that should be localized) can be deferred to future i18n cleanup passes rather than requiring immediate fixes in PRs that don't introduce new i18n violations.
Applied to files:
apps/frontend/src/shared/i18n/locales/zh-CN/common.json
🧬 Code graph analysis (1)
apps/frontend/src/renderer/stores/settings-store.ts (1)
apps/frontend/src/shared/types/settings.ts (1)
AppSettings(219-286)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
- GitHub Check: test-python (3.13, windows-latest)
- GitHub Check: test-python (3.12, macos-latest)
- GitHub Check: test-python (3.12, windows-latest)
- GitHub Check: test-frontend (windows-latest)
- GitHub Check: test-frontend (macos-latest)
- GitHub Check: CodeQL (python)
- GitHub Check: CodeQL (javascript-typescript)
🔇 Additional comments (18)
apps/frontend/src/shared/i18n/locales/zh-CN/welcome.json (1)
1-16: LGTM — welcome strings and placeholders look consistent.apps/frontend/src/shared/i18n/locales/zh-CN/navigation.json (1)
1-80: LGTM — navigation resource is structurally aligned with expected keys.apps/frontend/src/shared/i18n/locales/zh-CN/onboarding.json (1)
1-237: LGTM — onboarding translations appear comprehensive and preserve placeholders.apps/frontend/src/shared/i18n/locales/zh-CN/tasks.json (1)
1-244: LGTM — task translations are thorough and keep interpolation placeholders intact.apps/frontend/src/shared/constants/i18n.ts (1)
6-12: zh-CN locale is complete — the addition to AVAILABLE_LANGUAGES is valid.All required translation namespaces (common, navigation, settings, dialogs, tasks, errors, onboarding, welcome) are present in the zh-CN directory with matching key counts to the English locale. The language is ready to be advertised.
apps/frontend/src/shared/i18n/locales/zh-CN/errors.json (1)
1-5: LGTM — translation and placeholders look consistent.apps/frontend/src/renderer/stores/settings-store.ts (1)
298-308: LGTM — legacyzhmapping is clear and contained.apps/frontend/src/shared/i18n/locales/zh-CN/dialogs.json (1)
1-163: LGTM — dialogs namespace looks complete.apps/frontend/src/shared/i18n/locales/zh-CN/taskReview.json (1)
1-58: LGTM — task review translations look good.apps/frontend/src/shared/i18n/locales/zh-CN/gitlab.json (1)
1-208: No action needed. Thegitlabnamespace is properly registered inapps/frontend/src/shared/i18n/index.tswith full locale coverage (en, fr, zh-CN) and correctly included in the i18n configuration. The coding guidelines documentation is outdated and does not reflect the complete list of active namespaces in the codebase, which includesgitlab,taskReview, andterminalin addition to the originally documented ones.apps/frontend/src/shared/i18n/locales/zh-CN/terminal.json (1)
1-39: LGTM!The terminal translations are well-structured with proper Chinese localization. Interpolation placeholders (
{{profileName}},{{branch}}) are correctly formatted and consistent with i18next conventions.apps/frontend/src/shared/i18n/locales/zh-CN/common.json (3)
257-266: Verify duplicate severity labels are intentional.Both
mediumandlowseverity levels translate to "建议" (suggestion). While this may be intentional (grouping non-critical items), it could cause confusion in the UI where users need to distinguish between the two levels.Consider using distinct translations:
medium: "建议" (suggestion)low: "可选" (optional) or "参考" (reference)
320-322: Mixed language in PR review messages.These strings contain both English ("Auto Claude PR Review") and Chinese. This appears intentional for brand consistency, but verify this matches the pattern used in other locales (en, fr) and aligns with UX expectations for Chinese users.
1-371: Translations are comprehensive and well-structured.The common.json file provides thorough coverage of UI elements with proper interpolation syntax and nested organization. ARIA labels and accessibility strings are included, which is excellent for i18n completeness.
apps/frontend/src/shared/i18n/index.ts (2)
30-42: LGTM!The zh-CN imports follow the established naming convention (
zhCnprefix) and correctly reference thezh-CNdirectory path, addressing the previous review feedback about directory naming.
71-84: LGTM!The
zh-CNresource entry is correctly structured with all 11 namespaces matching the English and French locale configurations. The BCP 47 language tag'zh-CN'is appropriate for Simplified Chinese.apps/frontend/src/shared/i18n/locales/zh-CN/settings.json (2)
265-269: Security warning translation looks good.The YOLO mode warning appropriately conveys the security implications in Chinese. The
--dangerously-skip-permissionsflag is kept in English (correct, as it's a CLI argument).
1-581: Comprehensive settings translations.The settings.json file provides thorough coverage of all settings sections with:
- Proper interpolation syntax throughout
- Appropriate preservation of technical terms (OAuth, API Key, MCP, Git, etc.)
- Consistent nested structure matching the application's settings hierarchy
- Complete validation messages and toast notifications
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
| // Apply migrations | ||
| const migratedSettings = migrateLanguageCode(migrateOnboardingCompleted(result.data)); | ||
| store.setSettings(migratedSettings); | ||
|
|
||
| // If migration changed the settings, persist them | ||
| // If migrations changed the settings, persist them | ||
| const updates: Partial<AppSettings> = {}; | ||
| if (migratedSettings.onboardingCompleted !== result.data.onboardingCompleted) { | ||
| await window.electronAPI.saveSettings({ | ||
| onboardingCompleted: migratedSettings.onboardingCompleted | ||
| }); | ||
| updates.onboardingCompleted = migratedSettings.onboardingCompleted; | ||
| } | ||
| if (migratedSettings.language !== result.data.language) { | ||
| updates.language = migratedSettings.language; | ||
| } | ||
| if (Object.keys(updates).length > 0) { | ||
| await window.electronAPI.saveSettings(updates); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don’t abort settings load if migration persistence fails.
A failed saveSettings here will throw into the outer catch, preventing markSettingsLoaded() even though settings were successfully retrieved. That can leave Sentry (and any “settings loaded” gate) disabled due to a transient persistence error. Consider isolating persistence failures and logging them instead.
🛠️ Suggested fix
- if (Object.keys(updates).length > 0) {
- await window.electronAPI.saveSettings(updates);
- }
+ if (Object.keys(updates).length > 0) {
+ try {
+ const saveResult = await window.electronAPI.saveSettings(updates);
+ if (!saveResult.success) {
+ console.warn('[settings-store] Failed to persist migrated settings', saveResult.error);
+ }
+ } catch (error) {
+ console.warn('[settings-store] Failed to persist migrated settings', error);
+ }
+ }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // Apply migrations | |
| const migratedSettings = migrateLanguageCode(migrateOnboardingCompleted(result.data)); | |
| store.setSettings(migratedSettings); | |
| // If migration changed the settings, persist them | |
| // If migrations changed the settings, persist them | |
| const updates: Partial<AppSettings> = {}; | |
| if (migratedSettings.onboardingCompleted !== result.data.onboardingCompleted) { | |
| await window.electronAPI.saveSettings({ | |
| onboardingCompleted: migratedSettings.onboardingCompleted | |
| }); | |
| updates.onboardingCompleted = migratedSettings.onboardingCompleted; | |
| } | |
| if (migratedSettings.language !== result.data.language) { | |
| updates.language = migratedSettings.language; | |
| } | |
| if (Object.keys(updates).length > 0) { | |
| await window.electronAPI.saveSettings(updates); | |
| } | |
| // Apply migrations | |
| const migratedSettings = migrateLanguageCode(migrateOnboardingCompleted(result.data)); | |
| store.setSettings(migratedSettings); | |
| // If migrations changed the settings, persist them | |
| const updates: Partial<AppSettings> = {}; | |
| if (migratedSettings.onboardingCompleted !== result.data.onboardingCompleted) { | |
| updates.onboardingCompleted = migratedSettings.onboardingCompleted; | |
| } | |
| if (migratedSettings.language !== result.data.language) { | |
| updates.language = migratedSettings.language; | |
| } | |
| if (Object.keys(updates).length > 0) { | |
| try { | |
| const saveResult = await window.electronAPI.saveSettings(updates); | |
| if (!saveResult.success) { | |
| console.warn('[settings-store] Failed to persist migrated settings', saveResult.error); | |
| } | |
| } catch (error) { | |
| console.warn('[settings-store] Failed to persist migrated settings', error); | |
| } | |
| } |
🤖 Prompt for AI Agents
In `@apps/frontend/src/renderer/stores/settings-store.ts` around lines 348 - 362,
When persisting migrated settings, don't let save failures abort the rest of the
load flow: wrap the await window.electronAPI.saveSettings(updates) call in its
own try/catch, log the error (e.g., console.error or an existing logger), and
continue so that store.setSettings(...) and markSettingsLoaded() still run;
locate this around migrateLanguageCode/migrateOnboardingCompleted, where updates
is built, and ensure the catch only handles/logs the persistence error without
rethrowing.
The lazy-loaded getGitBashEnv() using createRequire was failing silently in bundled Electron apps, causing CLAUDE_CODE_GIT_BASH_PATH to not be set. Reverted to the working pattern: direct ESM import of getToolInfo from cli-tool-manager with explicit process.platform === 'win32' check.
…n Windows" This reverts commit c021abd.
Base Branch
Description
Adds Simplified Chinese (zh-CN) i18n resources for the frontend and registers the new locale in the i18n resource map and language selector.
Related Issue
Closes #
Type of Change
Area
Commit Message Format
Follow conventional commits: :
Types: feat, fix, docs, style, refactor, test, chore
Example: feat: add user authentication system
Checklist
Platform Testing Checklist
CRITICAL: This project supports Windows, macOS, and Linux. Platform-specific bugs are a common source of breakage.
If you only have access to one OS: CI now tests on all platforms. Ensure all checks pass before submitting.
CI/Testing Requirements
Screenshots
Feature Toggle
Breaking Changes
Breaking: No
Details:
N/A
Summary by CodeRabbit
New Features
Bug Fixes / Migrations
✏️ Tip: You can customize this high-level summary in your review settings.