feat: add language change handling and prompts for restart in settings
Some checks are pending
Tests & Quality Checks / Test on Python 3.11 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.11-1 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12-1 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.10 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.11-2 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12-2 (push) Waiting to run
Tests & Quality Checks / Build Artifacts (push) Blocked by required conditions
Tests & Quality Checks / Build Artifacts-1 (push) Blocked by required conditions

This commit is contained in:
claudi 2026-03-10 14:38:17 +01:00
parent 7daec731ca
commit a48cc01254
5 changed files with 43 additions and 0 deletions

View file

@ -1662,6 +1662,7 @@ class MainWindow(QMainWindow):
# Store current URL before opening dialog
old_webapp_url = self.config.webapp_url
old_language = self.config.language
# Show dialog
dialog = SettingsDialog(self.config, self)
@ -1669,6 +1670,7 @@ class MainWindow(QMainWindow):
# Check if webapp URL changed
new_webapp_url = self.config.webapp_url
language_changed = old_language != self.config.language
if old_webapp_url != new_webapp_url:
logger.info(f"Web application URL changed: {old_webapp_url}{new_webapp_url}")
@ -1685,6 +1687,10 @@ class MainWindow(QMainWindow):
self.web_view.clear_cache_and_cookies()
QTimer.singleShot(100, self._navigate_home)
if language_changed:
logger.info(f"Language changed: {old_language}{self.config.language}")
self._handle_language_change_restart()
def _check_domain_changed(self, old_url: str, new_url: str) -> bool:
"""Check if the domain/host has changed between two URLs.
@ -1745,6 +1751,27 @@ class MainWindow(QMainWindow):
self.web_view.clear_cache_and_cookies()
self._navigate_home()
def _handle_language_change_restart(self) -> None:
"""Handle language change by prompting for an optional restart."""
from PySide6.QtWidgets import QMessageBox
msg = QMessageBox(self)
msg.setWindowTitle(tr("dialog.language_changed.title"))
msg.setIcon(QMessageBox.Icon.Information)
msg.setText(tr("dialog.language_changed.msg"))
restart_now_btn = msg.addButton(
tr("dialog.language_changed.restart_now"), QMessageBox.ButtonRole.AcceptRole
)
msg.addButton(
tr("dialog.language_changed.restart_later"), QMessageBox.ButtonRole.RejectRole
)
msg.exec()
if msg.clickedButton() == restart_now_btn:
self._restart_application()
def _restart_application(self) -> None:
"""Restart the application automatically.

View file

@ -129,6 +129,7 @@ class SettingsDialog(QDialog):
lang_layout.addWidget(QLabel(tr("settings.general.language_label")))
self.language_combo = QComboBox()
self.language_combo.addItem(tr("settings.general.language_auto"), "auto")
available = get_available_languages()
current_lang = self.config.language
for code, name in available.items():