We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8863812 commit 5f17ba5Copy full SHA for 5f17ba5
src/features/navigation/usePathWithoutLocale.tsx
@@ -1,7 +1,11 @@
1
import { useMatches } from 'react-router-dom';
2
+import i18n from 'src/i18n';
3
4
export const usePathWithoutLocale = () => {
- const [locale, ...matches] = useMatches();
5
+ const [, ...matches] = useMatches();
6
+ const currentLanguage = i18n.language === 'en' ? '' : `/${i18n.language}`;
7
+
8
if (!matches.length) return false;
- return matches[matches.length - 1].pathname.replace(locale.pathname, '');
9
10
+ return matches[matches.length - 1].pathname.replace(currentLanguage, '');
11
};
0 commit comments