i18n: English for every visitor until the language picker ships -- German is opt-in by ?lang=de (remembered, ?lang=en resets); no browser-language detection yet

This commit is contained in:
matthewtrahan authored and Matthew Trahan committed 2026-10-03 15:10:00 -05:00
1 parent cfd8b01354
commit de88eef9d2
1 file changed
+12 -2
+12 -2
View File
@@ -15,8 +15,18 @@ function setStoredLang(lang) {
try { localStorage.setItem(STORAGE_KEY, lang); } catch {}
}
export let currentLang = getStoredLang() ||
(navigator.language && navigator.language.startsWith('de') ? 'de' : 'en');
// No language picker on the site yet, and the German is still partial, so every
// visitor gets English. Testers opt in with ?lang=de (remembered; ?lang=en resets).
// Browser-language detection comes back with the picker.
function initialLang() {
try {
const q = new URLSearchParams(location.search).get('lang');
if (q) setStoredLang(q);
} catch {}
return getStoredLang() || 'en';
}
export let currentLang = initialLang();
if (!SUPPORTED_LANGS[currentLang]) currentLang = 'en';