Files
homaroma/apps/spa/src/i18n.ts
T
2026-06-21 01:52:57 -04:00

33 lines
1.0 KiB
TypeScript

import i18n from 'i18next'
import { initReactI18next } from 'react-i18next'
import enTranslation from './locales/en/translation.json'
import thTranslation from './locales/th/translation.json'
import jaTranslation from "./locales/ja/translation.json"
import zhTranslation from "./locales/zh/translation.json"
import viTranslation from "./locales/vi/translation.json"
import koTranslation from "./locales/ko/translation.json"
// Retrieve default lang from localStorage if set
const savedLang = localStorage.getItem('app_lang') || 'th'
i18n
.use(initReactI18next)
.init({
resources: {
en: { translation: enTranslation },
th: { translation: thTranslation },
ja: { translation: jaTranslation },
zh: { translation: zhTranslation },
vi: { translation: viTranslation },
ko: { translation: koTranslation },
},
lng: savedLang, // default language (Thai)
fallbackLng: 'en',
interpolation: {
escapeValue: false, // react already safes from xss
},
})
export default i18n