ui: fix - translate display text of updater_state (#36649)

* Add updater_state translation

* Move STATE_TO_DISPLAY_TEXT on top
This commit is contained in:
Chechulin Serhii
2025-12-02 23:13:13 +02:00
committed by GitHub
parent ae6250e685
commit 63563c3561
+10 -1
View File
@@ -14,6 +14,13 @@ from openpilot.system.ui.widgets.scroller_tici import Scroller
# TODO: remove this. updater fails to respond on startup if time is not correct
UPDATED_TIMEOUT = 10 # seconds to wait for updated to respond
# Mapping updater internal states to translated display strings
STATE_TO_DISPLAY_TEXT = {
"checking...": tr("checking..."),
"downloading...": tr("downloading..."),
"finalizing update...": tr("finalizing update..."),
}
def time_ago(date: datetime.datetime | None) -> str:
if not date:
@@ -100,7 +107,9 @@ class SoftwareLayout(Widget):
# Updater responded
self._waiting_for_updater = False
self._download_btn.action_item.set_enabled(False)
self._download_btn.action_item.set_value(updater_state)
# Use the mapping, with a fallback to the original state string
display_text = STATE_TO_DISPLAY_TEXT.get(updater_state, updater_state)
self._download_btn.action_item.set_value(display_text)
else:
if failed_count > 0:
self._download_btn.action_item.set_value(tr("failed to check for update"))