[bugfix] Fix the bug that the component was not re-rendering when even the Ui language is changed.
This commit is contained in:
@@ -25,7 +25,8 @@ i18n
|
|||||||
debug: true,
|
debug: true,
|
||||||
interpolation: {
|
interpolation: {
|
||||||
escapeValue: false // react already safes from xss
|
escapeValue: false // react already safes from xss
|
||||||
}
|
},
|
||||||
|
// react: { useSuspense: false },
|
||||||
});
|
});
|
||||||
|
|
||||||
export default i18n;
|
export default i18n;
|
||||||
|
|||||||
22
package-lock.json
generated
22
package-lock.json
generated
@@ -22,7 +22,7 @@
|
|||||||
"js-base64": "^3.7.7",
|
"js-base64": "^3.7.7",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-i18next": "^14.1.2",
|
"react-i18next": "^15.1.1",
|
||||||
"react-resizable-layout": "^0.7.2"
|
"react-resizable-layout": "^0.7.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -2628,9 +2628,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/cross-spawn": {
|
"node_modules/cross-spawn": {
|
||||||
"version": "7.0.3",
|
"version": "7.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
|
||||||
"integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==",
|
"integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"path-key": "^3.1.0",
|
"path-key": "^3.1.0",
|
||||||
"shebang-command": "^2.0.0",
|
"shebang-command": "^2.0.0",
|
||||||
@@ -4569,9 +4569,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/npm-run-all/node_modules/cross-spawn": {
|
"node_modules/npm-run-all/node_modules/cross-spawn": {
|
||||||
"version": "6.0.5",
|
"version": "6.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.6.tgz",
|
||||||
"integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==",
|
"integrity": "sha512-VqCUuhcd1iB+dsv8gxPttb5iZh/D0iubSP21g36KXdEuf6I5JiioesUVjpCdHV9MZRUfVFlvwtIUyPfxo5trtw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"nice-try": "^1.0.4",
|
"nice-try": "^1.0.4",
|
||||||
@@ -5001,11 +5001,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/react-i18next": {
|
"node_modules/react-i18next": {
|
||||||
"version": "14.1.3",
|
"version": "15.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-14.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-15.1.1.tgz",
|
||||||
"integrity": "sha512-wZnpfunU6UIAiJ+bxwOiTmBOAaB14ha97MjOEnLGac2RJ+h/maIYXZuTHlmyqQVX1UVHmU1YDTQ5vxLmwfXTjw==",
|
"integrity": "sha512-R/Vg9wIli2P3FfeI8o1eNJUJue5LWpFsQePCHdQDmX0Co3zkr6kdT8gAseb/yGeWbNz1Txc4bKDQuZYsC0kQfw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.23.9",
|
"@babel/runtime": "^7.25.0",
|
||||||
"html-parse-stringify": "^3.0.1"
|
"html-parse-stringify": "^3.0.1"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
"js-base64": "^3.7.7",
|
"js-base64": "^3.7.7",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-i18next": "^14.1.2",
|
"react-i18next": "^15.1.1",
|
||||||
"react-resizable-layout": "^0.7.2"
|
"react-resizable-layout": "^0.7.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import { useEffect, useRef } from "react";
|
import { useEffect, useRef } from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
import { useStartPython } from "@logics/useStartPython";
|
import { useStartPython } from "@logics/useStartPython";
|
||||||
import { WindowTitleBar } from "./window_title_bar/WindowTitleBar";
|
import { WindowTitleBar } from "./window_title_bar/WindowTitleBar";
|
||||||
import { MainPage } from "./main_page/MainPage";
|
import { MainPage } from "./main_page/MainPage";
|
||||||
@@ -11,6 +13,7 @@ import { useIsBackendReady } from "@logics_common";
|
|||||||
export const App = () => {
|
export const App = () => {
|
||||||
const { currentIsBackendReady } = useIsBackendReady();
|
const { currentIsBackendReady } = useIsBackendReady();
|
||||||
const { WindowGeometryController } = useWindow();
|
const { WindowGeometryController } = useWindow();
|
||||||
|
const { i18n } = useTranslation();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.container}>
|
<div className={styles.container}>
|
||||||
@@ -24,7 +27,7 @@ export const App = () => {
|
|||||||
|
|
||||||
{currentIsBackendReady.data === false
|
{currentIsBackendReady.data === false
|
||||||
? <SplashComponent />
|
? <SplashComponent />
|
||||||
: <Contents />
|
: <Contents key={i18n.language}/>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -80,12 +83,13 @@ const StartPythonFacadeComponent = () => {
|
|||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
import { useTranslation } from "react-i18next";
|
|
||||||
const UiLanguageController = () => {
|
const UiLanguageController = () => {
|
||||||
const { currentUiLanguage } = useUiLanguage();
|
const { currentUiLanguage } = useUiLanguage();
|
||||||
const { i18n } = useTranslation();
|
const { i18n } = useTranslation();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
console.log(currentUiLanguage.data);
|
||||||
|
|
||||||
i18n.changeLanguage(currentUiLanguage.data);
|
i18n.changeLanguage(currentUiLanguage.data);
|
||||||
}, [currentUiLanguage.data]);
|
}, [currentUiLanguage.data]);
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user