这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
lang
只读特性在
SpeechSynthesisVoice
interface returns a BCP 47 language tag indicating the language of the voice.
var myLang = speechSynthesisVoiceInstance.lang;
A
DOMString
representing the language of the device.
for(i = 0; i < voices.length ; i++) {
var option = document.createElement('option');
option.textContent = voices[i].name + ' (' + voices[i].lang + ')';
if(voices[i].default) {
option.textContent += ' -- DEFAULT';
}
option.setAttribute('data-lang', voices[i].lang);
option.setAttribute('data-name', voices[i].name);
voiceSelect.appendChild(option);
}
| 规范 | 状态 | 注释 |
|---|---|---|
|
Web 语音 API
The definition of 'lang' in that specification. |
草案 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
lang
|
Chrome 33 | Edge 14 | Firefox 49 | IE No | Opera 21 | Safari 7 | WebView Android 4.4.3 | Chrome Android 33 |
Firefox Android
62
|
Opera Android No | Safari iOS 7 | Samsung Internet Android 3.0 |
完整支持
不支持
实验。期望将来行为有所改变。
用户必须明确启用此特征。