project-nomad/admin/inertia/i18n/index.ts
Claude a8f6fe353b feat(i18n): Add internationalization support with English and Chinese
- Add i18next, react-i18next, and i18next-browser-languagedetector
- Create i18n configuration with language detection
- Add English (en) and Chinese (zh) translation files
- Create LanguageSwitcher component for runtime language switching
- Integrate i18n initialization in app.tsx

Translation keys organized by section:
- common: Common UI elements
- home: Dashboard/home page
- menu: Navigation menu items
- maps: Maps feature
- chat: AI chat feature
- settings: Settings pages
- system: System settings
- apps: App management
- models: AI models
- easySetup: Setup wizard
- docs: Documentation
- about: About page
- errors: Error pages

Co-Authored-By: Claude <noreply@anthropic.com>
2026-04-04 10:24:25 +08:00

30 lines
605 B
TypeScript

import i18n from 'i18next'
import { initReactI18next } from 'react-i18next'
import LanguageDetector from 'i18next-browser-languagedetector'
import en from './locales/en.json'
import zh from './locales/zh.json'
const resources = {
en: { translation: en },
zh: { translation: zh },
}
i18n
.use(LanguageDetector)
.use(initReactI18next)
.init({
resources,
fallbackLng: 'en',
supportedLngs: ['en', 'zh'],
interpolation: {
escapeValue: false,
},
detection: {
order: ['localStorage', 'navigator'],
caches: ['localStorage'],
},
})
export default i18n