2022-10-10 10:14:19 +00:00
|
|
|
import { createInstance } from "i18next";
|
|
|
|
import HttpBackend from "i18next-http-backend";
|
|
|
|
import { initReactI18next } from "react-i18next";
|
|
|
|
|
|
|
|
import { environment } from "./environment";
|
2022-11-03 14:06:26 +00:00
|
|
|
import { joinPath } from "./utils/joinPath";
|
2022-10-10 10:14:19 +00:00
|
|
|
|
|
|
|
const DEFAULT_LOCALE = "en";
|
|
|
|
const DEFAULT_NAMESPACE = "translation";
|
|
|
|
|
|
|
|
export const i18n = createInstance({
|
|
|
|
defaultNS: DEFAULT_NAMESPACE,
|
|
|
|
fallbackLng: DEFAULT_LOCALE,
|
|
|
|
ns: [DEFAULT_NAMESPACE],
|
|
|
|
interpolation: {
|
|
|
|
escapeValue: false,
|
|
|
|
},
|
|
|
|
backend: {
|
2022-11-03 14:06:26 +00:00
|
|
|
loadPath: joinPath(environment.resourceUrl, "locales/{{lng}}/{{ns}}.json"),
|
2022-10-10 10:14:19 +00:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
i18n.use(HttpBackend);
|
|
|
|
i18n.use(initReactI18next);
|