fix: opt out of browser auto-translation

The app ships its own 7-language i18n and serves localized content, but mobile
browsers (Google Translate) were auto-translating the Chinese UI into broken
English (brand, nav, language dropdown). Add translate="no" + the Google
notranslate meta, and keep the attribute set on language changes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
TerryM
2026-06-02 10:47:36 +08:00
parent 5a5acfcbc2
commit 8acb3a281b
2 changed files with 6 additions and 1 deletions

View File

@@ -1,7 +1,10 @@
<!doctype html>
<html lang="zh-CN">
<html lang="zh-CN" translate="no">
<head>
<meta charset="UTF-8" />
<!-- The app ships its own 7-language i18n and serves localized content, so
browser auto-translation only garbles the UI. Opt out of it. -->
<meta name="google" content="notranslate" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover"

View File

@@ -153,6 +153,8 @@ export function DocumentMeta() {
const canonical = `${window.location.origin}${pathname}${search}`;
document.documentElement.lang = lang;
// Keep browser auto-translation off — the app is already fully localized.
document.documentElement.setAttribute("translate", "no");
document.title = title;
setMeta('meta[name="description"]', "name", "description").content =