From 4cd56d7fda50aa1bfde4b3ffb812a19aaa64aac6 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 3 Mar 2022 22:31:54 -0600 Subject: [PATCH 1/2] gitkeep custom/locales directory --- .gitignore | 4 +++- custom/locales/.gitkeep | 0 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 custom/locales/.gitkeep diff --git a/.gitignore b/.gitignore index 576659c3f..8a53931ef 100644 --- a/.gitignore +++ b/.gitignore @@ -17,8 +17,10 @@ yarn-error.log* .DS_Store # Custom build files -/custom/* +/custom/**/* +!/custom/* !/custom/.gitkeep +!/custom/**/.gitkeep # surge.sh CNAME diff --git a/custom/locales/.gitkeep b/custom/locales/.gitkeep new file mode 100644 index 000000000..e69de29bb From 4543e943ddca58f8c73f7c265b1a9f7052eb057b Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 3 Mar 2022 22:45:22 -0600 Subject: [PATCH 2/2] Fix custom locale imports --- .gitignore | 1 + app/soapbox/locales/messages.js | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 8a53931ef..d2c20b8ef 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ yarn-error.log* # Custom build files /custom/**/* !/custom/* +/custom/*.* !/custom/.gitkeep !/custom/**/.gitkeep diff --git a/app/soapbox/locales/messages.js b/app/soapbox/locales/messages.js index bcea22f3c..129869d50 100644 --- a/app/soapbox/locales/messages.js +++ b/app/soapbox/locales/messages.js @@ -1,10 +1,7 @@ // Import custom messages const importCustom = locale => { - try { - return import(/* webpackChunkName: "locale_[request]" */`custom/locales/${locale}.json`); - } catch(e) { - return new Promise(resolve => resolve({ default: {} })); - } + return import(/* webpackChunkName: "locale_[request]" */`custom/locales/${locale}.json`) + .catch(error => ({ default: {} })); }; // Import git-checked messages @@ -20,6 +17,9 @@ const importMessagesWithCustom = locale => { ]).then(messages => { const [native, custom] = messages; return Object.assign(native.default, custom.default); + }).catch(error => { + console.error(error); + throw error; }); };