feat: Enhance HeaderBar to support language change messaging
- Added functionality to post a message to the iframe when the language is changed. - This update improves localization support by ensuring that the iframe content updates according to the selected language.
This commit is contained in:
@@ -105,6 +105,10 @@ const HeaderBar = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleLanguageChanged = (lng) => {
|
const handleLanguageChanged = (lng) => {
|
||||||
setCurrentLang(lng);
|
setCurrentLang(lng);
|
||||||
|
const iframe = document.querySelector('iframe');
|
||||||
|
if (iframe) {
|
||||||
|
iframe.contentWindow.postMessage({ lang: lng }, '*');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
i18n.on('languageChanged', handleLanguageChanged);
|
i18n.on('languageChanged', handleLanguageChanged);
|
||||||
|
|||||||
Reference in New Issue
Block a user