Merge branch 'locale-fixes' into 'develop'

Locale fixes

See merge request soapbox-pub/soapbox-fe!1071
This commit is contained in:
Alex Gleason 2022-03-04 05:01:14 +00:00
commit c91638c3f2
3 changed files with 9 additions and 6 deletions

5
.gitignore vendored
View File

@ -17,8 +17,11 @@ yarn-error.log*
.DS_Store .DS_Store
# Custom build files # Custom build files
/custom/* /custom/**/*
!/custom/*
/custom/*.*
!/custom/.gitkeep !/custom/.gitkeep
!/custom/**/.gitkeep
# surge.sh # surge.sh
CNAME CNAME

View File

@ -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;
}); });
}; };

0
custom/locales/.gitkeep Normal file
View File