From 1daba9e91365da2d32b3233ec5492e7533ab22a2 Mon Sep 17 00:00:00 2001 From: Vesa Pikki Date: Thu, 2 Jul 2009 13:48:32 +0300 Subject: [PATCH] Error types are now translated aswell. --- gui/cppcheck_de.ts | 69 ++++++++++++++++++++++++++++++--------------- gui/cppcheck_en.ts | 69 ++++++++++++++++++++++++++++++--------------- gui/cppcheck_fi.ts | 69 ++++++++++++++++++++++++++++++--------------- gui/cppcheck_ru.ts | 69 ++++++++++++++++++++++++++++++--------------- gui/cppcheck_se.ts | 69 ++++++++++++++++++++++++++++++--------------- gui/mainwindow.cpp | 15 ++++++++-- gui/resultstree.cpp | 18 ++++++------ 7 files changed, 258 insertions(+), 120 deletions(-) diff --git a/gui/cppcheck_de.ts b/gui/cppcheck_de.ts index fc90bf83d..542c4b16a 100644 --- a/gui/cppcheck_de.ts +++ b/gui/cppcheck_de.ts @@ -120,10 +120,10 @@ kate -l(line) (file) MainWindow - - - - + + + + Cppcheck @@ -288,49 +288,49 @@ kate -l(line) (file) - + Select files to check - + Select directory to check - + No suitable files found to check! - + Cannot exit while checking. Stop the checking before exiting. - + XML files (*.xml);;Text files (*.txt) - + Save the report file - + XML files (*.xml) - + Cppcheck - %1 - + Failed to change language: %1 @@ -379,55 +379,80 @@ Stop the checking before exiting. ResultsTree - + File - + Severity - + Line - + Message - + + Undefined file + + + + Copy filename - + Copy full path - + Cppcheck - + You can open this error by specifying applications in program's settings. - + Could not start %1 Please check the application path and parameters are correct. + + + all + + + + + style + + + + + security + + + + + error + + ResultsView diff --git a/gui/cppcheck_en.ts b/gui/cppcheck_en.ts index 147b881e7..997c23900 100644 --- a/gui/cppcheck_en.ts +++ b/gui/cppcheck_en.ts @@ -132,10 +132,10 @@ kate -l(line) (file) MainWindow - - - - + + + + Cppcheck Cppcheck @@ -300,22 +300,22 @@ kate -l(line) (file) &Help - + Select files to check Select files to check - + Select directory to check Select directory to check - + No suitable files found to check! No suitable files found to check! - + Cannot exit while checking. Stop the checking before exiting. @@ -324,27 +324,27 @@ Stop the checking before exiting. Stop the checking before exiting. - + XML files (*.xml);;Text files (*.txt) XML files (*.xml);;Text files (*.txt) - + Save the report file Save the report file - + XML files (*.xml) XML files (*.xml) - + Cppcheck - %1 Cppcheck - %1 - + Failed to change language: %1 @@ -395,50 +395,55 @@ Stop the checking before exiting. ResultsTree - + File File - + Severity Severity - + Line Line - + Message Message - + + Undefined file + Undefined file + + + Copy filename Copy filename - + Copy full path Copy full path - + Cppcheck Cppcheck - + You can open this error by specifying applications in program's settings. You can open this error by specifying applications in program's settings. - + Could not start %1 Please check the application path and parameters are correct. @@ -446,6 +451,26 @@ Please check the application path and parameters are correct. Please check the application path and parameters are correct. + + + all + All + + + + style + Style + + + + security + Security + + + + error + Error + ResultsView diff --git a/gui/cppcheck_fi.ts b/gui/cppcheck_fi.ts index d356c0b22..20fd73f49 100644 --- a/gui/cppcheck_fi.ts +++ b/gui/cppcheck_fi.ts @@ -134,10 +134,10 @@ kate -l(line) (file) MainWindow - - - - + + + + Cppcheck Cppcheck @@ -302,22 +302,22 @@ kate -l(line) (file) &Ohje - + Select files to check Valitse tarkistettavat tiedostot - + Select directory to check Valitse tarkistettava hakemisto - + No suitable files found to check! Tarkistettavaksi sopivia tiedostoja ei löytynyt! - + Cannot exit while checking. Stop the checking before exiting. @@ -326,27 +326,27 @@ Stop the checking before exiting. Lopeta tarkistus ennen ohjelman sammuttamista. - + XML files (*.xml);;Text files (*.txt) XML-tiedostot (*.xml);;Tekstitiedostot (*.txt) - + Save the report file Tallenna raportti - + XML files (*.xml) XML-tiedostot (*xml) - + Cppcheck - %1 Cppcheck - %1 - + Failed to change language: %1 @@ -395,50 +395,55 @@ Lopeta tarkistus ennen ohjelman sammuttamista. ResultsTree - + File Tiedosto - + Severity Tyyppi - + Line Rivi - + Message Virhe - + + Undefined file + Määrittelemätön tiedosto + + + Copy filename Kopioi tiedostonimi - + Copy full path Kopioi tiedoston koko polku - + Cppcheck Cppcheck - + You can open this error by specifying applications in program's settings. Voit asetuksista määritellä muita ohjelmia joilla avata tämän virheen sisältävän tiedoston. - + Could not start %1 Please check the application path and parameters are correct. @@ -446,6 +451,26 @@ Please check the application path and parameters are correct. Tarkista että ohjelman polku ja parametrit ovat oikeat. + + + all + Epävarmat + + + + style + Tyyli + + + + security + Tietoturva + + + + error + Yleinen + ResultsView diff --git a/gui/cppcheck_ru.ts b/gui/cppcheck_ru.ts index 36eecc994..9221dc167 100644 --- a/gui/cppcheck_ru.ts +++ b/gui/cppcheck_ru.ts @@ -122,10 +122,10 @@ kate -l(line) (file) MainWindow - - - - + + + + Cppcheck @@ -290,49 +290,49 @@ kate -l(line) (file) - + Select files to check - + Select directory to check - + No suitable files found to check! - + Cannot exit while checking. Stop the checking before exiting. - + XML files (*.xml);;Text files (*.txt) - + Save the report file - + XML files (*.xml) - + Cppcheck - %1 - + Failed to change language: %1 @@ -381,55 +381,80 @@ Stop the checking before exiting. ResultsTree - + File - + Severity - + Line - + Message - + + Undefined file + + + + Copy filename - + Copy full path - + Cppcheck - + You can open this error by specifying applications in program's settings. - + Could not start %1 Please check the application path and parameters are correct. + + + all + + + + + style + + + + + security + + + + + error + + ResultsView diff --git a/gui/cppcheck_se.ts b/gui/cppcheck_se.ts index 36eecc994..9221dc167 100644 --- a/gui/cppcheck_se.ts +++ b/gui/cppcheck_se.ts @@ -122,10 +122,10 @@ kate -l(line) (file) MainWindow - - - - + + + + Cppcheck @@ -290,49 +290,49 @@ kate -l(line) (file) - + Select files to check - + Select directory to check - + No suitable files found to check! - + Cannot exit while checking. Stop the checking before exiting. - + XML files (*.xml);;Text files (*.txt) - + Save the report file - + XML files (*.xml) - + Cppcheck - %1 - + Failed to change language: %1 @@ -381,55 +381,80 @@ Stop the checking before exiting. ResultsTree - + File - + Severity - + Line - + Message - + + Undefined file + + + + Copy filename - + Copy full path - + Cppcheck - + You can open this error by specifying applications in program's settings. - + Could not start %1 Please check the application path and parameters are correct. + + + all + + + + + style + + + + + security + + + + + error + + ResultsView diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 2c334bc01..6ee3a1fbf 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -78,7 +78,7 @@ MainWindow::MainWindow() : - + CreateLanguageMenuItems(); LoadSettings(); mThread->Initialize(mUI.mResults); @@ -90,7 +90,7 @@ MainWindow::MainWindow() : mUI.mActionSave->setEnabled(false); - CreateLanguageMenuItems(); + } @@ -572,8 +572,19 @@ void MainWindow::SetLanguage(int index) } else { + //Translate everything that is visible here mUI.retranslateUi(this); mUI.mResults->Translate(); + QStringList languages = mTranslation->GetNames(); + QList actions = mLanguages->actions(); + + if (languages.size() <= actions.size()) + { + for (int i=0;isetText(tr(languages[i].toLatin1())); + } + } } } diff --git a/gui/resultstree.cpp b/gui/resultstree.cpp index d4e4d48a8..9d3cfabbc 100644 --- a/gui/resultstree.cpp +++ b/gui/resultstree.cpp @@ -82,7 +82,7 @@ void ResultsTree::AddErrorItem(const QString &file, if (realfile.isEmpty()) { - realfile = "Undefined file"; + realfile = tr("Undefined file"); } bool hide = !mShowTypes[SeverityToShowType(severity)]; @@ -149,9 +149,11 @@ QStandardItem *ResultsTree::AddBacktraceFiles(QStandardItem *parent, QList list; list << CreateItem(file); - list << CreateItem(severity); + list << CreateItem(tr(severity.toLatin1())); list << CreateItem(QString("%1").arg(line)); - list << CreateItem(message); + //TODO message has parameter names so we'll need changes to the core + //cppcheck so we can get proper translations + list << CreateItem(tr(message.toLatin1())); QModelIndex index = QModelIndex(); @@ -607,19 +609,19 @@ QString ResultsTree::ShowTypeToString(ShowTypes type) switch (type) { case SHOW_ALL: - return "all"; + return tr("all"); break; case SHOW_STYLE: - return "style"; + return tr("style"); break; case SHOW_SECURITY: - return "security"; + return tr("security"); break; case SHOW_ERRORS: - return "error"; + return tr("error"); break; case SHOW_NONE: @@ -751,6 +753,6 @@ void ResultsTree::Translate() QStringList labels; labels << tr("File") << tr("Severity") << tr("Line") << tr("Message"); mModel.setHorizontalHeaderLabels(labels); - + //TODO go through all the errors in the tree and translate severity and message }