Revert "i18n: add diagnostic logging to localizer + lang-toggle click path"
This reverts commit 74b61a59ed.
This commit is contained in:
parent
74b61a59ed
commit
f9d448d57b
2 changed files with 8 additions and 28 deletions
|
|
@ -143,11 +143,12 @@
|
|||
};
|
||||
|
||||
window.cassandraSetLang = async function (newLang) {
|
||||
console.log('[lang] click', newLang);
|
||||
var pill = document.getElementById('lang-toggle');
|
||||
if (!pill) { console.warn('[lang] no pill element'); return; }
|
||||
if (!pill) return;
|
||||
var prev = pill.dataset.lang;
|
||||
if (prev === newLang) { console.log('[lang] already', newLang); return; }
|
||||
if (prev === newLang) return;
|
||||
// Optimistic update — flip the pill immediately so the click feels
|
||||
// responsive. Revert on PATCH failure.
|
||||
pill.dataset.lang = newLang;
|
||||
try {
|
||||
var r = await fetch('/api/settings/language', {
|
||||
|
|
@ -156,17 +157,18 @@
|
|||
credentials: 'same-origin',
|
||||
body: JSON.stringify({lang: newLang}),
|
||||
});
|
||||
console.log('[lang] PATCH', r.status);
|
||||
if (!r.ok) throw new Error('HTTP ' + r.status);
|
||||
// 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);
|
||||
console.log('[lang] trigger', sel, 'found:', !!el, 'htmx:', !!window.htmx);
|
||||
if (el && window.htmx) window.htmx.trigger(el, 'lang-changed');
|
||||
});
|
||||
} catch (e) {
|
||||
pill.dataset.lang = prev;
|
||||
console.warn('[lang] switch failed:', e);
|
||||
console.warn('language switch failed:', e);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue