File tree Expand file tree Collapse file tree 1 file changed +4
-11
lines changed Expand file tree Collapse file tree 1 file changed +4
-11
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import styles from './styles.module.css';
15
15
import Translate from "@docusaurus/Translate" ;
16
16
import IconClose from "@theme/Icon/Close" ;
17
17
import { useLocation } from "@docusaurus/router" ;
18
+ import useDocusaurusContext from "@docusaurus/useDocusaurusContext" ;
18
19
/**
19
20
* Decide if the toc should be rendered, on mobile or desktop viewports
20
21
*/
@@ -42,6 +43,8 @@ export default function DocItemLayout({children}) {
42
43
const { editUrl} = metadata ;
43
44
44
45
const location = useLocation ( ) ;
46
+ const context = useDocusaurusContext ( ) ;
47
+
45
48
const [ showPopup , setShowPopup ] = useState ( false )
46
49
useEffect ( ( ) => {
47
50
@@ -56,17 +59,7 @@ export default function DocItemLayout({children}) {
56
59
isDocsHome = true
57
60
}
58
61
59
- const locales = [ '/ru/' , '/jp/' , '/zh/' ]
60
- let isEnglish = true ;
61
- console . log ( location . pathname )
62
- locales . forEach ( ( locale ) => {
63
- if ( location . pathname . includes ( locale ) ) {
64
- isEnglish = false ;
65
- }
66
- } )
67
- console . log ( 'isEnglish' , isEnglish )
68
-
69
- if ( isEnglish ) {
62
+ if ( context . i18n . currentLocale === 'en' ) {
70
63
setShowPopup ( false ) ;
71
64
} else {
72
65
if ( ( isDocsHome && ! userClosed ) ) {
You can’t perform that action at this time.
0 commit comments