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';
1515import Translate from "@docusaurus/Translate" ;
1616import IconClose from "@theme/Icon/Close" ;
1717import { useLocation } from "@docusaurus/router" ;
18+ import useDocusaurusContext from "@docusaurus/useDocusaurusContext" ;
1819/**
1920 * Decide if the toc should be rendered, on mobile or desktop viewports
2021 */
@@ -42,6 +43,8 @@ export default function DocItemLayout({children}) {
4243 const { editUrl} = metadata ;
4344
4445 const location = useLocation ( ) ;
46+ const context = useDocusaurusContext ( ) ;
47+
4548 const [ showPopup , setShowPopup ] = useState ( false )
4649 useEffect ( ( ) => {
4750
@@ -56,17 +59,7 @@ export default function DocItemLayout({children}) {
5659 isDocsHome = true
5760 }
5861
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' ) {
7063 setShowPopup ( false ) ;
7164 } else {
7265 if ( ( isDocsHome && ! userClosed ) ) {
You can’t perform that action at this time.
0 commit comments