Mo ṣeto ara mi ni iṣẹ ṣiṣe kikọ ohun ti ọrọ naa ni Kannada.Eyi jẹ ọrọ ti o rọrun ti o rọrun ti o ba ti ni iriri tẹlẹ, ṣugbọn nigbati o ba bẹrẹ ṣiṣe lati ibere, iwọ yoo gba ọpọlọpọ awọn iṣoro ti ifẹ naa le parẹ pupọ tẹlẹ.JavaScript jẹ ede ti o ṣiṣẹ pupọ, o dabi pe o ni ohun gbogbo ti ọkan rẹ fẹ.
Jẹ ki a wo ẹya ikẹhin ti o le lẹẹmọ sinu DevTools ki o ṣayẹwo.
var utterance = new SpeechSynthesisUtterance('菜');
var voices = window.speechSynthesis.getVoices();
utterance.voice = voices.filter(function(voice) { return voice.lang == 'zh-CN'; })[0];
window.speechSynthesis.speak(utterance);
zh-CN - eyi ni bii ede Kannada ṣe jẹ apẹrẹ ninu awọn ifun ti ẹrọ aṣawakiri naa.Ninu eto wa, a wa ẹrọ aṣawakiri fun ohun ti ede Kannada, a si gbiyanju lati tun gbolohun wa.Ni iṣe ko yatọ si sisọ ede eyikeyi miiran.Ṣugbọn awọn nuances meji wa nibi.Sisẹ ọpọlọpọ awọn ede ti o wa a wa kọja awọn ohun 2 Kannada zh-CN.Odo yoo jẹ ohùn abo, ati akọkọ jẹ ohùn akọ.
Obinrin
utterance.voice = voices.filter(function(voice) { return voice.lang == 'zh-CN'; })[0];
Okunrin
utterance.voice = voices.filter(function(voice) { return voice.lang == 'zh-CN'; })[1];
Ni afikun, ṣiṣe ohun yoo yatọ lati ẹrọ aṣawakiri si ẹrọ aṣawakiri ati lati ẹrọ si ẹrọ.Ẹrọ aṣawakiri Chrome ni awọn ohun tirẹ, ẹrọ aṣawakiri Edge ni iyatọ patapata, awọn ti o dun diẹ sii, nipasẹ ọna, ati ẹrọ aṣawakiri Opera ko ni awọn ohun rara, nitorinaa kii yoo ṣe iṣe ohun.
Yi koodu le wa ni ṣù lori awọn bọtini ati ki o ohun nkankan ti ara rẹ.
function say(voiceId){
let text = document.getElementById("pole").innerHTML
console.log (text)
var utterance = new SpeechSynthesisUtterance(text);
var voices = window.speechSynthesis.getVoices();
utterance.voice = voices.filter(function(voice) { return voice.lang == 'zh-CN'; })[voiceId];
window.speechSynthesis.speak(utterance);
}
ati koodu bọtini:
<button onclick="say(1)">👨🔉</button>
Ko si awọn iṣoro miiran pẹlu ṣiṣe ohun.Bẹẹni, bawo ni gbogbo rẹ ṣe n ṣiṣẹ lori awọn fonutologbolori.Bẹẹni, nla, pataki ni ẹrọ aṣawakiri Edge alagbeka.Nipa ọna, da lori imọ-ẹrọ yii, Mo n gbiyanju lati ṣe microservice fun kikọ Kannada, eyi ni:
http://jkeks.ru/china .Ohun gbogbo ti wa ni imuse ni deede bi Mo ti ṣalaye nibi.