From f303f2ac347e8adeb44e1e45765b2b50150efa1b Mon Sep 17 00:00:00 2001 From: Felix Mosheev <9304194+felixmosh@users.noreply.github.com> Date: Tue, 28 May 2024 19:12:57 +0300 Subject: [PATCH] feat: use settings saved lang --- packages/ui/src/index.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/ui/src/index.tsx b/packages/ui/src/index.tsx index c1cd79c1..cdac1bd2 100644 --- a/packages/ui/src/index.tsx +++ b/packages/ui/src/index.tsx @@ -5,6 +5,7 @@ import { BrowserRouter } from 'react-router-dom'; import { App } from './App'; import { ApiContext } from './hooks/useApi'; import './index.css'; +import { useSettingsStore } from './hooks/useSettings'; import { UIConfigContext } from './hooks/useUIConfig'; import { Api } from './services/Api'; import './theme.css'; @@ -18,7 +19,10 @@ const uiConfig = JSON.parse( document.getElementById('__UI_CONFIG__')?.textContent || '{}' ) as UIConfig; -initI18n({ lng: uiConfig.locale?.lng || navigator.language || 'en-US', basePath }).then(() => { +const settingsLang = useSettingsStore.getState().language; +const lng = settingsLang || uiConfig.locale?.lng || navigator.language || 'en-US'; + +initI18n({ lng, basePath }).then(() => { render(