diff --git a/src/comingsoon.tsx b/src/comingsoon.tsx index 9066daa..cf953d6 100644 --- a/src/comingsoon.tsx +++ b/src/comingsoon.tsx @@ -1,6 +1,7 @@ import { useEffect } from "react"; - import { Trans, useTranslation } from "react-i18next"; +import { useSearchParams } from "react-router-dom"; + import { appCSS, headerCSS, @@ -20,11 +21,12 @@ import text from "./assets/text.svg"; export default function ComingSoon() { const { t, i18n } = useTranslation(); + const [searchParams] = useSearchParams(); useEffect(() => { - i18n.changeLanguage(navigator.language.split("-")[0]); + i18n.changeLanguage(searchParams.get('lang') || navigator.language.split("-")[0]); - document.documentElement.lang = navigator.language.split("-")[0]; + document.documentElement.lang = searchParams.get('lang') || navigator.language.split("-")[0]; document.title = i18n.t("comingsoon.title").replace("<1>", "").replace("", ""); }, [i18n]); diff --git a/src/maintenance.tsx b/src/maintenance.tsx index 1523337..c239f95 100644 --- a/src/maintenance.tsx +++ b/src/maintenance.tsx @@ -1,6 +1,7 @@ import { useEffect } from "react"; - import { Trans, useTranslation } from "react-i18next"; +import { useSearchParams } from "react-router-dom"; + import { appCSS, headerCSS, @@ -20,11 +21,12 @@ import text from "./assets/text.svg"; export default function Maintenance() { const { t, i18n } = useTranslation(); + const [searchParams] = useSearchParams(); useEffect(() => { - i18n.changeLanguage(navigator.language.split("-")[0]); + i18n.changeLanguage(searchParams.get('lang') || navigator.language.split("-")[0]); - document.documentElement.lang = navigator.language.split("-")[0]; + document.documentElement.lang = searchParams.get('lang') || navigator.language.split("-")[0]; document.title = i18n.t("maintenance.title").replace("<1>", "").replace("", ""); }, [i18n]);