@@ -4,7 +4,10 @@ const currentPath = Astro.url.pathname;
44const isJa = currentPath .includes (' /ja/' ) || currentPath .endsWith (' /ja' );
55const homeHref = isJa ? ` ${base }ja/ ` : base ;
66const langLabel = isJa ? ' English' : ' 日本語' ;
7- const altPath = isJa ? base : ` ${base }ja/ ` ;
7+ // Switch language while staying on the same page
8+ const altPath = isJa
9+ ? currentPath .replace (` ${base }ja/ ` , base )
10+ : currentPath .replace (base , ` ${base }ja/ ` );
811---
912
1013<header class =" fixed top-0 left-0 right-0 z-50 border-b border-border bg-bg/80 backdrop-blur-md" >
@@ -27,7 +30,7 @@ const altPath = isJa ? base : `${base}ja/`;
2730
2831 <nav class =" hidden md:flex items-center gap-6" >
2932 <a
30- href ={ ` ${base }docs/getting-started/ ` }
33+ href ={ isJa ? ` ${ base }ja/docs/getting-started/ ` : ` ${base }docs/getting-started/ ` }
3134 class:list ={ [' text-sm font-medium transition-colors no-underline' , currentPath .includes (' /docs' ) ? ' text-text' : ' text-text-secondary hover:text-text' ]}
3235 >
3336 Docs
@@ -79,7 +82,7 @@ const altPath = isJa ? base : `${base}ja/`;
7982 <!-- Mobile menu -->
8083 <div id =" mobile-menu" class =" md:hidden hidden border-t border-border bg-bg/95 backdrop-blur-md" >
8184 <nav class =" flex flex-col p-4 gap-3" >
82- <a href ={ ` ${base }docs/getting-started/ ` } class =" text-sm font-medium text-text-secondary hover:text-text no-underline" >Docs</a >
85+ <a href ={ isJa ? ` ${ base }ja/docs/getting-started/ ` : ` ${base }docs/getting-started/ ` } class =" text-sm font-medium text-text-secondary hover:text-text no-underline" >Docs</a >
8386 <a href ={ isJa ? ` ${base }ja/playground/ ` : ` ${base }playground/ ` } class =" text-sm font-medium text-text-secondary hover:text-text no-underline" >Playground</a >
8487 <a href =" https://www.npmjs.com/package/data-chart" target =" _blank" rel =" noopener noreferrer" class =" text-sm font-medium text-text-secondary hover:text-text no-underline" >npm</a >
8588 <a href =" https://github.com/ryo-manba/data-chart" target =" _blank" rel =" noopener noreferrer" class =" text-sm font-medium text-text-secondary hover:text-text no-underline" >GitHub</a >
0 commit comments