From 998b4de2900f8eda27984026bfcdcafdda59fcf7 Mon Sep 17 00:00:00 2001 From: thisconnect Date: Fri, 15 Nov 2024 10:43:36 +0100 Subject: [PATCH] frontend: ensure falling back to native langauge --- frontends/web/src/components/guide/entry.tsx | 2 +- frontends/web/src/i18n/i18n.ts | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/frontends/web/src/components/guide/entry.tsx b/frontends/web/src/components/guide/entry.tsx index d9f898ab93..b1b10523df 100644 --- a/frontends/web/src/components/guide/entry.tsx +++ b/frontends/web/src/components/guide/entry.tsx @@ -55,7 +55,7 @@ export const Entry = (props: TProps) => {
{shown ? (
- {entry.text.trim().split('\n').map((p, idx) =>

{p}

)} + {entry?.text?.trim().split('\n').map((p, idx) =>

{p}

)} {entry.link && (

{ // changei18nLanguage triggers languageChanged, thus this check to prevent loop if (isChangingLanguage) { @@ -127,4 +124,12 @@ i18n.on('languageChanged', async (lng) => { } }); +i18n.on('initialized', () => { + languageFromConfig.detect((lang) => { + if (lang && typeof lang === 'string') { + changei18nLanguage(localeMainLanguage(lang)); + } + }); +}); + export { i18n };