2019-12-16 14:01:01 +00:00
|
|
|
import i18n from "i18next";
|
2021-05-21 14:19:00 +00:00
|
|
|
import { initReactI18next } from "react-i18next";
|
|
|
|
import Backend from "i18next-http-backend";
|
|
|
|
import { LANGUAGE } from "../../constants";
|
2021-06-02 10:55:11 +00:00
|
|
|
import { loadLanguagePath } from "../../utils";
|
2019-12-16 14:01:01 +00:00
|
|
|
|
2021-05-21 14:19:00 +00:00
|
|
|
i18n
|
|
|
|
.use(Backend)
|
|
|
|
.use(initReactI18next)
|
|
|
|
.init({
|
|
|
|
lng: localStorage.getItem(LANGUAGE) || "en",
|
|
|
|
fallbackLng: "en",
|
2021-06-02 10:55:11 +00:00
|
|
|
load: "all",
|
2021-05-21 14:19:00 +00:00
|
|
|
//debug: true,
|
2019-12-16 14:01:01 +00:00
|
|
|
|
2021-05-21 14:19:00 +00:00
|
|
|
interpolation: {
|
|
|
|
escapeValue: false, // not needed for react as it escapes by default
|
|
|
|
format: function (value, format) {
|
|
|
|
if (format === "lowercase") return value.toLowerCase();
|
|
|
|
return value;
|
|
|
|
},
|
|
|
|
},
|
2019-12-16 14:01:01 +00:00
|
|
|
|
2021-05-21 14:19:00 +00:00
|
|
|
backend: {
|
2021-06-02 10:55:11 +00:00
|
|
|
loadPath: loadLanguagePath(""),
|
2021-05-21 14:19:00 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
react: {
|
|
|
|
useSuspense: false,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
export default i18n;
|