Commit d0d8f6eb by CalciumIon

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.
parent fd2f6ed4
...@@ -105,6 +105,10 @@ const HeaderBar = () => { ...@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment