diff --git a/core/embed/rust/src/translations/generated/translated_string.rs b/core/embed/rust/src/translations/generated/translated_string.rs index e8da45f6eb..c005763b1d 100644 --- a/core/embed/rust/src/translations/generated/translated_string.rs +++ b/core/embed/rust/src/translations/generated/translated_string.rs @@ -546,7 +546,7 @@ pub enum TranslatedString { homescreen__title_no_usb_connection = 327, // "No USB connection" homescreen__title_pin_not_set = 328, // "PIN not set" homescreen__title_seedless = 329, // "Seedless" - homescreen__title_set = 330, // "Change wallpaper" + homescreen__title_set = 330, // {"Bolt": "Change wallpaper?", "Samson": "Change wallpaper?", "Quicksilver": "Change wallpaper?"} inputs__back = 331, // "BACK" inputs__cancel = 332, // "CANCEL" inputs__delete = 333, // "DELETE" @@ -1385,6 +1385,8 @@ pub enum TranslatedString { } impl TranslatedString { + // Allow building with `--all-features` (enabling all layouts results in duplicate match keys) for clippy + #[allow(unreachable_patterns)] pub fn untranslated(self) -> &'static str { match self { Self::addr_mismatch__contact_support_at => "Please contact Trezor support at", @@ -1922,7 +1924,12 @@ impl TranslatedString { Self::homescreen__title_no_usb_connection => "No USB connection", Self::homescreen__title_pin_not_set => "PIN not set", Self::homescreen__title_seedless => "Seedless", - Self::homescreen__title_set => "Change wallpaper", + #[cfg(feature = "layout_bolt")] + Self::homescreen__title_set => "Change wallpaper?", + #[cfg(feature = "layout_samson")] + Self::homescreen__title_set => "Change wallpaper?", + #[cfg(feature = "layout_quicksilver")] + Self::homescreen__title_set => "Change wallpaper?", Self::inputs__back => "BACK", Self::inputs__cancel => "CANCEL", Self::inputs__delete => "DELETE", diff --git a/core/embed/rust/src/translations/generated/translated_string.rs.mako b/core/embed/rust/src/translations/generated/translated_string.rs.mako index 9ecc94fbcf..24251e0461 100644 --- a/core/embed/rust/src/translations/generated/translated_string.rs.mako +++ b/core/embed/rust/src/translations/generated/translated_string.rs.mako @@ -32,6 +32,9 @@ order = {int(k): v for k, v in order_index_name.items()} en_file = TR_DIR / "en.json" en_data = json.loads(en_file.read_text())["translations"] +def encode_str(s): + return re.sub(r'\\u([0-9a-f]{4})', r'\\u{\g<1>}', json.dumps(s)) + %>\ #[cfg(feature = "micropython")] use crate::micropython::qstr::Qstr; @@ -50,13 +53,26 @@ pub enum TranslatedString { } impl TranslatedString { + // Allow building with `--all-features` (enabling all layouts results in duplicate match keys) for clippy + #[allow(unreachable_patterns)] pub fn untranslated(self) -> &'static str { match self { % for name in order.values(): +<% + value = en_data.get(name, '""') + layouts_dict = value if isinstance(value, dict) else None +%>\ %if any(name.startswith(prefix + "__") for prefix in ALTCOIN_PREFIXES): #[cfg(feature = "universal_fw")] %endif - Self::${name} => ${re.sub(r'\\u([0-9a-f]{4})', r'\\u{\g<1>}', json.dumps(en_data.get(name, '""')))}, + %if layouts_dict is not None: + % for layout_name, layout_value in layouts_dict.items(): + #[cfg(feature = "${f"layout_{layout_name.lower()}"}")] + Self::${name} => ${encode_str(layout_value)}, + % endfor + %else: + Self::${name} => ${encode_str(value)}, + %endif % endfor } } diff --git a/core/mocks/trezortranslate_keys.pyi b/core/mocks/trezortranslate_keys.pyi index 8454099bfd..f60c5ea865 100644 --- a/core/mocks/trezortranslate_keys.pyi +++ b/core/mocks/trezortranslate_keys.pyi @@ -377,7 +377,7 @@ class TR: homescreen__title_no_usb_connection: str = "No USB connection" homescreen__title_pin_not_set: str = "PIN not set" homescreen__title_seedless: str = "Seedless" - homescreen__title_set: str = "Change wallpaper" + homescreen__title_set: str = "Change wallpaper?" inputs__back: str = "BACK" inputs__cancel: str = "CANCEL" inputs__delete: str = "DELETE" diff --git a/core/mocks/trezortranslate_keys.pyi.mako b/core/mocks/trezortranslate_keys.pyi.mako index 722eb3bc52..8f0085c76e 100644 --- a/core/mocks/trezortranslate_keys.pyi.mako +++ b/core/mocks/trezortranslate_keys.pyi.mako @@ -9,7 +9,12 @@ en_data = json.loads(en_file.read_text())["translations"] %>\ class TR: -% for name, text in sorted(en_data.items()): - ${name}: str = ${json.dumps(text)} +% for name, value in sorted(en_data.items()): +<% + if isinstance(value, dict): + # For simplicity, use the first model's text for the stubs. + value, *_ = value.values() +%>\ + ${name}: str = ${json.dumps(value)} % endfor diff --git a/core/translations/en.json b/core/translations/en.json index 02edf7b9fe..501885add6 100644 --- a/core/translations/en.json +++ b/core/translations/en.json @@ -379,7 +379,7 @@ "homescreen__title_no_usb_connection": "No USB connection", "homescreen__title_pin_not_set": "PIN not set", "homescreen__title_seedless": "Seedless", - "homescreen__title_set": "Change wallpaper", + "homescreen__title_set": {"Bolt": "Change wallpaper?", "Samson": "Change wallpaper?", "Quicksilver": "Change wallpaper?"}, "inputs__back": "BACK", "inputs__cancel": "CANCEL", "inputs__delete": "DELETE",