v157 · concept 4 · edge / failure
Failure & policy gates
Every way the Language Detector API can say no, triggered for real and compared with what Chromium's language_detector.cc does. One ordering detail matters on a phone: Chromium checks expectedInputLanguages after it loads the model. So create() with an unsupported language can still start a download before it rejects. This page never calls create() when that could happen.
LanguageDetector is exposed…No gates run yet.
Invalid language tag
availability({ expectedInputLanguages: ["not a tag!"] }). Tags are validated as BCP 47 before anything else runs. Expected: RangeError.
Unsupported language
kl (Kalaallisut) is a valid tag but isn't in Chromium's list. Expected: availability() returns unavailable. create() would reject with NotSupportedError (“Language not available”), but only after loading the model, so this card calls it only when the model is already on the device.
Already-aborted signal
create({ signal }) with a signal that's already aborted. This is checked before any model work, so it's safe to run. Expected: AbortError.
Permissions policy: iframe denied
A same-origin <iframe allow="language-detector 'none'">. The feature defaults to 'self'. Expected: availability() returns unavailable and create() rejects with NotAllowedError (“Access denied because the Permission Policy is not enabled.”).
No user gesture
When the model is downloadable or downloading, Chromium rejects create() without transient activation, before it fetches anything. This waits 6 s for your tap's activation to expire (Chrome's window is 5 s), then calls create(). Expected: NotAllowedError. If the model is available, no gesture is needed and it succeeds with no download.
Context: secure context & workers
The interface is [SecureContext], and in workers it's gated by a separate flag (LanguageDetectionAPIForWorkers). This card reports isSecureContext here and runs typeof LanguageDetector inside a dedicated worker.
Enterprise policy (source finding, not a live probe)
Translator has its own TranslatorAPIAllowed policy. In Chromium's policy definitions (read 2026-11-22) we found no LanguageDetector-specific policy, and BuiltInAIAPIsEnabled (Android 160+) names the Prompt, Summarizer, Writer and Rewriter APIs, not the Language Detector. A page can't read policy anyway. This button just records what this device reports for the plain call, so you can compare a managed phone with an unmanaged one.
the order Chromium checks things
availability(options):
1. validate + canonicalise expectedInputLanguages → RangeError
2. permissions policy "language-detector" off → "unavailable"
3. model status; unsupported expected language → "unavailable"
create(options):
1. validate tags → RangeError
2. signal already aborted → AbortError
3. permissions policy off → NotAllowedError
4. model downloadable/downloading + no activation → NotAllowedError
5. load (maybe download) the model → NotSupportedError "Model not available"
6. unsupported expected language → NotSupportedError "Language not available"
see also
- Availability & expected languages
- Translator failure & policy gates (v161), including the
TranslatorAPIAllowedpolicy - ChromeStatus entry (5087964794322944)
- Spec: Language Detector API