Translator and Language Detector APIs
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 Translator.create_static 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
Browser compatibility
See also
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
