Let JS own the live status labels instead of sharing them with data-i18n
#chain-status-label and #draw-label carried a data-i18n attribute *and* were written from live state by app.js, so a language switch had both mechanisms fighting over them: applyStaticTranslations reset each to its static default and the next poll put the real value back. On the draw label that was a flicker. On the status bar it was a false statement — with the connection down, the bar went back to claiming "connecting" until a further fetch failed, up to a full poll interval later. The attribute is gone from both. The status bar is now rendered from remembered state (last payload, plus whether we're in the offline state) rather than straight from the response that triggered it, so a language switch repaints it correctly and immediately, with no fetch involved. logout() also stops wiping the chosen language: localStorage.clear() took plm_lang with it, dropping the user back to the browser-detected default on the one screen where they'd have to go find the switcher again. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -59,7 +59,10 @@
|
||||
<div class="chain-bar" id="chain-bar">
|
||||
<span class="chain-status-pill">
|
||||
<span class="status-dot" id="chain-status-dot"></span>
|
||||
<span id="chain-status-label" data-i18n="chain.connecting">Connecting…</span>
|
||||
<!-- No data-i18n on this one or on #draw-label below: both are written by
|
||||
app.js from live state, and letting applyStaticTranslations() also own
|
||||
them made a language switch flash (or, here, assert) a stale value. -->
|
||||
<span id="chain-status-label">Connecting…</span>
|
||||
</span>
|
||||
<span class="chain-bar-right">
|
||||
<span class="chain-block mono" id="chain-block">—</span>
|
||||
@@ -157,7 +160,7 @@
|
||||
|
||||
<div class="draw-state" id="draw-state">
|
||||
<div class="draw-spinner"></div>
|
||||
<div class="draw-label" id="draw-label" data-i18n="draw.defaultLabel">Estrazione del vincitore in corso…</div>
|
||||
<div class="draw-label" id="draw-label">Drawing the winner…</div>
|
||||
</div>
|
||||
|
||||
<div class="hidden" id="draw-result"></div>
|
||||
|
||||
Reference in New Issue
Block a user