Skip to content

Commit 8f40ec6

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 3ec23f9 commit 8f40ec6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/step.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -512,10 +512,10 @@ <h1>Error Loading Content</h1>
512512
var t=li.dataset.locale==='pt-BR'?'pt_BR':li.dataset.locale;
513513
if(t===locale){close();return;}
514514
var p=location.pathname;
515-
if(locale!=='en')p=p.replace(new RegExp('/'+locale+'/'),'/');;
516-
if(t!=='en'){var base=p.replace(/\/index\.html$/,'/');if(!base.endsWith('/'))base+='/';p=base+t+'/';}
515+
if(locale!=='en')p=p.replace(new RegExp('/'+locale+'/'),'/');
516+
if(t!=='en'){var ls=p.lastIndexOf('/');p=p.substring(0,ls+1)+t+p.substring(ls);}
517517
localStorage.setItem('preferred-locale',t);
518-
window.location.href=p;
518+
window.location.href=p+location.search;
519519
});
520520
});
521521
})();

0 commit comments

Comments
 (0)