Translator: sourceLanguage property
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The sourceLanguage
read-only property of the Translator
interface returns the expected language of the input text to be translated.
A Translator
instance's sourceLanguage
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 "en"
console.log(translator.sourceLanguage);
Specifications
Specification |
---|
Translator and Language Detector APIs # dom-translator-sourcelanguage |