From 3bbd99cc798a54ec44585f5deeff816492719745 Mon Sep 17 00:00:00 2001 From: Korbs Date: Sat, 13 Jul 2024 16:09:13 -0400 Subject: [PATCH] Update cookie check --- src/components/global/Head.astro | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/global/Head.astro b/src/components/global/Head.astro index 495e94e..8f3a786 100644 --- a/src/components/global/Head.astro +++ b/src/components/global/Head.astro @@ -7,6 +7,10 @@ import i18next, { t } from "i18next"; //// If the user is new to the site, set English as default if (Astro.cookies.get("Language") === undefined) { Astro.cookies.set("Language", "EN", {path: "/",sameSite: 'strict'}) +} else { + var UserLanguage = Astro.cookies.get("Language").value + if (UserLanguage === "JP") {i18next.changeLanguage("jp")} + else if (UserLanguage === "EN") {i18next.changeLanguage("en")} } /// Telemtry @@ -16,9 +20,7 @@ if (Astro.cookies.get("Telemtry") === undefined) { } //// Check what language the user has set it to and switch to it -var UserLanguage = Astro.cookies.get("Language").value -if (UserLanguage === "JP") {i18next.changeLanguage("jp")} -else if (UserLanguage === "EN") {i18next.changeLanguage("en")} + // Properties const {