What changed, and why it matters
This commit only translates existing error messages into multiple languages. It does not change what the program does, how it handles files, or how it protects data. There is no security issue visible in the changes.
No action needed. This is a localization-only change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit wraps existing WalletFileException error strings with Electrum’s internationalization helper _() so they can be translated. The exception types, control flow, and file handling logic are unchanged. No security-sensitive behavior is modified.
Changed components
electrum/json_db.pyelectrum/storage.pyelectrum/wallet.pyelectrum/wallet_db.pyInspect captured patch +7 / −6
### electrum/json_db.py
@@ -30,7 +30,7 @@
import jsonpatch
import jsonpointer
-from . import util
+from .i18n import _
from .util import WalletFileException, profiler, sticky_property
from .logging import Logger
from .stored_dict import StoredDict, _FLEX_KEY, registered_names, registered_keys, _convert_dict_key, _convert_dict_value
@@ -128,9 +128,9 @@ def load_data(self, s: str) -> Dict[str, Any]:
data, patches = r, []
self.set_modified(True)
else:
- raise WalletFileException("Cannot read wallet file. (parsing failed)")
+ raise WalletFileException(_("Cannot read wallet file") + " (parsing failed)")
if not isinstance(data, dict):
- raise WalletFileException("Malformed wallet file (not dict)")
+ raise WalletFileException(_("Malformed wallet file") + " (not dict)")
if patches:
# apply patches
self.logger.info('found %d patches'%len(patches))
### electrum/storage.py
@@ -33,6 +33,7 @@
import electrum_ecc as ecc
from . import crypto
+from .i18n import _
from .util import (profiler, InvalidPassword, WalletFileException, bfh, standardize_path,
test_read_write_permissions, os_chmod)
@@ -80,7 +81,7 @@ def __init__(
try:
self.raw = f.read().decode("utf-8")
except UnicodeDecodeError as e:
- raise WalletFileException("Cannot read wallet file. (not an Electrum wallet file?)") from e
+ raise WalletFileException(_("Cannot read wallet file. (not an Electrum wallet file?)")) from e
self.pos = f.seek(0, os.SEEK_END)
self.init_pos = self.pos
self._encryption_version = self._init_encryption_version()
### electrum/wallet.py
@@ -4634,7 +4634,7 @@ def wallet_class(wallet_type):
return Multisig_Wallet
if wallet_type in wallet_constructors:
return wallet_constructors[wallet_type]
- raise WalletFileException("Unknown wallet type: " + str(wallet_type))
+ raise WalletFileException(_("Unknown wallet type: {}").format(wallet_type))
def create_new_wallet(
### electrum/wallet_db.py
@@ -356,7 +356,7 @@ def _convert_wallet_type(self):
d['seed'] = seed
self.put(key, d)
else:
- raise WalletFileException('Unable to tell wallet type. Is this even a wallet file?')
+ raise WalletFileException(_('Unable to tell wallet type. Is this even a wallet file?'))
# remove junk
self.put('master_public_key', None)
self.put('master_public_keys', None)Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.