diff --git a/src/layouts/Site.astro b/src/layouts/Site.astro
index e0e556f..7782abb 100644
--- a/src/layouts/Site.astro
+++ b/src/layouts/Site.astro
@@ -131,6 +131,25 @@ const hasForm = isAudiencePage;
// DOMContentLoaded, not at parse time (found live 2026-11-21: the
// banner never dismissed because it did not exist yet on lookup).
const KEY = "vl-consent";
+ const LANG_KEY = "vl-lang";
+ // One-time browser-language detection, default locale only: if the
+ // visitor's navigator.languages match one of our locales and they
+ // haven't chosen one (stored flag), hop to that locale's version of
+ // this page ONCE. Crawlers send en-US, so they never get redirected;
+ // hreflang/sitemap already handle indexing of every locale URL.
+ try {
+ if (${JSON.stringify(locale)} === ${JSON.stringify(DEFAULT_LOCALE)} && !localStorage.getItem(LANG_KEY)) {
+ const codes = ${JSON.stringify([...new Set(parsePages().map((p) => p.code))])};
+ const want = (navigator.languages || [navigator.language || ""]).map((l) => String(l).slice(0, 2).toLowerCase());
+ const hit = want.find((w) => codes.includes(w) && w !== ${JSON.stringify(DEFAULT_LOCALE)});
+ if (hit) {
+ localStorage.setItem(LANG_KEY, hit);
+ const prefix = "/" + hit;
+ const rest = ${JSON.stringify(pageId)} === "" ? "/" : "/" + ${JSON.stringify(pageId)} + "/";
+ location.replace(${JSON.stringify(baseUrl)} + prefix + rest);
+ }
+ }
+ } catch {}
const STATS_URL = ${JSON.stringify(site.stats_script_url)};
const STATS_ID = ${JSON.stringify(site.stats_website_id)};
const injectStats = () => {
@@ -207,7 +226,7 @@ const hasForm = isAudiencePage;
{strings.switcher_label}