fix(web): loading from root instead of base path (#3342)

This fixes an issue where we were loading the locales from the root rather than the base path.
This commit is contained in:
James Elliott 2022-05-12 07:43:30 +10:00 committed by GitHub
parent b7e40d7319
commit cb46e9064b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,10 @@ import LanguageDetector from "i18next-browser-languagedetector";
import Backend from "i18next-http-backend"; import Backend from "i18next-http-backend";
import { initReactI18next } from "react-i18next"; import { initReactI18next } from "react-i18next";
import { getBasePath } from "@utils/BasePath";
const basePath = getBasePath();
i18n.use(Backend) i18n.use(Backend)
.use(LanguageDetector) .use(LanguageDetector)
.use(initReactI18next) .use(initReactI18next)
@ -12,7 +16,7 @@ i18n.use(Backend)
lookupQuerystring: "lng", lookupQuerystring: "lng",
}, },
backend: { backend: {
loadPath: "/locales/{{lng}}/{{ns}}.json", loadPath: basePath + "/locales/{{lng}}/{{ns}}.json",
}, },
ns: ["portal"], ns: ["portal"],
defaultNS: "portal", defaultNS: "portal",