Skip to content

Commit

Permalink
chore,fix(frontend/internationlization): refactor default module access
Browse files Browse the repository at this point in the history
  • Loading branch information
JoltCode committed Jan 18, 2025
1 parent 21b5c9d commit 41cd34c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions frontend/src/utils/internationalization.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ async function getTranslatedMessages(locale) {
}
if (val) {
const parsed = val.replace('-', '_');
return await import(/* webpackChunkName: "lang-[request]" */ `../locales/${parsed}.json`);
return await import(/* webpackChunkName: "lang-[request]" */ `../locales/${parsed}.json`).default;
}
return await import(/* webpackChunkName: "lang-en" */ '../locales/en.json');
return await import(/* webpackChunkName: "lang-en" */ '../locales/en.json').default;
}

/* textComponent is for orderBy <select>, see codesandbox at https://github.com/facebook/react/issues/15513 */
Expand All @@ -73,7 +73,7 @@ let ConnectedIntl = (props) => {
props.setLocale(getSupportedLocale(navigator.language).value);
}
getTranslatedMessages(props.locale)
.then((messages) => setI18nMessages(messages.default))
.then((messages) => setI18nMessages(messages))
.catch((err) => console.error(err));
}, [props]);

Expand Down

0 comments on commit 41cd34c

Please sign in to comment.