From d877825b70d26aa142c724d863a6355f8be69772 Mon Sep 17 00:00:00 2001 From: tadeubas Date: Fri, 6 Dec 2024 18:26:41 -0300 Subject: [PATCH] Simplifying messages / translations --- i18n/translations/de-DE.json | 12 +-- i18n/translations/es-MX.json | 12 +-- i18n/translations/fr-FR.json | 12 +-- i18n/translations/ja-JP.json | 12 +-- i18n/translations/ko-KR.json | 12 +-- i18n/translations/nl-NL.json | 12 +-- i18n/translations/pt-BR.json | 12 +-- i18n/translations/ru-RU.json | 12 +-- i18n/translations/tr-TR.json | 12 +-- i18n/translations/vi-VN.json | 12 +-- i18n/translations/zh-CN.json | 12 +-- pyproject.toml | 1 + src/krux/firmware.py | 91 ++++++++++--------- src/krux/pages/encryption_ui.py | 29 +++--- src/krux/pages/home_pages/addresses.py | 2 +- src/krux/pages/home_pages/home.py | 2 +- src/krux/pages/home_pages/sign_message_ui.py | 2 +- .../pages/home_pages/wallet_descriptor.py | 2 +- src/krux/pages/login.py | 4 +- src/krux/pages/wallet_settings.py | 18 ++-- src/krux/translations/__init__.py | 12 +-- src/krux/translations/de.py | 12 +-- src/krux/translations/es.py | 12 +-- src/krux/translations/fr.py | 12 +-- src/krux/translations/ja.py | 12 +-- src/krux/translations/ko.py | 12 +-- src/krux/translations/nl.py | 12 +-- src/krux/translations/pt.py | 12 +-- src/krux/translations/ru.py | 12 +-- src/krux/translations/tr.py | 12 +-- src/krux/translations/vi.py | 12 +-- src/krux/translations/zh.py | 12 +-- tests/pages/test_encryption_ui.py | 17 +++- tests/pages/test_wallet_settings.py | 19 +++- 34 files changed, 129 insertions(+), 334 deletions(-) diff --git a/i18n/translations/de-DE.json b/i18n/translations/de-DE.json index f01f7d9d..45c2e289 100644 --- a/i18n/translations/de-DE.json +++ b/i18n/translations/de-DE.json @@ -87,13 +87,7 @@ "Extended Public Key": "Öffentlicher Schlüssel", "Factory Settings": "Werkeinstellungen", "Failed to decrypt": "Entschlüsselung fehlgeschlagen", - "Failed to load PSBT": "PSBT konnte nicht geladen werden", - "Failed to load address": "Adresse konnte nicht geladen werden", - "Failed to load key": "Schlüssel konnte nicht geladen werden", - "Failed to load message": "Nachricht konnte nicht geladen werden", - "Failed to load mnemonic": "Mnemonic konnte nicht geladen werden", - "Failed to load output descriptor": "Ausgabedeskriptor konnte nicht geladen werden", - "Failed to load passphrase": "Passphrase konnte nicht geladen werden", + "Failed to load": "Laden fehlgeschlagen.", "Failed to store mnemonic": "Mnemonic konnte nicht gespeichert werden", "Fee:": "Gebühr:", "Feed Rate": "Vorschubgeschwindigkeit", @@ -102,7 +96,6 @@ "Fill the flash with entropy from camera?": "Den Flash mit Entropie von der Kamera füllen?", "Filling Flash": "Flash wird gefüllt", "Fingerprint unset in PSBT": "Fingerabdruck in PSBT deaktiviert", - "Firmware exceeds max size: %d": "Die Firmware übersteigt die maximale Größe: %d", "Flash Map": "Flash-Karte", "Flash Tools": "Flash-Tools", "Flash filled with camera entropy": "Flash gefüllt mit Kameraentropie", @@ -129,9 +122,7 @@ "Insufficient entropy": "Unzureichende Entropie", "Invalid Tamper Check Code": "Ungültiger Tamper Check Code", "Invalid address": "Ungültige Adresse", - "Invalid bootloader": "Ungültiger Bootloader", "Invalid mnemonic length": "Ungültige mnemonische Lange", - "Invalid public key": "Ungültiger öffentlicher Schlüssel", "Invalid wallet:": "Ungültige Wallet:", "Invert": "Umkehren", "Inverted Colors": "Invertierte Farben", @@ -160,7 +151,6 @@ "Loading..": "Wird geladen..", "Locale": "Spracheinstellung", "Location": "Speicherort", - "Maximum length exceeded (%s)": "Maximale Länge überschritten (%s)", "Message": "Nachricht", "Message:": "Nachricht:", "Missing signature file": "Fehlende Signaturdatei", diff --git a/i18n/translations/es-MX.json b/i18n/translations/es-MX.json index 48c3a5fa..0380d8c1 100644 --- a/i18n/translations/es-MX.json +++ b/i18n/translations/es-MX.json @@ -87,13 +87,7 @@ "Extended Public Key": "Clave Pública Extendida", "Factory Settings": "Ajustes de Fábrica", "Failed to decrypt": "Error al descifrar", - "Failed to load PSBT": "No se pudo cargar la PSBT", - "Failed to load address": "No se pudo cargar la dirección", - "Failed to load key": "No se pudo cargar la clave", - "Failed to load message": "No se pudo cargar el mensaje", - "Failed to load mnemonic": "No se pudo importar el mnemónico", - "Failed to load output descriptor": "No se pudo cargar el descriptor de salida", - "Failed to load passphrase": "No se pudo cargar el passphrase", + "Failed to load": "Error al cargar", "Failed to store mnemonic": "No pudo almacenar mnemónico", "Fee:": "Comisión:", "Feed Rate": "Feed Rate", @@ -102,7 +96,6 @@ "Fill the flash with entropy from camera?": "¿Llenar el flash con entropía de la cámara?", "Filling Flash": "Llenando Flash", "Fingerprint unset in PSBT": "Huella dactilar no establecida en PSBT", - "Firmware exceeds max size: %d": "El firmware supera el tamaño máximo: %d", "Flash Map": "Mapa Flash", "Flash Tools": "Flash Tools", "Flash filled with camera entropy": "Flash lleno de entropía de cámara", @@ -129,9 +122,7 @@ "Insufficient entropy": "Entropía insuficiente", "Invalid Tamper Check Code": "Código de verificación no válido", "Invalid address": "Dirección inválida", - "Invalid bootloader": "Bootloader inválido", "Invalid mnemonic length": "Longitud mnemónica no válida", - "Invalid public key": "Clave pública inválida", "Invalid wallet:": "Cartera inválida:", "Invert": "Invertir", "Inverted Colors": "Colores Invertidos", @@ -160,7 +151,6 @@ "Loading..": "Cargando..", "Locale": "Idioma", "Location": "Ubicación", - "Maximum length exceeded (%s)": "Longitud máxima excedida (%s)", "Message": "Mensaje", "Message:": "Mensaje:", "Missing signature file": "Falta archivo de firma", diff --git a/i18n/translations/fr-FR.json b/i18n/translations/fr-FR.json index ff1232d4..23a77c2b 100644 --- a/i18n/translations/fr-FR.json +++ b/i18n/translations/fr-FR.json @@ -87,13 +87,7 @@ "Extended Public Key": "Clé publique", "Factory Settings": "Paramètres d'usine", "Failed to decrypt": "Échec du déchiffrement", - "Failed to load PSBT": "Échec du chargement PSBT", - "Failed to load address": "Échec du chargement d'adresse", - "Failed to load key": "Échec du chargement de la clé", - "Failed to load message": "Échec du chargement du message", - "Failed to load mnemonic": "Échec du chargement mnémonique", - "Failed to load output descriptor": "Échec du chargement du descripteur de sortie", - "Failed to load passphrase": "Échec du chargement de la phrase secrète", + "Failed to load": "Échec lors du chargement", "Failed to store mnemonic": "Échec du stockage mnémonique", "Fee:": "Frais :", "Feed Rate": "Taux d'alimentation", @@ -102,7 +96,6 @@ "Fill the flash with entropy from camera?": "Remplir le flash avec l'entropie de la caméra ?", "Filling Flash": "Remplissage du Flash", "Fingerprint unset in PSBT": "Empreinte digitale manquante dans PSBT", - "Firmware exceeds max size: %d": "Le micrologiciel dépasse la taille maximale : %d", "Flash Map": "Plan du Flash", "Flash Tools": "Outils Flash", "Flash filled with camera entropy": "Flash rempli par l'entropie de la caméra", @@ -129,9 +122,7 @@ "Insufficient entropy": "Entropie insuffisante", "Invalid Tamper Check Code": "Code de non compromis non valide", "Invalid address": "Adresse invalide", - "Invalid bootloader": "Chargeur de démarrage invalide", "Invalid mnemonic length": "Longueur mnémonique invalide", - "Invalid public key": "Clé publique non valide", "Invalid wallet:": "Portefeuille invalide :", "Invert": "Inverser", "Inverted Colors": "Couleurs inversées", @@ -160,7 +151,6 @@ "Loading..": "Chargement..", "Locale": "Paramètres régionaux", "Location": "Emplacement", - "Maximum length exceeded (%s)": "Longueur maximale dépassée (%s)", "Message": "Message", "Message:": "Message :", "Missing signature file": "Fichier de signature manquant", diff --git a/i18n/translations/ja-JP.json b/i18n/translations/ja-JP.json index 51c5dc5d..68833735 100644 --- a/i18n/translations/ja-JP.json +++ b/i18n/translations/ja-JP.json @@ -87,13 +87,7 @@ "Extended Public Key": "拡張公開キー", "Factory Settings": "初期設定", "Failed to decrypt": "復号化に失敗しました", - "Failed to load PSBT": "PSBTのロードに失敗しました", - "Failed to load address": "アドレスの読み込みに失敗しました", - "Failed to load key": "キーのロードに失敗しました", - "Failed to load message": "メッセージの読み込みに失敗しました", - "Failed to load mnemonic": "mnemonicのロードに失敗しました", - "Failed to load output descriptor": "出力記述子のロードに失敗しました", - "Failed to load passphrase": "パスフレーズのロードに失敗しました", + "Failed to load": "ロードに失敗しました。", "Failed to store mnemonic": "mnemonicの保存に失敗しました", "Fee:": "手数料:", "Feed Rate": "フィードレート", @@ -102,7 +96,6 @@ "Fill the flash with entropy from camera?": "カメラからのエントロピーでフラッシュを埋めますか?", "Filling Flash": "フラッシュを充填中", "Fingerprint unset in PSBT": "PSBTでデジタル指紋が未設定", - "Firmware exceeds max size: %d": "ファームウェアが最大サイズを超えました: %d", "Flash Map": "フラッシュマップ", "Flash Tools": "Flashツール", "Flash filled with camera entropy": "カメラエントロピーで満たされたフラッシュ", @@ -129,9 +122,7 @@ "Insufficient entropy": "不十分なエントロピー", "Invalid Tamper Check Code": "無効な改ざんチェックコード", "Invalid address": "無効なアドレス", - "Invalid bootloader": "無効なブートローダー", "Invalid mnemonic length": "無効なニーモニックの長さ", - "Invalid public key": "無効な公開キー", "Invalid wallet:": "無効なウォレット:", "Invert": "反転する", "Inverted Colors": "反転した色", @@ -160,7 +151,6 @@ "Loading..": "読み込み中..", "Locale": "ロケール", "Location": "場所", - "Maximum length exceeded (%s)": "最大長を超えました (%s)", "Message": "メッセージ", "Message:": "メッセージ:", "Missing signature file": "署名ファイルが欠落しています", diff --git a/i18n/translations/ko-KR.json b/i18n/translations/ko-KR.json index 39073943..ac6e4f10 100644 --- a/i18n/translations/ko-KR.json +++ b/i18n/translations/ko-KR.json @@ -87,13 +87,7 @@ "Extended Public Key": "XPUB 내보내기", "Factory Settings": "공장 초기 설정", "Failed to decrypt": "복호화에 실패했습니다", - "Failed to load PSBT": "PSBT를 불러오지 못했습니다", - "Failed to load address": "주소를 불러오지 못했습니다", - "Failed to load key": "키 로드에 실패했습니다", - "Failed to load message": "메시지를 불러오지 못했습니다", - "Failed to load mnemonic": "니모닉을 불러오지 못했습니다", - "Failed to load output descriptor": "아웃풋 디스크립터를 불러오지 못했습니다", - "Failed to load passphrase": "패스프레이즈를 불러오지 못했습니다", + "Failed to load": "로드 실패", "Failed to store mnemonic": "니모닉을 저장하지 못했습니다", "Fee:": "수수료:", "Feed Rate": "Feed Rate", @@ -102,7 +96,6 @@ "Fill the flash with entropy from camera?": "카메라의 엔트로피로 플래시를 채우시겠습니까?", "Filling Flash": "플래시 채우기", "Fingerprint unset in PSBT": "PSBT에서 지문이 설정되지 않았습니다", - "Firmware exceeds max size: %d": "펌웨어가 최대 크기를 초과했습니다: %d", "Flash Map": "플래시 맵", "Flash Tools": "플래시 도구", "Flash filled with camera entropy": "카메라 엔트로피로 가득 찬 플래시", @@ -129,9 +122,7 @@ "Insufficient entropy": "엔트로피가 충분하지 않습니다", "Invalid Tamper Check Code": "유효하지 않은 탬퍼 체크 코드", "Invalid address": "주소가 잘못되었습니다", - "Invalid bootloader": "부트로더가 잘못되었습니다", "Invalid mnemonic length": "니모닉 길이가 잘못되었습니다", - "Invalid public key": "공개키가 잘못되었습니다", "Invalid wallet:": "지갑이 잘못되었습니다:", "Invert": "반전", "Inverted Colors": "반전된 색상", @@ -160,7 +151,6 @@ "Loading..": "로딩 중..", "Locale": "언어 설정", "Location": "기본 저장소", - "Maximum length exceeded (%s)": "최대 길이를 초과함 (%s)", "Message": "메시지", "Message:": "메시지:", "Missing signature file": "서명 파일이 누락되었습니다", diff --git a/i18n/translations/nl-NL.json b/i18n/translations/nl-NL.json index c8f87eae..a97ffeab 100644 --- a/i18n/translations/nl-NL.json +++ b/i18n/translations/nl-NL.json @@ -87,13 +87,7 @@ "Extended Public Key": "Uitgebreide publieke sleutel", "Factory Settings": "Fabrieksinstellingen", "Failed to decrypt": "Ontsleutelen is niet gelukt", - "Failed to load PSBT": "PSBT laden is niet gelukt", - "Failed to load address": "Adres laden is niet gelukt", - "Failed to load key": "Sleutel laden is niet gelukt", - "Failed to load message": "Bericht laden is niet gelukt", - "Failed to load mnemonic": "Geheugensteun laden is niet gelukt", - "Failed to load output descriptor": "Descriptor laden is niet gelukt", - "Failed to load passphrase": "Wachtwoord laden is niet gelukt", + "Failed to load": "Laden mislukt", "Failed to store mnemonic": "Geheugensteun opslaan is niet gelukt", "Fee:": "Tarief:", "Feed Rate": "Voedingssnelheid", @@ -102,7 +96,6 @@ "Fill the flash with entropy from camera?": "De flash vullen met entropie van de camera?", "Filling Flash": "Flash vullen", "Fingerprint unset in PSBT": "Vingerafdruk niet ingesteld in PSBT", - "Firmware exceeds max size: %d": "Firmware overschrijdt de maximale grootte: %d", "Flash Map": "Flash Map", "Flash Tools": "Flash Tools", "Flash filled with camera entropy": "Flash gevuld met camera-entropie", @@ -129,9 +122,7 @@ "Insufficient entropy": "Onvoldoende entropie", "Invalid Tamper Check Code": "Ongeldige sabotagecontrolecode", "Invalid address": "Ongeldig adres", - "Invalid bootloader": "Ongeldige bootloader", "Invalid mnemonic length": "Ongeldige geheugensteun lengte", - "Invalid public key": "Ongeldige publieke sleutel", "Invalid wallet:": "Ongeldige portemonnee:", "Invert": "Omkeren", "Inverted Colors": "Omgekeerde kleuren", @@ -160,7 +151,6 @@ "Loading..": "Laden..", "Locale": "Taal", "Location": "Opslaglocatie", - "Maximum length exceeded (%s)": "Maximale lengte overschreden (%s)", "Message": "Bericht", "Message:": "Bericht:", "Missing signature file": "Handtekening bestand mist", diff --git a/i18n/translations/pt-BR.json b/i18n/translations/pt-BR.json index 7eb4dc1f..cfb13ba9 100644 --- a/i18n/translations/pt-BR.json +++ b/i18n/translations/pt-BR.json @@ -87,13 +87,7 @@ "Extended Public Key": "Chave Pública Estendida", "Factory Settings": "Configurações de Fábrica", "Failed to decrypt": "Falhou em descriptografar", - "Failed to load PSBT": "Falhou ao carregar PSBT", - "Failed to load address": "Falhou ao carregar endereço", - "Failed to load key": "Falha ao carregar a chave", - "Failed to load message": "Falhou ao carregar mensagem", - "Failed to load mnemonic": "Falhou ao carregar mnemônico", - "Failed to load output descriptor": "Falha ao carregar o descritor de saída", - "Failed to load passphrase": "Falha ao carregar a senha", + "Failed to load": "Falha ao carregar", "Failed to store mnemonic": "Falhou ao armazenar mnemônico", "Fee:": "Taxa:", "Feed Rate": "Taxa de Alimentação", @@ -102,7 +96,6 @@ "Fill the flash with entropy from camera?": "Preencher a flash com entropia da câmera?", "Filling Flash": "Preenchendo a Flash", "Fingerprint unset in PSBT": "Impressão digital não definida no PSBT", - "Firmware exceeds max size: %d": "Firmware excede o tamanho máximo: %d", "Flash Map": "Mapa da Flash", "Flash Tools": "Ferramentas da Flash", "Flash filled with camera entropy": "Flash preenchida com entropia da câmera", @@ -129,9 +122,7 @@ "Insufficient entropy": "Entropia insuficiente", "Invalid Tamper Check Code": "Código de verificação inválido", "Invalid address": "Endereço inválido", - "Invalid bootloader": "Bootloader inválido", "Invalid mnemonic length": "Comprimento de mnemônico inválido", - "Invalid public key": "Chave pública inválida", "Invalid wallet:": "Carteira inválida:", "Invert": "Invertido", "Inverted Colors": "Cores invertidas", @@ -160,7 +151,6 @@ "Loading..": "Carregando..", "Locale": "Idioma", "Location": "Local", - "Maximum length exceeded (%s)": "Comprimento máximo excedido (%s)", "Message": "Mensagem", "Message:": "Mensagem:", "Missing signature file": "Arquivo de assinatura faltando", diff --git a/i18n/translations/ru-RU.json b/i18n/translations/ru-RU.json index 5e25e708..2d0d76f6 100644 --- a/i18n/translations/ru-RU.json +++ b/i18n/translations/ru-RU.json @@ -87,13 +87,7 @@ "Extended Public Key": "Расширенный Публичный Ключ", "Factory Settings": "Заводские Настройки", "Failed to decrypt": "Не удалось расшифровать", - "Failed to load PSBT": "Не удалось загрузить PSBT", - "Failed to load address": "Не удалось загрузить адрес", - "Failed to load key": "Не удалось загрузить ключ", - "Failed to load message": "Не удалось загрузить сообщение", - "Failed to load mnemonic": "Не удалось загрузить мнемонику", - "Failed to load output descriptor": "Не удалось загрузить выходной дескриптор", - "Failed to load passphrase": "Не удалось загрузить фразу-пароль", + "Failed to load": "Не удалось ничего загрузить", "Failed to store mnemonic": "Не удалось сохранить мнемонику", "Fee:": "Комиссия:", "Feed Rate": "Скорость Подачи", @@ -102,7 +96,6 @@ "Fill the flash with entropy from camera?": "Заполнить флэш энтропией с камеры?", "Filling Flash": "Заполнение флэша", "Fingerprint unset in PSBT": "Отпечаток пальца не установлен в PSBT", - "Firmware exceeds max size: %d": "Прошивка превышает максимальный размер: %d", "Flash Map": "Карта флэша", "Flash Tools": "Flash Tools", "Flash filled with camera entropy": "Флэш заполнен энтропией камеры", @@ -129,9 +122,7 @@ "Insufficient entropy": "Недостаточная энтропия", "Invalid Tamper Check Code": "Недействительный код проверки вскрытия", "Invalid address": "Неверный адрес", - "Invalid bootloader": "Неверный загрузчик", "Invalid mnemonic length": "Неверная длина мнемоники", - "Invalid public key": "Неверный публичный ключ", "Invalid wallet:": "Неверный кошелек:", "Invert": "Инвертировать", "Inverted Colors": "Перевернутые цвета", @@ -160,7 +151,6 @@ "Loading..": "Загрузка..", "Locale": "Локаль", "Location": "Расположение", - "Maximum length exceeded (%s)": "Максимальная длина превышена (%s)", "Message": "Сообщение", "Message:": "Сообщение:", "Missing signature file": "Отсутствует файл подписи", diff --git a/i18n/translations/tr-TR.json b/i18n/translations/tr-TR.json index 12071ba7..d59d2242 100644 --- a/i18n/translations/tr-TR.json +++ b/i18n/translations/tr-TR.json @@ -87,13 +87,7 @@ "Extended Public Key": "Genişletilmiş Public Key", "Factory Settings": "Fabrika Ayarları", "Failed to decrypt": "Şifre çözme başarısız", - "Failed to load PSBT": "PSBT yükleme başarısız", - "Failed to load address": "Adres yükleme başarısız", - "Failed to load key": "Anahtar yükleme başarısız", - "Failed to load message": "Mesaj yükleme başarısız", - "Failed to load mnemonic": "Mnemonic yükleme başarısız", - "Failed to load output descriptor": "Çıktı tanımlayıcısı yüklemesi başarısız", - "Failed to load passphrase": "Parola yükleme başarısız", + "Failed to load": "Yüklenemedi", "Failed to store mnemonic": "Mnemonic depolama başarısız", "Fee:": "Ücret:", "Feed Rate": "Besleme Hızı", @@ -102,7 +96,6 @@ "Fill the flash with entropy from camera?": "Flash'ı kameradan gelen entropi ile doldur?", "Filling Flash": "Flash Dolduruluyor", "Fingerprint unset in PSBT": "PSBT'de parmak izi ayarı kaldırıldı", - "Firmware exceeds max size: %d": "Donanım yazılımı maksimum boyutu aşıyor: %d", "Flash Map": "Flash Haritası", "Flash Tools": "Flash Araçları", "Flash filled with camera entropy": "Flash kamera entropisi ile dolduruldu", @@ -129,9 +122,7 @@ "Insufficient entropy": "Yetersiz entropi", "Invalid Tamper Check Code": "Geçersiz Kurcalama Kontrol Kodu", "Invalid address": "Geçersiz adres", - "Invalid bootloader": "Geçersiz önyükleyici", "Invalid mnemonic length": "Geçersiz mnemonic uzunluğu", - "Invalid public key": "Geçersiz public key", "Invalid wallet:": "Geçersiz cüzdan:", "Invert": "Ters Çevir", "Inverted Colors": "Ters Renkler", @@ -160,7 +151,6 @@ "Loading..": "Yükleniyor..", "Locale": "Yerel", "Location": "Konum", - "Maximum length exceeded (%s)": "Maksimum uzunluk aşıldı (%s)", "Message": "Mesaj", "Message:": "Mesaj:", "Missing signature file": "İmza dosyası eksik", diff --git a/i18n/translations/vi-VN.json b/i18n/translations/vi-VN.json index a4b2dfaa..14b760db 100644 --- a/i18n/translations/vi-VN.json +++ b/i18n/translations/vi-VN.json @@ -87,13 +87,7 @@ "Extended Public Key": "Khóa công cộng", "Factory Settings": "Cài đặt Gốc", "Failed to decrypt": "Không giải mã được", - "Failed to load PSBT": "Tải PSBT thất bại", - "Failed to load address": "Tải địa chỉ thất bại", - "Failed to load key": "Không tải được khóa", - "Failed to load message": "Không tải được tin nhắn", - "Failed to load mnemonic": "Tải mã Mnemonic thất bại", - "Failed to load output descriptor": "Không tải được bộ mô tả đầu ra", - "Failed to load passphrase": "Không tải được cụm mật khẩu", + "Failed to load": "Tải thất bại", "Failed to store mnemonic": "Không lưu trữ Mnemonic được", "Fee:": "Phí:", "Feed Rate": "Tốc độ cắt CNC", @@ -102,7 +96,6 @@ "Fill the flash with entropy from camera?": "Điền vào flash với entropy từ máy ảnh?", "Filling Flash": "Đèn Flash Đổ Đầy", "Fingerprint unset in PSBT": "Bỏ dấu vân tay trong PSBT", - "Firmware exceeds max size: %d": "Phần mềm vượt quá kích thước tối đa: %d", "Flash Map": "Bản đồ Flash", "Flash Tools": "Công cụ Flash", "Flash filled with camera entropy": "Đèn flash chứa đầy entropy của máy ảnh", @@ -129,9 +122,7 @@ "Insufficient entropy": "Không đủ entropy", "Invalid Tamper Check Code": "Mã kiểm tra giả mạo không hợp lệ", "Invalid address": "Địa chỉ không hợp lệ", - "Invalid bootloader": "Bộ tải khởi động không hợp lệ", "Invalid mnemonic length": "Độ dài mã Mnemonic không hợp lệ", - "Invalid public key": "Khóa công cộng không hợp lệ", "Invalid wallet:": "Ví không hợp lệ:", "Invert": "Đảo ngược", "Inverted Colors": "Màu đảo ngược", @@ -160,7 +151,6 @@ "Loading..": "Đang tải..", "Locale": "Ngôn ngữ", "Location": "Vị trí lưu", - "Maximum length exceeded (%s)": "Chiều dài tối đa vượt quá (%s)", "Message": "Tin nhắn", "Message:": "Tin nhắn:", "Missing signature file": "Thiếu tập tin chữ ký", diff --git a/i18n/translations/zh-CN.json b/i18n/translations/zh-CN.json index acbf94cc..e80c2e32 100644 --- a/i18n/translations/zh-CN.json +++ b/i18n/translations/zh-CN.json @@ -87,13 +87,7 @@ "Extended Public Key": "扩展公钥", "Factory Settings": "出厂设置", "Failed to decrypt": "解密失败", - "Failed to load PSBT": "加载 PSBT 失败", - "Failed to load address": "加载地址失败", - "Failed to load key": "加载密钥失败", - "Failed to load message": "加载消息失败", - "Failed to load mnemonic": "加载助记词失败", - "Failed to load output descriptor": "加载输出描述符失败", - "Failed to load passphrase": "加载密码失败", + "Failed to load": "加载失败", "Failed to store mnemonic": "存储助记词失败", "Fee:": "费用:", "Feed Rate": "进给速度", @@ -102,7 +96,6 @@ "Fill the flash with entropy from camera?": "用摄像头的熵填充Flash?", "Filling Flash": "填充Flash", "Fingerprint unset in PSBT": "PSBT 中未设置指纹", - "Firmware exceeds max size: %d": "固件超过最大尺寸:%d", "Flash Map": "Flash地图", "Flash Tools": "Flash工具", "Flash filled with camera entropy": "Flash已用摄像头熵填充", @@ -129,9 +122,7 @@ "Insufficient entropy": "熵不足", "Invalid Tamper Check Code": "无效的防篡改检查码", "Invalid address": "无效地址", - "Invalid bootloader": "无效的 ootloader ", "Invalid mnemonic length": "助记词长度无效", - "Invalid public key": "无效公钥", "Invalid wallet:": "无效钱包:", "Invert": "反转", "Inverted Colors": "反转颜色", @@ -160,7 +151,6 @@ "Loading..": "加载中..", "Locale": "语言环境", "Location": "位置", - "Maximum length exceeded (%s)": "超过最大长度(%s)", "Message": "消息", "Message:": "消息:", "Missing signature file": "缺少签名文件", diff --git a/pyproject.toml b/pyproject.toml index 304a94c9..623a0d5c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -119,6 +119,7 @@ simulator-wonder-mv = "python simulator/simulator.py --device maixpy_wonder_mv" # aliases simulator.ref = "simulator-amigo" simulator-m5.ref = "simulator-m5stickv" +simulator-mv.ref = "simulator-wonder-mv" # git tasks git-update = "git submodule update --init --recursive" diff --git a/src/krux/firmware.py b/src/krux/firmware.py index 3d99ca09..03bdf969 100644 --- a/src/krux/firmware.py +++ b/src/krux/firmware.py @@ -193,15 +193,17 @@ def upgrade(): inp = Input() - display.clear() - display.draw_centered_text(t("New firmware detected.") + "\n\n" + t("Verifying..")) + def status_text(text): + display.clear() + display.draw_centered_text(text) + + status_text(t("New firmware detected.") + "\n\n" + t("Verifying..")) new_size = fsize(firmware_path) firmware_hash = sha256(firmware_path) firmware_with_header_hash = sha256(firmware_path, new_size) - display.clear() - display.draw_centered_text( + status_text( t("New firmware detected.") + "\n\n" + "SHA256:\n" @@ -215,14 +217,14 @@ def upgrade(): return False if new_size > MAX_FIRMWARE_SIZE: - display.flash_text(t("Firmware exceeds max size: %d") % MAX_FIRMWARE_SIZE) + display.flash_text("Firmware exceeds max size: %d" % MAX_FIRMWARE_SIZE) return False pubkey = None try: pubkey = ec.PublicKey.from_string(SIGNER_PUBKEY) except: - display.flash_text(t("Invalid public key")) + display.flash_text("Invalid public key") return False sig = None @@ -248,53 +250,52 @@ def upgrade(): boot_config_sector = flash.read(BACKUP_BOOT_CONFIG_SECTOR_ADDRESS, 4096) address, _, entry_index = find_active_firmware(boot_config_sector) if address is None: - display.flash_text(t("Invalid bootloader")) + display.flash_text("Invalid bootloader") return False # Write new firmware to the opposite slot new_address = FIRMWARE_SLOT_2 if address == FIRMWARE_SLOT_1 else FIRMWARE_SLOT_1 - def status_text(text): - display.clear() - display.draw_centered_text(text) - - write_data( - lambda pct: status_text( - t("Processing..") + "1/3" + "\n\n%d%%" % int(pct * 100) - ), - new_address, - open(firmware_path, "rb", buffering=0), - new_size, - 65536, - True, - firmware_with_header_hash, - ) + try: + write_data( + lambda pct: status_text( + t("Processing..") + "1/3" + "\n\n%d%%" % int(pct * 100) + ), + new_address, + open(firmware_path, "rb", buffering=0), + new_size, + 65536, + True, + firmware_with_header_hash, + ) - write_data( - lambda pct: status_text( - t("Processing..") + "2/3" + "\n\n%d%%" % int(pct * 100) - ), - BACKUP_BOOT_CONFIG_SECTOR_ADDRESS, - io.BytesIO(boot_config_sector), - len(boot_config_sector), - 4096, - ) + write_data( + lambda pct: status_text( + t("Processing..") + "2/3" + "\n\n%d%%" % int(pct * 100) + ), + BACKUP_BOOT_CONFIG_SECTOR_ADDRESS, + io.BytesIO(boot_config_sector), + len(boot_config_sector), + 4096, + ) - new_boot_config_sector = update_boot_config_sector( - boot_config_sector, entry_index, new_address, new_size - ) - write_data( - lambda pct: status_text( - t("Processing..") + "3/3" + "\n\n%d%%" % int(pct * 100) - ), - MAIN_BOOT_CONFIG_SECTOR_ADDRESS, - io.BytesIO(new_boot_config_sector), - len(new_boot_config_sector), - 4096, - ) + new_boot_config_sector = update_boot_config_sector( + boot_config_sector, entry_index, new_address, new_size + ) + write_data( + lambda pct: status_text( + t("Processing..") + "3/3" + "\n\n%d%%" % int(pct * 100) + ), + MAIN_BOOT_CONFIG_SECTOR_ADDRESS, + io.BytesIO(new_boot_config_sector), + len(new_boot_config_sector), + 4096, + ) + except: + display.flash_text("Error read/write data") + return False - display.clear() - display.draw_centered_text( + status_text( t("Upgrade complete.") + "\n" + t("Remove firmware files from SD Card?") ) inp.buttons_active = True diff --git a/src/krux/pages/encryption_ui.py b/src/krux/pages/encryption_ui.py index 5b06b136..f63571bd 100644 --- a/src/krux/pages/encryption_ui.py +++ b/src/krux/pages/encryption_ui.py @@ -60,20 +60,22 @@ def encryption_key(self): if key: self.ctx.display.clear() - continue_string = t("Key") + ": " + key + "\n\n" - continue_string += t("Proceed?") + self.ctx.display.draw_hcentered_text(t("Key") + ": " + key) if self.prompt( - continue_string, - self.ctx.display.height() // 2, + t("Proceed?"), + BOTTOM_PROMPT_LINE, ): return key return None def load_key(self): """Loads and returns a key from keypad""" - return self.capture_from_keypad( + data = self.capture_from_keypad( t("Key"), [LETTERS, UPPERCASE_LETTERS, NUM_SPECIAL_1, NUM_SPECIAL_2] ) + if len(str(data)) > ENCRYPTION_KEY_MAX_LEN: + raise ValueError("Maximum length exceeded (%s)" % ENCRYPTION_KEY_MAX_LEN) + return data def load_qr_encryption_key(self): """Loads and returns a key from a QR code""" @@ -83,11 +85,10 @@ def load_qr_encryption_key(self): qr_capture = QRCodeCapture(self.ctx) data, _ = qr_capture.qr_capture_loop() if data is None: - self.flash_error(t("Failed to load key")) + self.flash_error(t("Failed to load")) return None if len(data) > ENCRYPTION_KEY_MAX_LEN: - self.flash_error(t("Maximum length exceeded (%s)") % ENCRYPTION_KEY_MAX_LEN) - return None + raise ValueError("Maximum length exceeded (%s)" % ENCRYPTION_KEY_MAX_LEN) return data @@ -125,7 +126,7 @@ def _get_user_inputs(self): key_capture = EncryptionKey(self.ctx) key = key_capture.encryption_key() if key is None: - self.flash_text(error_txt) + self.flash_error(t("Key was not provided")) return None version = Settings().encryption.version @@ -136,14 +137,14 @@ def _get_user_inputs(self): t("Additional entropy from camera required for AES-CBC mode") ) if not self.prompt(t("Proceed?"), BOTTOM_PROMPT_LINE): - self.flash_text(error_txt) + self.flash_error(error_txt) return None from .capture_entropy import CameraEntropy camera_entropy = CameraEntropy(self.ctx) entropy = camera_entropy.capture(show_entropy_details=False) if entropy is None: - self.flash_text(error_txt) + self.flash_error(error_txt) return None i_vector = entropy[:AES_BLOCK_SIZE] @@ -269,6 +270,8 @@ def _load_encrypted_mnemonic(self, mnemonic_id, sd_card=False): """Uses encryption module to load and decrypt a mnemonic""" from ..encryption import MnemonicStorage + error_txt = t("Failed to decrypt") + key_capture = EncryptionKey(self.ctx) key = key_capture.encryption_key() if key in (None, "", ESC_KEY): @@ -280,11 +283,11 @@ def _load_encrypted_mnemonic(self, mnemonic_id, sd_card=False): try: words = mnemonic_storage.decrypt(key, mnemonic_id, sd_card).split() except: - self.flash_error(t("Failed to decrypt")) + self.flash_error(error_txt) return MENU_CONTINUE if len(words) not in (12, 24): - self.flash_error(t("Failed to decrypt")) + self.flash_error(error_txt) return MENU_CONTINUE del mnemonic_storage return words diff --git a/src/krux/pages/home_pages/addresses.py b/src/krux/pages/home_pages/addresses.py index 2544394c..5228aeb3 100644 --- a/src/krux/pages/home_pages/addresses.py +++ b/src/krux/pages/home_pages/addresses.py @@ -148,7 +148,7 @@ def scan_address(self, addr_type=0): qr_capture = QRCodeCapture(self.ctx) data, qr_format = qr_capture.qr_capture_loop() if data is None or qr_format != FORMAT_NONE: - self.flash_error(t("Failed to load address")) + self.flash_error(t("Failed to load")) return MENU_CONTINUE addr = None diff --git a/src/krux/pages/home_pages/home.py b/src/krux/pages/home_pages/home.py index a4ee86db..8285e993 100644 --- a/src/krux/pages/home_pages/home.py +++ b/src/krux/pages/home_pages/home.py @@ -285,7 +285,7 @@ def sign_psbt(self): if data is None and psbt_filename == "": # Both the camera and the file on SD card failed! - self.flash_error(t("Failed to load PSBT")) + self.flash_error(t("Failed to load")) return MENU_CONTINUE # PSBT read OK! Will try to sign diff --git a/src/krux/pages/home_pages/sign_message_ui.py b/src/krux/pages/home_pages/sign_message_ui.py index b4d186c9..c02aa3c9 100644 --- a/src/krux/pages/home_pages/sign_message_ui.py +++ b/src/krux/pages/home_pages/sign_message_ui.py @@ -344,7 +344,7 @@ def sign_message(self): data, qr_format, message_filename = self._load_message() if data is None: - self.flash_error(t("Failed to load message")) + self.flash_error(t("Failed to load")) return MENU_CONTINUE if message_filename: diff --git a/src/krux/pages/home_pages/wallet_descriptor.py b/src/krux/pages/home_pages/wallet_descriptor.py index 85cbb22b..a146406e 100644 --- a/src/krux/pages/home_pages/wallet_descriptor.py +++ b/src/krux/pages/home_pages/wallet_descriptor.py @@ -107,7 +107,7 @@ def _load_wallet(self): if wallet_data is None: # Camera or SD card loading failed! - self.flash_error(t("Failed to load output descriptor")) + self.flash_error(t("Failed to load")) return MENU_CONTINUE from ...wallet import Wallet, AssumptionWarning diff --git a/src/krux/pages/login.py b/src/krux/pages/login.py index 28019df5..55dee40f 100644 --- a/src/krux/pages/login.py +++ b/src/krux/pages/login.py @@ -382,7 +382,7 @@ def load_key_from_qr_code(self): qr_capture = QRCodeCapture(self.ctx) data, qr_format = qr_capture.qr_capture_loop() if data is None: - self.flash_error(t("Failed to load mnemonic")) + self.flash_error(t("Failed to load")) return MENU_CONTINUE words = [] @@ -706,7 +706,7 @@ def load_key_from_tiny_seed_image(self, grid_type="Tiny Seed"): words = tiny_scanner.scanner(len_mnemonic == 24) del tiny_scanner if words is None: - self.flash_error(t("Failed to load mnemonic")) + self.flash_error(t("Failed to load")) return MENU_CONTINUE return self._load_key_from_words(words) diff --git a/src/krux/pages/wallet_settings.py b/src/krux/pages/wallet_settings.py index 04dcb5b7..6a16abd4 100644 --- a/src/krux/pages/wallet_settings.py +++ b/src/krux/pages/wallet_settings.py @@ -22,7 +22,7 @@ from embit.networks import NETWORKS from embit.bip32 import HARDENED_INDEX -from ..display import FONT_HEIGHT, DEFAULT_PADDING +from ..display import FONT_HEIGHT, DEFAULT_PADDING, BOTTOM_PROMPT_LINE from ..krux_settings import t from . import ( Page, @@ -69,17 +69,21 @@ def load_passphrase_menu(self): if passphrase in (ESC_KEY, MENU_EXIT): return None self.ctx.display.clear() + self.ctx.display.draw_hcentered_text(t("Passphrase") + ": " + passphrase) if self.prompt( - t("Passphrase") + ": " + passphrase, - self.ctx.display.height() // 2, + t("Proceed?"), + BOTTOM_PROMPT_LINE, ): return passphrase def _load_passphrase(self): """Loads and returns a passphrase from keypad""" - return self.capture_from_keypad( + data = self.capture_from_keypad( t("Passphrase"), [LETTERS, UPPERCASE_LETTERS, NUM_SPECIAL_1, NUM_SPECIAL_2] ) + if len(str(data)) > PASSPHRASE_MAX_LEN: + raise ValueError("Maximum length exceeded (%s)" % PASSPHRASE_MAX_LEN) + return data def _load_qr_passphrase(self): from .qr_capture import QRCodeCapture @@ -87,11 +91,10 @@ def _load_qr_passphrase(self): qr_capture = QRCodeCapture(self.ctx) data, _ = qr_capture.qr_capture_loop() if data is None: - self.flash_error(t("Failed to load passphrase")) + self.flash_error(t("Failed to load")) return MENU_CONTINUE if len(data) > PASSPHRASE_MAX_LEN: - self.flash_error(t("Maximum length exceeded (%s)") % PASSPHRASE_MAX_LEN) - return MENU_CONTINUE + raise ValueError("Maximum length exceeded (%s)" % PASSPHRASE_MAX_LEN) return data @@ -125,6 +128,7 @@ def customize_wallet(self, key): if multisig: derivation_path += "/2'" + self.ctx.display.clear() derivation_path = self.fit_to_line(derivation_path, crop_middle=False) info_len = self.ctx.display.draw_hcentered_text( derivation_path, info_box=True diff --git a/src/krux/translations/__init__.py b/src/krux/translations/__init__.py index d7f3a069..d430f4d2 100644 --- a/src/krux/translations/__init__.py +++ b/src/krux/translations/__init__.py @@ -121,13 +121,7 @@ 1711312434, 3981762528, 383371114, - 3048830188, - 4192663412, - 1996021743, - 1108715658, - 1081425878, - 928667220, - 1620572516, + 3215045701, 2946146830, 262248294, 104500973, @@ -136,7 +130,6 @@ 4014189410, 3804482397, 4006602858, - 2542772894, 828589330, 2777318640, 1384661010, @@ -163,9 +156,7 @@ 2032416055, 3248804547, 2585599782, - 2874529150, 4093416954, - 1422874211, 237577215, 4122897393, 640219121, @@ -194,7 +185,6 @@ 3159494909, 1177338798, 2817059741, - 2917810189, 2030045667, 762611188, 3928301843, diff --git a/src/krux/translations/de.py b/src/krux/translations/de.py index e29ac9b3..c5ccbe62 100644 --- a/src/krux/translations/de.py +++ b/src/krux/translations/de.py @@ -109,13 +109,7 @@ "Öffentlicher Schlüssel", "Werkeinstellungen", "Entschlüsselung fehlgeschlagen", - "PSBT konnte nicht geladen werden", - "Adresse konnte nicht geladen werden", - "Schlüssel konnte nicht geladen werden", - "Nachricht konnte nicht geladen werden", - "Mnemonic konnte nicht geladen werden", - "Ausgabedeskriptor konnte nicht geladen werden", - "Passphrase konnte nicht geladen werden", + "Laden fehlgeschlagen.", "Mnemonic konnte nicht gespeichert werden", "Gebühr:", "Vorschubgeschwindigkeit", @@ -124,7 +118,6 @@ "Den Flash mit Entropie von der Kamera füllen?", "Flash wird gefüllt", "Fingerabdruck in PSBT deaktiviert", - "Die Firmware übersteigt die maximale Größe: %d", "Flash-Karte", "Flash-Tools", "Flash gefüllt mit Kameraentropie", @@ -151,9 +144,7 @@ "Unzureichende Entropie", "Ungültiger Tamper Check Code", "Ungültige Adresse", - "Ungültiger Bootloader", "Ungültige mnemonische Lange", - "Ungültiger öffentlicher Schlüssel", "Ungültige Wallet:", "Umkehren", "Invertierte Farben", @@ -182,7 +173,6 @@ "Wird geladen..", "Spracheinstellung", "Speicherort", - "Maximale Länge überschritten (%s)", "Nachricht", "Nachricht:", "Fehlende Signaturdatei", diff --git a/src/krux/translations/es.py b/src/krux/translations/es.py index a4ccb463..7df8539a 100644 --- a/src/krux/translations/es.py +++ b/src/krux/translations/es.py @@ -109,13 +109,7 @@ "Clave Pública Extendida", "Ajustes de Fábrica", "Error al descifrar", - "No se pudo cargar la PSBT", - "No se pudo cargar la dirección", - "No se pudo cargar la clave", - "No se pudo cargar el mensaje", - "No se pudo importar el mnemónico", - "No se pudo cargar el descriptor de salida", - "No se pudo cargar el passphrase", + "Error al cargar", "No pudo almacenar mnemónico", "Comisión:", "Feed Rate", @@ -124,7 +118,6 @@ "¿Llenar el flash con entropía de la cámara?", "Llenando Flash", "Huella dactilar no establecida en PSBT", - "El firmware supera el tamaño máximo: %d", "Mapa Flash", "Flash Tools", "Flash lleno de entropía de cámara", @@ -151,9 +144,7 @@ "Entropía insuficiente", "Código de verificación no válido", "Dirección inválida", - "Bootloader inválido", "Longitud mnemónica no válida", - "Clave pública inválida", "Cartera inválida:", "Invertir", "Colores Invertidos", @@ -182,7 +173,6 @@ "Cargando..", "Idioma", "Ubicación", - "Longitud máxima excedida (%s)", "Mensaje", "Mensaje:", "Falta archivo de firma", diff --git a/src/krux/translations/fr.py b/src/krux/translations/fr.py index 56953458..daef5f8c 100644 --- a/src/krux/translations/fr.py +++ b/src/krux/translations/fr.py @@ -109,13 +109,7 @@ "Clé publique", "Paramètres d'usine", "Échec du déchiffrement", - "Échec du chargement PSBT", - "Échec du chargement d'adresse", - "Échec du chargement de la clé", - "Échec du chargement du message", - "Échec du chargement mnémonique", - "Échec du chargement du descripteur de sortie", - "Échec du chargement de la phrase secrète", + "Échec lors du chargement", "Échec du stockage mnémonique", "Frais\u2009:", "Taux d'alimentation", @@ -124,7 +118,6 @@ "Remplir le flash avec l'entropie de la caméra ?", "Remplissage du Flash", "Empreinte digitale manquante dans PSBT", - "Le micrologiciel dépasse la taille maximale\u2009: %d", "Plan du Flash", "Outils Flash", "Flash rempli par l'entropie de la caméra", @@ -151,9 +144,7 @@ "Entropie insuffisante", "Code de non compromis non valide", "Adresse invalide", - "Chargeur de démarrage invalide", "Longueur mnémonique invalide", - "Clé publique non valide", "Portefeuille invalide\u2009:", "Inverser", "Couleurs inversées", @@ -182,7 +173,6 @@ "Chargement..", "Paramètres régionaux", "Emplacement", - "Longueur maximale dépassée (%s)", "Message", "Message\u2009:", "Fichier de signature manquant", diff --git a/src/krux/translations/ja.py b/src/krux/translations/ja.py index f576a5ea..ac54e030 100644 --- a/src/krux/translations/ja.py +++ b/src/krux/translations/ja.py @@ -109,13 +109,7 @@ "拡張公開キー", "初期設定", "復号化に失敗しました", - "PSBTのロードに失敗しました", - "アドレスの読み込みに失敗しました", - "キーのロードに失敗しました", - "メッセージの読み込みに失敗しました", - "mnemonicのロードに失敗しました", - "出力記述子のロードに失敗しました", - "パスフレーズのロードに失敗しました", + "ロードに失敗しました。", "mnemonicの保存に失敗しました", "手数料:", "フィードレート", @@ -124,7 +118,6 @@ "カメラからのエントロピーでフラッシュを埋めますか?", "フラッシュを充填中", "PSBTでデジタル指紋が未設定", - "ファームウェアが最大サイズを超えました: %d", "フラッシュマップ", "Flashツール", "カメラエントロピーで満たされたフラッシュ", @@ -151,9 +144,7 @@ "不十分なエントロピー", "無効な改ざんチェックコード", "無効なアドレス", - "無効なブートローダー", "無効なニーモニックの長さ", - "無効な公開キー", "無効なウォレット:", "反転する", "反転した色", @@ -182,7 +173,6 @@ "読み込み中..", "ロケール", "場所", - "最大長を超えました (%s)", "メッセージ", "メッセージ:", "署名ファイルが欠落しています", diff --git a/src/krux/translations/ko.py b/src/krux/translations/ko.py index c7a31e13..f726f355 100644 --- a/src/krux/translations/ko.py +++ b/src/krux/translations/ko.py @@ -109,13 +109,7 @@ "XPUB 내보내기", "공장 초기 설정", "복호화에 실패했습니다", - "PSBT를 불러오지 못했습니다", - "주소를 불러오지 못했습니다", - "키 로드에 실패했습니다", - "메시지를 불러오지 못했습니다", - "니모닉을 불러오지 못했습니다", - "아웃풋 디스크립터를 불러오지 못했습니다", - "패스프레이즈를 불러오지 못했습니다", + "로드 실패", "니모닉을 저장하지 못했습니다", "수수료:", "Feed Rate", @@ -124,7 +118,6 @@ "카메라의 엔트로피로 플래시를 채우시겠습니까?", "플래시 채우기", "PSBT에서 지문이 설정되지 않았습니다", - "펌웨어가 최대 크기를 초과했습니다: %d", "플래시 맵", "플래시 도구", "카메라 엔트로피로 가득 찬 플래시", @@ -151,9 +144,7 @@ "엔트로피가 충분하지 않습니다", "유효하지 않은 탬퍼 체크 코드", "주소가 잘못되었습니다", - "부트로더가 잘못되었습니다", "니모닉 길이가 잘못되었습니다", - "공개키가 잘못되었습니다", "지갑이 잘못되었습니다:", "반전", "반전된 색상", @@ -182,7 +173,6 @@ "로딩 중..", "언어 설정", "기본 저장소", - "최대 길이를 초과함 (%s)", "메시지", "메시지:", "서명 파일이 누락되었습니다", diff --git a/src/krux/translations/nl.py b/src/krux/translations/nl.py index 53f74838..b9eeacbc 100644 --- a/src/krux/translations/nl.py +++ b/src/krux/translations/nl.py @@ -109,13 +109,7 @@ "Uitgebreide publieke sleutel", "Fabrieksinstellingen", "Ontsleutelen is niet gelukt", - "PSBT laden is niet gelukt", - "Adres laden is niet gelukt", - "Sleutel laden is niet gelukt", - "Bericht laden is niet gelukt", - "Geheugensteun laden is niet gelukt", - "Descriptor laden is niet gelukt", - "Wachtwoord laden is niet gelukt", + "Laden mislukt", "Geheugensteun opslaan is niet gelukt", "Tarief:", "Voedingssnelheid", @@ -124,7 +118,6 @@ "De flash vullen met entropie van de camera?", "Flash vullen", "Vingerafdruk niet ingesteld in PSBT", - "Firmware overschrijdt de maximale grootte: %d", "Flash Map", "Flash Tools", "Flash gevuld met camera-entropie", @@ -151,9 +144,7 @@ "Onvoldoende entropie", "Ongeldige sabotagecontrolecode", "Ongeldig adres", - "Ongeldige bootloader", "Ongeldige geheugensteun lengte", - "Ongeldige publieke sleutel", "Ongeldige portemonnee:", "Omkeren", "Omgekeerde kleuren", @@ -182,7 +173,6 @@ "Laden..", "Taal", "Opslaglocatie", - "Maximale lengte overschreden (%s)", "Bericht", "Bericht:", "Handtekening bestand mist", diff --git a/src/krux/translations/pt.py b/src/krux/translations/pt.py index fb501104..c65c6153 100644 --- a/src/krux/translations/pt.py +++ b/src/krux/translations/pt.py @@ -109,13 +109,7 @@ "Chave Pública Estendida", "Configurações de Fábrica", "Falhou em descriptografar", - "Falhou ao carregar PSBT", - "Falhou ao carregar endereço", - "Falha ao carregar a chave", - "Falhou ao carregar mensagem", - "Falhou ao carregar mnemônico", - "Falha ao carregar o descritor de saída", - "Falha ao carregar a senha", + "Falha ao carregar", "Falhou ao armazenar mnemônico", "Taxa:", "Taxa de Alimentação", @@ -124,7 +118,6 @@ "Preencher a flash com entropia da câmera?", "Preenchendo a Flash", "Impressão digital não definida no PSBT", - "Firmware excede o tamanho máximo: %d", "Mapa da Flash", "Ferramentas da Flash", "Flash preenchida com entropia da câmera", @@ -151,9 +144,7 @@ "Entropia insuficiente", "Código de verificação inválido", "Endereço inválido", - "Bootloader inválido", "Comprimento de mnemônico inválido", - "Chave pública inválida", "Carteira inválida:", "Invertido", "Cores invertidas", @@ -182,7 +173,6 @@ "Carregando..", "Idioma", "Local", - "Comprimento máximo excedido (%s)", "Mensagem", "Mensagem:", "Arquivo de assinatura faltando", diff --git a/src/krux/translations/ru.py b/src/krux/translations/ru.py index 92acc829..09cfb065 100644 --- a/src/krux/translations/ru.py +++ b/src/krux/translations/ru.py @@ -109,13 +109,7 @@ "Расширенный Публичный Ключ", "Заводские Настройки", "Не удалось расшифровать", - "Не удалось загрузить PSBT", - "Не удалось загрузить адрес", - "Не удалось загрузить ключ", - "Не удалось загрузить сообщение", - "Не удалось загрузить мнемонику", - "Не удалось загрузить выходной дескриптор", - "Не удалось загрузить фразу-пароль", + "Не удалось ничего загрузить", "Не удалось сохранить мнемонику", "Комиссия:", "Скорость Подачи", @@ -124,7 +118,6 @@ "Заполнить флэш энтропией с камеры?", "Заполнение флэша", "Отпечаток пальца не установлен в PSBT", - "Прошивка превышает максимальный размер: %d", "Карта флэша", "Flash Tools", "Флэш заполнен энтропией камеры", @@ -151,9 +144,7 @@ "Недостаточная энтропия", "Недействительный код проверки вскрытия", "Неверный адрес", - "Неверный загрузчик", "Неверная длина мнемоники", - "Неверный публичный ключ", "Неверный кошелек:", "Инвертировать", "Перевернутые цвета", @@ -182,7 +173,6 @@ "Загрузка..", "Локаль", "Расположение", - "Максимальная длина превышена (%s)", "Сообщение", "Сообщение:", "Отсутствует файл подписи", diff --git a/src/krux/translations/tr.py b/src/krux/translations/tr.py index 31c35bbe..d8a5cd5f 100644 --- a/src/krux/translations/tr.py +++ b/src/krux/translations/tr.py @@ -109,13 +109,7 @@ "Genişletilmiş Public Key", "Fabrika Ayarları", "Şifre çözme başarısız", - "PSBT yükleme başarısız", - "Adres yükleme başarısız", - "Anahtar yükleme başarısız", - "Mesaj yükleme başarısız", - "Mnemonic yükleme başarısız", - "Çıktı tanımlayıcısı yüklemesi başarısız", - "Parola yükleme başarısız", + "Yüklenemedi", "Mnemonic depolama başarısız", "Ücret:", "Besleme Hızı", @@ -124,7 +118,6 @@ "Flash'ı kameradan gelen entropi ile doldur?", "Flash Dolduruluyor", "PSBT'de parmak izi ayarı kaldırıldı", - "Donanım yazılımı maksimum boyutu aşıyor: %d", "Flash Haritası", "Flash Araçları", "Flash kamera entropisi ile dolduruldu", @@ -151,9 +144,7 @@ "Yetersiz entropi", "Geçersiz Kurcalama Kontrol Kodu", "Geçersiz adres", - "Geçersiz önyükleyici", "Geçersiz mnemonic uzunluğu", - "Geçersiz public key", "Geçersiz cüzdan:", "Ters Çevir", "Ters Renkler", @@ -182,7 +173,6 @@ "Yükleniyor..", "Yerel", "Konum", - "Maksimum uzunluk aşıldı (%s)", "Mesaj", "Mesaj:", "İmza dosyası eksik", diff --git a/src/krux/translations/vi.py b/src/krux/translations/vi.py index c345a77f..402d60b4 100644 --- a/src/krux/translations/vi.py +++ b/src/krux/translations/vi.py @@ -109,13 +109,7 @@ "Khóa công cộng", "Cài đặt Gốc", "Không giải mã được", - "Tải PSBT thất bại", - "Tải địa chỉ thất bại", - "Không tải được khóa", - "Không tải được tin nhắn", - "Tải mã Mnemonic thất bại", - "Không tải được bộ mô tả đầu ra", - "Không tải được cụm mật khẩu", + "Tải thất bại", "Không lưu trữ Mnemonic được", "Phí:", "Tốc độ cắt CNC", @@ -124,7 +118,6 @@ "Điền vào flash với entropy từ máy ảnh?", "Đèn Flash Đổ Đầy", "Bỏ dấu vân tay trong PSBT", - "Phần mềm vượt quá kích thước tối đa: %d", "Bản đồ Flash", "Công cụ Flash", "Đèn flash chứa đầy entropy của máy ảnh", @@ -151,9 +144,7 @@ "Không đủ entropy", "Mã kiểm tra giả mạo không hợp lệ", "Địa chỉ không hợp lệ", - "Bộ tải khởi động không hợp lệ", "Độ dài mã Mnemonic không hợp lệ", - "Khóa công cộng không hợp lệ", "Ví không hợp lệ:", "Đảo ngược", "Màu đảo ngược", @@ -182,7 +173,6 @@ "Đang tải..", "Ngôn ngữ", "Vị trí lưu", - "Chiều dài tối đa vượt quá (%s)", "Tin nhắn", "Tin nhắn:", "Thiếu tập tin chữ ký", diff --git a/src/krux/translations/zh.py b/src/krux/translations/zh.py index 726e32cf..02e818c6 100644 --- a/src/krux/translations/zh.py +++ b/src/krux/translations/zh.py @@ -109,13 +109,7 @@ "扩展公钥", "出厂设置", "解密失败", - "加载 PSBT 失败", - "加载地址失败", - "加载密钥失败", - "加载消息失败", - "加载助记词失败", - "加载输出描述符失败", - "加载密码失败", + "加载失败", "存储助记词失败", "费用:", "进给速度", @@ -124,7 +118,6 @@ "用摄像头的熵填充Flash?", "填充Flash", "PSBT 中未设置指纹", - "固件超过最大尺寸:%d", "Flash地图", "Flash工具", "Flash已用摄像头熵填充", @@ -151,9 +144,7 @@ "熵不足", "无效的防篡改检查码", "无效地址", - "无效的 ootloader ", "助记词长度无效", - "无效公钥", "无效钱包:", "反转", "反转颜色", @@ -182,7 +173,6 @@ "加载中..", "语言环境", "位置", - "超过最大长度(%s)", "消息", "消息:", "缺少签名文件", diff --git a/tests/pages/test_encryption_ui.py b/tests/pages/test_encryption_ui.py index d48f3ce6..e1d54ddc 100644 --- a/tests/pages/test_encryption_ui.py +++ b/tests/pages/test_encryption_ui.py @@ -92,15 +92,22 @@ def test_load_key_from_qr_code(m5stickv, mocker): print("case 2: load_key_from_qr_code") # Repeat with too much characters >ENCRYPTION_KEY_MAX_LEN - BTN_SEQUENCE = [BUTTON_PAGE] + [ # move to QR code key - BUTTON_ENTER + BTN_SEQUENCE = [ + BUTTON_PAGE, # move to QR code key + BUTTON_ENTER, # read too long text + BUTTON_ENTER, # click to pass error + BUTTON_ENTER, # enter to read normal text + BUTTON_PAGE, # Cancel ] # choose QR code key ctx = create_ctx(mocker, BTN_SEQUENCE) key_generator = EncryptionKey(ctx) too_long_text = "l" * (ENCRYPTION_KEY_MAX_LEN + 1) - mocker.patch.object( - QRCodeCapture, "qr_capture_loop", new=lambda self: (too_long_text, None) - ) + values_list = ["short text", too_long_text] + + def qr_return(self): + return values_list.pop(), None + + mocker.patch.object(QRCodeCapture, "qr_capture_loop", new=qr_return) key = key_generator.encryption_key() assert key == None diff --git a/tests/pages/test_wallet_settings.py b/tests/pages/test_wallet_settings.py index 094f7047..e68eda40 100644 --- a/tests/pages/test_wallet_settings.py +++ b/tests/pages/test_wallet_settings.py @@ -1,5 +1,6 @@ from . import create_ctx from .home_pages.test_home import tdata +import pytest def test_type_passphrase(m5stickv, mocker): @@ -11,7 +12,7 @@ def test_type_passphrase(m5stickv, mocker): mocker.patch.object( passphrase_editor, "capture_from_keypad", - mocker.MagicMock(return_value=TEST_VALUE), + return_value=TEST_VALUE, ) test_passphrase = passphrase_editor._load_passphrase() @@ -52,7 +53,11 @@ def test_qr_passphrase(m5stickv, mocker): def test_qr_passphrase_too_long(m5stickv, mocker): - from krux.pages.wallet_settings import PassphraseEditor, MENU_CONTINUE + from krux.pages.wallet_settings import ( + PassphraseEditor, + MENU_CONTINUE, + PASSPHRASE_MAX_LEN, + ) from krux.pages.qr_capture import QRCodeCapture TEST_VALUE = "Test value" * 25 @@ -61,10 +66,14 @@ def test_qr_passphrase_too_long(m5stickv, mocker): passphrase_editor = PassphraseEditor(ctx) mocker.patch.object(QRCodeCapture, "qr_capture_loop", new=lambda self: (QR_DATA)) qr_capturer = mocker.spy(QRCodeCapture, "qr_capture_loop") - test_passphrase = passphrase_editor._load_qr_passphrase() - assert test_passphrase == MENU_CONTINUE - qr_capturer.assert_called_once() + error_message = "Maximum length exceeded (%s)" % PASSPHRASE_MAX_LEN + with pytest.raises(ValueError) as error: + test_passphrase = passphrase_editor._load_qr_passphrase() + + assert error_message in str(error.value) + assert test_passphrase == MENU_CONTINUE + qr_capturer.assert_called_once() def test_qr_passphrase_fail(m5stickv, mocker):