Frontend (React 18 + TS + Vite): - Landing: glitching hero, live /api/stats veil ticker, mode cards, featured spirits - Séance: three.js shader ghost (hue/form per entity, mood + audio-reactive), Ouija planchette board spelling utterances, transcript with TTS replay, entity dossier, direct contact streaming, passive/active listening - Modes: Wire Ghost telemetry panel, EVP mic anomaly detection, WebUSB RTL-SDR sweep + waterfall (hardware pass pending), Ouija/Direct Contact - Codex: public registry + entity dossiers, rarity tiers, i18n EN/ES complete - State: VeilSocket (reconnect/backoff), seance reducer, auth context - 72 vitest tests green; served by FastAPI at :7777 Docs: README + as-built plans 3-7
39 lines
816 B
TypeScript
39 lines
816 B
TypeScript
import i18n from 'i18next'
|
|
import { initReactI18next } from 'react-i18next'
|
|
import en from './en.json'
|
|
import es from './es.json'
|
|
import type { Language } from '../lib/types'
|
|
|
|
const STORAGE_KEY = 'qm_language'
|
|
|
|
export function storedLanguage(): Language {
|
|
try {
|
|
const v = localStorage.getItem(STORAGE_KEY)
|
|
if (v === 'es' || v === 'en') return v
|
|
} catch {
|
|
/* private mode etc. */
|
|
}
|
|
return 'en'
|
|
}
|
|
|
|
export function persistLanguage(lang: Language): void {
|
|
try {
|
|
localStorage.setItem(STORAGE_KEY, lang)
|
|
} catch {
|
|
/* ignore */
|
|
}
|
|
}
|
|
|
|
void i18n.use(initReactI18next).init({
|
|
resources: {
|
|
en: { translation: en },
|
|
es: { translation: es },
|
|
},
|
|
lng: storedLanguage(),
|
|
fallbackLng: 'en',
|
|
interpolation: { escapeValue: false },
|
|
returnEmptyString: false,
|
|
})
|
|
|
|
export default i18n
|