// Static markup: elements with data-i18n="label" get their text, and data-i18n-aria-label / data-i18n-title // their attribute, from the dictionary once at boot. The English stays in the markup for search engines. function i18nDom(){if(LANG==='en')return;for(const el of document.querySelectorAll('[data-i18n]'))el.textContent=tr(el.dataset.i18n); for(const a of ['aria-label','title'])for(const el of document.querySelectorAll(`[data-i18n-${a}]`))el.setAttribute(a,tr(el.getAttribute('data-i18n-'+a)));} // One button per [value,label] option; the current one is highlighted. // One dropdown instead of a button per language: the list keeps growing, and on phones the system picker opens. // Each language is named in itself (lang= lets screen readers say it right). const langPick=id=>``; function segBtns(act,cur,opts){return opts.map(([v,l])=>btn(l,act,{v},cur===v?'pink sm':'ghost sm')).join('');} /* Animation setting: auto follows the system's reduced-motion preference, or force it on or off. */ /* Settings are per device (localStorage), not part of the save: they are about how you like to play. */ const PREF_DEF={pauseFurious:true,warnUnhappy:true,pauseIncident:false,quiet:false}; let PREFS=(()=>{try{const j=JSON.parse(localStorage.getItem('sot-prefs')||'{}');return j&&typeof j==='object'?j:{};}catch(e){return {};}})(); const pref=k=>typeof PREFS[k]==='boolean'?PREFS[k]:PREF_DEF[k]; // Quiet notifications: the player's choice once made, until then on in Best Effort only. const quietOn=()=>typeof PREFS.quiet==='boolean'?PREFS.quiet:rulePreset()==='soft'; function setPref(k,v){if(!own(PREF_DEF,k))return;PREFS[k]=!!v;try{localStorage.setItem('sot-prefs',JSON.stringify(PREFS));}catch(e){}} // Stop the clock for something the player must see. Nothing happens if the game is already paused. function autoPause(){if(!S||!UI.speed)return false;UI.resumeSpeed=UI.speed;UI.speed=0;renderHUD();return true;} const resumeAct=()=>({l:tr('common.resume'),act:'speed',args:{v:UI.resumeSpeed||1}}); function settingsHtml(){const seg=(lab,act,cur,opts,note)=>`
${tr('settings.saved_on_this_device')}