feat: Enhance Home component to support language messaging
- Added language messaging functionality to the iframe in the Home component. - This update ensures that the iframe receives the current language setting, improving localization support.
This commit is contained in:
@@ -7,7 +7,7 @@ import { StyleContext } from '../../context/Style/index.js';
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
const Home = () => {
|
const Home = () => {
|
||||||
const { t } = useTranslation();
|
const { t, i18n } = useTranslation();
|
||||||
const [statusState] = useContext(StatusContext);
|
const [statusState] = useContext(StatusContext);
|
||||||
const [homePageContentLoaded, setHomePageContentLoaded] = useState(false);
|
const [homePageContentLoaded, setHomePageContentLoaded] = useState(false);
|
||||||
const [homePageContent, setHomePageContent] = useState('');
|
const [homePageContent, setHomePageContent] = useState('');
|
||||||
@@ -49,6 +49,7 @@ const Home = () => {
|
|||||||
// console.log('Sending theme-mode to iframe:', theme);
|
// console.log('Sending theme-mode to iframe:', theme);
|
||||||
iframe.onload = () => {
|
iframe.onload = () => {
|
||||||
iframe.contentWindow.postMessage({ themeMode: theme }, '*');
|
iframe.contentWindow.postMessage({ themeMode: theme }, '*');
|
||||||
|
iframe.contentWindow.postMessage({ lang: i18n.language }, '*');
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user