demo · v138

LanguageDetector

Paste some text and the page detects its language using the built-in on-device model. Picks the top three candidates with confidence scores.

To actually run this you need Chrome with the Built-in AI APIs enabled — start with chrome://flags/#language-detection-api and let the model download (one-time, on-device). Without it, the demo falls back to a small heuristic detector so you can still see the shape.
checking support…

the code

// Chrome 138+ (flag/origin trial):
const det = await LanguageDetector.create();
const out = await det.detect("Bonjour le monde");
// [{ detectedLanguage: "fr", confidence: 0.99 }, ...]

see also