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) {},
|
bootstrap(app) {},
|
||||||
async registerTrads({ locales }) {
|
async registerTrads({ locales }) {
|
||||||
const importedTrads = await Promise.all(
|
const importedTrads = await Promise.all(
|
||||||
locales.map((locale) => {
|
locales.map(async (locale) => {
|
||||||
return import(
|
try {
|
||||||
/* webpackChunkName: "config-sync-translation-[request]" */ `./translations/${locale}.json`
|
// eslint-disable-next-line import/no-dynamic-require, global-require
|
||||||
)
|
const data = require(`./translations/${locale}.json`);
|
||||||
.then(({ default: data }) => {
|
return {
|
||||||
return {
|
data: prefixPluginTranslations(data, pluginId),
|
||||||
data: prefixPluginTranslations(data, pluginId),
|
locale,
|
||||||
locale,
|
};
|
||||||
};
|
} catch {
|
||||||
})
|
return {
|
||||||
.catch(() => {
|
data: {},
|
||||||
return {
|
locale,
|
||||||
data: {},
|
};
|
||||||
locale,
|
}
|
||||||
};
|
|
||||||
});
|
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue