Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zbeyens committed Dec 25, 2024
1 parent f837f4f commit 8206fea
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions apps/www/src/components/languages-dropdown-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ export function LanguagesDropdownMenu() {
} else {
if (!pathname?.includes('cn')) return;
if (pathname) {
const isHomePage = pathname.split('/').filter((p) => !!p).length === 1;

url.pathname = isHomePage ? '/' : (pathname.split('/').at(-1) ?? '/');
const segments = pathname.split('/').filter((p) => !!p);
const newSegments = segments.filter((segment) => segment !== 'cn');
url.pathname =
newSegments.length > 0 ? `/${newSegments.join('/')}` : '/';
}

url.searchParams.delete('locale');
Expand Down

0 comments on commit 8206fea

Please sign in to comment.