From 06beab403d8debea16a8f0cb97a7fd5eaa18bfb3 Mon Sep 17 00:00:00 2001 From: oliver Date: Sat, 24 Oct 2026 21:25:33 +0000 Subject: [PATCH] lang.js: remember the language a switcher click picked MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The switcher links were plain anchors: clicking one navigated but stored nothing, so the auto-detect on the EN homepage bounced the visitor straight back. A de-DE browser on /de/ that clicked EN landed on / and was replaced back to /de/ — the 'an explicit choice always wins' promise in the plan and in llms.txt was only true for ?lang=. A click now calls remember() with the link's own hreflang, so the choice is stored in localStorage + the o4p_lang cookie and survives the next session. Selector tests 27 -> 31 (switcher click stores EN, sets the cookie, stores DE, chosen EN survives a new session). --- static/lang.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/static/lang.js b/static/lang.js index 476c9c1..f10f45b 100644 --- a/static/lang.js +++ b/static/lang.js @@ -33,6 +33,8 @@ render(c); function render(current){var nav=document.createElement("nav"),i,a;nav.className="lang-switch";nav.setAttribute("aria-label","Language"); for(i=0;i