1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-17 19:00:58 +00:00

fix(core/translations): preserve model groups when running cli.py gen

[no changelog]
This commit is contained in:
Martin Milata 2024-11-06 14:43:21 +01:00
parent 5bc2f8d1ec
commit 0f8a2955ec

View File

@ -124,11 +124,11 @@ class TranslationsDir:
def _lang_path(self, lang: str) -> Path: def _lang_path(self, lang: str) -> Path:
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, model_groups: bool = True) -> translations.JsonDef:
json_def = 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 # 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 # of duplicating it in two entries, risking a desync
if (fonts_safe3 := json_def.get("fonts", {}).get("##Safe3")) is not None: if model_groups and (fonts_safe3 := json_def.get("fonts", {}).get("##Safe3")) is not None:
json_def["fonts"]["T2B1"] = fonts_safe3 json_def["fonts"]["T2B1"] = fonts_safe3
json_def["fonts"]["T3B1"] = fonts_safe3 json_def["fonts"]["T3B1"] = fonts_safe3
return json_def return json_def
@ -150,7 +150,7 @@ class TranslationsDir:
def update_version_from_h(self, check: bool = False) -> VersionTuple: def update_version_from_h(self, check: bool = False) -> VersionTuple:
version = _version_from_version_h() version = _version_from_version_h()
for lang in self.all_languages(): for lang in self.all_languages():
blob_json = self.load_lang(lang) blob_json = self.load_lang(lang, model_groups=False)
blob_version = translations.version_from_json( blob_version = translations.version_from_json(
blob_json["header"]["version"] blob_json["header"]["version"]
) )