Skip to content

Commit

Permalink
Translations removing format characters
Browse files Browse the repository at this point in the history
  • Loading branch information
tadeubas committed Mar 22, 2024
1 parent ed72561 commit 1ba8cb5
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 59 deletions.
7 changes: 3 additions & 4 deletions i18n/translations/de-DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"%s\n\nwas NOT FOUND in the first %d receive addresses": "%s\n\nwurde in den ersten %d Empfangsadressen NICHT GEFUNDEN",
"%s was removed from SD card": "%s wurde von der SD-Karte gelöscht",
"%s was removed from flash": "%s wurde aus dem Flash-Speicher gelöscht",
"(%d total)\n\n": "(%d insgesamt)\n\n",
"(%d total)": "(%d insgesamt)",
"(Experimental)": "(Experimental)",
"12 words": "12 Wörter",
"24 words": "24 Wörter",
Expand Down Expand Up @@ -174,7 +174,7 @@
"Passphrase: ": "Passphrase:",
"Permanently remove all stored encrypted mnemonics and settings from flash?": "Alle gespeicherten verschlüsselten Mnemoniken und Einstellungen dauerhaft vom Flash-Speicher entfernen?",
"Persist": "Speicher",
"Pixels deviation index: ": "Pixelabweichungsindex:",
"Pixels deviation index:": "Pixelabweichungsindex:",
"Plaintext QR": "Klartext-QR",
"Please load a wallet output descriptor": "Bitte lade einen Wallet Ausgabedeskriptor",
"Plunge Rate": "Tauchrate",
Expand Down Expand Up @@ -228,8 +228,7 @@
"SeedQR": "SeedQR",
"Self-transfer or Change (%d): ": "Selbstübertragung oder Change (%d): ",
"Settings": "Einstellungen",
"Shannon's Entropy: ": "Shannons Entropie:",
"Shannon's entropy:\n": "Shannons Entropie:\n",
"Shannon's Entropy:": "Shannons Entropie:",
"Shutdown": "Ausschalten",
"Shutting down..": "Herunterfahren..",
"Sign": "Signieren",
Expand Down
7 changes: 3 additions & 4 deletions i18n/translations/es-MX.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"%s\n\nwas NOT FOUND in the first %d receive addresses": "%s\n\nNO FUE ENCONTRADO en las primeras %d direcciones de depósito",
"%s was removed from SD card": "%s fue eliminado de la tarjeta SD",
"%s was removed from flash": "%s se eliminó del flash",
"(%d total)\n\n": "(%d total)\n\n",
"(%d total)": "(%d total)",
"(Experimental)": "(Experimental)",
"12 words": "12 palabras",
"24 words": "24 palabras",
Expand Down Expand Up @@ -174,7 +174,7 @@
"Passphrase: ": "Frase de pases:",
"Permanently remove all stored encrypted mnemonics and settings from flash?": "¿Eliminar permanentemente todos los mnemónicos y configuraciones cifrados almacenados del flash?",
"Persist": "Salvar",
"Pixels deviation index: ": "Índice de desviación de píxeles:",
"Pixels deviation index:": "Índice de desviación de píxeles:",
"Plaintext QR": "QR de Texto",
"Please load a wallet output descriptor": "Cargue un descriptor de billetera",
"Plunge Rate": "Tasa de caída",
Expand Down Expand Up @@ -228,8 +228,7 @@
"SeedQR": "Seedqr",
"Self-transfer or Change (%d): ": "Autotransferencia o Cambio (%d): ",
"Settings": "Ajustes",
"Shannon's Entropy: ": "Entropía de Shannon:",
"Shannon's entropy:\n": "Entropía de Shannon:\n",
"Shannon's Entropy:": "Entropía de Shannon:",
"Shutdown": "Apagar",
"Shutting down..": "Apagando..",
"Sign": "Firmar",
Expand Down
7 changes: 3 additions & 4 deletions i18n/translations/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"%s\n\nwas NOT FOUND in the first %d receive addresses": "%s\n\nINTROUVABLE dans les premières %d adresses de reçues",
"%s was removed from SD card": "%s a été supprimé de la carte SD",
"%s was removed from flash": "%s a été supprimé du flash",
"(%d total)\n\n": "(%d au total)\n\n",
"(%d total)": "(%d au total)",
"(Experimental)": "(Expérimental)",
"12 words": "12 mots",
"24 words": "24 mots",
Expand Down Expand Up @@ -174,7 +174,7 @@
"Passphrase: ": "Phrass de passe:",
"Permanently remove all stored encrypted mnemonics and settings from flash?": "Supprimer définitivement tous les mnémoniques et paramètres chiffrés stockés dans le flash ?",
"Persist": "Persister",
"Pixels deviation index: ": "Indice de déviation des pixels :",
"Pixels deviation index:": "Indice de déviation des pixels:",
"Plaintext QR": "QR en Texte Brut",
"Please load a wallet output descriptor": "Veuillez charger un descripteur de sortie de portefeuille",
"Plunge Rate": "Taux de plongée",
Expand Down Expand Up @@ -228,8 +228,7 @@
"SeedQR": "Seedqr",
"Self-transfer or Change (%d): ": "Auto-transfert ou changement (%d): ",
"Settings": "Paramètres",
"Shannon's Entropy: ": "Entropie de Shannon :",
"Shannon's entropy:\n": "L'entropie de Shannon :\n",
"Shannon's Entropy:": "Entropie de Shannon:",
"Shutdown": "Fermer",
"Shutting down..": "Éteindre..",
"Sign": "Signature",
Expand Down
7 changes: 3 additions & 4 deletions i18n/translations/nl-NL.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"%s\n\nwas NOT FOUND in the first %d receive addresses": "%s\n\nwerd NIET GEVONDEN in de eerste %d ontvangst adressen",
"%s was removed from SD card": "%s verwijderd van SD-kaart",
"%s was removed from flash": "%s verwijderd van flashgeheugen",
"(%d total)\n\n": "(%d totaal)\n\n",
"(%d total)": "(%d totaal)",
"(Experimental)": "(Experimenteel)",
"12 words": "12 woorden",
"24 words": "24 woorden",
Expand Down Expand Up @@ -174,7 +174,7 @@
"Passphrase: ": "Wachtwoord: ",
"Permanently remove all stored encrypted mnemonics and settings from flash?": "Alle opgeslagen versleutelde mnemonics en instellingen permanent uit het flashgeheugen verwijderen?",
"Persist": "Opslag",
"Pixels deviation index: ": "Pixelafwijkingsindex:",
"Pixels deviation index:": "Pixelafwijkingsindex:",
"Plaintext QR": "Platte tekst QR",
"Please load a wallet output descriptor": "Laadt een portemonnee descriptor in",
"Plunge Rate": "Duik tarief",
Expand Down Expand Up @@ -228,8 +228,7 @@
"SeedQR": "SeedQR",
"Self-transfer or Change (%d): ": "Zelf overschrijving of wisselgeld (%d): ",
"Settings": "Instellingen",
"Shannon's Entropy: ": "Shannons Entropie:",
"Shannon's entropy:\n": "Shannon 's entropie:\n",
"Shannon's Entropy:": "Shannons Entropie:",
"Shutdown": "Afsluiten",
"Shutting down..": "Bezig met afsluiten...",
"Sign": "Ondertekenen",
Expand Down
7 changes: 3 additions & 4 deletions i18n/translations/pl-PL.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"%s\n\nwas NOT FOUND in the first %d receive addresses": "%s\n\nwas nie znaleziono w pierwszych %D Otrzymuj adresy",
"%s was removed from SD card": "%s usunięto z karty SD",
"%s was removed from flash": "%s usunięto z pamięci flash",
"(%d total)\n\n": "(łącznie %d)\n\n",
"(%d total)": "(łącznie %d)",
"(Experimental)": "(Eksperymentalny)",
"12 words": "12 słów",
"24 words": "24 słowa",
Expand Down Expand Up @@ -174,7 +174,7 @@
"Passphrase: ": "FRASSE:",
"Permanently remove all stored encrypted mnemonics and settings from flash?": "Trwale usunąć wszystkie zapisane zaszyfrowane mnemoniki i ustawienia z pamięci flash?",
"Persist": "Trwać",
"Pixels deviation index: ": "Indeks odchyleń w pikselach:",
"Pixels deviation index:": "Indeks odchyleń w pikselach:",
"Plaintext QR": "PlainText QR",
"Please load a wallet output descriptor": "Załaduj deskryptor wyjściowy portfela",
"Plunge Rate": "Szybkość spadku",
Expand Down Expand Up @@ -228,8 +228,7 @@
"SeedQR": "Seedqr",
"Self-transfer or Change (%d): ": "Samo-transfer lub zmiana (%d):",
"Settings": "Ustawienia",
"Shannon's Entropy: ": "Entropia Shannona:",
"Shannon's entropy:\n": "Entropia Shannon:\n",
"Shannon's Entropy:": "Entropia Shannona:",
"Shutdown": "Zamknięcie",
"Shutting down..": "Wyłączanie..",
"Sign": "Podpisać",
Expand Down
7 changes: 3 additions & 4 deletions i18n/translations/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"%s\n\nwas NOT FOUND in the first %d receive addresses": "%s\n\nNÃO FOI ENCONTRADO nos primeiros %d endereços de recebimento",
"%s was removed from SD card": "%s foi excluído do cartão SD",
"%s was removed from flash": "%s foi excluído da memória flash",
"(%d total)\n\n": "(%d total)\n\n",
"(%d total)": "(%d total)",
"(Experimental)": "(Experimental)",
"12 words": "12 palavras",
"24 words": "24 palavras",
Expand Down Expand Up @@ -174,7 +174,7 @@
"Passphrase: ": "Senha:",
"Permanently remove all stored encrypted mnemonics and settings from flash?": "Remover permanentemente todos os mnemônicos criptografados e configurações armazenados da memória flash?",
"Persist": "Salvar",
"Pixels deviation index: ": "Índice de desvio de pixels:",
"Pixels deviation index:": "Índice de desvio de pixels:",
"Plaintext QR": "QR em Texto",
"Please load a wallet output descriptor": "Carregue um descritor da carteira",
"Plunge Rate": "Taxa de Mergulho",
Expand Down Expand Up @@ -228,8 +228,7 @@
"SeedQR": "SeedQR",
"Self-transfer or Change (%d): ": "Autotransferência ou Troco (%d): ",
"Settings": "Configurações",
"Shannon's Entropy: ": "Entropia de Shannon: ",
"Shannon's entropy:\n": "Entropia de Shannon:\n",
"Shannon's Entropy:": "Entropia de Shannon:",
"Shutdown": "Desligar",
"Shutting down..": "Desligando..",
"Sign": "Assinar",
Expand Down
7 changes: 3 additions & 4 deletions i18n/translations/ru-RU.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"%s\n\nwas NOT FOUND in the first %d receive addresses": "%s\n\nНЕ НАЙДЕН в первых %d адресах получения",
"%s was removed from SD card": "%s удален с SD-карты",
"%s was removed from flash": "%s удален с флеш-памяти",
"(%d total)\n\n": "(%d всего)\n\n",
"(%d total)": "(%d всего)",
"(Experimental)": "(Эксперементальный)",
"12 words": "12 слов",
"24 words": "24 слова",
Expand Down Expand Up @@ -174,7 +174,7 @@
"Passphrase: ": "Фраза-пароль: ",
"Permanently remove all stored encrypted mnemonics and settings from flash?": "Окончательно удалить все сохраненные зашифрованные мнемоники и настройки из флеш-памяти?",
"Persist": "Постоянная Память",
"Pixels deviation index: ": "Индекс отклонения пикселей:",
"Pixels deviation index:": "Индекс отклонения пикселей:",
"Plaintext QR": "QR Открытым Текстом",
"Please load a wallet output descriptor": "Пожалуйста загрузите выходной дескриптор кошелька",
"Plunge Rate": "Скорость Погружения",
Expand Down Expand Up @@ -228,8 +228,7 @@
"SeedQR": "SeedQR",
"Self-transfer or Change (%d): ": "Трансфер самому себе или Сдача (%d): ",
"Settings": "Настройки",
"Shannon's Entropy: ": "Энтропия Шеннона:",
"Shannon's entropy:\n": "Энтропия Шеннона:\n",
"Shannon's Entropy:": "Энтропия Шеннона:",
"Shutdown": "Выключить",
"Shutting down..": "Выключение..",
"Sign": "Подписать",
Expand Down
7 changes: 3 additions & 4 deletions i18n/translations/vi-VN.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"%s\n\nwas NOT FOUND in the first %d receive addresses": "%s\n\nKHÔNG TÌM ĐƯỢC trong địa chỉ %d nhận đầu tiên",
"%s was removed from SD card": "%s đã được xóa khỏi thẻ SD",
"%s was removed from flash": "%s đã bị xóa khỏi bộ nhớ flash",
"(%d total)\n\n": "(tổng cộng %d)\n\n",
"(%d total)": "(tổng cộng %d)",
"(Experimental)": "(Thực nghiệm)",
"12 words": "12 từ",
"24 words": "24 từ",
Expand Down Expand Up @@ -174,7 +174,7 @@
"Passphrase: ": "Cụm mật khẩu:",
"Permanently remove all stored encrypted mnemonics and settings from flash?": "Xóa vĩnh viễn mọi Mnemonics và cài đặt được mã hóa lưu trữ trong flash?",
"Persist": "Vị trí lưu",
"Pixels deviation index: ": "Chỉ số độ lệch điểm ảnh:",
"Pixels deviation index:": "Chỉ số độ lệch điểm ảnh:",
"Plaintext QR": "QR dạng văn bản",
"Please load a wallet output descriptor": "Vui lòng tải bộ mô tả đầu ra ví",
"Plunge Rate": "Tỷ lệ sụt giảm",
Expand Down Expand Up @@ -228,8 +228,7 @@
"SeedQR": "SEEDQR",
"Self-transfer or Change (%d): ": "Tự chuyển nhượng hoặc giao dịch (%d): ",
"Settings": "Cài đặt",
"Shannon's Entropy: ": "Entropy của Shannon:",
"Shannon's entropy:\n": "Entropy của Shannon:\n",
"Shannon's Entropy:": "Entropy của Shannon:",
"Shutdown": "Tắt máy",
"Shutting down..": "Đang tắt..",
"Sign": "Chữ kí",
Expand Down
8 changes: 4 additions & 4 deletions src/krux/pages/capture_entropy.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,10 @@ def capture(self, show_entropy_details=True):
shannon_16b = shannon.entropy_img16b(img_bytes)
shannon_16b_total = shannon_16b * img_pixels

entropy_msg = t("Shannon's entropy:\n")
entropy_msg += str(round(shannon_16b, 2)) + " bits/px\n"
entropy_msg += t("(%d total)\n\n") % int(shannon_16b_total)
entropy_msg += t("Pixels deviation index: ")
entropy_msg = t("Shannon's Entropy:") + "\n"
entropy_msg += str(round(shannon_16b, 2)) + " " + t("bits/px") + "\n"
entropy_msg += t("(%d total)") % int(shannon_16b_total) + "\n\n"
entropy_msg += t("Pixels deviation index:") + " "
entropy_msg += str(stdev_index)
self.ctx.display.clear()
self.ctx.input.reset_ios_state()
Expand Down
2 changes: 1 addition & 1 deletion src/krux/pages/new_mnemonic/dice_rolls.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def stats_for_nerds(self):
offset_x += bar_pad
offset_y += self.ctx.display.font_height
self.ctx.display.draw_hcentered_text(
t("Shannon's Entropy: ") + str(shannon_entropy) + " bits",
t("Shannon's Entropy:") + " " + str(shannon_entropy) + " " + t("bits"),
offset_y,
)

Expand Down
36 changes: 14 additions & 22 deletions tests/pages/test_capture_entropy.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
from ..shared_mocks import mock_context, snapshot_generator, SNAP_SUCCESS, IMAGE_TO_HASH
import hashlib

ENTROPY_MESSAGE_STR = (
f"Shannon's Entropy:\n%s bits/px\n(%s total)\n\nPixels deviation index: %s"
)

ENTROPY_INSUFFICIENT_MESSAGE_STR = "Insufficient Entropy!\n\n" + ENTROPY_MESSAGE_STR


def test_cancel_capture(amigo, mocker):
"""Test that the capture method returns None when the user cancels the capture"""
Expand Down Expand Up @@ -79,13 +85,9 @@ def test_insufficient_variance(amigo, mocker):
assert result is None

# Assert ctx.display.draw_centered_text was called with "Insufficient Entropy!"
call_message_str = (
"Insufficient Entropy!\n\n"
+ f"Shannon's entropy:\n{shannon_value} bits/px\n"
+ f"({total_shannon} total)\n\n"
+ f"Pixels deviation index: {variance}"
call_message = mocker.call(
ENTROPY_INSUFFICIENT_MESSAGE_STR % (shannon_value, total_shannon, variance), RED
)
call_message = mocker.call(call_message_str, RED)

ctx.display.draw_centered_text.assert_has_calls([call_message])

Expand Down Expand Up @@ -135,13 +137,9 @@ def test_insufficient_shannons_entropy(amigo, mocker):
assert result is None

# Assert ctx.display.draw_centered_text was called with "Insufficient Entropy!"
call_message_str = (
"Insufficient Entropy!\n\n"
+ f"Shannon's entropy:\n{shannon_value} bits/px\n"
+ f"({total_shannon} total)\n\n"
+ f"Pixels deviation index: {variance}"
call_message = mocker.call(
ENTROPY_INSUFFICIENT_MESSAGE_STR % (shannon_value, total_shannon, variance), RED
)
call_message = mocker.call(call_message_str, RED)

ctx.display.draw_centered_text.assert_has_calls([call_message])

Expand Down Expand Up @@ -196,12 +194,9 @@ def test_poor_variance(amigo, mocker):
assert result == hasher.digest()

# Assert ctx.display.draw_centered_text was called with "Insufficient Entropy!"
call_message_str = (
f"Shannon's entropy:\n{shannon_value} bits/px\n"
+ f"({total_shannon} total)\n\n"
+ f"Pixels deviation index: {variance}"
call_message = mocker.call(
ENTROPY_MESSAGE_STR % (shannon_value, total_shannon, variance)
)
call_message = mocker.call(call_message_str)

ctx.display.draw_centered_text.assert_has_calls([call_message])

Expand Down Expand Up @@ -256,11 +251,8 @@ def test_good_variance_good_shannons_entropy(amigo, mocker):
assert result == hasher.digest()

# Assert ctx.display.draw_centered_text was called with "Insufficient Entropy!"
call_message_str = (
f"Shannon's entropy:\n{shannon_value} bits/px\n"
+ f"({total_shannon} total)\n\n"
+ f"Pixels deviation index: {variance}"
call_message = mocker.call(
ENTROPY_MESSAGE_STR % (shannon_value, total_shannon, variance)
)
call_message = mocker.call(call_message_str)

ctx.display.draw_centered_text.assert_has_calls([call_message])

0 comments on commit 1ba8cb5

Please sign in to comment.