Gusoma inyandiko mu Gishinwa



Nishyiriyeho inshingano yo kwandika amajwi akora inyandiko mu gishinwa.Iki nikintu cyoroshye cyane niba usanzwe ufite uburambe, ariko mugihe utangiye kubikora guhera, uzakusanya ibibazo byinshi kuburyo icyifuzo gishobora gucika kare cyane.JavaScript ni ururimi rukora cyane, bisa nkaho bifite ibintu byose umutima wawe wifuza.

Reka turebe verisiyo yanyuma ushobora gushira muri DevTools hanyuma ukareba.

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 - nuburyo ururimi rwigishinwa rwagenwe mumara ya mushakisha.Muri gahunda yacu, dushakisha mushakisha amajwi yururimi rwigishinwa, kandi tugerageza kubyara interuro yacu.Ntabwo rwose bitandukanye no kuvuga urundi rurimi.Ariko hano hari uduce tubiri.Gushungura umurongo windimi ziboneka duhura nijwi 2 ryigishinwa zh-CN.Zeru izaba ijwi ryumugore, naho iyambere nijwi ryumugabo.

Umugore

utterance.voice = voices.filter(function(voice) { return voice.lang == 'zh-CN'; })[0];

Umugabo

utterance.voice = voices.filter(function(voice) { return voice.lang == 'zh-CN'; })[1];

Mubyongeyeho, gukora amajwi bizatandukana na mushakisha kuri mushakisha no kubikoresho.Mucukumbuzi ya Chrome ifite amajwi yayo bwite, mushakisha ya Edge itandukanye rwose, irashimishije cyane, nukuvuga, kandi mushakisha ya Opera nta majwi namba afite, kuburyo ntamajwi azakora.

Iyi code irashobora kumanikwa kuri buto hanyuma ukavuga ikintu cyawe wenyine.

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);
}

na kode ya buto:

<button onclick="say(1)">👨🔉</button>

Ntakindi kibazo kijyanye no gukina amajwi.Yego yego, burya byose bikora kuri terefone.Yego, bikomeye, cyane cyane muri mushakisha ya mobile ya Edge.By the way, nkurikije iri koranabuhanga, ndagerageza gukora microservice yo kwiga igishinwa, hano ni:

http://jkeks.ru/china .Ibintu byose bishyirwa mubikorwa nkuko nabisobanuye hano.





bg bs ca ceb co cs cy da de el en eo es et fa fi fr fy ga gd gl gu ha haw hi hmn hr ht hu id ig is it iw ja jw ka kk km kn ko ku ky la lb lo lt lv mg mi mk ml mn mr ms mt my ne nl no ny or pa pl ps pt ro ru rw sd si sk sl sm sn so sr st su sv sw ta te tg th tk tl tr tt ug uk ur uz vi xh yi yo zh zu
Text to speech
QR-Code generator
Parsedown cheatsheet. Markdown
Filter data by column with regular expressions
Engines for creating games on LUA ?
JavaScript: draw a point
JavaScript: Speaking text in Chinese