GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • MDN
  • HTML: Markup language
  • Elements
  • Global attributes
  • Attributes
  • See all…
  • Responsive images
  • HTML cheatsheet
  • Date & time formats
  • See all…
  • SVG
  • MathML
  • XML
  • CSS: Styling language

This view

  • Original page
  • New address

GeezerVison is showing developer.mozilla.org — Translator - Web APIs | MDN

Translator

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Want more browser support for this feature? Tell us why.

  • See full compatibility
  • Learn more

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

The Translator interface of the Translator and Language Detector APIs contains all the associated translation functionality, including checking AI model availability, creating a new Translator instance, using it to create a translation, and more.

Instance properties

inputQuota Read only

The input quota available to the browser for generating translations.

sourceLanguage Read only

The expected language of the input text to be translated.

targetLanguage Read only

The language that the input text will be translated into.

Static methods

availability()

Returns an enumerated value that indicates the availability of the AI model for the given Translator configuration.

create()

Creates a new Translator instance from which to generate translations.

Instance methods

destroy()

Releases the resources assigned to the Translator instance it is called on and stops any further activity on it.

measureInputUsage()

Reports how much input quota would be used by a translation operation for a given text input.

translate()

Returns a string containing a translation of the input string.

translateStreaming()

Generates a translation of the input string as a ReadableStream.

Examples

See Using the Translator and Language Detector APIs for a complete example.

Creating a Translator instance

js
const translator = await Translator.create({
  sourceLanguage: "en",
  targetLanguage: "ja",
});

Generating a translation

js
const translation = await translator.translate(myTextString);
console.log(translation);

Generating a translation stream

js
const stream = translator.translateStreaming(myTextString);
let translation = "";

for await (const chunk of stream) {
  translation += chunk;
}

console.log("Stream complete");
console.log(translation);

Specifications

Specification
Translator and Language Detector APIs
# translator

Browser compatibility

See also

  • Using the Translator and Language Detector APIs

Help improve MDN

Learn how to contribute

This page was last modified on Oct 28, 2025 by MDN contributors.

View this page on GitHub • Report a problem with this content
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.