From e554adc7d890ed230ab5218f430bfe2236abd3ed Mon Sep 17 00:00:00 2001 From: cihatata Date: Fri, 4 Apr 2025 01:02:26 +0300 Subject: [PATCH] 2002 fix: use available language --- src/App.jsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index feddfb60f..1d5709847 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -25,10 +25,14 @@ function App() { if (authToken) { dispatch(getAppSettings({ authToken })).then((action) => { if (action.payload && action.payload.success) { - const { language } = action.payload.data; - if (language) { + const { language } = action.payload.data; + const availableLanguages = Object.keys(i18n.options.resources || {}); + if (language && availableLanguages.includes(language)) { dispatch(setLanguage(language)); i18n.changeLanguage(language); + } else { + dispatch(setLanguage(availableLanguages[0])); + i18n.changeLanguage(availableLanguages[0]); } } });