Skip to content

Commit

Permalink
Some support for #448
Browse files Browse the repository at this point in the history
  • Loading branch information
Psychokiller1888 committed May 28, 2021
1 parent 807a83c commit 894235a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
14 changes: 14 additions & 0 deletions core/base/AssistantManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,3 +278,17 @@ def skillResource(self) -> Generator[Path, None, None]:
continue

yield resource


def switchLanguage(self, targetLang: str):
"""
Switches the assistant language to targetLang
:param targetLang: str, the language to switch to
:return:
"""
self.ConfigManager.updateAliceConfiguration(key='activeLanguage', value=targetLang)
self.LanguageManager.restart()
self.TalkManager.restart()
self.ASRManager.restart()
self.linkAssistant()
self.checkAssistant()
9 changes: 9 additions & 0 deletions core/base/model/Manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@ def onStop(self):
self._isActive = False


def restart(self):
"""
Stops and starts the manager
:return:
"""
self.onStop()
self.onStart()


def _initDB(self):
if self._databaseSchema:
return SuperManager.getInstance().databaseManager.initDB(schema=self._databaseSchema, callerName=self.name)
Expand Down

0 comments on commit 894235a

Please sign in to comment.