Skip to content

Commit 58e2feb

Browse files
brunoborgesCopilot
andcommitted
Fix locale picker navigation on step.html pages
The JS was using index.html-specific path logic that broke on step.html. Now uses lastIndexOf('/') to correctly insert locale before the filename: /repo/step.html → /repo/es/step.html Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 49ceba8 commit 58e2feb

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

docs/step.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -547,10 +547,10 @@ <h1>Error Loading Content</h1>
547547
var t=li.dataset.locale==='pt-BR'?'pt_BR':li.dataset.locale;
548548
if(t===locale){close();return;}
549549
var p=location.pathname;
550-
if(locale!=='en')p=p.replace(new RegExp('/'+locale+'/'),'/');;
551-
if(t!=='en'){var base=p.replace(/\/index\.html$/,'/');if(!base.endsWith('/'))base+='/';p=base+t+'/';}
550+
if(locale!=='en')p=p.replace(new RegExp('/'+locale+'/'),'/');
551+
if(t!=='en'){var ls=p.lastIndexOf('/');p=p.substring(0,ls+1)+t+p.substring(ls);}
552552
localStorage.setItem('preferred-locale',t);
553-
window.location.href=p;
553+
window.location.href=p+location.search;
554554
});
555555
});
556556
})();

0 commit comments

Comments
 (0)