Przeglądaj źródła

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.
CalciumIon 1 rok temu
rodzic
commit
fd86de19b5
1 zmienionych plików z 4 dodań i 0 usunięć
  1. 4 0
      web/src/components/HeaderBar.js

+ 4 - 0
web/src/components/HeaderBar.js

@@ -105,6 +105,10 @@ const HeaderBar = () => {
   useEffect(() => {
     const handleLanguageChanged = (lng) => {
       setCurrentLang(lng);
+      const iframe = document.querySelector('iframe');
+      if (iframe) {
+        iframe.contentWindow.postMessage({ lang: lng }, '*');
+      }
     };
 
     i18n.on('languageChanged', handleLanguageChanged);