Translator: targetLanguage property

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

The targetLanguage read-only property of the Translator interface returns the language that the input text will be translated into.

A Translator instance's targetLanguage is set when creating it via a create() call.

Value

A string specifying the source language. This will be a valid BCP 47 language tag (as specified in RFC 5646).

Examples

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

// Logs "ja"
console.log(translator.targetLanguage);

Specifications

No specification found

No specification data found for api.Translator.targetLanguage.
Check for problems with this page or contribute a missing spec_url to mdn/browser-compat-data. Also make sure the specification is included in w3c/browser-specs.

Browser compatibility

See also