Skip to content

Commit

Permalink
fix tests and lint
Browse files Browse the repository at this point in the history
  • Loading branch information
odudex committed Sep 17, 2024
1 parent b947b5e commit 3fbaba5
Show file tree
Hide file tree
Showing 15 changed files with 55 additions and 216 deletions.
4 changes: 1 addition & 3 deletions i18n/i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,7 @@ def bake_translations():
translations_array.append(slug)
else:
translations_array.append(translations[slug])
language_code = (
basename(translation_filename).split(".")[0].replace("-", "_")
)
language_code = basename(translation_filename).split(".")[0][:2]

# Write the individual translation table to a separate Python file in the 'translations' subfolder
with open(
Expand Down
7 changes: 5 additions & 2 deletions src/krux/krux_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ def t(slug):
if not locale_control.translation:
return slug
slug_id = binascii.crc32(slug.encode("utf-8"))
translation_index = locale_control.reference.index(slug_id)
try:
translation_index = locale_control.reference.index(slug_id)
except:
return slug
return locale_control.translation[translation_index]


Expand Down Expand Up @@ -87,7 +90,7 @@ def load_locale(self, locale):
self.reference = None
self.translation = None
return
module_path = "krux.translations.{}".format(locale.replace("-", "_"))
module_path = "krux.translations.{}".format(locale[:2])
translation_module = __import__(module_path)
# Navigate to the nested module (translations.<locale>)
for part in module_path.split(".")[1:]:
Expand Down
15 changes: 0 additions & 15 deletions src/krux/translations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@
2029624154,
3656120779,
3903754133,
2433276713,
1272005728,
1022211991,
133139382,
Expand All @@ -105,20 +104,12 @@
3768416405,
602716148,
2365886561,
167100211,
1257161524,
3285413280,
3954726429,
2741273573,
1038288324,
2470115694,
712533907,
2736513298,
388908871,
563836138,
3981762528,
2808868327,
3138902155,
3663022166,
1963678224,
1583186953,
Expand All @@ -138,9 +129,6 @@
2739590230,
1310058127,
690625786,
2669588306,
589459321,
3847882980,
1198393582,
3761518438,
2032416055,
Expand Down Expand Up @@ -237,15 +225,12 @@
1178563089,
1871146425,
2258131455,
2940953674,
2115024667,
3442025874,
3037062877,
4094072796,
1712856005,
1476462492,
262410364,
4286144962,
3976793317,
3336226318,
1077771640,
Expand Down
15 changes: 0 additions & 15 deletions src/krux/translations/de_DE.py → src/krux/translations/de.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
"Bildschirmschonerzeit",
"Abschaltzeit:",
"Mnemonics ausblenden",
"Hash Flash at Boot",
"Standard-Wallet",
"Sicherheit",
"Hardware",
Expand All @@ -94,20 +93,12 @@
"Change:",
"Go",
"Werkseinstellungen wiederherstellen und neu starten?",
"PIN disabled",
"Enter a 6+ characters PIN",
"Confirm PIN",
"PINs do not match",
"PIN set successfully",
"Error saving PIN",
"Suche nach SD-Karte..",
"Einstellungen auf SD-Karte gespeichert.",
"SD-Karte nicht erkannt.",
"Änderungen bleiben bis zum Herunterfahren bestehen.",
"Die Einstellungen werden intern auf Flash gespeichert.",
"Werkeinstellungen",
"Set PIN",
"Disable PIN",
"Links",
"Rechts",
"Thema ändern und neu starten?",
Expand All @@ -127,9 +118,6 @@
"12 Wörter",
"24 Wörter",
"Doppelte Gedächtnisstütze",
"Current PIN",
"PIN",
"Invalid PIN",
"Gute Entropie",
"Schlechte Entropie",
"Unzureichende Entropie",
Expand Down Expand Up @@ -226,15 +214,12 @@
"%s wurde entfernt.",
"Löschen Sie Ihre SD-Karte vollständig in einem anderen Gerät, um sicherzustellen, dass die Daten nicht wiederhergestellt werden können",
"Um sicherzustellen, dass die Daten nicht wiederhergestellt werden können, verwenden Sie die Funktion 'Gerät löschen'",
"Generating Flash Hash..",
"Flash Hash",
"Prüfe SD-Karte",
"Drucke Test-QR",
"Erstelle QR-Code",
"Deskriptor-Adressen",
"Mnemonic löschen",
"Gerät löschen",
"Set a PIN first",
"SD-Karte",
"Belegt:",
"Frei:",
Expand Down
15 changes: 0 additions & 15 deletions src/krux/translations/es_MX.py → src/krux/translations/es.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
"Tiempo de Espera del Protector de Pantalla",
"Tiempo de Apagado",
"Ocultar Mnemónicos",
"Hash Flash at Boot",
"Cartera Predeterminada",
"Seguridad",
"Hardware",
Expand All @@ -94,20 +93,12 @@
"Cambio:",
"Ir",
"¿Restablecer a la configuración de fábrica y reiniciar?",
"PIN disabled",
"Enter a 6+ characters PIN",
"Confirm PIN",
"PINs do not match",
"PIN set successfully",
"Error saving PIN",
"Comprobación de la tarjeta SD..",
"Configuración almacenada en la tarjeta SD.",
"Tarjeta SD no detectada.",
"Los cambios durarán hasta que el dispositivo se apague.",
"Ajustes almacenados internamente en flash.",
"Ajustes de Fábrica",
"Set PIN",
"Disable PIN",
"Izquierda",
"Derecha",
"¿Cambiar de tema y reiniciar?",
Expand All @@ -127,9 +118,6 @@
"12 palabras",
"24 palabras",
"Doble mnemónico",
"Current PIN",
"PIN",
"Invalid PIN",
"Buena entropía",
"Baja entropía",
"Entropía insuficiente",
Expand Down Expand Up @@ -226,15 +214,12 @@
"%s eliminado.",
"Borra completamente su tarjeta SD en otro dispositivo para asegurarse de que los datos sean irrecuperables",
"Para garantizar que los datos no se puedan recuperar, utiliza la función de borrar dispositivo",
"Generating Flash Hash..",
"Flash Hash",
"Verifica Tarjeta SD",
"Prueba de Impresión QR",
"Crear Código QR",
"Direcciones del descriptor",
"Eliminar Mnemónico",
"Borrar Dispositivo",
"Set a PIN first",
"Tarjeta SD",
"Usado:",
"Libre:",
Expand Down
15 changes: 0 additions & 15 deletions src/krux/translations/fr_FR.py → src/krux/translations/fr.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
"Delai d'Inactivité",
"Delai d'Arrêt",
"Masquer les mnémoniques",
"Hash Flash at Boot",
"Portefeuille par défaut",
"Sécurité",
"Matériel",
Expand All @@ -94,20 +93,12 @@
"La monnaie\u2009:",
"Go",
"Restaurer les paramètres d'usine et redémarrer\u2009?",
"PIN disabled",
"Enter a 6+ characters PIN",
"Confirm PIN",
"PINs do not match",
"PIN set successfully",
"Error saving PIN",
"Vérification de la carte SD..",
"Paramètres stockés sur la carte SD.",
"Carte SD non détectée.",
"Les modifications dureront jusqu'à l'arrêt.",
"Paramètres stockés en interne sur flash.",
"Paramètres d'usine",
"Set PIN",
"Disable PIN",
"Gauche",
"À droite",
"Changer de thème et redémarrer\u2009?",
Expand All @@ -127,9 +118,6 @@
"12 mots",
"24 mots",
"Double mnémonique",
"Current PIN",
"PIN",
"Invalid PIN",
"Bonne entropie",
"Mauvaise entropie",
"Entropie insuffisante",
Expand Down Expand Up @@ -226,15 +214,12 @@
"%s supprimé.",
"Effacez complètement votre carte SD dans un autre appareil pour assurer que les données soient irrécupérables",
"Pour assurer que les données soient irrécupérables, utilisez la fonctionnalité 'Effacer l'appareil'",
"Generating Flash Hash..",
"Flash Hash",
"Vérifiez la carte SD",
"Test d'impression QR",
"Créer du code QR",
"Adresses des descripteurs",
"Supprimer mnémonique",
"Effacer l'appareil",
"Set a PIN first",
"Carte SD",
"Utilisé\u2009:",
"Libre\u2009:",
Expand Down
15 changes: 0 additions & 15 deletions src/krux/translations/ko_KR.py → src/krux/translations/ko.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
"화면보호기 시간",
"자동 종료시간",
"니모닉 숨기기",
"Hash Flash at Boot",
"지갑 기본설정",
"보안",
"하드웨어",
Expand All @@ -94,20 +93,12 @@
"변경",
"선택",
"공장 설정을 복원하고 재부팅하시겠습니까?",
"PIN disabled",
"Enter a 6+ characters PIN",
"Confirm PIN",
"PINs do not match",
"PIN set successfully",
"Error saving PIN",
"SD카드 확인 중..",
"SD 카드에 저장된 설정.",
"SD카드가 감지되지 않았습니다.",
"변경 사항은 종료될때까지 유지됩니다.",
"설정은 플래시에서 내부적으로 저장됩니다.",
"공장 초기 설정",
"Set PIN",
"Disable PIN",
"왼쪽",
"오른쪽",
"테마를 변경하고 재부팅하시겠습니까?",
Expand All @@ -127,9 +118,6 @@
"12단어",
"24단어",
"이중 니모닉",
"Current PIN",
"PIN",
"Invalid PIN",
"엔트로피가 충분합니다",
"엔트로피가 부족합니다",
"엔트로피가 충분하지 않습니다",
Expand Down Expand Up @@ -226,15 +214,12 @@
"%s 제거되었습니다.",
"다른 장치에서 데이터 복구가 불가능하도록 SD카드를 완전히 지우십시오",
"데이터 복구가 불가능하도록 장치 전체지우기 기능을 사용하십시오",
"Generating Flash Hash..",
"Flash Hash",
"SD카드 확인",
"QR 테스트 인쇄",
"QR 코드 생성",
"디스크립터 주소",
"니모닉 제거",
"기기 초기화",
"Set a PIN first",
"SD카드",
"이미 사용됨:",
"여유 공간:",
Expand Down
15 changes: 0 additions & 15 deletions src/krux/translations/nl_NL.py → src/krux/translations/nl.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
"Schermbeveiligingstijd",
"Uitschakelingstijd:",
"Verberg geheugensteunen",
"Hash Flash at Boot",
"Standaard portemonnee",
"Beveiliging",
"Hardware",
Expand All @@ -94,20 +93,12 @@
"Wisselgeld:",
"Ga",
"Fabrieksinstellingen herstellen en opnieuw opstarten?",
"PIN disabled",
"Enter a 6+ characters PIN",
"Confirm PIN",
"PINs do not match",
"PIN set successfully",
"Error saving PIN",
"SD kaart controleren..",
"Instellingen opgeslagen op SD kaart.",
"SD kaart niet gedetecteerd.",
"Wijzigingen blijven van kracht tot afsluiten.",
"Instellingen intern opgeslagen op flitser.",
"Fabrieksinstellingen",
"Set PIN",
"Disable PIN",
"Links",
"Rechts",
"Thema veranderen en opnieuw opstarten?",
Expand All @@ -127,9 +118,6 @@
"12 woorden",
"24 woorden",
"Dubbel geheugensteuntje",
"Current PIN",
"PIN",
"Invalid PIN",
"Goede entropie",
"Slechte entropie",
"Onvoldoende entropie",
Expand Down Expand Up @@ -226,15 +214,12 @@
"%s verwijderd.",
"Wis uw SD kaart volledig in een ander apparaat om te zorgen dat de gegevens onherstelbaar zijn",
"Gebruik de functie 'Apparaat wissen' om te zorgen dat de gegevens onherstelbaar zijn",
"Generating Flash Hash..",
"Flash Hash",
"Controleer SD kaart",
"Test QR afdrukken",
"QR code maken",
"Descriptoradressen",
"Geheugensteun verwijderen",
"Apparaat wissen",
"Set a PIN first",
"SD kaart",
"Gebruikt:",
"Vrij:",
Expand Down
Loading

0 comments on commit 3fbaba5

Please sign in to comment.