Fix scratchpad translation on language change. (#3078)

This commit is contained in:
Mathias Schmid 2021-01-23 17:56:16 +01:00 committed by GitHub
parent a4953575f1
commit fa30464a96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 3 deletions

View File

@ -22,7 +22,7 @@
<location filename="about.ui" line="81"/> <location filename="about.ui" line="81"/>
<source>Copyright © 2007-%1 Cppcheck team.</source> <source>Copyright © 2007-%1 Cppcheck team.</source>
<oldsource>Copyright © 2007-2019 Cppcheck team.</oldsource> <oldsource>Copyright © 2007-2019 Cppcheck team.</oldsource>
<translation type="unfinished">Copyright © 2007-2019 Cppcheck-Team.</translation> <translation>Copyright © 2007-%1 Cppcheck-Team.</translation>
</message> </message>
<message> <message>
<location filename="about.ui" line="91"/> <location filename="about.ui" line="91"/>
@ -2310,7 +2310,7 @@ Legen Sie unter dem Menü Ansicht fest, welche Arten von Fehlern angezeigt werde
<message> <message>
<location filename="resultsview.ui" line="196"/> <location filename="resultsview.ui" line="196"/>
<source>Variables</source> <source>Variables</source>
<translation type="unfinished"></translation> <translation>Variablen</translation>
</message> </message>
<message> <message>
<location filename="resultsview.ui" line="217"/> <location filename="resultsview.ui" line="217"/>
@ -2345,7 +2345,7 @@ Legen Sie unter dem Menü Ansicht fest, welche Arten von Fehlern angezeigt werde
<message> <message>
<location filename="scratchpad.ui" line="37"/> <location filename="scratchpad.ui" line="37"/>
<source>Optionally enter a filename (mainly for automatic language detection) and click on &quot;Check&quot;:</source> <source>Optionally enter a filename (mainly for automatic language detection) and click on &quot;Check&quot;:</source>
<translation>Optional einen Dateinamen (hauptsächlich für automatische Spracherkennung) eingeben und auf &quot;Check&quot; klicken:</translation> <translation>Optional einen Dateinamen (hauptsächlich für automatische Spracherkennung) eingeben und auf &quot;Prüfe&quot; klicken:</translation>
</message> </message>
<message> <message>
<location filename="scratchpad.ui" line="71"/> <location filename="scratchpad.ui" line="71"/>

View File

@ -1462,6 +1462,8 @@ void MainWindow::setLanguage(const QString &code)
mLineEditFilter->setPlaceholderText(QCoreApplication::translate("MainWindow", "Quick Filter:")); mLineEditFilter->setPlaceholderText(QCoreApplication::translate("MainWindow", "Quick Filter:"));
if (mProjectFile) if (mProjectFile)
formatAndSetTitle(tr("Project:") + ' ' + mProjectFile->getFilename()); formatAndSetTitle(tr("Project:") + ' ' + mProjectFile->getFilename());
if (mScratchPad)
mScratchPad->translate();
} }
} }

View File

@ -29,6 +29,11 @@ ScratchPad::ScratchPad(MainWindow& mainWindow)
connect(mUI.mCheckButton, &QPushButton::clicked, this, &ScratchPad::checkButtonClicked); connect(mUI.mCheckButton, &QPushButton::clicked, this, &ScratchPad::checkButtonClicked);
} }
void ScratchPad::translate()
{
mUI.retranslateUi(this);
}
void ScratchPad::checkButtonClicked() void ScratchPad::checkButtonClicked()
{ {
QString filename = mUI.lineEdit->text(); QString filename = mUI.lineEdit->text();

View File

@ -35,6 +35,11 @@ class ScratchPad : public QDialog {
public: public:
explicit ScratchPad(MainWindow& mainWindow); explicit ScratchPad(MainWindow& mainWindow);
/**
* @brief Translate dialog
*/
void translate();
private slots: private slots:
/** /**
* @brief Called when check button is clicked. * @brief Called when check button is clicked.