37 lines
1.2 KiB
TypeScript
37 lines
1.2 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'
|
|
import loTranslation from '../locales/lo/translation.json'
|
|
import itTranslation from '../locales/it/translation.json'
|
|
|
|
// Check if it's already initialized to prevent re-initialization on HMR
|
|
if (!i18n.isInitialized) {
|
|
i18n
|
|
.use(initReactI18next)
|
|
.init({
|
|
resources: {
|
|
en: { translation: enTranslation },
|
|
th: { translation: thTranslation },
|
|
ja: { translation: jaTranslation },
|
|
zh: { translation: zhTranslation },
|
|
vi: { translation: viTranslation },
|
|
ko: { translation: koTranslation },
|
|
lo: { translation: loTranslation },
|
|
it: { translation: itTranslation },
|
|
},
|
|
lng: 'th',
|
|
fallbackLng: 'en',
|
|
interpolation: {
|
|
escapeValue: false, // react already safes from xss
|
|
},
|
|
})
|
|
}
|
|
|
|
export default i18n
|