v138 · miscellaneous

Translator API

A JavaScript API to provide language translation capabilities to web pages. Browsers are increasingly offering language translation to their users. Such translation capabilities can also be useful to web developers. This is especially the case when browser's built-in translation abilities cannot help. An enterprise policy (GenAILocalFoundationalModelSettings

concepts

  1. Translate

    On-device translator. Pairs with Language Detector for end-to-end auto-translate pipelines that never call out to a server.

  2. Streaming captions

    Live-captioning case: translateStreaming() emits partial chunks so the overlay updates per word instead of per paragraph. First-chunk latency is what matters here.

  3. Language pair matrix

    An N × N grid of Translator.availability() probes. See which packs are already on-device, which are downloadable, and which are unavailable — click any cell to instantiate that session and translate a sample sentence.

  4. Batch translator

    Eight UI strings translated into your chosen language with a single shared session — no new session per string. Shows per-item progress, reuse of the same Translator instance, total elapsed time, and milliseconds per string. Falls back to realistic simulated output.

why it shipped

Browsers are increasingly offering language translation to their users. Such translation capabilities can also be useful to web developers. This is especially the case when browser's built-in translation abilities cannot help, such as:

references