From 2ca86f7918052721c4bdbc5ae6ea82de30f0a43a Mon Sep 17 00:00:00 2001 From: Nils Hanff Date: Wed, 7 Feb 2024 17:10:28 +0100 Subject: [PATCH] Use same locale name for logging and loading from file Signed-off-by: Nils Hanff --- src/language-helper.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/language-helper.ts b/src/language-helper.ts index 16adc912dd..26cc19a4c5 100644 --- a/src/language-helper.ts +++ b/src/language-helper.ts @@ -115,8 +115,8 @@ export class AppLocalization { public fetchTranslationJson(locale: string): Record | null { try { - console.log("Fetching translation json for locale: " + locale); - return loadJsonFile(__dirname, "i18n", "strings", `${this.denormalize(locale)}.json`); + console.log(`Fetching translation json for locale: ${locale}`); + return loadJsonFile(__dirname, "i18n", "strings", `${locale}.json`); } catch (e) { console.log(`Could not fetch translation json for locale: '${locale}'`, e); return null; @@ -130,7 +130,7 @@ export class AppLocalization { locales = [locales]; } - const loadedLocales = locales.flatMap(this.variations).filter((locale) => { + const loadedLocales = locales.flatMap(this.variations).map(this.denormalize).filter((locale) => { const translations = this.fetchTranslationJson(locale); if (translations !== null) { counterpart.registerTranslations(locale, translations);