← Chrome 151 reference

v151 · javascript · covered on mdn

LanguageDetector support for Traditional vs. Simplified Chinese

Detection results that previously reported bare "zh" for Chinese may now distinguish the scripts: "zh-Hans" (Simplified) and "zh-Hant" (Traditional) — chosen from the characters in the detected input text, not from any requested locale. Any code comparing detectedLanguage === "zh" may silently stop matching.

this feature is documented on MDN

MDN: LanguageDetector

MDN's reference covers the API in full — the interface and its members, create() and detect() with examples showing the detectedLanguage + confidence result structure, specifications, and browser compatibility. gendn doesn't duplicate that here; this page only records the Chrome 151 output-value change and its migration, which MDN does not yet cover (checked 2026-07-26; MDN page last modified 2025-10-28).

the Chrome 151 change

What changedDetection results that previously returned "zh" for Chinese text may now return "zh-Hans" or "zh-Hant", decided per detection from the input text's characters. detect() takes text — there is no requested-locale or region mapping.
How the script is decidedChromium's ChineseScriptClassifier counts characters unique to each script (two UnicodeSets, one per script); the majority wins. Ties and all-common text default to zh-Hans; behavior is undefined for non-Chinese input (documented in chinese_script_classifier.h). Input is truncated (first 500 bytes, whitespace removed) before counting.
Direct proofWPT detector.optional.https.window.js (pinned at 1985b47) — Simplified text (这是一个例句。) detects to zh-Hans, Traditional text (這是一個例句。) to zh-Hant
Migrationresult.detectedLanguage === "zh" may never be true from 151 — match the language arc instead: tag === "zh" || tag.startsWith("zh-"). No deprecation shim; results change at 151.
ConfidenceRemains model-defined and paired with the tag in the same result dictionary; the sources do not define it as a measure of script certainty.
BoundaryChromium's Translate path runs the same classifier but converts its result to the legacy codes zh-CN/zh-TW for that API (language_detection_util.cc) — that is not the LanguageDetector output. Blink's supported-code list recognizes zh, zh-Hans, zh-Hant, and zh-Latn as input-side codes.
Chrome statusChrome 151 — Enabled by default (milestone listing); feature detail (ChromeStatus API record, updated 2026-07-09): desktop + Android + WebView 151, status text “Proposed”; no flag, no trial program; tracking: crbug.com/519251262
CompatibilityInterim, from ChromeStatus (BCD's api/LanguageDetector.json covers the general API at Chrome 138 but has no zh-variant entries): Chrome 151; Edge not separately reported; Firefox Opposed (recorded signal); Safari No signal; web developers Strongly positive
MDNLanguageDetector (full API reference; no zh-variant coverage as of 2026-07-26)
ChromeStatus5138651886518272 — LanguageDetector support for Traditional vs. Simplified Chinese
Interactive demoChrome Platform Showcase — LanguageDetector zh variants
Source: chromestatus.com/feature/5138651886518272; ChromeStatus API record; chinese_script_classifier.cc; chinese_script_classifier.h; WPT detector.optional (pinned); MDN, checked 2026-07-26.