Scaffold Gishen Admin: React/Vite shadcn console with role modules, EN/AM i18n, mocks, and backend spec. Co-authored-by: Cursor <cursoragent@cursor.com>
26 lines
613 B
TypeScript
26 lines
613 B
TypeScript
import i18n from 'i18next'
|
|
import { initReactI18next } from 'react-i18next'
|
|
import en from '@/locales/en/translation.json'
|
|
import am from '@/locales/am/translation.json'
|
|
|
|
const saved = localStorage.getItem('gishen_locale') || 'en'
|
|
|
|
void i18n.use(initReactI18next).init({
|
|
resources: {
|
|
en: { translation: en },
|
|
am: { translation: am },
|
|
},
|
|
lng: saved,
|
|
fallbackLng: 'en',
|
|
interpolation: { escapeValue: false },
|
|
})
|
|
|
|
i18n.on('languageChanged', (lng) => {
|
|
localStorage.setItem('gishen_locale', lng)
|
|
document.documentElement.lang = lng
|
|
})
|
|
|
|
document.documentElement.lang = saved
|
|
|
|
export default i18n
|