File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
2
import i18n from '../../i18n' ;
3
3
//import { useTranslation } from 'react-i18next';
4
- import { redirect } from 'react-router-dom' ;
4
+ import { redirect , redirectDocument , replace } from 'react-router-dom' ;
5
5
6
6
import "./Language.scss" ;
7
7
@@ -20,14 +20,13 @@ const Language: React.FC<LanguageProps> = ({ changeLanguage }) => {
20
20
21
21
const currentPath = window . location . href ;
22
22
let newUrl = '' ;
23
-
23
+
24
24
if ( lng === 'en' ) {
25
- newUrl = currentPath . replace ( '\.fr' , '\ .com' ) ;
25
+ newUrl = currentPath . replace ( '\.fr' , '.com' ) ;
26
26
} else {
27
- newUrl = currentPath . replace ( '\.com' , '\ .fr' ) ;
27
+ newUrl = currentPath . replace ( '\.com' , '.fr' ) ;
28
28
}
29
-
30
- redirect ( newUrl ) ;
29
+ window . location . href = newUrl ;
31
30
} ;
32
31
33
32
return (
You can’t perform that action at this time.
0 commit comments