BugFix: switching locale for home page did not work
This commit is contained in:
@@ -10,7 +10,7 @@ export const SelectLanguage: React.FC = () => {
|
||||
|
||||
const currentLocale = useLocale();
|
||||
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>);
|
||||
}
|
||||
Reference in New Issue
Block a user