diff --git a/python/src/trezorlib/cli/device.py b/python/src/trezorlib/cli/device.py index 6ca2e9b0d..379e01a00 100644 --- a/python/src/trezorlib/cli/device.py +++ b/python/src/trezorlib/cli/device.py @@ -137,7 +137,6 @@ def load( pin=pin, passphrase_protection=passphrase_protection, label=label, - language="en-US", skip_checksum=ignore_checksum, needs_backup=needs_backup, no_backup=no_backup, @@ -188,7 +187,6 @@ def recover( pin_protection=pin_protection, label=label, u2f_counter=u2f_counter, - language="en-US", input_callback=input_callback, type=rec_type, dry_run=dry_run, @@ -241,7 +239,6 @@ def setup( passphrase_protection=passphrase_protection, pin_protection=pin_protection, label=label, - language="en-US", u2f_counter=u2f_counter, skip_backup=skip_backup, no_backup=no_backup, diff --git a/python/src/trezorlib/debuglink.py b/python/src/trezorlib/debuglink.py index 67de27da2..989d6006d 100644 --- a/python/src/trezorlib/debuglink.py +++ b/python/src/trezorlib/debuglink.py @@ -1241,7 +1241,6 @@ def load_device( pin: Optional[str], passphrase_protection: bool, label: Optional[str], - language: str = "en-US", skip_checksum: bool = False, needs_backup: bool = False, no_backup: bool = False, @@ -1261,7 +1260,6 @@ def load_device( mnemonics=mnemonics, pin=pin, passphrase_protection=passphrase_protection, - language=language, label=label, skip_checksum=skip_checksum, needs_backup=needs_backup, diff --git a/python/src/trezorlib/device.py b/python/src/trezorlib/device.py index 41fd08879..dbea87e80 100644 --- a/python/src/trezorlib/device.py +++ b/python/src/trezorlib/device.py @@ -18,6 +18,7 @@ from __future__ import annotations import os import time +import warnings from typing import TYPE_CHECKING, Callable, Optional from . import messages @@ -47,9 +48,13 @@ def apply_settings( experimental_features: Optional[bool] = None, hide_passphrase_from_host: Optional[bool] = None, ) -> "MessageType": + if language is not None: + warnings.warn( + "language ignored. Use change_language() to set device language.", + DeprecationWarning, + ) settings = messages.ApplySettings( label=label, - language=language, use_passphrase=use_passphrase, homescreen=homescreen, passphrase_always_on_device=passphrase_always_on_device, @@ -150,12 +155,18 @@ def recover( passphrase_protection: bool = False, pin_protection: bool = True, label: Optional[str] = None, - language: str = "en-US", + language: Optional[str] = None, input_callback: Optional[Callable] = None, type: messages.RecoveryDeviceType = messages.RecoveryDeviceType.ScrambledWords, dry_run: bool = False, u2f_counter: Optional[int] = None, ) -> "MessageType": + if language is not None: + warnings.warn( + "language ignored. Use change_language() to set device language.", + DeprecationWarning, + ) + if client.features.model == "1" and input_callback is None: raise RuntimeError("Input callback required for Trezor One") @@ -179,7 +190,6 @@ def recover( msg.passphrase_protection = passphrase_protection msg.pin_protection = pin_protection msg.label = label - msg.language = language msg.u2f_counter = u2f_counter res = client.call(msg) @@ -205,12 +215,18 @@ def reset( passphrase_protection: bool = False, pin_protection: bool = True, label: Optional[str] = None, - language: str = "en-US", + language: Optional[str] = None, u2f_counter: int = 0, skip_backup: bool = False, no_backup: bool = False, backup_type: messages.BackupType = messages.BackupType.Bip39, ) -> "MessageType": + if language is not None: + warnings.warn( + "language ignored. Use change_language() to set device language.", + DeprecationWarning, + ) + if client.features.initialized: raise RuntimeError( "Device is initialized already. Call wipe_device() and try again." @@ -228,7 +244,6 @@ def reset( strength=strength, passphrase_protection=bool(passphrase_protection), pin_protection=bool(pin_protection), - language=language, label=label, u2f_counter=u2f_counter, skip_backup=bool(skip_backup),