Skip to content

Commit 894235a

Browse files
Some support for #448
1 parent 807a83c commit 894235a

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

core/base/AssistantManager.py

+14
Original file line numberDiff line numberDiff line change
@@ -278,3 +278,17 @@ def skillResource(self) -> Generator[Path, None, None]:
278278
continue
279279

280280
yield resource
281+
282+
283+
def switchLanguage(self, targetLang: str):
284+
"""
285+
Switches the assistant language to targetLang
286+
:param targetLang: str, the language to switch to
287+
:return:
288+
"""
289+
self.ConfigManager.updateAliceConfiguration(key='activeLanguage', value=targetLang)
290+
self.LanguageManager.restart()
291+
self.TalkManager.restart()
292+
self.ASRManager.restart()
293+
self.linkAssistant()
294+
self.checkAssistant()

core/base/model/Manager.py

+9
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,15 @@ def onStop(self):
8686
self._isActive = False
8787

8888

89+
def restart(self):
90+
"""
91+
Stops and starts the manager
92+
:return:
93+
"""
94+
self.onStop()
95+
self.onStart()
96+
97+
8998
def _initDB(self):
9099
if self._databaseSchema:
91100
return SuperManager.getInstance().databaseManager.initDB(schema=self._databaseSchema, callerName=self.name)

0 commit comments

Comments
 (0)