diff --git a/assets/language/en.qm b/assets/language/en.qm index 5b122ff..6ea56dc 100644 Binary files a/assets/language/en.qm and b/assets/language/en.qm differ diff --git a/assets/language/en.ts b/assets/language/en.ts index 95c42ba..9dcdeb1 100644 --- a/assets/language/en.ts +++ b/assets/language/en.ts @@ -1,6 +1,19 @@ + + LanguageSelection + + + SELECT YOUR LANGUAGE + Select your language + + + + START + Start + + SurveyEngine @@ -27,12 +40,4 @@ Next - - SurveyWindow - - - SURVEY - Survey - - diff --git a/assets/language/es.qm b/assets/language/es.qm index 9d5259e..99e7510 100644 Binary files a/assets/language/es.qm and b/assets/language/es.qm differ diff --git a/assets/language/es.ts b/assets/language/es.ts index b30617d..22c16fc 100644 --- a/assets/language/es.ts +++ b/assets/language/es.ts @@ -1,6 +1,19 @@ + + LanguageSelection + + + SELECT YOUR LANGUAGE + Seleccione su idioma + + + + START + Comenzar + + SurveyEngine @@ -27,12 +40,4 @@ Siguiente - - SurveyWindow - - - SURVEY - Encuesta - - diff --git a/assets/language/fr.qm b/assets/language/fr.qm index 19f8f2c..0d86afb 100644 Binary files a/assets/language/fr.qm and b/assets/language/fr.qm differ diff --git a/assets/language/fr.ts b/assets/language/fr.ts index c0b0980..55d7abb 100644 --- a/assets/language/fr.ts +++ b/assets/language/fr.ts @@ -1,12 +1,25 @@ + + LanguageSelection + + + SELECT YOUR LANGUAGE + Sélectionner votre langue + + + + START + Démarrer + + SurveyEngine WARNING - Avertissement + Attention @@ -27,12 +40,4 @@ Suivant - - SurveyWindow - - - SURVEY - Sondage - - diff --git a/source/save.py b/source/save.py index c6f5053..62ae555 100644 --- a/source/save.py +++ b/source/save.py @@ -5,6 +5,7 @@ from typing import Optional import nextcord import requests from PyQt6.QtCore import pyqtSignal +from PyQt6.QtWidgets import QApplication result_path = Path("./results/") @@ -59,6 +60,7 @@ def upload_discord( except Exception as exc: if signal_warning is not None: - signal_warning.emit("COULD NOT UPLOAD THE DATA") # NOQA: emit exist + application = QApplication.instance() + signal_warning.emit(application.tr("COULD NOT UPLOAD THE DATA")) # NOQA: emit exist else: raise exc diff --git a/source/ui/LanguageSelection.py b/source/ui/LanguageSelection.py index 1f07071..7f01e06 100644 --- a/source/ui/LanguageSelection.py +++ b/source/ui/LanguageSelection.py @@ -19,7 +19,6 @@ class LanguageSelection(QWidget): # title self.title = QLabel() self._layout.addWidget(self.title) - self.title.setText("Select your language.") self.title.setAlignment(Qt.AlignmentFlag.AlignCenter) # language selection @@ -40,13 +39,17 @@ class LanguageSelection(QWidget): if language == language_default: self.select_language.setCurrentIndex(i) + self.select_language.currentIndexChanged.connect(self.refresh_language) # NOQA: connect exist + # start button self.button_start = QPushButton() self._layout.addWidget(self.button_start) - self.button_start.setText("Start") self.button_start.clicked.connect(self.start) # NOQA: connect exist - def start(self) -> None: + # refresh the texts + self.refresh_language() + + def refresh_language(self): language_code = self.select_language.currentData() # load the correct translator @@ -60,6 +63,14 @@ class LanguageSelection(QWidget): application = QApplication.instance() application.installTranslator(translator) + # refresh the texts + self.retranslate() + + def retranslate(self): + self.title.setText(self.tr("SELECT YOUR LANGUAGE")) + self.button_start.setText(self.tr("START")) + + def start(self) -> None: # call the after event self.after() diff --git a/source/ui/SurveyEngine.py b/source/ui/SurveyEngine.py index 9426ee8..5612245 100644 --- a/source/ui/SurveyEngine.py +++ b/source/ui/SurveyEngine.py @@ -175,5 +175,5 @@ class SurveyEngine(QWidget): QMessageBox.warning( self, self.tr("WARNING"), - self.tr(message), + message, ) diff --git a/source/ui/SurveyWindow.py b/source/ui/SurveyWindow.py index 253e0d0..97bc379 100644 --- a/source/ui/SurveyWindow.py +++ b/source/ui/SurveyWindow.py @@ -3,7 +3,7 @@ from pathlib import Path from PyQt6.QtGui import QIcon from PyQt6.QtWidgets import QMainWindow -from source import ui, assets_path, __icon_png__ +from source import ui, assets_path, __icon_png__, __appname__ icon_path = assets_path / "icon.png" @@ -14,7 +14,7 @@ class SurveyWindow(QMainWindow): # window style self.setWindowIcon(QIcon(__icon_png__)) - self.setWindowTitle(self.tr("SURVEY")) + self.setWindowTitle(__appname__) # start by asking the user his language language_selection = ui.LanguageSelection(