Firefox Tomorrow

web api instance property

Translator: targetLanguage property

View on MDN ↗

Limited availabilitySecure context

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.

Examples

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

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

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also