v148 · Translator API · on-device

Document Translator

A multi-language document with paragraphs in five languages. Detect, badge, and translate — all on-device via Chrome's Translator API. No keys, no network, no data leaves your machine.

Checking API… Detecting Translator API availability…

multi-language document

language pair availability

Check which {sourceLanguage, targetLanguage} pairs are available via Translator.availability().

how it works

  1. Feature-detects window.Translator and window.LanguageDetector.
  2. "Detect languages" calls LanguageDetector.create() then detector.detect(text) on each paragraph.
  3. "Translate all to English" calls Translator.create({sourceLanguage, targetLanguage:'en'}) per non-English paragraph and fires all translations via Promise.allSettled().
  4. Language pair availability uses Translator.availability({sourceLanguage, targetLanguage}).
  5. When the API is absent, a static language-detection simulation is used as fallback.

references

implementation reference

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