From cb46e9064b9712abc022f48db32810e890202fb2 Mon Sep 17 00:00:00 2001 From: James Elliott Date: Thu, 12 May 2022 07:43:30 +1000 Subject: [PATCH] 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. --- web/src/i18n/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web/src/i18n/index.ts b/web/src/i18n/index.ts index 1e23cfc61..27383b3b6 100644 --- a/web/src/i18n/index.ts +++ b/web/src/i18n/index.ts @@ -3,6 +3,10 @@ import LanguageDetector from "i18next-browser-languagedetector"; import Backend from "i18next-http-backend"; import { initReactI18next } from "react-i18next"; +import { getBasePath } from "@utils/BasePath"; + +const basePath = getBasePath(); + i18n.use(Backend) .use(LanguageDetector) .use(initReactI18next) @@ -12,7 +16,7 @@ i18n.use(Backend) lookupQuerystring: "lng", }, backend: { - loadPath: "/locales/{{lng}}/{{ns}}.json", + loadPath: basePath + "/locales/{{lng}}/{{ns}}.json", }, ns: ["portal"], defaultNS: "portal",