From f1847e736d9219212d1c496f2f5406a6e9703e22 Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Fri, 3 Jul 2009 17:20:54 +0300 Subject: [PATCH] GUI: Further improve error message for lang file not found. Not being able to switch language is critical error, not just warning. Also show full file name (with extension) of the file not found. --- gui/cppcheck_de.ts | 15 ++++++++++----- gui/cppcheck_en.ts | 17 +++++++++++------ gui/cppcheck_fi.ts | 17 +++++++++++------ gui/cppcheck_ru.ts | 15 ++++++++++----- gui/cppcheck_se.ts | 15 ++++++++++----- gui/mainwindow.cpp | 6 +++--- gui/translationhandler.cpp | 3 ++- 7 files changed, 57 insertions(+), 31 deletions(-) diff --git a/gui/cppcheck_de.ts b/gui/cppcheck_de.ts index fcda7ac7c..d519fcde9 100644 --- a/gui/cppcheck_de.ts +++ b/gui/cppcheck_de.ts @@ -337,9 +337,14 @@ Stop the checking before exiting. - Failed to change language: + Failed to change the language: -%1 +%1 + + + Failed to change language: + +%1 @@ -351,12 +356,12 @@ Stop the checking before exiting. - - Language file %1 not found! + + Language file %1.qm not found! - + Failed to load language from file %1 diff --git a/gui/cppcheck_en.ts b/gui/cppcheck_en.ts index 7586e2a2b..a975b1deb 100644 --- a/gui/cppcheck_en.ts +++ b/gui/cppcheck_en.ts @@ -352,10 +352,15 @@ Stop the checking before exiting. - Failed to change language: + Failed to change the language: -%1 - Failed to change language: +%1 + + + Failed to change language: + +%1 + Failed to change language: %1 @@ -388,12 +393,12 @@ Stop the checking before exiting. Incorrect language specified! - - Language file %1 not found! + + Language file %1.qm not found! - + Failed to load language from file %1 Failed to load language from file %1 diff --git a/gui/cppcheck_fi.ts b/gui/cppcheck_fi.ts index a11765b33..a6d0beeb2 100644 --- a/gui/cppcheck_fi.ts +++ b/gui/cppcheck_fi.ts @@ -354,10 +354,15 @@ Lopeta tarkistus ennen ohjelman sammuttamista. - Failed to change language: + Failed to change the language: -%1 - Kielen %1 vaihto epäonnistui +%1 + + + Failed to change language: + +%1 + Kielen %1 vaihto epäonnistui @@ -388,12 +393,12 @@ Lopeta tarkistus ennen ohjelman sammuttamista. Virheellinen kieli valittu! - - Language file %1 not found! + + Language file %1.qm not found! - + Failed to load language from file %1 Kielen lataaminen tiedostosta %1 epäonnistui diff --git a/gui/cppcheck_ru.ts b/gui/cppcheck_ru.ts index f27e0139e..005359610 100644 --- a/gui/cppcheck_ru.ts +++ b/gui/cppcheck_ru.ts @@ -339,9 +339,14 @@ Stop the checking before exiting. - Failed to change language: + Failed to change the language: -%1 +%1 + + + Failed to change language: + +%1 @@ -353,12 +358,12 @@ Stop the checking before exiting. - - Language file %1 not found! + + Language file %1.qm not found! - + Failed to load language from file %1 diff --git a/gui/cppcheck_se.ts b/gui/cppcheck_se.ts index f27e0139e..005359610 100644 --- a/gui/cppcheck_se.ts +++ b/gui/cppcheck_se.ts @@ -339,9 +339,14 @@ Stop the checking before exiting. - Failed to change language: + Failed to change the language: -%1 +%1 + + + Failed to change language: + +%1 @@ -353,12 +358,12 @@ Stop the checking before exiting. - - Language file %1 not found! + + Language file %1.qm not found! - + Failed to load language from file %1 diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index f0ba638e0..b201dfa28 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -560,9 +560,9 @@ void MainWindow::SetLanguage(int index) QString error; if (!mTranslation->SetLanguage(index, error)) { - QMessageBox msg(QMessageBox::Warning, + QMessageBox msg(QMessageBox::Critical, tr("Cppcheck"), - QString(tr("Failed to change language:\n\n%1")).arg(error), + QString(tr("Failed to change the language:\n\n%1\n\n")).arg(error), QMessageBox::Ok, this); @@ -578,7 +578,7 @@ void MainWindow::SetLanguage(int index) if (languages.size() <= actions.size()) { - for (int i = 0;i < languages.size();i++) + for (int i = 0; i < languages.size(); i++) { actions[i]->setText(tr(languages[i].toLatin1())); } diff --git a/gui/translationhandler.cpp b/gui/translationhandler.cpp index 57da03158..e10a4b6f8 100644 --- a/gui/translationhandler.cpp +++ b/gui/translationhandler.cpp @@ -92,7 +92,8 @@ bool TranslationHandler::SetLanguage(const int index, QString &error) // Check translation file exists before trying to load it if (!QFile::exists(mFiles[index])) { - error = QObject::tr("Language file %1 not found!"); + QString filename(mFiles[index]); + error = QObject::tr("Language file %1.qm not found!"); error = error.arg(mFiles[index]); return false; }