mirror of
https://github.com/Heretek-Games/flatpark.git
synced 2026-10-12 02:05:52 +00:00
A Chinese reader arriving at flatpark.org had to find the globe menu before seeing a word of Chinese. Negotiate it instead, on the one URL that is ambiguous: a Pages Function on `/` reads Accept-Language and 302s to `/zh-Hans/` when that is what the browser asks for. Scoped to the root on purpose. English lives on the bare paths here, so every other URL is already unambiguous and stays a plain static asset — which keeps the canonical English pages out of any redirect and keeps Function invocations off the rest of the site. `_routes.json` pins that. An explicit pick from the language switcher wins over the browser: the switcher writes a `lang` cookie and the function prefers it, so choosing English on a Chinese browser is not undone on the next visit to the homepage. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>