From 05c64734ba2a9e2f0de3bfdc4fc99773bbab1253 Mon Sep 17 00:00:00 2001 From: Takuya Nishimoto Date: Mon, 27 Oct 2014 15:25:30 +0900 Subject: [PATCH] ti34542 fix JTalk issue with non-Japanese language environment --- source/synthDrivers/nvdajp_jtalk.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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): -- 2.11.0