BugFix: switching locale for home page did not work

This commit is contained in:
2024-02-17 09:48:27 +01:00
parent cc8c6968f6
commit db42fa29dd

View File

@@ -10,7 +10,7 @@ export const SelectLanguage: React.FC = () => {
const currentLocale = useLocale(); const currentLocale = useLocale();
const secondLocale = locales.find((l) => l !== currentLocale) as string; const secondLocale = locales.find((l) => l !== currentLocale) as string;
const secondLocalePathname = defaultLocale === currentLocale ? `/${secondLocale}${currentPathname}` : currentPathname.replace(`/${currentLocale}/`, `/${secondLocale}/`); const secondLocalePathname = defaultLocale === currentLocale ? `/${secondLocale}${currentPathname}` : currentPathname.replace(`/${currentLocale}`, `/${secondLocale}`);
return (<Link className="btn btn-ghost text-xl self-end" href={secondLocalePathname}>{localeNames[secondLocale]}</Link>); return (<Link className="btn btn-ghost text-xl self-end" href={secondLocalePathname}>{localeNames[secondLocale]}</Link>);
} }