// lexicon.js — in-world UI vocabulary (upgrade #3). // // Lore names are flavor layered on top of clear function. Visual labels get the // lore word; ARIA labels ALWAYS stay plain-English (set directly in markup), so // screen readers and the "mundane mode" toggle never lose meaning. export const LEXICON = { guide: 'The Almanac', guideShort: 'Almanac', favorites: 'The Grimoire', search: 'Scry', channelEntry: 'Incantation', sleepTimer: 'The Orb Dims', volume: 'Resonance', noSignal: 'THE ORB CLOUDS OVER', noSignalSub: 'no signal — seeking another vision', loading: 'Summoning…', nextUp: 'What Fate Foretells', live: 'LIVE', help: 'Incantations', // keyboard-help title theater: 'Theater', dim: 'Dim the Hall', ambient: 'Orb Glow', brand: 'THE PONDERING ORB', }; const PLAIN = { guide: 'TV Guide', guideShort: 'Guide', favorites: 'Favorites', search: 'Search', channelEntry: 'Channel', sleepTimer: 'Sleep timer', volume: 'Volume', noSignal: 'NO SIGNAL', noSignalSub: 'stream unavailable — trying another', loading: 'Loading…', nextUp: 'Next up', live: 'LIVE', help: 'Keyboard shortcuts', theater: 'Theater', dim: 'Dim', ambient: 'Ambient glow', brand: 'THE PONDERING ORB', }; const KEY = 'orb.mundaneMode'; let mundane = (() => { try { return localStorage.getItem(KEY) === '1'; } catch { return false; } })(); /** @param {string} k @returns {string} */ export function lex(k) { return (mundane ? PLAIN : LEXICON)[k] ?? PLAIN[k] ?? k; } export function isMundane() { return mundane; } export function setMundane(on) { mundane = !!on; try { localStorage.setItem(KEY, mundane ? '1' : '0'); } catch { /* ignore */ } applyLexicon(); } /** Fill every [data-lex] element's textContent. Never touches aria-label. */ export function applyLexicon(root = document) { for (const el of root.querySelectorAll('[data-lex]')) { const k = el.getAttribute('data-lex'); el.textContent = lex(k); } }