28 lines
710 B
TypeScript
28 lines
710 B
TypeScript
|
import i18n from 'i18next';
|
||
|
import Backend from 'i18next-xhr-backend';
|
||
|
const backendI18n = i18n.createInstance();
|
||
|
|
||
|
const API_SERVER_ORIGIN = process.env.REACT_APP_API_SERVER_ORIGIN;
|
||
|
|
||
|
backendI18n
|
||
|
.use(Backend)
|
||
|
// .use(initReactI18next) // passes i18n down to react-i18next
|
||
|
.init({
|
||
|
lng: 'en',
|
||
|
fallbackLng: 'en',
|
||
|
// initImmediate: true,
|
||
|
interpolation: {
|
||
|
escapeValue: false,
|
||
|
},
|
||
|
backend: {
|
||
|
loadPath: `${API_SERVER_ORIGIN}/translations/messages?lang={{lng}}`,
|
||
|
parse: (data: any) => data,
|
||
|
},
|
||
|
react: {
|
||
|
wait: true,
|
||
|
useSuspense: false,
|
||
|
},
|
||
|
});
|
||
|
|
||
|
export default backendI18n;
|