Skip to content

Commit

Permalink
fix(core/translations): preserve model groups when running cli.py gen
Browse files Browse the repository at this point in the history
[no changelog]
  • Loading branch information
mmilata committed Nov 6, 2024
1 parent 5bc2f8d commit 0f8a295
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/translations/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@ def fonts_dir(self) -> Path:
def _lang_path(self, lang: str) -> Path:
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())
# 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:
if model_groups and (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
Expand All @@ -150,7 +150,7 @@ def all_languages(self) -> t.Iterable[str]:
def update_version_from_h(self, check: bool = False) -> VersionTuple:
version = _version_from_version_h()
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_json["header"]["version"]
)
Expand Down

0 comments on commit 0f8a295

Please sign in to comment.