From dbe6c71d33ee6bd403b42f898cb47b71762cb0d5 Mon Sep 17 00:00:00 2001 From: PaulVua Date: Tue, 17 Mar 2026 18:40:11 +0100 Subject: [PATCH] Fix: re-appliquer i18n apres chargement dynamique sidebar/topbar Les textes data-i18n de la sidebar etaient vides car les traductions s'appliquaient avant que la sidebar soit chargee via fetch. topbar-logo.js re-applique maintenant les traductions via son MutationObserver, ce qui corrige le probleme sur toutes les pages. Co-Authored-By: Claude Opus 4.6 (1M context) --- html/assets/js/topbar-logo.js | 5 +++++ html/wifi.html | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/html/assets/js/topbar-logo.js b/html/assets/js/topbar-logo.js index 6b924a2..c377130 100644 --- a/html/assets/js/topbar-logo.js +++ b/html/assets/js/topbar-logo.js @@ -70,5 +70,10 @@ document.addEventListener('DOMContentLoaded', () => { document.querySelectorAll('.sidebar-hotspot-badge').forEach(badge => { badge.style.display = (config.WIFI_status === 'hotspot') ? '' : 'none'; }); + + // 5. Re-apply i18n translations for dynamically loaded elements (sidebar, topbar) + if (window.i18n && typeof window.i18n.applyTranslations === 'function') { + window.i18n.applyTranslations(); + } } }); diff --git a/html/wifi.html b/html/wifi.html index e5c376a..fe471f5 100755 --- a/html/wifi.html +++ b/html/wifi.html @@ -227,6 +227,10 @@ .then(data => { document.getElementById('sidebar').innerHTML = data; document.getElementById('sidebar_mobile').innerHTML = data; + // Re-apply translations to dynamically loaded sidebar + if (typeof i18n !== 'undefined' && i18n.translations) { + i18n.applyTranslations(); + } }) .catch(e => console.error('Error loading sidebar:', e));