fix: apply locale to DOM immediately on save — no reload needed
Add applyLocaleToDOM() which walks [data-i18n] elements and re-stamps their textContent from t(). Called after setLocale() in saveSettings() so the settings panel labels, checkboxes, and save button update live. Also called on boot after /api/settings resolves so Chinese persists without flicker on reload. - static/i18n.js: add applyLocaleToDOM() function - static/index.html: add data-i18n attributes to all settings panel static text nodes (labels, checkbox spans, save button) - static/panels.js: call applyLocaleToDOM() + syncTopbar() after save - static/boot.js: call applyLocaleToDOM() alongside setLocale() on boot
This commit is contained in:
@@ -1098,9 +1098,11 @@ async function saveSettings(andClose){
|
||||
window._botName=body.bot_name;
|
||||
if(typeof applyBotName==='function') applyBotName();
|
||||
if(typeof setLocale==='function') setLocale(language);
|
||||
if(typeof applyLocaleToDOM==='function') applyLocaleToDOM();
|
||||
_settingsDirty=false; _settingsThemeOnOpen=theme;
|
||||
const bar=$('settingsUnsavedBar'); if(bar) bar.style.display='none';
|
||||
renderMessages();
|
||||
if(typeof syncTopbar==='function') syncTopbar();
|
||||
if(typeof renderSessionList==='function') renderSessionList();
|
||||
showToast(t('settings_saved'));
|
||||
$('settingsOverlay').style.display='none';
|
||||
|
||||
Reference in New Issue
Block a user