Skip to content

Commit fe94df7

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 a21814e commit fe94df7

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
@@ -553,10 +553,10 @@ <h1>Error Loading Content</h1>
553553
var t=li.dataset.locale==='pt-BR'?'pt_BR':li.dataset.locale;
554554
if(t===locale){close();return;}
555555
var p=location.pathname;
556-
if(locale!=='en')p=p.replace(new RegExp('/'+locale+'/'),'/');;
557-
if(t!=='en'){var base=p.replace(/\/index\.html$/,'/');if(!base.endsWith('/'))base+='/';p=base+t+'/';}
556+
if(locale!=='en')p=p.replace(new RegExp('/'+locale+'/'),'/');
557+
if(t!=='en'){var ls=p.lastIndexOf('/');p=p.substring(0,ls+1)+t+p.substring(ls);}
558558
localStorage.setItem('preferred-locale',t);
559-
window.location.href=p;
559+
window.location.href=p+location.search;
560560
});
561561
});
562562
})();

0 commit comments

Comments
 (0)