initialize project

This commit is contained in:
Chantha
2020-09-21 10:06:53 +07:00
parent 4b1f586965
commit eb1b361fac
19 changed files with 4073 additions and 129 deletions

View 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;