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.
This commit is contained in:
Kimmo Varis 2009-07-03 17:20:54 +03:00
parent 8c2f5b42df
commit f1847e736d
7 changed files with 57 additions and 31 deletions

View File

@ -337,9 +337,14 @@ Stop the checking before exiting.</source>
</message>
<message>
<location filename="mainwindow.cpp" line="565"/>
<source>Failed to change language:
<source>Failed to change the language:
%1</source>
%1
</source>
<oldsource>Failed to change language:
%1</oldsource>
<translation type="unfinished"></translation>
</message>
</context>
@ -351,12 +356,12 @@ Stop the checking before exiting.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="95"/>
<source>Language file %1 not found!</source>
<location filename="translationhandler.cpp" line="96"/>
<source>Language file %1.qm not found!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="103"/>
<location filename="translationhandler.cpp" line="104"/>
<source>Failed to load language from file %1</source>
<translation type="unfinished"></translation>
</message>

View File

@ -352,10 +352,15 @@ Stop the checking before exiting.</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="565"/>
<source>Failed to change language:
<source>Failed to change the language:
%1</source>
<translation>Failed to change language:
%1
</source>
<oldsource>Failed to change language:
%1</oldsource>
<translation type="unfinished">Failed to change language:
%1</translation>
</message>
@ -388,12 +393,12 @@ Stop the checking before exiting.</translation>
<translation>Incorrect language specified!</translation>
</message>
<message>
<location filename="translationhandler.cpp" line="95"/>
<source>Language file %1 not found!</source>
<location filename="translationhandler.cpp" line="96"/>
<source>Language file %1.qm not found!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="103"/>
<location filename="translationhandler.cpp" line="104"/>
<source>Failed to load language from file %1</source>
<translation>Failed to load language from file %1</translation>
</message>

View File

@ -354,10 +354,15 @@ Lopeta tarkistus ennen ohjelman sammuttamista.</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="565"/>
<source>Failed to change language:
<source>Failed to change the language:
%1</source>
<translation>Kielen %1 vaihto epäonnistui</translation>
%1
</source>
<oldsource>Failed to change language:
%1</oldsource>
<translation type="unfinished">Kielen %1 vaihto epäonnistui</translation>
</message>
</context>
<context>
@ -388,12 +393,12 @@ Lopeta tarkistus ennen ohjelman sammuttamista.</translation>
<translation>Virheellinen kieli valittu!</translation>
</message>
<message>
<location filename="translationhandler.cpp" line="95"/>
<source>Language file %1 not found!</source>
<location filename="translationhandler.cpp" line="96"/>
<source>Language file %1.qm not found!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="103"/>
<location filename="translationhandler.cpp" line="104"/>
<source>Failed to load language from file %1</source>
<translation>Kielen lataaminen tiedostosta %1 epäonnistui</translation>
</message>

View File

@ -339,9 +339,14 @@ Stop the checking before exiting.</source>
</message>
<message>
<location filename="mainwindow.cpp" line="565"/>
<source>Failed to change language:
<source>Failed to change the language:
%1</source>
%1
</source>
<oldsource>Failed to change language:
%1</oldsource>
<translation type="unfinished"></translation>
</message>
</context>
@ -353,12 +358,12 @@ Stop the checking before exiting.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="95"/>
<source>Language file %1 not found!</source>
<location filename="translationhandler.cpp" line="96"/>
<source>Language file %1.qm not found!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="103"/>
<location filename="translationhandler.cpp" line="104"/>
<source>Failed to load language from file %1</source>
<translation type="unfinished"></translation>
</message>

View File

@ -339,9 +339,14 @@ Stop the checking before exiting.</source>
</message>
<message>
<location filename="mainwindow.cpp" line="565"/>
<source>Failed to change language:
<source>Failed to change the language:
%1</source>
%1
</source>
<oldsource>Failed to change language:
%1</oldsource>
<translation type="unfinished"></translation>
</message>
</context>
@ -353,12 +358,12 @@ Stop the checking before exiting.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="95"/>
<source>Language file %1 not found!</source>
<location filename="translationhandler.cpp" line="96"/>
<source>Language file %1.qm not found!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="103"/>
<location filename="translationhandler.cpp" line="104"/>
<source>Failed to load language from file %1</source>
<translation type="unfinished"></translation>
</message>

View File

@ -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()));
}

View File

@ -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;
}