diff --git a/frontend/src/MancalaApp.tsx b/frontend/src/MancalaApp.tsx index 1354c35..85b1831 100644 --- a/frontend/src/MancalaApp.tsx +++ b/frontend/src/MancalaApp.tsx @@ -24,7 +24,7 @@ const context = initContext(); const MancalaApp: FunctionComponent = () => { - const { t } = useTranslation(); + const { t, i18n } = useTranslation(); const [userKey, setUserKey] = useState(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);