I whakaritea e au te mahi tuhi i te reo whakaari o te tuhinga ki te reo Hainamana.He mea tino ngawari tenei mena kua whai wheako koe, engari ka timata koe ki te mahi mai i te wahanga, ka kohia e koe nga raru maha ka ngaro te hiahia i mua atu.Ko te JavaScript he reo tino mahi, me te mea kei a koe nga mea katoa e hiahia ana to ngakau.
Me titiro ki te putanga whakamutunga ka taea e koe te whakapiri ki nga DevTools ka tirohia.
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 - koinei te tohu o te reo Hainamana i roto i nga whekau o te kaitirotiro.I roto i ta maatau kaupapa, ka rapu matou i te kaitirotiro mo te reo o te reo Hainamana, ka ngana ki te whakaputa i to maatau rerenga korero.Kare he rerekee i te whakahua i tetahi atu reo.Engari he ruarua nga nuances kei konei.Ko te tarai i nga momo reo e waatea ana ka kitea e 2 nga reo Hainamana zh-CN.Ko Zero he reo wahine, ko te tuatahi he reo tane.
Wahine
utterance.voice = voices.filter(function(voice) { return voice.lang == 'zh-CN'; })[0];
Tane
utterance.voice = voices.filter(function(voice) { return voice.lang == 'zh-CN'; })[1];
I tua atu, ka rereke te mahi reo mai i te kaitirotiro ki tetahi kaitirotiro, mai i tetahi taputapu ki tetahi taputapu.Ko te kaitirotiro Chrome ona ake reo, he rereke te ahua o te kaitirotiro Edge, he pai ake te ahua, a, kaore he reo o te kaitirotiro Opera, na reira karekau he reo mahi.
Ka taea te whakairihia tenei waehere ki runga i te paatene me te whakahua i a koe ake.
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);
}
me te waehere paatene:
<button onclick="say(1)">👨🔉</button>
Karekau he raruraru o te mahi reo.Ae, me pehea te mahi katoa i runga i nga waea atamai.Ae, pai, ina koa i roto i te tirotiro pūkoro Edge.Ae ra, i runga i tenei hangarau, kei te ngana ahau ki te hanga ratonga moroiti mo te ako i te Hainamana, koinei:
http://jkeks.ru/china .Ka whakatinanahia nga mea katoa kia rite ki taku korero i konei.