fix(admin-ui): Load translations from path (#5064)

* fix(admin-ui): Load translations from path

* Create big-oranges-battle.md

* fix: resolve public folder path in dev

---------

Co-authored-by: Kasper <kasper@medusajs.com>
This commit is contained in:
Oli JuhlandKasper authored and GitHub committed 2023-09-15 13:19:24 +02:00
1 parent 53ffd614b5
commit c722440c30
5 files changed
+18 -1

No files matched your search

+8
View File
@@ -14,12 +14,20 @@ export const supportedLanguages = [
},
]
const backendUrl = window.location.origin
const adminPath = process.env.ADMIN_PATH ? `${process.env.ADMIN_PATH}` : ""
const pathToLoadFrom = `${backendUrl}${adminPath}locales/{{lng}}/{{ns}}.json`
void i18n
.use(Backend)
.use(LanguageDetector)
.use(initReactI18next)
// https://www.i18next.com/overview/configuration-options
.init({
backend: {
loadPath: pathToLoadFrom
},
supportedLngs: supportedLanguages.map((l) => l.locale),
fallbackLng: "en",
returnNull: false,