From 084187e67b733604e84de9c60f0a298b999ff992 Mon Sep 17 00:00:00 2001 From: Kurdistan Tech Ministry Date: Mon, 2 Feb 2026 19:11:43 +0300 Subject: [PATCH] fix(i18n): handle 'default' language by mapping to 'en' The ui-settings LANGUAGE_DEFAULT is 'default' but no locale folder exists for it. This caused i18n to fail loading translations, breaking the entire UI including wallet creation screen (showed instead of text). Fix normalizes 'default' language to 'en' in the i18n Backend. --- packages/extension-ui/src/i18n/Backend.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/packages/extension-ui/src/i18n/Backend.ts b/packages/extension-ui/src/i18n/Backend.ts index 1d5a14d..ed53fe6 100644 --- a/packages/extension-ui/src/i18n/Backend.ts +++ b/packages/extension-ui/src/i18n/Backend.ts @@ -14,17 +14,24 @@ export default class Backend { static type = 'backend' as const; + // Map 'default' language to 'en' since there's no 'default' locale folder + private normalizeLanguage (lng: string): string { + return lng === 'default' ? 'en' : lng; + } + async read (lng: string, _namespace: string, responder: Callback): Promise { - if (languageCache[lng]) { - return responder(null, languageCache[lng]); + const normalizedLng = this.normalizeLanguage(lng); + + if (languageCache[normalizedLng]) { + return responder(null, languageCache[normalizedLng]); } // eslint-disable-next-line @typescript-eslint/no-misused-promises - if (!loaders[lng]) { - loaders[lng] = this.createLoader(lng); + if (!loaders[normalizedLng]) { + loaders[normalizedLng] = this.createLoader(normalizedLng); } - const [error, data] = await loaders[lng]; + const [error, data] = await loaders[normalizedLng]; return responder(error, data); }