Fix custom locale imports
This commit is contained in:
parent
4cd56d7fda
commit
4543e943dd
2 changed files with 6 additions and 5 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -19,6 +19,7 @@ yarn-error.log*
|
||||||
# Custom build files
|
# Custom build files
|
||||||
/custom/**/*
|
/custom/**/*
|
||||||
!/custom/*
|
!/custom/*
|
||||||
|
/custom/*.*
|
||||||
!/custom/.gitkeep
|
!/custom/.gitkeep
|
||||||
!/custom/**/.gitkeep
|
!/custom/**/.gitkeep
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
// Import custom messages
|
// Import custom messages
|
||||||
const importCustom = locale => {
|
const importCustom = locale => {
|
||||||
try {
|
return import(/* webpackChunkName: "locale_[request]" */`custom/locales/${locale}.json`)
|
||||||
return import(/* webpackChunkName: "locale_[request]" */`custom/locales/${locale}.json`);
|
.catch(error => ({ default: {} }));
|
||||||
} catch(e) {
|
|
||||||
return new Promise(resolve => resolve({ default: {} }));
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Import git-checked messages
|
// Import git-checked messages
|
||||||
|
@ -20,6 +17,9 @@ const importMessagesWithCustom = locale => {
|
||||||
]).then(messages => {
|
]).then(messages => {
|
||||||
const [native, custom] = messages;
|
const [native, custom] = messages;
|
||||||
return Object.assign(native.default, custom.default);
|
return Object.assign(native.default, custom.default);
|
||||||
|
}).catch(error => {
|
||||||
|
console.error(error);
|
||||||
|
throw error;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue