2022-09-09 17:18:04 +00:00
|
|
|
import i18n from 'i18next';
|
|
|
|
import LanguageDetector from 'i18next-browser-languagedetector';
|
|
|
|
import { initReactI18next } from 'react-i18next';
|
2022-04-05 14:25:53 +00:00
|
|
|
import HttpApi from 'i18next-http-backend';
|
|
|
|
|
2022-09-28 12:08:16 +00:00
|
|
|
const config = {
|
|
|
|
backend: {
|
|
|
|
loadPath: '/static/locales/{{lng}}.json',
|
|
|
|
allowMultiLoading: false, // set loadPath: '/locales/resources.json?lng={{lng}}&ns={{ns}}' to adapt to multiLoading
|
|
|
|
crossDomain: false,
|
|
|
|
withCredentials: false,
|
|
|
|
overrideMimeType: false,
|
|
|
|
reloadInterval: false, // can be used to reload resources in a specific interval (useful in server environments)
|
|
|
|
},
|
|
|
|
fallbackLng: 'en',
|
|
|
|
debug: false,
|
|
|
|
|
|
|
|
// have a common namespace used around the full app
|
|
|
|
ns: ['translations'],
|
|
|
|
defaultNS: 'translations',
|
|
|
|
keySeparator: false, // we use content as keys
|
|
|
|
interpolation: {
|
|
|
|
escapeValue: false,
|
|
|
|
formatSeparator: ',',
|
|
|
|
},
|
|
|
|
react: {
|
|
|
|
useSuspense: false,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2022-04-05 14:25:53 +00:00
|
|
|
|
|
|
|
i18n
|
|
|
|
.use(HttpApi)
|
|
|
|
.use(LanguageDetector)
|
|
|
|
.use(initReactI18next)
|
2022-09-28 12:08:16 +00:00
|
|
|
.init(config);
|
2022-09-09 17:18:04 +00:00
|
|
|
|
|
|
|
export default i18n;
|