SpeechRecognition: lang property
Web Speech API
Web Speech API
The **`lang`** property of the SpeechRecognition
interface returns and sets the language of the current `SpeechRecognition`.
If not specified, this defaults to the HTML [`lang`](/docs/Web/HTML/Reference/Global_attributes/lang) attribute
value, or the user agent's language setting if that isn't set either.
## Value
A string representing the language for the current `SpeechRecognition`. The value should be a valid BCP 47 language tag.
## Examples
This code is excerpted from our [Speech color changer](https://github.com/mdn/dom-examples/blob/main/web-speech-api/speech-color-changer/script.js) example.
```js
const recognition = new SpeechRecognition();
recognition.lang = "en-US";
recognition.interimResults = false;
recognition.maxAlternatives = 1;
// …
```
## Specifications
## Browser compatibility
## See also
- [Web Speech API](/docs/Web/API/Web_Speech_API)
Cite this
"SpeechRecognition: lang property". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/lang JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy