mirror of
https://github.com/vercel/commerce.git
synced 2025-05-15 05:56:59 +00:00
Update locale-switcher.tsx
This commit is contained in:
parent
e703943014
commit
e1f0d4e54c
@ -28,7 +28,7 @@ export default function LocaleSwitcher() {
|
|||||||
|
|
||||||
// const translations = localeData.translations;
|
// const translations = localeData.translations;
|
||||||
|
|
||||||
const redirectedPathName = () => {
|
const redirectedPathName = (locale: string) => {
|
||||||
if (!pathName) return '/';
|
if (!pathName) return '/';
|
||||||
|
|
||||||
// if (translations.length > 0) {
|
// if (translations.length > 0) {
|
||||||
@ -43,7 +43,7 @@ export default function LocaleSwitcher() {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
return `/`;
|
return `/${locale}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
@ -67,7 +67,7 @@ export default function LocaleSwitcher() {
|
|||||||
className={`flex w-full cursor-pointer items-center px-4 py-2 text-sm ${
|
className={`flex w-full cursor-pointer items-center px-4 py-2 text-sm ${
|
||||||
currentLocale == locale.id && 'font-bold'
|
currentLocale == locale.id && 'font-bold'
|
||||||
}`}
|
}`}
|
||||||
href={redirectedPathName()}
|
href={redirectedPathName(locale.id)}
|
||||||
>
|
>
|
||||||
{locale.title}
|
{locale.title}
|
||||||
</Link>
|
</Link>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user