We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 48b326b commit 2fb7482Copy full SHA for 2fb7482
1 file changed
src/components/LanguageSelector.js
@@ -15,10 +15,13 @@ const LanguageSelector = ({ className }) => {
15
16
// Node and the browser differs in the pathname as node has a trailing slash
17
// This streamlines the pathname to not have a trailing slash.
18
- const realPath =
+ const cleanPath =
19
pathname[pathname.length - 1] === '/' ? pathname.slice(0, -1) : pathname;
20
21
- const path = locale === 'en' ? realPath : realPath.replace(`${locale}/`, '');
+ let path = locale === 'en' ? cleanPath : cleanPath.replace(`/${locale}`, '');
22
+ if (path === '') {
23
+ path = '/';
24
+ }
25
26
const onToggle = () => {
27
setOpen(!open);
0 commit comments