Etinyere m onwe m ọrụ nke ide ụda olu nke ederede na Chinese.Nke a bụ ihe dị mfe ma ọ bụrụ na ị nwere ahụmahụ, ma mgbe ịmalite ime ya site na ọkọ, ị ga-anakọta ọtụtụ nsogbu nke na ọchịchọ ahụ nwere ike ịla n'iyi na mbụ.Javascript bụ asụsụ na-arụ ọrụ nke ukwuu, ọ dị ka ọ nwere ihe niile obi gị chọrọ.
Ka anyị leba anya na ụdị ikpeazụ ị nwere ike mado na DevTools wee lelee ya.
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 - otu a ka esi ahọpụta asụsụ Chinese n'ime eriri afọ nke ihe nchọgharị ahụ.N'ime mmemme anyị, anyị na-achọgharị ihe nchọgharị maka olu asụsụ China, ma na-agbalị imepụtagharị akpaokwu anyị.Ọ fọrọ nke nta ka ọ dị iche n'ịkpọ asụsụ ọ bụla ọzọ.Mana enwere nuances di na nwunye ebe a.N'ịzacha ọtụtụ asụsụ dịnụ anyị na-ahụ olu 2 Chinese zh-CN.Zero ga-abụ olu nwanyị, nke mbụ bụ olu nwoke.
Nwanyị
utterance.voice = voices.filter(function(voice) { return voice.lang == 'zh-CN'; })[0];
Nwoke
utterance.voice = voices.filter(function(voice) { return voice.lang == 'zh-CN'; })[1];
Na mgbakwunye, ime olu ga-adị iche site na ihe nchọgharị gaa na ihe nchọgharị yana site na ngwaọrụ gaa na ngwaọrụ.Ihe nchọgharị Chrome nwere olu nke ya, ihe nchọgharị Edge nwere ihe dị iche iche, nke na-atọ ụtọ karị, n'agbanyeghị, ihe nchọgharị Opera enweghị olu ọ bụla, yabụ na ọ nweghị onye na-eme olu.
Enwere ike ịgbanye koodu a na bọtịnụ wee kwuo ihe nke gị.
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 koodu bọtịnụ:
<button onclick="say(1)">👨🔉</button>
Enweghị nsogbu ndị ọzọ na ime olu.Ee ee, ka ọ na-arụ ọrụ na smartphones.Ee, ọ dị mma, ọkachasị na ihe nchọgharị mkpanaka Edge.Site n'ụzọ, dabere na teknụzụ a, m na-agbalị ịmepụta microservice maka ịmụ Chinese, ebe a bụ:
http://jkeks.ru/china .A na-emejuputa ihe niile dịka m kọwara ebe a.