Skip to content

Commit 6325b8b

Browse files
committed
added change_locale method
1 parent 0458a74 commit 6325b8b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

anki_vector/behavior.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,26 @@ async def app_intent(self, intent: str, param: str = None) -> protocol.AppIntent
221221
app_intent_request = protocol.AppIntentRequest(intent=intent, param=param)
222222
return await self.conn.grpc_interface.AppIntent(app_intent_request)
223223

224+
# TODO Make this cancellable with is_cancellable_behavior
225+
@connection.on_connection_thread()
226+
async def change_locale(self, locale: str) -> protocol.UpdateSettingsResponse:
227+
"""Change Vectors voice locale
228+
229+
.. testcode::
230+
231+
import anki_vector
232+
with anki_vector.Robot() as robot:
233+
robot.behavior.change_locale(locale='de_DE')
234+
235+
:param locale: The locale ISO code
236+
237+
:return: object that provides the status
238+
"""
239+
240+
settings = {'locale': locale}
241+
updatet_settings_request = protocol.UpdateSettingsRequest(settings=settings)
242+
return await self.conn.grpc_interface.UpdateSettings(updatet_settings_request)
243+
224244
# TODO Make this cancellable with is_cancellable_behavior
225245
@connection.on_connection_thread()
226246
async def update_settings(self, settings) -> protocol.UpdateSettingsResponse:

0 commit comments

Comments
 (0)