31 lines
711 B
TypeScript
31 lines
711 B
TypeScript
import i18n from 'i18next'
|
|
import { initReactI18next } from 'react-i18next'
|
|
import LanguageDetector from 'i18next-browser-languagedetector'
|
|
import { config } from '@lib/config'
|
|
|
|
import en from '@/locales/en.json'
|
|
import ru from '@/locales/ru.json'
|
|
|
|
const resources = {
|
|
en: { translation: en },
|
|
ru: { translation: ru },
|
|
}
|
|
|
|
i18n
|
|
.use(LanguageDetector)
|
|
.use(initReactI18next)
|
|
.init({
|
|
resources,
|
|
fallbackLng: config.defaultLanguage,
|
|
supportedLngs: config.supportedLanguages,
|
|
interpolation: {
|
|
escapeValue: false,
|
|
},
|
|
detection: {
|
|
order: ['localStorage', 'navigator'],
|
|
caches: ['localStorage'],
|
|
lookupLocalStorage: 'language',
|
|
},
|
|
})
|
|
|
|
export default i18n
|