v148 · AI · JavaScript
Quality Control Panel
Benchmark the Translator API across multiple language pairs simultaneously. See per-pair latency, availability status, and translation output — all from a single source text. Identify which pairs are downloaded and ready vs. need a model download.
—Avg latency (ms)
—Pairs available
—Inference mode
Source text & pairs
Source language
Source text
Translation pairs
// Check availability before creating — avoids silent failures
const PAIRS = [
{ from: 'en', to: 'fr' },
{ from: 'en', to: 'de' },
{ from: 'en', to: 'ja' },
];
const results = await Promise.all(PAIRS.map(async ({ from, to }) => {
const avail = await Translator.availability({ sourceLanguage: from, targetLanguage: to });
if (avail === 'no') return { pair: `${from}→${to}`, error: 'unavailable' };
const t = await Translator.create({ sourceLanguage: from, targetLanguage: to });
const t0 = performance.now();
const text = await t.translate(sourceText);
return { pair: `${from}→${to}`, text, latency: performance.now() - t0 };
}));
see also
- Language Pair Explorer — availability matrix
- Batch Translator — translate multiple strings
- Local-First Workflow — realistic app flows
- Safety Harness — edge cases
implementation reference
Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗