Skip to content

Commit

Permalink
Merge pull request #496 from tadeubas/simplify_translations
Browse files Browse the repository at this point in the history
Simplifying entropy translations
  • Loading branch information
odudex authored Dec 12, 2024
2 parents 2812693 + 445db5e commit e25501d
Show file tree
Hide file tree
Showing 29 changed files with 63 additions and 109 deletions.
8 changes: 3 additions & 5 deletions i18n/translations/de-DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@
"Index: %s": "Index: %s",
"Inputs (%d):": "Input (%d):",
"Install?": "Installieren?",
"Insufficient Entropy!": "Unzureichende Entropie!",
"Insufficient entropy": "Unzureichende Entropie",
"Insufficient entropy!": "Unzureichende Entropie!",
"Invalid Tamper Check Code": "Ungültiger Tamper Check Code",
"Invalid address": "Ungültige Adresse",
"Invalid mnemonic length": "Ungültige mnemonische Lange",
Expand Down Expand Up @@ -187,8 +186,7 @@
"Please load a wallet output descriptor": "Bitte lade einen Wallet Ausgabedeskriptor",
"Plunge Rate": "Tauchrate",
"Policy Type": "Richtlinientyp:",
"Poor entropy": "Schlechte Entropie",
"Poor entropy detected!": "Schlechte Entropie erkannt!",
"Poor entropy!": "Schlechte Entropie!",
"Print Test QR": "Drucke Test-QR",
"Print Tiny Seed?": "Tiny Seed drucken?",
"Print to QR": "Als QR-Code drucken",
Expand Down Expand Up @@ -240,7 +238,7 @@
"Settings": "Einstellungen",
"Settings stored internally on flash.": "Die Einstellungen werden intern auf Flash gespeichert.",
"Settings stored on SD card.": "Einstellungen auf SD-Karte gespeichert.",
"Shannon's Entropy:": "Shannons Entropie:",
"Shannon's entropy:": "Shannons Entropie:",
"Shutdown": "Ausschalten",
"Shutdown Time": "Abschaltzeit:",
"Shutting down..": "Herunterfahren..",
Expand Down
8 changes: 3 additions & 5 deletions i18n/translations/es-MX.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@
"Index: %s": "Índice: %s",
"Inputs (%d):": "Entradas (%d):",
"Install?": "¿Instalar?",
"Insufficient Entropy!": "¡Entropía Insuficiente!",
"Insufficient entropy": "Entropía insuficiente",
"Insufficient entropy!": "¡Entropía Insuficiente!",
"Invalid Tamper Check Code": "Código de verificación no válido",
"Invalid address": "Dirección inválida",
"Invalid mnemonic length": "Longitud mnemónica no válida",
Expand Down Expand Up @@ -187,8 +186,7 @@
"Please load a wallet output descriptor": "Carga un descriptor de cartera",
"Plunge Rate": "Tasa de Caída",
"Policy Type": "Tipo de póliza",
"Poor entropy": "Baja entropía",
"Poor entropy detected!": "Mala entropía detectada!",
"Poor entropy!": "Baja entropía!",
"Print Test QR": "Prueba de Impresión QR",
"Print Tiny Seed?": "¿Imprimir Tiny Seed?",
"Print to QR": "Imprimir como Código QR",
Expand Down Expand Up @@ -240,7 +238,7 @@
"Settings": "Ajustes",
"Settings stored internally on flash.": "Ajustes almacenados internamente en flash.",
"Settings stored on SD card.": "Configuración almacenada en la tarjeta SD.",
"Shannon's Entropy:": "Entropía de Shannon:",
"Shannon's entropy:": "Entropía de Shannon:",
"Shutdown": "Apagar",
"Shutdown Time": "Tiempo de Apagado",
"Shutting down..": "Apagando..",
Expand Down
8 changes: 3 additions & 5 deletions i18n/translations/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@
"Index: %s": "Index : %s",
"Inputs (%d):": "Entrées (%d) :",
"Install?": "Installer ?",
"Insufficient Entropy!": "Entropie insuffisante !",
"Insufficient entropy": "Entropie insuffisante",
"Insufficient entropy!": "Entropie insuffisante !",
"Invalid Tamper Check Code": "Code de non compromis non valide",
"Invalid address": "Adresse invalide",
"Invalid mnemonic length": "Longueur mnémonique invalide",
Expand Down Expand Up @@ -187,8 +186,7 @@
"Please load a wallet output descriptor": "Veuillez charger un descripteur de sortie de portefeuille",
"Plunge Rate": "Taux de plongée",
"Policy Type": "Type de politique",
"Poor entropy": "Entropie faible",
"Poor entropy detected!": "Entropie faible détectée !",
"Poor entropy!": "Entropie faible !",
"Print Test QR": "Impression Test QR",
"Print Tiny Seed?": "Imprimer Tiny Seed ?",
"Print to QR": "Imprimer Code QR",
Expand Down Expand Up @@ -240,7 +238,7 @@
"Settings": "Paramètres",
"Settings stored internally on flash.": "Paramètres stockés en interne sur flash.",
"Settings stored on SD card.": "Paramètres stockés sur la carte SD.",
"Shannon's Entropy:": "Entropie de Shannon :",
"Shannon's entropy:": "Entropie de Shannon :",
"Shutdown": "Éteindre",
"Shutdown Time": "Delai d'Arrêt",
"Shutting down..": "Arrêt en cours..",
Expand Down
8 changes: 3 additions & 5 deletions i18n/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@
"Index: %s": "インデックス:%s",
"Inputs (%d):": "インプット(%d):",
"Install?": "インストールしますか?",
"Insufficient Entropy!": "不十分なエントロピー!",
"Insufficient entropy": "不十分なエントロピー",
"Insufficient entropy!": "不十分なエントロピー!",
"Invalid Tamper Check Code": "無効な改ざんチェックコード",
"Invalid address": "無効なアドレス",
"Invalid mnemonic length": "無効なニーモニックの長さ",
Expand Down Expand Up @@ -187,8 +186,7 @@
"Please load a wallet output descriptor": "ウォレットの出力記述子をロードしてください",
"Plunge Rate": "沈下率",
"Policy Type": "証券の種類",
"Poor entropy": "低品質なエントロピー",
"Poor entropy detected!": "低品質なエントロピーが検出されました!",
"Poor entropy!": "低品質なエントロピー!",
"Print Test QR": "テストQRを印刷",
"Print Tiny Seed?": "小さなシードを印刷しますか?",
"Print to QR": "QRを印刷",
Expand Down Expand Up @@ -240,7 +238,7 @@
"Settings": "設定",
"Settings stored internally on flash.": "設定はフラッシュメモリに内部保存されています.",
"Settings stored on SD card.": "設定はSDカードに保存されています.",
"Shannon's Entropy:": "シャノンのエントロピー:",
"Shannon's entropy:": "シャノンのエントロピー:",
"Shutdown": "シャットダウン",
"Shutdown Time": "シャットダウン時間",
"Shutting down..": "シャットダウン中..",
Expand Down
8 changes: 3 additions & 5 deletions i18n/translations/ko-KR.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@
"Index: %s": "인덱스: %s",
"Inputs (%d):": "Input (%d):",
"Install?": "설치하시겠습니까?",
"Insufficient Entropy!": "엔트로피가 충분하지 않습니다!",
"Insufficient entropy": "엔트로피가 충분하지 않습니다",
"Insufficient entropy!": "엔트로피가 충분하지 않습니다!",
"Invalid Tamper Check Code": "유효하지 않은 탬퍼 체크 코드",
"Invalid address": "주소가 잘못되었습니다",
"Invalid mnemonic length": "니모닉 길이가 잘못되었습니다",
Expand Down Expand Up @@ -187,8 +186,7 @@
"Please load a wallet output descriptor": "지갑 출력 디스크립터를 불러오십시오",
"Plunge Rate": "침수율",
"Policy Type": "정책 유형",
"Poor entropy": "엔트로피가 부족합니다",
"Poor entropy detected!": "엔트로피가 부족합니다!",
"Poor entropy!": "엔트로피가 부족합니다!",
"Print Test QR": "QR 테스트 인쇄",
"Print Tiny Seed?": "Tiny Seed를 인쇄하시겠습니까?",
"Print to QR": "QR로 인쇄",
Expand Down Expand Up @@ -240,7 +238,7 @@
"Settings": "설정",
"Settings stored internally on flash.": "설정은 플래시에서 내부적으로 저장됩니다.",
"Settings stored on SD card.": "SD 카드에 저장된 설정.",
"Shannon's Entropy:": "Shannon의 엔트로피:",
"Shannon's entropy:": "Shannon의 엔트로피:",
"Shutdown": "종료",
"Shutdown Time": "자동 종료시간",
"Shutting down..": "종료 중..",
Expand Down
8 changes: 3 additions & 5 deletions i18n/translations/nl-NL.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@
"Index: %s": "Index: %s",
"Inputs (%d):": "Invoer (%d):",
"Install?": "Installeren?",
"Insufficient Entropy!": "Onvoldoende Entropie!",
"Insufficient entropy": "Onvoldoende entropie",
"Insufficient entropy!": "Onvoldoende Entropie!",
"Invalid Tamper Check Code": "Ongeldige sabotagecontrolecode",
"Invalid address": "Ongeldig adres",
"Invalid mnemonic length": "Ongeldige geheugensteun lengte",
Expand Down Expand Up @@ -187,8 +186,7 @@
"Please load a wallet output descriptor": "Laadt een portemonnee descriptor in",
"Plunge Rate": "Duik tarief",
"Policy Type": "Type beleid",
"Poor entropy": "Slechte entropie",
"Poor entropy detected!": "Lage entropie gedetecteerd!",
"Poor entropy!": "Slechte entropie!",
"Print Test QR": "Test QR afdrukken",
"Print Tiny Seed?": "Tiny Seed afdrukken?",
"Print to QR": "Afdrukken naar QR",
Expand Down Expand Up @@ -240,7 +238,7 @@
"Settings": "Instellingen",
"Settings stored internally on flash.": "Instellingen intern opgeslagen op flitser.",
"Settings stored on SD card.": "Instellingen opgeslagen op SD kaart.",
"Shannon's Entropy:": "Shannon's entropie:",
"Shannon's entropy:": "Shannon's entropie:",
"Shutdown": "Afsluiten",
"Shutdown Time": "Uitschakelingstijd:",
"Shutting down..": "Bezig met afsluiten..",
Expand Down
8 changes: 3 additions & 5 deletions i18n/translations/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@
"Index: %s": "Índice: %s",
"Inputs (%d):": "Entradas (%d):",
"Install?": "Instalar?",
"Insufficient Entropy!": "Entropia insuficiente!",
"Insufficient entropy": "Entropia insuficiente",
"Insufficient entropy!": "Entropia insuficiente!",
"Invalid Tamper Check Code": "Código de verificação inválido",
"Invalid address": "Endereço inválido",
"Invalid mnemonic length": "Comprimento de mnemônico inválido",
Expand Down Expand Up @@ -187,8 +186,7 @@
"Please load a wallet output descriptor": "Carregue um descritor da carteira",
"Plunge Rate": "Taxa de Mergulho",
"Policy Type": "Tipo de Apólice",
"Poor entropy": "Entropia fraca",
"Poor entropy detected!": "Baixa entropia detectada!",
"Poor entropy!": "Entropia fraca!",
"Print Test QR": "Imprimir QR de teste",
"Print Tiny Seed?": "Imprimir Tiny Seed?",
"Print to QR": "Imprimir QR",
Expand Down Expand Up @@ -240,7 +238,7 @@
"Settings": "Configurações",
"Settings stored internally on flash.": "Configurações armazenadas internamente no flash.",
"Settings stored on SD card.": "Configurações armazenadas no cartão SD.",
"Shannon's Entropy:": "Entropia de Shannon:",
"Shannon's entropy:": "Entropia de Shannon:",
"Shutdown": "Desligar",
"Shutdown Time": "Tempo de desligamento",
"Shutting down..": "Desligando..",
Expand Down
8 changes: 3 additions & 5 deletions i18n/translations/ru-RU.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@
"Index: %s": "Индекс: %s",
"Inputs (%d):": "Входы (%d):",
"Install?": "Установить?",
"Insufficient Entropy!": "Недостаточная Энтропия!",
"Insufficient entropy": "Недостаточная энтропия",
"Insufficient entropy!": "Недостаточная Энтропия!",
"Invalid Tamper Check Code": "Недействительный код проверки вскрытия",
"Invalid address": "Неверный адрес",
"Invalid mnemonic length": "Неверная длина мнемоники",
Expand Down Expand Up @@ -187,8 +186,7 @@
"Please load a wallet output descriptor": "Пожалуйста загрузите выходной дескриптор кошелька",
"Plunge Rate": "Скорость Погружения",
"Policy Type": "Тип политики",
"Poor entropy": "Плохая энтропия",
"Poor entropy detected!": "Обнаружена плохая энтропия!",
"Poor entropy!": "Плохая энтропия!",
"Print Test QR": "Напечатать Тестовый QR",
"Print Tiny Seed?": "Распечатать Tiny Seed?",
"Print to QR": "Печать в QR",
Expand Down Expand Up @@ -240,7 +238,7 @@
"Settings": "Настройки",
"Settings stored internally on flash.": "Настройки хранятся во флэш-памяти.",
"Settings stored on SD card.": "Настройки сохранены на SD-карте.",
"Shannon's Entropy:": "Энтропия Шеннона:",
"Shannon's entropy:": "Энтропия Шеннона:",
"Shutdown": "Выключить",
"Shutdown Time": "Время выключения",
"Shutting down..": "Выключение..",
Expand Down
8 changes: 3 additions & 5 deletions i18n/translations/tr-TR.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@
"Index: %s": "Dizin: %s",
"Inputs (%d):": "Girişler (%d):",
"Install?": "Yükle?",
"Insufficient Entropy!": "Yetersiz Entropi!",
"Insufficient entropy": "Yetersiz entropi",
"Insufficient entropy!": "Yetersiz entropi!",
"Invalid Tamper Check Code": "Geçersiz Kurcalama Kontrol Kodu",
"Invalid address": "Geçersiz adres",
"Invalid mnemonic length": "Geçersiz mnemonic uzunluğu",
Expand Down Expand Up @@ -187,8 +186,7 @@
"Please load a wallet output descriptor": "Lütfen bir cüzdan çıktı tanımlayıcısı yükleyin",
"Plunge Rate": "Dalış Hızı",
"Policy Type": "Politika türü",
"Poor entropy": "Düşük entropi",
"Poor entropy detected!": "Düşük entropi tespit edildi!",
"Poor entropy!": "Düşük entropi!",
"Print Test QR": "Test QR'ını Yazdır",
"Print Tiny Seed?": "Tiny Seed Yazdırılsın mı?",
"Print to QR": "QR'a Yazdır",
Expand Down Expand Up @@ -240,7 +238,7 @@
"Settings": "Ayarlar",
"Settings stored internally on flash.": "Ayarlar dahili olarak flaşta saklanır.",
"Settings stored on SD card.": "Ayarlar SD karta kaydedildi.",
"Shannon's Entropy:": "Shannon Entropisi:",
"Shannon's entropy:": "Shannon entropisi:",
"Shutdown": "Kapat",
"Shutdown Time": "Kapanma Süresi",
"Shutting down..": "Kapatılıyor..",
Expand Down
8 changes: 3 additions & 5 deletions i18n/translations/vi-VN.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@
"Index: %s": "Chỉ mục: %s",
"Inputs (%d):": "Đầu vào (%d):",
"Install?": "Cài đặt phần mềm?",
"Insufficient Entropy!": "Entropy không đủ!",
"Insufficient entropy": "Không đủ entropy",
"Insufficient entropy!": "Entropy không đủ!",
"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 mnemonic length": "Độ dài mã Mnemonic không hợp lệ",
Expand Down Expand Up @@ -187,8 +186,7 @@
"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",
"Policy Type": "Loại Chính sách",
"Poor entropy": "Entropy kém",
"Poor entropy detected!": "Phát hiện entropy yếu!",
"Poor entropy!": "Entropy kém!",
"Print Test QR": "In kiểm tra QR",
"Print Tiny Seed?": "In Tiny Seed?",
"Print to QR": "In ra QR",
Expand Down Expand Up @@ -240,7 +238,7 @@
"Settings": "Cài đặt",
"Settings stored internally on flash.": "Cài đặt được lưu trữ nội bộ trên đèn flash.",
"Settings stored on SD card.": "Cài đặt được lưu trên thẻ SD.",
"Shannon's Entropy:": "Entropy của Shannon:",
"Shannon's entropy:": "Entropy của Shannon:",
"Shutdown": "Tắt máy",
"Shutdown Time": "Thời gian tắt máy",
"Shutting down..": "Đang tắt..",
Expand Down
8 changes: 3 additions & 5 deletions i18n/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@
"Index: %s": "索引: %s",
"Inputs (%d):": "输入 (%d):",
"Install?": "安装?",
"Insufficient Entropy!": "熵不足!",
"Insufficient entropy": "熵不足",
"Insufficient entropy!": "熵不足!",
"Invalid Tamper Check Code": "无效的防篡改检查码",
"Invalid address": "无效地址",
"Invalid mnemonic length": "助记词长度无效",
Expand Down Expand Up @@ -187,8 +186,7 @@
"Please load a wallet output descriptor": "请加载钱包输出描述符",
"Plunge Rate": "下刀速度",
"Policy Type": "政策类型",
"Poor entropy": "熵值低",
"Poor entropy detected!": "检测到低熵!",
"Poor entropy!": "熵值低!",
"Print Test QR": "打印测试二维码",
"Print Tiny Seed?": "打印 Tiny Seed?",
"Print to QR": "打印到二维码",
Expand Down Expand Up @@ -240,7 +238,7 @@
"Settings": "设置",
"Settings stored internally on flash.": "设置存储在 Flash 内部。",
"Settings stored on SD card.": "设置存储在SD卡上。",
"Shannon's Entropy:": "香农熵:",
"Shannon's entropy:": "香农熵:",
"Shutdown": "关机",
"Shutdown Time": "关机时间",
"Shutting down..": "关机中..",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ docs = "poetry run mkdocs serve"
# translations tasks
i18n = "python i18n/i18n.py"
i18n-bake = "python i18n/i18n.py clean prettify bake"
format-translations = "black src/krux/translations.py"
format-translations = "black src/krux/translations/*.py"
i18n-build = ["i18n-bake", "format-translations", "i18n validate"]
# aliases
translations.ref = "i18n-build"
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 @@ -116,11 +116,11 @@ def entropy_measurement_update(self, img, all_at_once=False, show_measurement=Tr
)
elif entropy_level == POOR_ENTROPY:
self.ctx.display.draw_hcentered_text(
t("Poor entropy"), self.y_label_offset, theme.del_color
t("Poor entropy!"), self.y_label_offset, theme.del_color
)
else:
self.ctx.display.draw_hcentered_text(
t("Insufficient entropy"),
t("Insufficient entropy!"),
self.y_label_offset,
theme.error_color,
)
Expand Down Expand Up @@ -187,7 +187,7 @@ 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 = t("Shannon's entropy:") + "\n"
entropy_msg += str(round(shannon_16b, 2)) + " " + "bits/px" + "\n"
entropy_msg += t("(%d total)") % int(shannon_16b_total) + "\n\n"
entropy_msg += t("Pixels deviation index:") + " "
Expand All @@ -198,7 +198,7 @@ def capture(self, show_entropy_details=True):
shannon_16b < INSUFFICIENT_SHANNONS_ENTROPY_TH
or self.stdev_index < INSUFFICIENT_VARIANCE_TH
):
error_msg = t("Insufficient Entropy!")
error_msg = t("Insufficient entropy!")
error_msg += "\n\n"
error_msg += entropy_msg
self.ctx.display.draw_centered_text(error_msg, theme.error_color)
Expand Down
2 changes: 1 addition & 1 deletion src/krux/pages/fill_flash.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def capture_image_with_sufficient_entropy(self, entropy_measurement):
if entropy_measurement.stdev_index > POOR_VARIANCE_TH:
self.ctx.display.to_portrait()
return img.to_bytes()
raise ValueError("Insufficient entropy")
raise ValueError(t("Insufficient entropy!"))

def fill_flash_with_camera_entropy(self):
"""Fill the flash memory with entropy data from the camera."""
Expand Down
4 changes: 2 additions & 2 deletions src/krux/pages/new_mnemonic/dice_rolls.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def stats_for_nerds(self):
offset_x += bar_pad
offset_y += FONT_HEIGHT
self.ctx.display.draw_hcentered_text(
t("Shannon's Entropy:") + " " + str(shannon_entropy) + " " + "bits",
t("Shannon's entropy:") + " " + str(shannon_entropy) + " " + "bits",
offset_y,
)

Expand Down Expand Up @@ -278,7 +278,7 @@ def delete_roll(buffer):
if self.calculate_entropy() < (
self.min_entropy - ENTROPY_TOLERANCE
):
warning_txt += t("Poor entropy detected!")
warning_txt += t("Poor entropy!")
if self.pattern_detection():
if warning_txt:
warning_txt += "\n"
Expand Down
Loading

0 comments on commit e25501d

Please sign in to comment.