(frontend) fix current lang

This commit is contained in:
Halit Aksoy 2024-06-18 01:02:29 +03:00
parent 340fde01a1
commit 7d407db1ef

View File

@ -24,7 +24,7 @@ const context = initContext();
const MancalaApp: FunctionComponent = () => {
const { t } = useTranslation();
const { t, i18n } = useTranslation();
const [userKey, setUserKey] = useState<string | undefined>(undefined);
@ -38,6 +38,12 @@ const MancalaApp: FunctionComponent = () => {
const onThemeChange = (theme: Theme) => setTheme(theme);
React.useEffect(() => {
//@ts-ignore
const deviceLanguage = navigator.language || navigator.userLanguage;
i18n.changeLanguage(deviceLanguage === "tr-TR" ? "tr" : "en")
}, []);
const connectRTMT = (userKey: string) => {
const rtmt = context.rtmt as RTMTWS;
rtmt.on("error", onConnectionError);