fix(i18n): replace tr_noop with tr for sidebar menu names in sunnypilot settings
Root cause: all sidebar menu buttons used tr_noop() which returns the original string without translation. Replaced with tr() for all 16 menu items (Device, Network, sunnylink, Toggles, Software, Models, Steering, Cruise, Visuals, Display, OSM, Trips, Vehicle, Firehose, Developer). Also fixes: - PairBigButton: pair/paired/subscribed/upgrade to prime hardcoded text - UpdateOpenpilotBigButton: 'update sunnypilot' hardcoded text - SunnylinkHeader title: '🚀 sunnylink 🚀' hardcoded text - OSM: DELETING..., Loading... hardcoded text - PO: added 25 new translation entries for all above items
This commit is contained in:
@@ -130,7 +130,7 @@ class UpdaterState(IntEnum):
|
||||
|
||||
class PairBigButton(BigButton):
|
||||
def __init__(self):
|
||||
super().__init__("pair", "connect.comma.ai", gui_app.texture("icons_mici/settings/comma_icon.png", 33, 60))
|
||||
super().__init__(tr("pair"), "connect.comma.ai", gui_app.texture("icons_mici/settings/comma_icon.png", 33, 60))
|
||||
|
||||
def _get_label_font_size(self):
|
||||
return 64
|
||||
@@ -139,13 +139,13 @@ class PairBigButton(BigButton):
|
||||
super()._update_state()
|
||||
|
||||
if ui_state.prime_state.is_paired():
|
||||
self.set_text("paired")
|
||||
self.set_text(tr("paired"))
|
||||
if ui_state.prime_state.is_prime():
|
||||
self.set_value("subscribed")
|
||||
self.set_value(tr("subscribed"))
|
||||
else:
|
||||
self.set_value("upgrade to prime")
|
||||
self.set_value(tr("upgrade to prime"))
|
||||
else:
|
||||
self.set_text("pair")
|
||||
self.set_text(tr("pair"))
|
||||
self.set_value("connect.comma.ai")
|
||||
|
||||
def _handle_mouse_release(self, mouse_pos: MousePos):
|
||||
@@ -172,7 +172,7 @@ class UpdateOpenpilotBigButton(BigButton):
|
||||
self._txt_update_icon = gui_app.texture("icons_mici/settings/device/update.png", 64, 75)
|
||||
self._txt_reboot_icon = gui_app.texture("icons_mici/settings/device/reboot.png", 64, 70)
|
||||
self._txt_up_to_date_icon = gui_app.texture("icons_mici/settings/device/up_to_date.png", 64, 64)
|
||||
super().__init__("update sunnypilot", "", self._txt_update_icon)
|
||||
super().__init__(tr("update sunnypilot"), "", self._txt_update_icon)
|
||||
|
||||
self._waiting_for_updater_t: float | None = None
|
||||
self._hide_value_t: float | None = None
|
||||
|
||||
@@ -33,11 +33,11 @@ class SettingsLayout(NavScroller):
|
||||
device_btn.set_click_callback(lambda: gui_app.push_widget(device_panel))
|
||||
|
||||
developer_panel = DeveloperLayoutMici()
|
||||
developer_btn = SettingsBigButton("developer", "", gui_app.texture("icons_mici/settings/developer_icon.png", 64, 60))
|
||||
developer_btn = SettingsBigButton(tr("developer"), "", gui_app.texture("icons_mici/settings/developer_icon.png", 64, 60))
|
||||
developer_btn.set_click_callback(lambda: gui_app.push_widget(developer_panel))
|
||||
|
||||
firehose_panel = FirehoseLayout()
|
||||
firehose_btn = SettingsBigButton("firehose", "", gui_app.texture("icons_mici/settings/firehose.png", 52, 62))
|
||||
firehose_btn = SettingsBigButton(tr("firehose"), "", gui_app.texture("icons_mici/settings/firehose.png", 52, 62))
|
||||
firehose_btn.set_click_callback(lambda: gui_app.push_widget(firehose_panel))
|
||||
|
||||
self._scroller.add_widgets([
|
||||
|
||||
@@ -42,11 +42,11 @@ class OSMLayout(Widget):
|
||||
self._update_map_size()
|
||||
self._progress.set_visible(False)
|
||||
self._state_btn.set_visible(False)
|
||||
self._mapd_version.action_item.set_text(ui_state.params.get("MapdVersion") or "Loading...")
|
||||
self._mapd_version.action_item.set_text(ui_state.params.get("MapdVersion") or tr("Loading..."))
|
||||
self._scroller = Scroller(self.items, line_separator=True, spacing=0)
|
||||
|
||||
def _initialize_items(self):
|
||||
self._mapd_version = text_item(tr("Mapd Version"), lambda: ui_state.params.get("MapdVersion") or "Loading...")
|
||||
self._mapd_version = text_item(tr("Mapd Version"), lambda: ui_state.params.get("MapdVersion") or tr("Loading..."))
|
||||
self._delete_maps_btn = ListItemSP(tr("Downloaded Maps"), action_item=NoElideButtonAction(tr("DELETE"), enabled=True), callback=self._delete_maps)
|
||||
self._progress = progress_item(tr("Downloading Map"))
|
||||
self._update_btn = ListItemSP(tr("Database Update"), action_item=NoElideButtonAction(tr("CHECK"), enabled=True), callback=self._update_db)
|
||||
@@ -88,7 +88,7 @@ class OSMLayout(Widget):
|
||||
|
||||
def _on_confirm_delete_maps(self):
|
||||
self._delete_maps_btn.action_item.set_enabled(False)
|
||||
self._delete_maps_btn.action_item.set_text("DELETING...")
|
||||
self._delete_maps_btn.action_item.set_text(tr("DELETING..."))
|
||||
threading.Thread(target=self._do_delete_maps).start()
|
||||
|
||||
def _delete_maps(self):
|
||||
|
||||
@@ -25,7 +25,7 @@ from openpilot.selfdrive.ui.sunnypilot.layouts.settings.trips import TripsLayout
|
||||
from openpilot.selfdrive.ui.sunnypilot.layouts.settings.vehicle import VehicleLayout
|
||||
from openpilot.selfdrive.ui.sunnypilot.layouts.settings.visuals import VisualsLayout
|
||||
from openpilot.system.ui.lib.application import gui_app, MousePos
|
||||
from openpilot.system.ui.lib.multilang import tr_noop
|
||||
from openpilot.system.ui.lib.multilang import tr
|
||||
from openpilot.system.ui.lib.text_measure import measure_text_cached
|
||||
from openpilot.system.ui.lib.wifi_manager import WifiManager
|
||||
from openpilot.system.ui.sunnypilot.lib.styles import style
|
||||
@@ -109,22 +109,22 @@ class SettingsLayoutSP(OP.SettingsLayout):
|
||||
wifi_manager.set_active(False)
|
||||
|
||||
self._panels = {
|
||||
OP.PanelType.DEVICE: PanelInfo(tr_noop("Device"), DeviceLayoutSP(), icon="../../sunnypilot/selfdrive/assets/offroad/icon_home.png"),
|
||||
OP.PanelType.NETWORK: PanelInfo(tr_noop("Network"), NetworkUISP(wifi_manager), icon="icons/network.png"),
|
||||
OP.PanelType.SUNNYLINK: PanelInfo(tr_noop("sunnylink"), SunnylinkLayout(), icon="icons/wifi_strength_full.png"),
|
||||
OP.PanelType.TOGGLES: PanelInfo(tr_noop("Toggles"), TogglesLayout(), icon="../../sunnypilot/selfdrive/assets/offroad/icon_toggle.png"),
|
||||
OP.PanelType.SOFTWARE: PanelInfo(tr_noop("Software"), SoftwareLayoutSP(), icon="../../sunnypilot/selfdrive/assets/offroad/icon_software.png"),
|
||||
OP.PanelType.MODELS: PanelInfo(tr_noop("Models"), ModelsLayout(), icon="../../sunnypilot/selfdrive/assets/offroad/icon_models.png"),
|
||||
OP.PanelType.STEERING: PanelInfo(tr_noop("Steering"), SteeringLayout(), icon="../../sunnypilot/selfdrive/assets/offroad/icon_lateral.png"),
|
||||
OP.PanelType.CRUISE: PanelInfo(tr_noop("Cruise"), CruiseLayout(), icon="icons/speed_limit.png"),
|
||||
OP.PanelType.VISUALS: PanelInfo(tr_noop("Visuals"), VisualsLayout(), icon="../../sunnypilot/selfdrive/assets/offroad/icon_visuals.png"),
|
||||
OP.PanelType.DISPLAY: PanelInfo(tr_noop("Display"), DisplayLayout(), icon="../../sunnypilot/selfdrive/assets/offroad/icon_display.png"),
|
||||
OP.PanelType.OSM: PanelInfo(tr_noop("OSM"), OSMLayout(), icon="../../sunnypilot/selfdrive/assets/offroad/icon_map.png"),
|
||||
# OP.PanelType.NAVIGATION: PanelInfo(tr_noop("Navigation"), NavigationLayout(), icon="../../sunnypilot/selfdrive/assets/offroad/icon_map.png"),
|
||||
OP.PanelType.TRIPS: PanelInfo(tr_noop("Trips"), TripsLayout(), icon="../../sunnypilot/selfdrive/assets/offroad/icon_trips.png"),
|
||||
OP.PanelType.VEHICLE: PanelInfo(tr_noop("Vehicle"), VehicleLayout(), icon="../../sunnypilot/selfdrive/assets/offroad/icon_vehicle.png"),
|
||||
OP.PanelType.FIREHOSE: PanelInfo(tr_noop("Firehose"), FirehoseLayout(), icon="../../sunnypilot/selfdrive/assets/offroad/icon_firehose.png"),
|
||||
OP.PanelType.DEVELOPER: PanelInfo(tr_noop("Developer"), DeveloperLayoutSP(), icon="icons/shell.png"),
|
||||
OP.PanelType.DEVICE: PanelInfo(tr("Device"), DeviceLayoutSP(), icon="../../sunnypilot/selfdrive/assets/offroad/icon_home.png"),
|
||||
OP.PanelType.NETWORK: PanelInfo(tr("Network"), NetworkUISP(wifi_manager), icon="icons/network.png"),
|
||||
OP.PanelType.SUNNYLINK: PanelInfo(tr("sunnylink"), SunnylinkLayout(), icon="icons/wifi_strength_full.png"),
|
||||
OP.PanelType.TOGGLES: PanelInfo(tr("Toggles"), TogglesLayout(), icon="../../sunnypilot/selfdrive/assets/offroad/icon_toggle.png"),
|
||||
OP.PanelType.SOFTWARE: PanelInfo(tr("Software"), SoftwareLayoutSP(), icon="../../sunnypilot/selfdrive/assets/offroad/icon_software.png"),
|
||||
OP.PanelType.MODELS: PanelInfo(tr("Models"), ModelsLayout(), icon="../../sunnypilot/selfdrive/assets/offroad/icon_models.png"),
|
||||
OP.PanelType.STEERING: PanelInfo(tr("Steering"), SteeringLayout(), icon="../../sunnypilot/selfdrive/assets/offroad/icon_lateral.png"),
|
||||
OP.PanelType.CRUISE: PanelInfo(tr("Cruise"), CruiseLayout(), icon="icons/speed_limit.png"),
|
||||
OP.PanelType.VISUALS: PanelInfo(tr("Visuals"), VisualsLayout(), icon="../../sunnypilot/selfdrive/assets/offroad/icon_visuals.png"),
|
||||
OP.PanelType.DISPLAY: PanelInfo(tr("Display"), DisplayLayout(), icon="../../sunnypilot/selfdrive/assets/offroad/icon_display.png"),
|
||||
OP.PanelType.OSM: PanelInfo(tr("OSM"), OSMLayout(), icon="../../sunnypilot/selfdrive/assets/offroad/icon_map.png"),
|
||||
# OP.PanelType.NAVIGATION: PanelInfo(tr("Navigation"), NavigationLayout(), icon="../../sunnypilot/selfdrive/assets/offroad/icon_map.png"),
|
||||
OP.PanelType.TRIPS: PanelInfo(tr("Trips"), TripsLayout(), icon="../../sunnypilot/selfdrive/assets/offroad/icon_trips.png"),
|
||||
OP.PanelType.VEHICLE: PanelInfo(tr("Vehicle"), VehicleLayout(), icon="../../sunnypilot/selfdrive/assets/offroad/icon_vehicle.png"),
|
||||
OP.PanelType.FIREHOSE: PanelInfo(tr("Firehose"), FirehoseLayout(), icon="../../sunnypilot/selfdrive/assets/offroad/icon_firehose.png"),
|
||||
OP.PanelType.DEVELOPER: PanelInfo(tr("Developer"), DeveloperLayoutSP(), icon="icons/shell.png"),
|
||||
}
|
||||
|
||||
def _draw_sidebar(self, rect: rl.Rectangle):
|
||||
|
||||
@@ -28,7 +28,7 @@ class SunnylinkHeader(Widget):
|
||||
super().__init__()
|
||||
|
||||
self._title = UnifiedLabel(
|
||||
text="🚀 sunnylink 🚀",
|
||||
text=tr("🚀 sunnylink 🚀"),
|
||||
font_size=90,
|
||||
font_weight=FontWeight.AUDIOWIDE,
|
||||
text_color=rl.WHITE,
|
||||
|
||||
@@ -1978,6 +1978,7 @@ msgid "sponsor tier"
|
||||
msgstr "赞助等级"
|
||||
|
||||
#: auto_translated
|
||||
#: openpilot/selfdrive/ui/sunnypilot/mici/layouts/onboarding.py
|
||||
msgid "sunnylink"
|
||||
msgstr "SunnyLink"
|
||||
|
||||
@@ -2235,10 +2236,6 @@ msgstr "未找到 sunnylink Dongle ID。"
|
||||
msgid "Enable sunnylink uploader to allow sunnypilot to upload your driving data to sunnypilot servers."
|
||||
msgstr "启用 sunnylink 上传器,让 sunnypilot 将您的驾驶数据上传至 sunnypilot 服务器。"
|
||||
|
||||
#: openpilot/selfdrive/ui/sunnypilot/mici/layouts/onboarding.py
|
||||
msgid "sunnylink"
|
||||
msgstr "Sunnylink"
|
||||
|
||||
#: openpilot/selfdrive/ui/sunnypilot/mici/layouts/onboarding.py
|
||||
msgid "enable\nsunnylink"
|
||||
msgstr "启用\nSunnylink"
|
||||
@@ -2246,3 +2243,83 @@ msgstr "启用\nSunnylink"
|
||||
#: openpilot/selfdrive/ui/sunnypilot/mici/layouts/onboarding.py
|
||||
msgid "disable\nsunnylink"
|
||||
msgstr "禁用\nSunnylink"
|
||||
|
||||
#: auto_translated
|
||||
msgid "subscribed"
|
||||
msgstr "已订阅"
|
||||
|
||||
#: auto_translated
|
||||
msgid "upgrade to prime"
|
||||
msgstr "升级到 Prime"
|
||||
|
||||
#: auto_translated
|
||||
msgid "update sunnypilot"
|
||||
msgstr "更新 sunnypilot"
|
||||
|
||||
#: auto_translated
|
||||
msgid "wi-fi"
|
||||
msgstr "Wi-Fi"
|
||||
|
||||
#: auto_translated
|
||||
msgid "not connected"
|
||||
msgstr "未连接"
|
||||
|
||||
#: auto_translated
|
||||
msgid "Models"
|
||||
msgstr "模型"
|
||||
|
||||
#: auto_translated
|
||||
msgid "Steering"
|
||||
msgstr "转向"
|
||||
|
||||
#: auto_translated
|
||||
msgid "Cruise"
|
||||
msgstr "巡航"
|
||||
|
||||
#: auto_translated
|
||||
msgid "Visuals"
|
||||
msgstr "视觉"
|
||||
|
||||
#: auto_translated
|
||||
msgid "Display"
|
||||
msgstr "显示"
|
||||
|
||||
#: auto_translated
|
||||
msgid "OSM"
|
||||
msgstr "OSM"
|
||||
|
||||
#: auto_translated
|
||||
msgid "Trips"
|
||||
msgstr "行程"
|
||||
|
||||
#: auto_translated
|
||||
msgid "Navigation"
|
||||
msgstr "导航"
|
||||
|
||||
#: auto_translated
|
||||
msgid "starting"
|
||||
msgstr "启动中"
|
||||
|
||||
#: auto_translated
|
||||
msgid "connecting..."
|
||||
msgstr "连接中..."
|
||||
|
||||
#: auto_translated
|
||||
msgid "obtaining IP..."
|
||||
msgstr "获取 IP 中..."
|
||||
|
||||
#: auto_translated
|
||||
msgid "connect.comma.ai"
|
||||
msgstr "connect.comma.ai"
|
||||
|
||||
#: auto_translated
|
||||
msgid "🚀 sunnylink 🚀"
|
||||
msgstr "🚀 SunnyLink 🚀"
|
||||
|
||||
#: auto_translated
|
||||
msgid "DELETING..."
|
||||
msgstr "删除中..."
|
||||
|
||||
#: auto_translated
|
||||
msgid "Loading..."
|
||||
msgstr "加载中..."
|
||||
|
||||
Reference in New Issue
Block a user