Answer the question
In order to leave comments, you need to log in
What is the correct way to use I18next in production?
There are X translation files located like this:
locales/ru/translation.json
locales/ru/modul1.json
locales/ru/modul2.json
locales/en/translation.json
locales/en/modul1.json
locales/en/modul2. json
etc.
There are i18next and i18next-xhr-backend, the config is generally default.
import i18n from 'i18next'
import Backend from 'i18next-xhr-backend'
const options = {
whitelist: ['en', 'ru'],
fallbackLng: 'en',
debug: true,
interpolation: {
escapeValue: false // not needed for react!!
},
react: {
wait: true
}
}
const i18nextOptions = {
loadPath: '/public/locales/{{lng}}/{{ns}}.json'
}
i18n
.use(Backend)
.init({
...options,
backend: i18nextOptions
})
export default i18n
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question