i18n bootstrapped and applied for the root module

This commit is contained in:
Sebastian Sdorra
2018-07-24 14:36:14 +02:00
parent f7cab0e026
commit f57d408156
12 changed files with 179 additions and 35 deletions

37
scm-ui/src/i18n.js Normal file
View File

@@ -0,0 +1,37 @@
import i18n from "i18next";
import Backend from "i18next-fetch-backend";
import LanguageDetector from "i18next-browser-languagedetector";
import { reactI18nextModule } from "react-i18next";
const loadPath = process.env.PUBLIC_URL + "/locales/{{lng}}/{{ns}}.json";
i18n
.use(Backend)
.use(LanguageDetector)
.use(reactI18nextModule)
.init({
fallbackLng: "en",
// have a common namespace used around the full app
ns: ["commons"],
defaultNS: "commons",
debug: true,
interpolation: {
escapeValue: false // not needed for react!!
},
react: {
wait: true
},
backend: {
loadPath: loadPath,
init: {
credentials: "same-origin"
}
}
});
export default i18n;