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) <noreply@anthropic.com>
This commit is contained in:
@@ -70,5 +70,10 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
document.querySelectorAll('.sidebar-hotspot-badge').forEach(badge => {
|
document.querySelectorAll('.sidebar-hotspot-badge').forEach(badge => {
|
||||||
badge.style.display = (config.WIFI_status === 'hotspot') ? '' : 'none';
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -227,6 +227,10 @@
|
|||||||
.then(data => {
|
.then(data => {
|
||||||
document.getElementById('sidebar').innerHTML = data;
|
document.getElementById('sidebar').innerHTML = data;
|
||||||
document.getElementById('sidebar_mobile').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));
|
.catch(e => console.error('Error loading sidebar:', e));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user