Skip to content

Commit

Permalink
feat: use settings saved lang
Browse files Browse the repository at this point in the history
  • Loading branch information
felixmosh committed May 28, 2024
1 parent 3c82378 commit f303f2a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/ui/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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(
<BrowserRouter basename={basePath}>
<UIConfigContext.Provider value={uiConfig}>
Expand Down

0 comments on commit f303f2a

Please sign in to comment.