feat(ui): add i18n scaffolding with zh-CN locale#7998
feat(ui): add i18n scaffolding with zh-CN locale#7998kmzt-trade wants to merge 2 commits intoblock:mainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 10627a199d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| export const NAV_ITEMS: NavItem[] = [ | ||
| { id: 'home', path: '/', label: 'Home', icon: Home }, | ||
| { id: 'chat', path: '/pair', label: 'Chat', icon: MessageSquare, hasSubItems: true }, | ||
| { id: 'recipes', path: '/recipes', label: 'Recipes', icon: FileText }, | ||
| { id: 'apps', path: '/apps', label: 'Apps', icon: AppWindow }, | ||
| { id: 'scheduler', path: '/schedules', label: 'Scheduler', icon: Clock }, | ||
| { id: 'extensions', path: '/extensions', label: 'Extensions', icon: Puzzle }, | ||
| { id: 'settings', path: '/settings', label: 'Settings', icon: Settings }, | ||
| { id: 'home', path: '/', label: t('nav.home'), icon: Home }, | ||
| { id: 'chat', path: '/pair', label: t('nav.chat'), icon: MessageSquare, hasSubItems: true }, |
There was a problem hiding this comment.
Build navigation labels after i18n initialization
src/i18n/index.ts initializes i18next with init(...), but NAV_ITEMS evaluates i18n.t(...) immediately at module import time. NavigationPanel then memoizes getNavItemById() results without any language dependency, so on a cold start in a non-English locale the sidebar can stay stuck with whatever t() returned before initialization completed (typically English or the raw key) for the lifetime of that renderer process.
Useful? React with 👍 / 👎.
| const lower = language.toLowerCase(); | ||
| if (lower.startsWith('zh')) return 'zh-CN'; |
There was a problem hiding this comment.
Stop mapping every Chinese locale to zh-CN
This normalizer forces zh-TW, zh-HK, and other non-Simplified Chinese locales onto the zh-CN resource even though the bundle only ships a Simplified Chinese translation. For users whose navigator.language is Traditional Chinese, that is a readability regression compared with falling back to English, because we are selecting the wrong writing system rather than an unsupported locale fallback.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 505da2b292
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const handleLanguageChange = (option: { value: LanguagePreference; label: string } | null) => { | ||
| const nextLanguage = option?.value ?? 'system'; | ||
| setLanguagePreference(nextLanguage); | ||
| void window.electron.setSetting('language', nextLanguage); | ||
| applyLanguagePreference(nextLanguage); |
There was a problem hiding this comment.
Broadcast language changes to every open renderer
If a user has multiple Goose windows open (the app supports this via window.electron.createChatWindow(...) in App.tsx and related views), changing the language here only updates the current renderer. Unlike theme changes, there is no IPC broadcast/listener pair analogous to broadcastThemeChange/theme-changed in ThemeContext.tsx, so the other windows stay in the old locale until they are reopened. With the new app-wide language setting, that leaves multi-window sessions inconsistent.
Useful? React with 👍 / 👎.
Summary
Testing
Related Issues
Relates to #ISSUE_ID
Discussion: LINK (if any)
Screenshots/Demos (for UX changes)
Before:
After:
Summary
Testing