change language depending on account language

master
alex 2024-01-26 16:08:21 +01:00
parent c2b17ddae3
commit 72a2ff1d51
1 changed files with 7 additions and 0 deletions

View File

@ -12,11 +12,14 @@ import HeaderProvider from "./Contexts/HeaderContext";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import StoresProvider from "./Contexts/StoresContext"; import StoresProvider from "./Contexts/StoresContext";
import { clarity } from "react-microsoft-clarity"; import { clarity } from "react-microsoft-clarity";
import { useTranslation } from "react-i18next";
export default function App() { export default function App() {
/*const [notificationApi, notificationContextHolder] = /*const [notificationApi, notificationContextHolder] =
notification.useNotification(); notification.useNotification();
*/ */
const { t, i18n } = useTranslation();
const { userSession, setUserSession } = UseUserSession(); const { userSession, setUserSession } = UseUserSession();
//const [isWebSocketReady, setIsWebSocketReady] = useState(false); //const [isWebSocketReady, setIsWebSocketReady] = useState(false);
@ -35,6 +38,10 @@ export default function App() {
if (data.user.analytics_enabled) { if (data.user.analytics_enabled) {
clarity.init(Constants.CLARITY_PROJECT_ID); clarity.init(Constants.CLARITY_PROJECT_ID);
} }
if (data.user.language !== i18n.language) {
i18n.changeLanguage(data.user.language);
}
}) })
.catch(() => { .catch(() => {
setUserSession(); setUserSession();