@@ -114,6 +114,7 @@ def __init__(self):
114114 synth = synthDriverHandler ._getSynthDriver (v )()
115115 synth .initSettings ()
116116 self .synthInstanceMap [k ] = synth
117+ print ("synth added as key %s" % k )
117118 except BaseException as e :
118119 raise InitializationError (
119120 "Failed to load %s (reason: %s)" % (v , e ))
@@ -161,18 +162,22 @@ def terminate(self):
161162 self .thread .join ()
162163
163164 def speak (self , seq ):
165+ print ("last_lang: %s, dictionary keys: %s" % (self .last_lang , list (self .synthInstanceMap .keys ())))
164166 synth = self .synthInstanceMap [self .last_lang ]
165167 textList = []
166168 for i , item in enumerate (seq ):
167169 if isinstance (item , LangChangeCommand ):
168- if item .lang == self .last_lang :
170+ # monkeypatch: I don't know when it has changed, but apparently it receives "ja_JP" here, originally it was ja.
171+ code = item .lang .split ("_" )[0 ]
172+ if code == self .last_lang :
169173 continue
170174 if textList :
171175 _execWhenDone (self .wait_speak , synth , textList [:])
172176 textList = []
173177 # end textList exists
174- self .last_lang = item .lang
175- if item .lang == 'en' :
178+ self .last_lang = code
179+ print ("last_lang: %s" % code )
180+ if code == 'en' :
176181 synth = self .synthInstanceMap ['en' ]
177182 else :
178183 synth = self .synthInstanceMap ['ja' ]
0 commit comments