Skip to content

Commit 071aa94

Browse files
committed
remove logging and simplify using useDocusaurusContext hook
1 parent b3ee43e commit 071aa94

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/theme/DocItem/Layout/index.js

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import styles from './styles.module.css';
1515
import Translate from "@docusaurus/Translate";
1616
import IconClose from "@theme/Icon/Close";
1717
import {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)) {

0 commit comments

Comments
 (0)