From e9a8c69acda5eb08ca3777547ea4de212afaccd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Rialland?= Date: Wed, 14 Jun 2023 13:00:39 +0200 Subject: [PATCH] Fix lang switch --- site/source/components/layout/Footer/Footer.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/site/source/components/layout/Footer/Footer.tsx b/site/source/components/layout/Footer/Footer.tsx index 386d644be..39b1fe91e 100644 --- a/site/source/components/layout/Footer/Footer.tsx +++ b/site/source/components/layout/Footer/Footer.tsx @@ -29,11 +29,10 @@ export default function Footer() { const path = pathname.replace(/^\/(mon-entreprise|infrance)/, '') const altLang = language === 'en' ? 'fr' : 'en' const altHref = - (import.meta.env.DEV && typeof window !== 'undefined' - ? language === 'en' - ? '/mon-entreprise' - : '/infrance' - : '') + altPathname[language][path] ?? altPathname[language][path + '/'] + (language === 'en' + ? import.meta.env.VITE_FR_BASE_URL + : import.meta.env.VITE_EN_BASE_URL) + altPathname[language][path] ?? + altPathname[language][path + '/'] const isFrenchMode = language === 'fr'