Ke ile ka ipehela mosebetsi oa ho ngola lentsoe le sebetsang la mongolo ka Sechaena.Ena ke taba e bonolo haeba u se u ntse u e-na le phihlelo, empa ha u qala ho e etsa ho tloha qalong, u tla bokella mathata a mangata hoo takatso e ka nyamelang pejana.JavaScript ke puo e sebetsang haholo, e bonahala e na le tsohle tseo pelo ea hau e li lakatsang.
Ha re shebeng mofuta oa ho qetela oo u ka o behang ho DevTools 'me u o hlahlobe.
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 - ena ke tsela eo puo ea Sechaena e khethiloeng ka eona ka maleng a sebapali.Lenaneong la rona, re batla sebatli bakeng sa lentsoe la puo ea Sechaena, 'me re leka ho hlahisa poleloana ea rona.Ho hang ha e fapane le ho bua puo leha e le efe e 'ngoe.Empa ho na le li-nuances tse 'maloa mona.Ha re sefa letoto la lipuo tse fumanehang, re kopana le mantsoe a 2 a Sechaena a zh-CN.Zero e tla ba lentsoe la mosali, 'me la pele ke lentsoe la monna.
E tšehali
utterance.voice = voices.filter(function(voice) { return voice.lang == 'zh-CN'; })[0];
Monna
utterance.voice = voices.filter(function(voice) { return voice.lang == 'zh-CN'; })[1];
Ntle le moo, ts'ebetso ea lentsoe e tla fapana ho tloha ho sebatli ho ea ho sebatli le ho tloha sesebelisoa ho ea ho sesebelisoa.Sebatli sa Chrome se na le mantsoe a sona, sebatli sa Edge se na le tse fapaneng ka ho felletseng, tse monate le ho feta, 'me sebatli sa Opera ha se na mantsoe ho hang, kahoo ho ke ke ha e-ba le lentsoe le sebetsang.
Khoutu ena e ka fanyehoa konopong 'me u bue ntho ea hau.
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);
}
le konopo ea khoutu:
<button onclick="say(1)">👨🔉</button>
Ha ho na mathata a mang ka ho sebetsa ha lentsoe.Ee, e sebetsa joang ho li-smartphones.E, ho monate, haholo-holo ho sebatli sa Edge ea mobile.Ka tsela, ho latela theknoloji ena, ke leka ho etsa microservice bakeng sa ho ithuta Sechaena, ke ena:
http://jkeks.ru/china .Ntho e 'ngoe le e' ngoe e etsoa hantle feela joalokaha ke hlalositse mona.