From 4554f3fd3f0389127f48fdf82484a774e6963bdf Mon Sep 17 00:00:00 2001 From: Samuel Meuli Date: Tue, 14 Jan 2020 16:56:38 +0100 Subject: [PATCH] Fix detection of Simplified Chinese as system language `electron-builder` did not generate all required `lproj` folders for Chinese --- package.json | 1 + src/main/i18n/i18n.ts | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/package.json b/package.json index ed78a020..b43d074f 100644 --- a/package.json +++ b/package.json @@ -247,6 +247,7 @@ "tr", "uk", "zh", + "zh_CN", "zh_TW" ], "hardenedRuntime": true diff --git a/src/main/i18n/i18n.ts b/src/main/i18n/i18n.ts index aba5c2dd..8bcf3dc7 100644 --- a/src/main/i18n/i18n.ts +++ b/src/main/i18n/i18n.ts @@ -50,6 +50,7 @@ export function initI18n(): void { systemLang = app.getLocale(); const systemLangNoRegion = systemLang.split("-")[0]; const defaultTranslations = ALL_TRANSLATIONS[FALLBACK_LANG]; + logger.log(`System language is "${systemLang}" ("${systemLangNoRegion}" without region)`); if (systemLang in ALL_TRANSLATIONS) { // This if-else statement can ensure that if there is any region-specified localizations found, @@ -59,6 +60,7 @@ export function initI18n(): void { ...defaultTranslations, ...ALL_TRANSLATIONS[lang], }; + logger.log(`Using "${lang}" locale and translations`); } else if (systemLangNoRegion in ALL_TRANSLATIONS) { // Use system language if translations are available lang = systemLang; @@ -67,11 +69,13 @@ export function initI18n(): void { ...defaultTranslations, ...ALL_TRANSLATIONS[langNoRegion], }; + logger.log(`Using "${lang}" locale and "${langNoRegion}" translations`); } else { // Otherwise, fall back to default language lang = FALLBACK_LANG; langNoRegion = FALLBACK_LANG; translations = defaultTranslations; + logger.log(`Using default locale and translations ("${FALLBACK_LANG}")`); } }