From e0e9d5ef8cd7b9d64778cef85a4ffb37b323c8b0 Mon Sep 17 00:00:00 2001 From: Alexandra Goff Date: Thu, 15 Aug 2024 13:48:01 -0700 Subject: [PATCH] chore: remove deprecated language updater --- lib/i18n/client.js | 4 ---- pages/[locale]/[[...uriSegments]].js | 3 --- pages/_error.js | 2 -- 3 files changed, 9 deletions(-) diff --git a/lib/i18n/client.js b/lib/i18n/client.js index a25a4a28..4ee56540 100644 --- a/lib/i18n/client.js +++ b/lib/i18n/client.js @@ -13,10 +13,6 @@ import { loadResources } from "./index"; const runsOnServerSide = typeof window === "undefined"; -export const updateI18n = (lang) => { - i18n.language !== lang && i18n.changeLanguage(lang); -}; - i18n .use(initReactI18next) // passes i18n down to react-i18next .use(LanguageDetector) diff --git a/pages/[locale]/[[...uriSegments]].js b/pages/[locale]/[[...uriSegments]].js index d6212f76..09f5d2e5 100644 --- a/pages/[locale]/[[...uriSegments]].js +++ b/pages/[locale]/[[...uriSegments]].js @@ -24,7 +24,6 @@ import internalLinkShape, { import siteInfoShape from "@/shapes/siteInfo"; import footerContentShape from "@/shapes/footerContent"; import rootPagesShape from "@/shapes/rootPages"; -import { updateI18n } from "@/lib/i18n/client"; import { setEdcLog } from "@/lib/edc-log"; import { purgeNextjsStaticFiles } from "@/lib/purgeStaticFiles"; const glob = require("glob"); @@ -61,8 +60,6 @@ function logNextDir() { const GOOGLE_APP_ID = process.env.NEXT_PUBLIC_GOOGLE_APP_ID; export default function Page({ section, globalData, ...entryProps }) { - globalData.localeInfo.locale === "es" ? updateI18n("es") : updateI18n("en"); - const sectionMap = { events: EventPageTemplate, galleryItems: GalleryPageTemplate, diff --git a/pages/_error.js b/pages/_error.js index 89592425..e84db6e4 100644 --- a/pages/_error.js +++ b/pages/_error.js @@ -1,7 +1,6 @@ import { useEffect, useState } from "react"; import PropTypes from "prop-types"; import { useGlobalData } from "@/lib/api/global"; -import { updateI18n } from "@/lib/i18n/client"; import { GlobalDataProvider } from "@/contexts/GlobalData"; import ErrorPageTemplate from "@/components/templates/ErrorPage"; import { useTranslation } from "react-i18next"; @@ -11,7 +10,6 @@ export default function Error({ statusCode }) { let globalData = {}; const [lang, setLang] = useState("en"); const [error, setError] = useState("page-not-found"); - updateI18n(lang); const { t } = useTranslation(); const errorData = { title: t(`${error}-title`),