2.3 KiB
2.3 KiB
Proposal: App Localization (Automatic System Language Detection)
Change ID: localize-app-auto-detect
Summary
Add multilingual support to Gemini Nexus and automatically set the default UI language based on the user's OS language. If the OS language is unsupported, fall back to English. This includes updating i18n configuration, adding Chinese translation resources, and integrating a language detection plugin.
Motivation
To provide a better user experience, the app should adapt to users' preferred language environment. Automatically detecting system language reduces setup effort and improves first-run experience.
Proposed Changes
- Integrate language detection: Install and configure
i18next-browser-languagedetectorto auto-detect user language. - Update i18n config: Modify
src/localization/i18n.tsto enable language detection and define a fallback language (English). - Add Chinese resources: Create
zh-CNtranslation resources covering all app strings. - Update language actions: Ensure
src/actions/language.tscorrectly handles auto-detection and manual override. - UI updates: Ensure all UI components use translation keys instead of hardcoded text.
Alternatives Considered
- Force default Chinese: Rejected, to support a broader international user base and respect system settings.
- Force default English: Rejected, same reason.
Risks
- Detection failure: In certain environments (for example, some Linux distros), language detection may be inaccurate. Fallback behavior must remain reliable.
Acceptance Criteria
- Automatic detection:
- When OS language is Simplified Chinese, app defaults to Chinese on first launch.
- When OS language is English or another non-Chinese language, app defaults to English on first launch.
- Manual switching:
- Users can switch from Chinese to English in Settings, and UI updates immediately without restart.
- Users can switch from English to Chinese in Settings, and UI updates immediately without restart.
- Persistence:
- After users manually change language, app restart preserves the selected language instead of re-detecting.
- Completeness:
- All visible strings (home page, settings page, status bar, popups) render correctly in the selected language with no leftover hardcoded text.