You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(i18n): integrate internationalization support into dashboard
- Added i18next and react-i18next for localization support.
- Created i18n configuration in `src/i18n.ts` and set up language detection.
- Introduced `I18nProvider` to manage i18n context and resource updates.
- Added localization files for English and Chinese (Simplified) with necessary translations.
- Updated `ErrorElement` component to utilize translations for error messages.
- Enhanced dashboard documentation with i18n usage guidelines.
Signed-off-by: Innei <tukon479@gmail.com>
Copy file name to clipboardExpand all lines: AGENTS.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -192,6 +192,7 @@ class PhotoLoader {
192
192
2. Keep components focused - use hooks and component composition.
193
193
3. Follow React best practices - proper Context usage, state management.
194
194
4. Use TypeScript strictly - leverage type safety throughout.
195
+
5. Build React features out of small, atomic components. Push data fetching, stores, and providers down to the feature or tab that actually needs them so switching views unmounts unused logic and prevents runaway updates instead of centralizing everything in a mega component.
Copy file name to clipboardExpand all lines: be/apps/dashboard/agents.md
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,11 +47,20 @@ Providers:
47
47
- LazyMotion + MotionConfig
48
48
- TanStack QueryClientProvider
49
49
- Jotai Provider with a global store
50
+
- I18nProvider (react-i18next)
50
51
- Event, Context menu, and settings sync providers
51
52
- StableRouterProvider to stabilize routing data and navigation
52
53
- ModalContainer and Toaster
53
54
- Add new cross-cutting providers here, keeping order and side effects in mind.
54
55
56
+
### i18n usage
57
+
58
+
- Localization lives under `locales/dashboard/*.json`. Follow the same flat-key rules documented in the repo root AGENTS instructions (no nested parents vs. leaf conflicts). Update English first before translating other languages.
59
+
- Resource metadata/types live in `src/@types/constants.ts`, `src/@types/resources.ts`, and `src/@types/i18next.d.ts`. Keep these files in sync when adding new locales or namespaces.
60
+
-`src/i18n.ts` configures `i18next` with `react-i18next` + `i18next-browser-languagedetector`. The singleton is stored in a jotai atom for hot-refresh support.
61
+
- Use `useTranslation()` from `react-i18next` inside components. Example: `const { t } = useTranslation(); <span>{t('nav.overview')}</span>`.
62
+
- Trigger `EventBus.dispatch('I18N_UPDATE')` in development when you need to reload resources without a full refresh.
63
+
55
64
Animation rules:
56
65
57
66
- Always use m.\* components imported from motion/react.
0 commit comments