Merge pull request #150 from michaelrazmgah/feature/fix-issue-where-locale-is-not-found
fix: Fixing bug where Strapi UI is crashing when no locale is foundpull/153/head 2.1.0
commit
c02262184f
|
@ -49,22 +49,20 @@ export default {
|
|||
bootstrap(app) {},
|
||||
async registerTrads({ locales }) {
|
||||
const importedTrads = await Promise.all(
|
||||
locales.map((locale) => {
|
||||
return import(
|
||||
/* webpackChunkName: "config-sync-translation-[request]" */ `./translations/${locale}.json`
|
||||
)
|
||||
.then(({ default: data }) => {
|
||||
locales.map(async (locale) => {
|
||||
try {
|
||||
// eslint-disable-next-line import/no-dynamic-require, global-require
|
||||
const data = require(`./translations/${locale}.json`);
|
||||
return {
|
||||
data: prefixPluginTranslations(data, pluginId),
|
||||
locale,
|
||||
};
|
||||
})
|
||||
.catch(() => {
|
||||
} catch {
|
||||
return {
|
||||
data: {},
|
||||
locale,
|
||||
};
|
||||
});
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in New Issue