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:
parent
bcd837ae26
commit
234c065aae
@ -16,7 +16,7 @@ from trezorlib._internal.translations import VersionTuple
|
||||
HERE = Path(__file__).parent.resolve()
|
||||
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")]
|
||||
|
||||
@ -125,7 +125,13 @@ class TranslationsDir:
|
||||
return self.path / f"{lang}.json"
|
||||
|
||||
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:
|
||||
self._lang_path(lang).write_text(
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"fonts": {
|
||||
"T2B1": {
|
||||
"##Safe3": {
|
||||
"1_FONT_NORMAL": "font_pixeloperator_regular_8_cs.json",
|
||||
"2_FONT_BOLD": "font_pixeloperator_bold_8_cs.json",
|
||||
"3_FONT_MONO": "font_pixeloperatormono_regular_8_cs.json",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"fonts": {
|
||||
"T2B1": {
|
||||
"##Safe3": {
|
||||
"1_FONT_NORMAL": "font_pixeloperator_regular_8_de.json",
|
||||
"2_FONT_BOLD": "font_pixeloperator_bold_8_de.json",
|
||||
"3_FONT_MONO": "font_pixeloperatormono_regular_8_de.json",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"fonts": {
|
||||
"T2B1": {
|
||||
"##Safe3": {
|
||||
"1_FONT_NORMAL": "font_pixeloperator_regular_8_es.json",
|
||||
"2_FONT_BOLD": "font_pixeloperator_bold_8_es.json",
|
||||
"3_FONT_MONO": "font_pixeloperatormono_regular_8_es.json",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"fonts": {
|
||||
"T2B1": {
|
||||
"##Safe3": {
|
||||
"1_FONT_NORMAL": "font_pixeloperator_regular_8_fr.json",
|
||||
"2_FONT_BOLD": "font_pixeloperator_bold_8_fr.json",
|
||||
"3_FONT_MONO": "font_pixeloperatormono_regular_8_fr.json",
|
||||
|
@ -1,8 +1,8 @@
|
||||
{
|
||||
"current": {
|
||||
"merkle_root": "0682f8041f5d002800da51d3c3a36351d326b89ddf8fff6c3e70cd1943f3e064",
|
||||
"datetime": "2024-08-29T14:44:39.968325",
|
||||
"commit": "c5e520fd1e34182fb19044baa190dbc81fcf5cad"
|
||||
"merkle_root": "23cd34c69ea6414849d484a7a9cf990f245d4522371fbdad909807d2bd8efe17",
|
||||
"datetime": "2024-09-03T08:33:15.680225",
|
||||
"commit": "4002c934c0dff69ded4247bee4c92bc6642dc0ac"
|
||||
},
|
||||
"history": [
|
||||
{
|
||||
|
@ -70,7 +70,11 @@ def set_language(client: Client, lang: str):
|
||||
|
||||
def get_lang_json(lang: str) -> translations.JsonDef:
|
||||
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]]:
|
||||
|
Loading…
Reference in New Issue
Block a user