demo · v130

Language Router

Detect the language of an incoming support message and dispatch it to the right team — entirely on-device, with no server round-trip. Paste a message, click Route, and watch the API decide which language queue it goes into.

requires Built-in AI / Language Detection Enable chrome://flags/#language-detection-api in Chrome 130+, or join the Built-in AI origin trial. If unavailable, a script-based heuristic handles the routing so the demo always works.

incoming message

routed queue

how routing works

The router maps detected language codes to support teams. BCP-47 codes like es, fr, de route to dedicated queues. Any language below the confidence threshold — or with no matching team — goes to the multilingual queue where a human translator assists.

This pattern requires zero server infrastructure for language detection. The LanguageDetector model runs locally in the browser, making decisions in single-digit milliseconds with no network latency and no PII leaving the device.

the code

const ROUTING_TABLE = {
  en: "English Support",
  fr: "Équipe France",
  es: "Soporte Español",
  de: "Deutsches Support-Team",
  ja: "日本語サポート",
  ko: "한국어 지원",
  it: "Supporto Italiano",
  pt: "Suporte Português",
};
const CONFIDENCE_THRESHOLD = 0.7;

async function routeMessage(text) {
  const detector = await LanguageDetector.create();
  const [top] = await detector.detect(text);
  if (top.confidence >= CONFIDENCE_THRESHOLD) {
    return ROUTING_TABLE[top.detectedLanguage] ?? "Multilingual Queue";
  }
  return "Multilingual Queue"; // below threshold → human review
}

see also