From f15f6ceab1b216bb2c084e7394308c4364945e05 Mon Sep 17 00:00:00 2001 From: Ralph Buijtendorp Date: Thu, 6 Nov 2025 15:53:10 +0100 Subject: [PATCH] Adding try/catch block to avoid fatal error in case of missing language files --- app/locale.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/locale.js b/app/locale.js index 23dfdb7ce..890b4335c 100644 --- a/app/locale.js +++ b/app/locale.js @@ -9,11 +9,15 @@ function makeBundle(locale, ftl) { export async function getTranslator(locale) { const bundles = []; const { default: en } = await import('../public/locales/en-US/send.ftl'); - if (locale !== 'en-US') { - const { default: ftl } = await import( - `../public/locales/${locale}/send.ftl` - ); - bundles.push(makeBundle(locale, ftl)); + try { + if (locale !== 'en-US') { + const { default: ftl } = await import( + `../public/locales/${locale}/send.ftl` + ); + bundles.push(makeBundle(locale, ftl)); + } + } catch { + console.warn(`Locale ${locale} not found. Using en-US as fallback.`); } bundles.push(makeBundle('en-US', en)); return function(id, data) {