From 8539ed9dd5969081b62b2cf060b0ba4dab8307e7 Mon Sep 17 00:00:00 2001 From: Mubashir Rahim Date: Wed, 3 Jun 2026 07:17:32 +0500 Subject: [PATCH] fix: validate the stored language before using it (detectLang) detectLang() validates the URL-hash language against ['en','ko','ja'] but returns the localStorage value unchecked. A stale/invalid `harness-lang` value would be handed to setLang(), which then no-ops every translation lookup (leaving the page in English with no active language button) instead of falling through to the navigator-language / 'en' default. Validate the stored value the same way the hash path does. Co-Authored-By: Claude Opus 4.8 --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index bf0650f..df940cc 100644 --- a/index.html +++ b/index.html @@ -1163,7 +1163,7 @@

Get Started in Seconds

const hash = location.hash.replace('#', '').toLowerCase(); if (['en', 'ko', 'ja'].includes(hash)) return hash; const stored = localStorage.getItem('harness-lang'); - if (stored) return stored; + if (stored && ['en', 'ko', 'ja'].includes(stored)) return stored; const nav = (navigator.language || '').toLowerCase(); if (nav.startsWith('ko')) return 'ko'; if (nav.startsWith('ja')) return 'ja';