i18n: instant lang switch via HTMX trigger + refresh paid-plans terms
This commit is contained in:
parent
f4d9c9f2ec
commit
e4dc6d0071
4 changed files with 22 additions and 25 deletions
|
|
@ -158,12 +158,14 @@
|
|||
body: JSON.stringify({lang: newLang}),
|
||||
});
|
||||
if (!r.ok) throw new Error('HTTP ' + r.status);
|
||||
// Reload localized panels so the user immediately sees content
|
||||
// in the new language (strategic log, dashboard header, etc.).
|
||||
if (window.location.pathname === '/log' ||
|
||||
window.location.pathname.startsWith('/log/')) {
|
||||
window.location.reload();
|
||||
}
|
||||
// Trigger HTMX-driven panels to re-fetch in the new language.
|
||||
// Same shape as cassandraSetTone — every panel that listens to
|
||||
// tone-changed also listens to lang-changed.
|
||||
['#dash-header-container', '#log-panel .panel-body',
|
||||
'#indicators-body', '#log-content'].forEach(function (sel) {
|
||||
var el = document.querySelector(sel);
|
||||
if (el && window.htmx) window.htmx.trigger(el, 'lang-changed');
|
||||
});
|
||||
} catch (e) {
|
||||
pill.dataset.lang = prev;
|
||||
console.warn('language switch failed:', e);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue