mirror of
https://github.com/Crosstalk-Solutions/project-nomad.git
synced 2026-04-05 16:26:15 +02:00
- 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>
30 lines
605 B
TypeScript
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
|