v148 · AI · JavaScript
Language Pair Explorer
The Translator API requires you to check availability for a specific source→target language pair before creating a translator. Pair availability can be readily (model cached), after-download (model needs fetching), or no. This explorer checks any pair and shows a matrix of common language combinations.
Check a specific pair
Common pairs matrix (click any cell to check)
readily available
after-download
not available
not checked
// Chrome 148: check language pair availability
const capabilities = await self.ai.translator.capabilities();
const available = capabilities.languagePairAvailable('en', 'fr');
// 'readily' | 'after-download' | 'no'
if (available === 'no') {
console.log('Pair not supported');
} else {
const translator = await self.ai.translator.create({
sourceLanguage: 'en',
targetLanguage: 'fr',
// 'after-download' will trigger model download here
});
const result = await translator.translate('Hello, world!');
console.log(result); // 'Bonjour, monde!'
}
see also
- Live Translator — translate text in real time
- Translate Chain — multi-step translation
- Batch Translator — batch text processing
- Document Translator — full-document translation
references
implementation reference
Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗