diff --git a/firmware/README.md b/firmware/README.md index 75ead0b..afc1052 100644 --- a/firmware/README.md +++ b/firmware/README.md @@ -22,6 +22,8 @@ File `authenticity.json` is the source of truth for public keys used in the devi Directory `translations` holds translation blobs. These are not available for T1B1 and older firmware versions. Trezor Suite downloads translations from [https://data.trezor.io/](https://data.trezor.io/). During the initial firmware installation, Suite downloads and installs a firmware translation corresponding to the Suite language, if available. The file is silently updated during subsequent firmware installations or any call to Trezor Connect, if needed. If a translation download fails, no error is shown and the outdated version is kept, which may result in some strings not being translated. +Per-release JSONs may also contain a `translations_metadata` map alongside `translations`, holding metadata for each language, e.g. `"translations_metadata": {"cs-CZ": {"status": "production"}, "de-DE": {"status": "beta"}}`. The keys of `translations_metadata` always match the keys of `translations`. Trezor Suite displays a production status label for it (e.g. "Beta") based on this field. The legacy `releases.json` keeps `translations_metadata` as the same map, while `translations` is reduced to a list of all language tags. + ## Models mapping | Model | Name | diff --git a/scripts/copy-firmware-jsons.py b/scripts/copy-firmware-jsons.py index bc623f3..c0dc542 100755 --- a/scripts/copy-firmware-jsons.py +++ b/scripts/copy-firmware-jsons.py @@ -14,10 +14,10 @@ from __future__ import annotations import json -import typing as t -import subprocess -import shutil import re +import shutil +import subprocess +import typing as t from pathlib import Path import click @@ -92,6 +92,15 @@ def update_releases_json( if (translations := universal_json.get("translations")) is not None: new_item["translations"] = list(translations) # keep only the keys + # metadata of each translation (e.g. {"status": "production"} or {"status": "beta"}) + metadata = universal_json.get("translations_metadata") + assert metadata == btconly_json.get("translations_metadata") + if metadata is not None: + # translations_metadata must list every language present in translations + assert translations is not None + assert set(metadata.keys()) == set(translations.keys()) + new_item["translations_metadata"] = metadata # keep the map as-is + for suffix, items in [("", universal_json), ("_bitcoinonly", btconly_json)]: for k in non_shared_keys: value = items[k]