From 76619c9c64807e1e52c3027cc6e9ca0b6f6c1852 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=91=98=E9=98=BF=E6=B1=9F=28Relakkes?= =?UTF-8?q?=29?= Date: Sun, 27 Sep 2026 01:35:49 +0800 Subject: [PATCH] fix(site): choose first-visit language from browser --- site/AGENTS.md | 2 +- site/index.html | 7 ++-- site/scripts/check-docs.mjs | 10 +++-- site/src/lib/locale.js | 14 +++++-- site/src/lib/locale.test.js | 73 ++++++++++++++++++++++++++++++++----- 5 files changed, 85 insertions(+), 21 deletions(-) diff --git a/site/AGENTS.md b/site/AGENTS.md index 1c9be16a..9cf006e9 100644 --- a/site/AGENTS.md +++ b/site/AGENTS.md @@ -27,7 +27,7 @@ Sidebar grouping comes from the `sections` array in the generator — register a `src/styles/base.css` holds shared tokens. The landing page uses the user-provided Wandor direction throughout: warm paper illustrations, a white-faded ambient video, Geist typography, Special Elite wordmark, liquid glass surfaces and black capsule controls. Keep the entire landing journey consistent, including features, onboarding, FAQ and download. Documentation uses the same paper, illustration, typography and terracotta palette, scoped through `src/docs/doc-wandor.css` so its reading surfaces remain legible in both themes. The public display name is `cc-haha`; preserve legacy executable paths and release filenames when they must match actual artifacts. Rules: -English is the default language for the landing page and documentation. `/en` and `/en/start` are the English entries; `/` and `/start` remain explicit Chinese routes. A saved manual language choice takes precedence when opening `/`. +On a first visit to `/`, show Chinese when the browser's preferred language is Chinese; use English for every other language. `/en` and `/en/start` are the English entries; `/` and `/start` remain Chinese routes. A saved manual language choice takes precedence when opening `/`. - Use tokens (`--surface-*`, `--text-*`, `--border*`, `--brand*`, `--sp-*`, `--fs-*`, `--r-*`) rather than literal values. A raw hex in a component is a bug. - Keep screenshots flat and legible. Never stack, tilt, blur, or auto-rotate product UI as the main evidence. diff --git a/site/index.html b/site/index.html index 905d2097..d1fca428 100644 --- a/site/index.html +++ b/site/index.html @@ -20,15 +20,16 @@ cc-haha — Less busywork. More room for life.