initialize project
This commit is contained in:
27
src/config/i18next/i18next.ts
Normal file
27
src/config/i18next/i18next.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user