Kuwerenga mawu mu Chitchaina



Ndidadziikira ntchito yolemba mawu aku China.Iyi ndi nkhani yophweka ngati muli ndi chidziwitso, koma mukangoyamba kuchichita, mudzasonkhanitsa mavuto ambiri kotero kuti chilakolakocho chikhoza kutha kale.JavaScript ndi chilankhulo chogwira ntchito kwambiri, chikuwoneka kuti chili ndi chilichonse chomwe mtima wanu umafuna.

Tiyeni tiwone mtundu womaliza womwe mutha kuyika mu DevTools ndikuwuwona.

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 - umu ndi momwe chilankhulo cha Chitchaina chimayikidwa m'matumbo a osatsegula.Mu pulogalamu yathu, timafufuza msakatuli kuti timve mawu a chilankhulo cha Chitchaina, ndikuyesera kubwereza mawu athu.Sizosiyana kwenikweni ndi kutchula chinenero china chilichonse.Koma pali ma nuances angapo apa.Kusefa zilankhulo zambiri zomwe zilipo timapeza mawu awiri achi China zh-CN.Zero adzakhala liwu lachikazi, ndipo loyamba ndi liwu lachimuna.

Mkazi

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

Mwamuna

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

Kuphatikiza apo, machitidwe amawu amasiyana kuchokera pa msakatuli kupita ku msakatuli komanso kuchokera ku chipangizo kupita ku chipangizo.Msakatuli wa Chrome ali ndi mawu ake, msakatuli wa Edge ali ndi zosiyana kwambiri, zokondweretsa, mwa njira, ndipo Opera osatsegula alibe mawu, kotero sipadzakhala mawu ochitapo kanthu.

Khodi iyi ikhoza kupachikidwa pa batani ndikulankhula zanuzanu.

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

ndi batani kodi:

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

Palibenso zovuta zina pakuchita mawu.O inde, momwe zonse zimagwirira ntchito pa mafoni.Inde, zabwino, makamaka mu msakatuli wa Edge.Mwa njira, kutengera ukadaulo uwu, ndikuyesera kupanga microservice yophunzirira Chitchaina, nayi:

http://jkeks.ru/china .Chilichonse chikuchitika ndendende monga ndafotokozera apa.





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