1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-19 05:58:09 +00:00

chore(core): support T3B1 for translation blobs

This commit is contained in:
matejcik 2024-09-02 10:26:13 +02:00 committed by matejcik
parent bcd837ae26
commit 234c065aae
7 changed files with 20 additions and 10 deletions

View File

@ -16,7 +16,7 @@ from trezorlib._internal.translations import VersionTuple
HERE = Path(__file__).parent.resolve() HERE = Path(__file__).parent.resolve()
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
ALL_MODELS = {models.T2B1, models.T2T1, models.T3T1} ALL_MODELS = {models.T2B1, models.T2T1, models.T3T1, models.T3B1}
PRIVATE_KEYS_DEV = [byte * 32 for byte in (b"\xdd", b"\xde", b"\xdf")] PRIVATE_KEYS_DEV = [byte * 32 for byte in (b"\xdd", b"\xde", b"\xdf")]
@ -125,7 +125,13 @@ class TranslationsDir:
return self.path / f"{lang}.json" return self.path / f"{lang}.json"
def load_lang(self, lang: str) -> translations.JsonDef: def load_lang(self, lang: str) -> translations.JsonDef:
return json.loads(self._lang_path(lang).read_text()) json_def = json.loads(self._lang_path(lang).read_text())
# special-case for T2B1 and T3B1, so that we keep the info in one place instead
# of duplicating it in two entries, risking a desync
if (fonts_safe3 := json_def.get("fonts", {}).get("##Safe3")) is not None:
json_def["fonts"]["T2B1"] = fonts_safe3
json_def["fonts"]["T3B1"] = fonts_safe3
return json_def
def save_lang(self, lang: str, data: translations.JsonDef) -> None: def save_lang(self, lang: str, data: translations.JsonDef) -> None:
self._lang_path(lang).write_text( self._lang_path(lang).write_text(

View File

@ -1,6 +1,6 @@
{ {
"fonts": { "fonts": {
"T2B1": { "##Safe3": {
"1_FONT_NORMAL": "font_pixeloperator_regular_8_cs.json", "1_FONT_NORMAL": "font_pixeloperator_regular_8_cs.json",
"2_FONT_BOLD": "font_pixeloperator_bold_8_cs.json", "2_FONT_BOLD": "font_pixeloperator_bold_8_cs.json",
"3_FONT_MONO": "font_pixeloperatormono_regular_8_cs.json", "3_FONT_MONO": "font_pixeloperatormono_regular_8_cs.json",

View File

@ -1,6 +1,6 @@
{ {
"fonts": { "fonts": {
"T2B1": { "##Safe3": {
"1_FONT_NORMAL": "font_pixeloperator_regular_8_de.json", "1_FONT_NORMAL": "font_pixeloperator_regular_8_de.json",
"2_FONT_BOLD": "font_pixeloperator_bold_8_de.json", "2_FONT_BOLD": "font_pixeloperator_bold_8_de.json",
"3_FONT_MONO": "font_pixeloperatormono_regular_8_de.json", "3_FONT_MONO": "font_pixeloperatormono_regular_8_de.json",

View File

@ -1,6 +1,6 @@
{ {
"fonts": { "fonts": {
"T2B1": { "##Safe3": {
"1_FONT_NORMAL": "font_pixeloperator_regular_8_es.json", "1_FONT_NORMAL": "font_pixeloperator_regular_8_es.json",
"2_FONT_BOLD": "font_pixeloperator_bold_8_es.json", "2_FONT_BOLD": "font_pixeloperator_bold_8_es.json",
"3_FONT_MONO": "font_pixeloperatormono_regular_8_es.json", "3_FONT_MONO": "font_pixeloperatormono_regular_8_es.json",

View File

@ -1,6 +1,6 @@
{ {
"fonts": { "fonts": {
"T2B1": { "##Safe3": {
"1_FONT_NORMAL": "font_pixeloperator_regular_8_fr.json", "1_FONT_NORMAL": "font_pixeloperator_regular_8_fr.json",
"2_FONT_BOLD": "font_pixeloperator_bold_8_fr.json", "2_FONT_BOLD": "font_pixeloperator_bold_8_fr.json",
"3_FONT_MONO": "font_pixeloperatormono_regular_8_fr.json", "3_FONT_MONO": "font_pixeloperatormono_regular_8_fr.json",

View File

@ -1,8 +1,8 @@
{ {
"current": { "current": {
"merkle_root": "0682f8041f5d002800da51d3c3a36351d326b89ddf8fff6c3e70cd1943f3e064", "merkle_root": "23cd34c69ea6414849d484a7a9cf990f245d4522371fbdad909807d2bd8efe17",
"datetime": "2024-08-29T14:44:39.968325", "datetime": "2024-09-03T08:33:15.680225",
"commit": "c5e520fd1e34182fb19044baa190dbc81fcf5cad" "commit": "4002c934c0dff69ded4247bee4c92bc6642dc0ac"
}, },
"history": [ "history": [
{ {

View File

@ -70,7 +70,11 @@ def set_language(client: Client, lang: str):
def get_lang_json(lang: str) -> translations.JsonDef: def get_lang_json(lang: str) -> translations.JsonDef:
assert lang in LANGUAGES assert lang in LANGUAGES
return json.loads((TRANSLATIONS / f"{lang}.json").read_text()) lang_json = json.loads((TRANSLATIONS / f"{lang}.json").read_text())
if (fonts_safe3 := lang_json.get("fonts", {}).get("##Safe3")) is not None:
lang_json["fonts"]["T2B1"] = fonts_safe3
lang_json["fonts"]["T3B1"] = fonts_safe3
return lang_json
def _get_all_language_data() -> list[dict[str, str]]: def _get_all_language_data() -> list[dict[str, str]]: