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.

Checking availability…
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

implementation reference

Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗