(frontend) fix current lang
This commit is contained in:
parent
340fde01a1
commit
7d407db1ef
@ -24,7 +24,7 @@ const context = initContext();
|
|||||||
|
|
||||||
const MancalaApp: FunctionComponent = () => {
|
const MancalaApp: FunctionComponent = () => {
|
||||||
|
|
||||||
const { t } = useTranslation();
|
const { t, i18n } = useTranslation();
|
||||||
|
|
||||||
const [userKey, setUserKey] = useState<string | undefined>(undefined);
|
const [userKey, setUserKey] = useState<string | undefined>(undefined);
|
||||||
|
|
||||||
@ -38,6 +38,12 @@ const MancalaApp: FunctionComponent = () => {
|
|||||||
|
|
||||||
const onThemeChange = (theme: Theme) => setTheme(theme);
|
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 connectRTMT = (userKey: string) => {
|
||||||
const rtmt = context.rtmt as RTMTWS;
|
const rtmt = context.rtmt as RTMTWS;
|
||||||
rtmt.on("error", onConnectionError);
|
rtmt.on("error", onConnectionError);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user