From: Takuya Nishimoto Date: Mon, 27 Oct 2014 06:25:30 +0000 (+0900) Subject: ti34542 fix JTalk issue with non-Japanese language environment X-Git-Url: http://git.osdn.net/view?p=nvdajp%2Fnvdajpmiscdep.git;a=commitdiff_plain;h=05c64734ba2a9e2f0de3bfdc4fc99773bbab1253 ti34542 fix JTalk issue with non-Japanese language environment --- diff --git a/source/synthDrivers/nvdajp_jtalk.py b/source/synthDrivers/nvdajp_jtalk.py index 1a455ac..25a5f6b 100644 --- a/source/synthDrivers/nvdajp_jtalk.py +++ b/source/synthDrivers/nvdajp_jtalk.py @@ -16,6 +16,7 @@ import synthDriverHandler import languageHandler from jtalk import jtalkDriver from jtalk.jtalkDriver import VoiceProperty +from jtalk._nvdajp_espeak import isJapaneseLang class SynthDriver(SynthDriver): """A Japanese synth driver for NVDAjp. @@ -57,7 +58,15 @@ class SynthDriver(SynthDriver): p.pitch = self._pitch p.inflection = self._inflection p.characterMode = spellState - jtalkDriver.speak(unicode(item), currentLang, index=finalIndex, voiceProperty_=p) + msg = unicode(item) + isMsgJp = isJapaneseLang(msg) + lang = currentLang + if isMsgJp: + lang = 'ja' + elif defaultLanguage != 'ja' and not isMsgJp: + lang = defaultLanguage + log.debug("lang:%s idx:%s pit:%d inf:%d chr:%d (%s)" % (lang, str(finalIndex), p.pitch, p.inflection, p.characterMode, msg)) + jtalkDriver.speak(msg, lang, index=finalIndex, voiceProperty_=p) elif isinstance(item,speech.IndexCommand): finalIndex = item.index elif isinstance(item,speech.CharacterModeCommand):