fix(core): chance fstrings to with_colon in Bolt Caesar [no changelog]
What changed, and why it matters
This commit is a code cleanup in the Trezor hardware wallet's user interface. It replaces hard-coded colon punctuation (like 'Amount:') with a helper function called with_colon that adds the colon in a translation-friendly way. There is no security issue here.
No security action needed. Treat as a normal UI refactoring commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch refactors UI label construction in core/src/trezor/ui/layouts/bolt/init.py and core/src/trezor/ui/layouts/caesar/init.py. It removes f-string concatenation of translated strings with literal colons (e.g., f”{TR.words__amount}:”) and instead uses a with_colon() utility from ..properties. This is a localization/translation hygiene change, not a functional or security change.
Changed components
core/src/trezor/ui/layouts/bolt/__init__.pycore/src/trezor/ui/layouts/caesar/__init__.pyInspect captured patch +22 / −11
diff --git a/core/src/trezor/ui/layouts/bolt/__init__.py b/core/src/trezor/ui/layouts/bolt/__init__.py
index edda7208..0267d4f4 100644
--- a/core/src/trezor/ui/layouts/bolt/__init__.py
+++ b/core/src/trezor/ui/layouts/bolt/__init__.py
@@ -6,7 +6,13 @@ from trezor import TR, ui, utils
from trezor.enums import ButtonRequestType, RecoveryType
from trezor.wire import ActionCancelled
-from ..common import interact, interact_simple, raise_if_not_confirmed, with_info
+from ..common import (
+ interact,
+ interact_simple,
+ raise_if_not_confirmed,
+ with_info,
+)
+from ..properties import with_colon
if TYPE_CHECKING:
from buffer_types import AnyBytes, StrOrBytes
@@ -835,7 +841,7 @@ def confirm_amount(
br_name: str = "confirm_amount",
br_code: ButtonRequestType = BR_CODE_OTHER,
) -> Awaitable[None]:
- description = description or f"{TR.words__amount}:" # def_arg
+ description = description or with_colon(TR.words__amount) # def_arg
return confirm_value(
title,
amount,
@@ -1113,9 +1119,11 @@ if not utils.BITCOIN_ONLY:
total_amount = f"{total_amount}\n{native_amount}"
if is_send:
- description = f"{TR.words__recipient}:"
+ description = with_colon(TR.words__recipient)
else:
- description = f"{TR.ethereum__interaction_contract}:" if recipient else None
+ description = (
+ with_colon(TR.ethereum__interaction_contract) if recipient else None
+ )
address_ctx = trezorui_api.confirm_value(
title=TR.words__address,
@@ -1142,9 +1150,9 @@ if not utils.BITCOIN_ONLY:
total_ctx = trezorui_api.confirm_summary(
amount=total_amount,
- amount_label=f"{TR.words__amount}:",
+ amount_label=with_colon(TR.words__amount),
fee=maximum_fee,
- fee_label=f"{TR.send__maximum_fee}:",
+ fee_label=with_colon(TR.send__maximum_fee),
title=TR.words__title_summary,
extra_items=extra_items, # used so that info button is shown
extra_title=TR.confirm_total__title_fee,
@@ -1281,7 +1289,7 @@ if not utils.BITCOIN_ONLY:
await _confirm_summary(
native_amount,
- f"{TR.words__amount}:" if native_amount else None,
+ with_colon(TR.words__amount) if native_amount else None,
maximum_fee,
TR.send__maximum_fee,
TR.words__title_summary,
@@ -1656,7 +1664,7 @@ if not utils.BITCOIN_ONLY:
confirm_ctx = trezorui_api.confirm_value(
title=title,
description=description,
- extra=f"{TR.words__provider}:" if vote_account else None,
+ extra=with_colon(TR.words__provider) if vote_account else None,
value=vote_account,
verb=TR.buttons__continue,
info=True,
diff --git a/core/src/trezor/ui/layouts/caesar/__init__.py b/core/src/trezor/ui/layouts/caesar/__init__.py
index bcea757e..2db1d8e9 100644
--- a/core/src/trezor/ui/layouts/caesar/__init__.py
+++ b/core/src/trezor/ui/layouts/caesar/__init__.py
@@ -6,6 +6,7 @@ from trezor.enums import ButtonRequestType, RecoveryType
from trezor.wire import ActionCancelled
from ..common import interact, interact_simple, raise_if_not_confirmed
+from ..properties import with_colon
if TYPE_CHECKING:
from buffer_types import AnyBytes, StrOrBytes
@@ -899,7 +900,9 @@ def confirm_amount(
br_name: str = "confirm_amount",
br_code: ButtonRequestType = BR_CODE_OTHER,
) -> Awaitable[None]:
- description = description or f"{TR.words__amount}:" # def_arg
+ from ..properties import with_colon
+
+ description = description or with_colon(TR.words__amount) # def_arg
return confirm_blob(
br_name,
title,
@@ -1324,7 +1327,7 @@ if not utils.BITCOIN_ONLY:
amount_title = verb
amount_value = ""
else:
- amount_title = f"{TR.words__amount}:"
+ amount_title = with_colon(TR.words__amount)
amount_value = total_amount
with trezorui_api.confirm_summary(
@@ -2175,7 +2178,7 @@ async def confirm_modify_output(
title=TR.modify_amount__title,
value=address,
verb=TR.buttons__continue,
- description=f"{TR.words__address}:",
+ description=with_colon(TR.words__address),
)
modify_ctx = trezorui_api.confirm_modify_output(
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.