v148 · AI · demo
Multilingual Sorter
Enter one sentence per line in any mix of languages. The on-device LanguageDetector detects each one and groups them by language — showing how you'd automatically route multilingual user content.
Sentences (one per line)
Results will appear here after sorting.
const detector = await LanguageDetector.create({
expectedInputLanguages: ['en', 'fr', 'de', 'es', 'ja', 'zh', 'pt', 'ru', 'ar']
});
const sentences = text.split('\n').filter(Boolean);
const detections = await Promise.all(
sentences.map(async s => {
const [top] = await detector.detect(s);
return { text: s, lang: top.detectedLanguage };
})
);
// Group by language
const groups = Map.groupBy(detections, d => d.lang);
see also
- Language Sniffer — single-text detection with confidence scores
- Back to feature index
- Translator and Language Detector APIs spec
- ChromeStatus entry
implementation reference
Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗