Conversation
- Add react-i18next, i18next, i18next-browser-languagedetector - Create i18n initialization with browser language detection - Add 5 translation namespaces: common, navigation, settings, page, auth - Add English and Chinese (zh-CN) translation files - Migrate PrimaryNavigation, SubHeader, NavLabels to i18n - Migrate SettingModal tabs and GeneralSetting to i18n - Add language switcher dropdown in Settings > General - Migrate SignIn page to i18n
feat: add i18n multi-language support (English + Chinese) 添加国际化支持,包含中文翻译
- Introduced a new interface and utility functions for managing Twitter settings in TwitterSaveRulesSetting component. - Updated validation messages in TwitterSaveRulesSetting to use localized strings. - Refactored initial values for Twitter settings to utilize the new utility functions. - Improved user feedback messages for saving Twitter settings. - Added new localization keys for various settings and navigation labels in English and Chinese. - Updated collection and sorting labels across multiple components to use localized strings. - Enhanced error handling and user notifications in XSetting and other components.
🤖 Augment PR SummarySummary: This PR introduces full client-side internationalization (English + Chinese) and updates large parts of the Huntly UI to use translated strings. Changes:
Technical Notes: i18n is initialized at app startup ( 🤖 Was this summary useful? React with 👍 or 👎 |
| <Select | ||
| labelId="language-select-label" | ||
| id="language-select" | ||
| value={i18n.language?.startsWith('zh') ? 'zh-CN' : i18n.language || 'en'} |
There was a problem hiding this comment.
i18n.language can be a regional code (e.g. en-US), so this Select value may not match any supportedLanguages option and can render as an empty/invalid selection. Consider normalizing the value to one of the supported base language codes used in the menu items.
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
| search: zhSearch, | ||
| }, | ||
| }, | ||
| fallbackLng: 'en', |
There was a problem hiding this comment.
With LanguageDetector, the resolved language can be a variant like en-US/zh, which isn’t present in resources and can leak into i18n.language (impacting UI like the language selector). Consider configuring supportedLngs (and/or nonExplicitSupportedLngs) so i18next consistently uses en/zh-CN.
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
| <MenuItem value="ARCHIVED">Archive</MenuItem> | ||
| <InputLabel>{t('settings:library')}</InputLabel> | ||
| <Select value={saveStatus} label={t('settings:library')} onChange={(e) => setSaveStatus(e.target.value as "ALL" | "SAVED" | "ARCHIVED")}> | ||
| <MenuItem value="ALL">{t('settings:libraryStatus')}</MenuItem> |
There was a problem hiding this comment.
The saveStatus === "ALL" menu item is labeled with settings:libraryStatus ("Library status (optional)"), which doesn’t seem to describe the "All" option. This looks like it will display a confusing label in the Library filter dropdown.
Severity: low
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
|
|
||
| React.useEffect(() => { | ||
| setDocTitle('My Highlights'); | ||
| setDocTitle(t('page:myHighlightsTitle')); |
There was a problem hiding this comment.
This useEffect uses t(...) but has an empty dependency array, so the document title won’t update if the user switches languages while staying on this page. Same issue exists in the selectedPageId title effect below.
Severity: low
Other Locations
app/client/src/pages/Highlights.tsx:321
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
| </div>} | ||
| {isLoading && <Loading/>} | ||
| {error && <p>Oops, something was broken. <div>{error.toString()}</div></p>} | ||
| {error && <p>{t('page:loadError')} <div>{error.toString()}</div></p>} |
There was a problem hiding this comment.
<p> cannot contain a block-level <div> child; this invalid markup can lead to unexpected DOM structure across browsers. Consider rendering the error message in a single container element to avoid HTML nesting issues.
Severity: low
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
Summary
Key Changes
Internationalization (i18n)
Twitter Settings
Cleanup
.github/copilot-instructions.md(outdated document)Test plan
🤖 Generated with Claude Code