Udated the button handling to refresh after a language change

This commit is contained in:
2026-09-19 14:44:46 +02:00
parent 1471a342d8
commit 75a82f1f01
+19 -7
View File
@@ -147,13 +147,25 @@ class DownloadManagerApp(App[None]):
self._format_selection_line("video", self.selected_video) self._format_selection_line("video", self.selected_video)
) )
self.query_one("#select-parts-btn", Button).label = t( select_parts_btn = self.query_one("#select-parts-btn", Button)
"button.select_parts", default="Select parts" select_parts_btn.label = t("button.select_parts", default="Select parts")
) select_parts_btn.refresh(layout=True)
self.query_one("#start-download-btn", Button).label = t(
"button.start_download", default="Start download" start_download_btn = self.query_one("#start-download-btn", Button)
) start_download_btn.label = t("button.start_download", default="Start download")
self.query_one("#exit-btn", Button).label = t("button.exit", default="Exit") start_download_btn.refresh(layout=True)
exit_btn = self.query_one("#exit-btn", Button)
exit_btn.label = t("button.exit", default="Exit")
exit_btn.refresh(layout=True)
# Buttons auto-size to their label, but changing `.label` alone
# doesn't retrigger that sizing — without this, a button keeps its
# old (English) width after switching to a language with longer or
# shorter text. Refreshing the row (and the screen) forces the
# whole layout to recompute around the new label widths.
self.query_one("#button-row").refresh(layout=True)
self.screen.refresh(layout=True)
# Only clobber the progress text with "Idle" while nothing is # Only clobber the progress text with "Idle" while nothing is
# running; an in-progress download keeps updating it anyway. # running; an in-progress download keeps updating it anyway.