修訂 | 05c64734ba2a9e2f0de3bfdc4fc99773bbab1253 (tree) |
---|---|
時間 | 2014-10-27 15:25:30 |
作者 | ![]() |
Commiter | Takuya Nishimoto |
ti34542 fix JTalk issue with non-Japanese language environment
@@ -16,6 +16,7 @@ import synthDriverHandler | ||
16 | 16 | import languageHandler |
17 | 17 | from jtalk import jtalkDriver |
18 | 18 | from jtalk.jtalkDriver import VoiceProperty |
19 | +from jtalk._nvdajp_espeak import isJapaneseLang | |
19 | 20 | |
20 | 21 | class SynthDriver(SynthDriver): |
21 | 22 | """A Japanese synth driver for NVDAjp. |
@@ -57,7 +58,15 @@ class SynthDriver(SynthDriver): | ||
57 | 58 | p.pitch = self._pitch |
58 | 59 | p.inflection = self._inflection |
59 | 60 | p.characterMode = spellState |
60 | - jtalkDriver.speak(unicode(item), currentLang, index=finalIndex, voiceProperty_=p) | |
61 | + msg = unicode(item) | |
62 | + isMsgJp = isJapaneseLang(msg) | |
63 | + lang = currentLang | |
64 | + if isMsgJp: | |
65 | + lang = 'ja' | |
66 | + elif defaultLanguage != 'ja' and not isMsgJp: | |
67 | + lang = defaultLanguage | |
68 | + log.debug("lang:%s idx:%s pit:%d inf:%d chr:%d (%s)" % (lang, str(finalIndex), p.pitch, p.inflection, p.characterMode, msg)) | |
69 | + jtalkDriver.speak(msg, lang, index=finalIndex, voiceProperty_=p) | |
61 | 70 | elif isinstance(item,speech.IndexCommand): |
62 | 71 | finalIndex = item.index |
63 | 72 | elif isinstance(item,speech.CharacterModeCommand): |