GUI: Check translation file exists before loading it.

This allows more accurate error message for the user.
This commit is contained in:
Kimmo Varis 2009-07-03 14:18:35 +03:00
parent e2248c35f9
commit 8c2f5b42df
6 changed files with 114 additions and 166 deletions

View File

@ -18,7 +18,7 @@
<source>Cppcheck - A tool for static C/C++ code analysis.</source> <source>Cppcheck - A tool for static C/C++ code analysis.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message utf8="true">
<location filename="about.ui" line="65"/> <location filename="about.ui" line="65"/>
<source>Copyright (C) 2007-2009 Daniel Marjamäki and cppcheck team.</source> <source>Copyright (C) 2007-2009 Daniel Marjamäki and cppcheck team.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -117,9 +117,9 @@ kate -l(line) (file)</source>
<message> <message>
<location filename="main.ui" line="26"/> <location filename="main.ui" line="26"/>
<location filename="mainwindow.cpp" line="239"/> <location filename="mainwindow.cpp" line="239"/>
<location filename="mainwindow.cpp" line="446"/> <location filename="mainwindow.cpp" line="448"/>
<location filename="mainwindow.cpp" line="544"/> <location filename="mainwindow.cpp" line="546"/>
<location filename="mainwindow.cpp" line="562"/> <location filename="mainwindow.cpp" line="564"/>
<source>Cppcheck</source> <source>Cppcheck</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -299,44 +299,44 @@ kate -l(line) (file)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="442"/> <location filename="mainwindow.cpp" line="444"/>
<source>Cannot exit while checking. <source>Cannot exit while checking.
Stop the checking before exiting.</source> Stop the checking before exiting.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="488"/> <location filename="mainwindow.cpp" line="490"/>
<source>License</source> <source>License</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="495"/> <location filename="mainwindow.cpp" line="497"/>
<source>Authors</source> <source>Authors</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="503"/> <location filename="mainwindow.cpp" line="505"/>
<source>XML files (*.xml);;Text files (*.txt)</source> <source>XML files (*.xml);;Text files (*.txt)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="505"/> <location filename="mainwindow.cpp" line="507"/>
<source>Save the report file</source> <source>Save the report file</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="513"/> <location filename="mainwindow.cpp" line="515"/>
<source>XML files (*.xml)</source> <source>XML files (*.xml)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="546"/> <location filename="mainwindow.cpp" line="548"/>
<source>Cppcheck - %1</source> <source>Cppcheck - %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="563"/> <location filename="mainwindow.cpp" line="565"/>
<source>Failed to change language: <source>Failed to change language:
%1</source> %1</source>
@ -346,37 +346,17 @@ Stop the checking before exiting.</source>
<context> <context>
<name>QObject</name> <name>QObject</name>
<message> <message>
<location filename="translationhandler.cpp" line="12"/> <location filename="translationhandler.cpp" line="88"/>
<source>English</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="13"/>
<source>Finnish</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="14"/>
<source>Swedish</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="15"/>
<source>German</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="16"/>
<source>Russian</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="69"/>
<source>Incorrect language specified!</source> <source>Incorrect language specified!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="translationhandler.cpp" line="77"/> <location filename="translationhandler.cpp" line="95"/>
<source>Language file %1 not found!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="103"/>
<source>Failed to load language from file %1</source> <source>Failed to load language from file %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>

View File

@ -18,7 +18,7 @@
<source>Cppcheck - A tool for static C/C++ code analysis.</source> <source>Cppcheck - A tool for static C/C++ code analysis.</source>
<translation>Cppcheck - A tool for static C/C++ code analysis.</translation> <translation>Cppcheck - A tool for static C/C++ code analysis.</translation>
</message> </message>
<message> <message utf8="true">
<location filename="about.ui" line="65"/> <location filename="about.ui" line="65"/>
<source>Copyright (C) 2007-2009 Daniel Marjamäki and cppcheck team.</source> <source>Copyright (C) 2007-2009 Daniel Marjamäki and cppcheck team.</source>
<translation>Copyright (C) 2007-2009 Daniel Marjamäki and cppcheck team.</translation> <translation>Copyright (C) 2007-2009 Daniel Marjamäki and cppcheck team.</translation>
@ -130,9 +130,9 @@ kate -l(line) (file)</translation>
<message> <message>
<location filename="main.ui" line="26"/> <location filename="main.ui" line="26"/>
<location filename="mainwindow.cpp" line="239"/> <location filename="mainwindow.cpp" line="239"/>
<location filename="mainwindow.cpp" line="446"/> <location filename="mainwindow.cpp" line="448"/>
<location filename="mainwindow.cpp" line="544"/> <location filename="mainwindow.cpp" line="546"/>
<location filename="mainwindow.cpp" line="562"/> <location filename="mainwindow.cpp" line="564"/>
<source>Cppcheck</source> <source>Cppcheck</source>
<translation>Cppcheck</translation> <translation>Cppcheck</translation>
</message> </message>
@ -312,7 +312,7 @@ kate -l(line) (file)</translation>
<translation>No suitable files found to check!</translation> <translation>No suitable files found to check!</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="442"/> <location filename="mainwindow.cpp" line="444"/>
<source>Cannot exit while checking. <source>Cannot exit while checking.
Stop the checking before exiting.</source> Stop the checking before exiting.</source>
@ -321,37 +321,37 @@ Stop the checking before exiting.</source>
Stop the checking before exiting.</translation> Stop the checking before exiting.</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="488"/> <location filename="mainwindow.cpp" line="490"/>
<source>License</source> <source>License</source>
<translation>License</translation> <translation>License</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="495"/> <location filename="mainwindow.cpp" line="497"/>
<source>Authors</source> <source>Authors</source>
<translation>Authors</translation> <translation>Authors</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="503"/> <location filename="mainwindow.cpp" line="505"/>
<source>XML files (*.xml);;Text files (*.txt)</source> <source>XML files (*.xml);;Text files (*.txt)</source>
<translation>XML files (*.xml);;Text files (*.txt)</translation> <translation>XML files (*.xml);;Text files (*.txt)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="505"/> <location filename="mainwindow.cpp" line="507"/>
<source>Save the report file</source> <source>Save the report file</source>
<translation>Save the report file</translation> <translation>Save the report file</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="513"/> <location filename="mainwindow.cpp" line="515"/>
<source>XML files (*.xml)</source> <source>XML files (*.xml)</source>
<translation>XML files (*.xml)</translation> <translation>XML files (*.xml)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="546"/> <location filename="mainwindow.cpp" line="548"/>
<source>Cppcheck - %1</source> <source>Cppcheck - %1</source>
<translation>Cppcheck - %1</translation> <translation>Cppcheck - %1</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="563"/> <location filename="mainwindow.cpp" line="565"/>
<source>Failed to change language: <source>Failed to change language:
%1</source> %1</source>
@ -363,37 +363,37 @@ Stop the checking before exiting.</translation>
<context> <context>
<name>QObject</name> <name>QObject</name>
<message> <message>
<location filename="translationhandler.cpp" line="12"/>
<source>English</source> <source>English</source>
<translation>English</translation> <translation type="obsolete">English</translation>
</message> </message>
<message> <message>
<location filename="translationhandler.cpp" line="13"/>
<source>Finnish</source> <source>Finnish</source>
<translation>Finnish</translation> <translation type="obsolete">Finnish</translation>
</message> </message>
<message> <message>
<location filename="translationhandler.cpp" line="14"/>
<source>Swedish</source> <source>Swedish</source>
<translation>Swedish</translation> <translation type="obsolete">Swedish</translation>
</message> </message>
<message> <message>
<location filename="translationhandler.cpp" line="15"/>
<source>German</source> <source>German</source>
<translation>German</translation> <translation type="obsolete">German</translation>
</message> </message>
<message> <message>
<location filename="translationhandler.cpp" line="16"/>
<source>Russian</source> <source>Russian</source>
<translation>Russian</translation> <translation type="obsolete">Russian</translation>
</message> </message>
<message> <message>
<location filename="translationhandler.cpp" line="69"/> <location filename="translationhandler.cpp" line="88"/>
<source>Incorrect language specified!</source> <source>Incorrect language specified!</source>
<translation>Incorrect language specified!</translation> <translation>Incorrect language specified!</translation>
</message> </message>
<message> <message>
<location filename="translationhandler.cpp" line="77"/> <location filename="translationhandler.cpp" line="95"/>
<source>Language file %1 not found!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="103"/>
<source>Failed to load language from file %1</source> <source>Failed to load language from file %1</source>
<translation>Failed to load language from file %1</translation> <translation>Failed to load language from file %1</translation>
</message> </message>

View File

@ -18,7 +18,7 @@
<source>Cppcheck - A tool for static C/C++ code analysis.</source> <source>Cppcheck - A tool for static C/C++ code analysis.</source>
<translation>Cppcheck - Työkalu C/C++ koodin staattiseen analysointiin.</translation> <translation>Cppcheck - Työkalu C/C++ koodin staattiseen analysointiin.</translation>
</message> </message>
<message> <message utf8="true">
<location filename="about.ui" line="65"/> <location filename="about.ui" line="65"/>
<source>Copyright (C) 2007-2009 Daniel Marjamäki and cppcheck team.</source> <source>Copyright (C) 2007-2009 Daniel Marjamäki and cppcheck team.</source>
<translation>Copyright (C) 2007-2009 Daniel Marjamäki ja cppcheck tiimi.</translation> <translation>Copyright (C) 2007-2009 Daniel Marjamäki ja cppcheck tiimi.</translation>
@ -132,9 +132,9 @@ kate -l(line) (file)
<message> <message>
<location filename="main.ui" line="26"/> <location filename="main.ui" line="26"/>
<location filename="mainwindow.cpp" line="239"/> <location filename="mainwindow.cpp" line="239"/>
<location filename="mainwindow.cpp" line="446"/> <location filename="mainwindow.cpp" line="448"/>
<location filename="mainwindow.cpp" line="544"/> <location filename="mainwindow.cpp" line="546"/>
<location filename="mainwindow.cpp" line="562"/> <location filename="mainwindow.cpp" line="564"/>
<source>Cppcheck</source> <source>Cppcheck</source>
<translation>Cppcheck</translation> <translation>Cppcheck</translation>
</message> </message>
@ -314,7 +314,7 @@ kate -l(line) (file)
<translation>Tarkistettavaksi sopivia tiedostoja ei löytynyt!</translation> <translation>Tarkistettavaksi sopivia tiedostoja ei löytynyt!</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="442"/> <location filename="mainwindow.cpp" line="444"/>
<source>Cannot exit while checking. <source>Cannot exit while checking.
Stop the checking before exiting.</source> Stop the checking before exiting.</source>
@ -323,37 +323,37 @@ Stop the checking before exiting.</source>
Lopeta tarkistus ennen ohjelman sammuttamista.</translation> Lopeta tarkistus ennen ohjelman sammuttamista.</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="488"/> <location filename="mainwindow.cpp" line="490"/>
<source>License</source> <source>License</source>
<translation>Lisenssi</translation> <translation>Lisenssi</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="495"/> <location filename="mainwindow.cpp" line="497"/>
<source>Authors</source> <source>Authors</source>
<translation>Tekijät</translation> <translation>Tekijät</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="503"/> <location filename="mainwindow.cpp" line="505"/>
<source>XML files (*.xml);;Text files (*.txt)</source> <source>XML files (*.xml);;Text files (*.txt)</source>
<translation>XML-tiedostot (*.xml);;Tekstitiedostot (*.txt)</translation> <translation>XML-tiedostot (*.xml);;Tekstitiedostot (*.txt)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="505"/> <location filename="mainwindow.cpp" line="507"/>
<source>Save the report file</source> <source>Save the report file</source>
<translation>Tallenna raportti</translation> <translation>Tallenna raportti</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="513"/> <location filename="mainwindow.cpp" line="515"/>
<source>XML files (*.xml)</source> <source>XML files (*.xml)</source>
<translation>XML-tiedostot (*xml)</translation> <translation>XML-tiedostot (*xml)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="546"/> <location filename="mainwindow.cpp" line="548"/>
<source>Cppcheck - %1</source> <source>Cppcheck - %1</source>
<translation>Cppcheck - %1</translation> <translation>Cppcheck - %1</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="563"/> <location filename="mainwindow.cpp" line="565"/>
<source>Failed to change language: <source>Failed to change language:
%1</source> %1</source>
@ -363,37 +363,37 @@ Lopeta tarkistus ennen ohjelman sammuttamista.</translation>
<context> <context>
<name>QObject</name> <name>QObject</name>
<message> <message>
<location filename="translationhandler.cpp" line="12"/>
<source>English</source> <source>English</source>
<translation>Englanti</translation> <translation type="obsolete">Englanti</translation>
</message> </message>
<message> <message>
<location filename="translationhandler.cpp" line="13"/>
<source>Finnish</source> <source>Finnish</source>
<translation>Suomi</translation> <translation type="obsolete">Suomi</translation>
</message> </message>
<message> <message>
<location filename="translationhandler.cpp" line="14"/>
<source>Swedish</source> <source>Swedish</source>
<translation>Ruotsi</translation> <translation type="obsolete">Ruotsi</translation>
</message> </message>
<message> <message>
<location filename="translationhandler.cpp" line="15"/>
<source>German</source> <source>German</source>
<translation>Saksa</translation> <translation type="obsolete">Saksa</translation>
</message> </message>
<message> <message>
<location filename="translationhandler.cpp" line="16"/>
<source>Russian</source> <source>Russian</source>
<translation>Venäjä</translation> <translation type="obsolete">Venäjä</translation>
</message> </message>
<message> <message>
<location filename="translationhandler.cpp" line="69"/> <location filename="translationhandler.cpp" line="88"/>
<source>Incorrect language specified!</source> <source>Incorrect language specified!</source>
<translation>Virheellinen kieli valittu!</translation> <translation>Virheellinen kieli valittu!</translation>
</message> </message>
<message> <message>
<location filename="translationhandler.cpp" line="77"/> <location filename="translationhandler.cpp" line="95"/>
<source>Language file %1 not found!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="103"/>
<source>Failed to load language from file %1</source> <source>Failed to load language from file %1</source>
<translation>Kielen lataaminen tiedostosta %1 epäonnistui</translation> <translation>Kielen lataaminen tiedostosta %1 epäonnistui</translation>
</message> </message>

View File

@ -18,7 +18,7 @@
<source>Cppcheck - A tool for static C/C++ code analysis.</source> <source>Cppcheck - A tool for static C/C++ code analysis.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message utf8="true">
<location filename="about.ui" line="65"/> <location filename="about.ui" line="65"/>
<source>Copyright (C) 2007-2009 Daniel Marjamäki and cppcheck team.</source> <source>Copyright (C) 2007-2009 Daniel Marjamäki and cppcheck team.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -119,9 +119,9 @@ kate -l(line) (file)</source>
<message> <message>
<location filename="main.ui" line="26"/> <location filename="main.ui" line="26"/>
<location filename="mainwindow.cpp" line="239"/> <location filename="mainwindow.cpp" line="239"/>
<location filename="mainwindow.cpp" line="446"/> <location filename="mainwindow.cpp" line="448"/>
<location filename="mainwindow.cpp" line="544"/> <location filename="mainwindow.cpp" line="546"/>
<location filename="mainwindow.cpp" line="562"/> <location filename="mainwindow.cpp" line="564"/>
<source>Cppcheck</source> <source>Cppcheck</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -301,44 +301,44 @@ kate -l(line) (file)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="442"/> <location filename="mainwindow.cpp" line="444"/>
<source>Cannot exit while checking. <source>Cannot exit while checking.
Stop the checking before exiting.</source> Stop the checking before exiting.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="488"/> <location filename="mainwindow.cpp" line="490"/>
<source>License</source> <source>License</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="495"/> <location filename="mainwindow.cpp" line="497"/>
<source>Authors</source> <source>Authors</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="503"/> <location filename="mainwindow.cpp" line="505"/>
<source>XML files (*.xml);;Text files (*.txt)</source> <source>XML files (*.xml);;Text files (*.txt)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="505"/> <location filename="mainwindow.cpp" line="507"/>
<source>Save the report file</source> <source>Save the report file</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="513"/> <location filename="mainwindow.cpp" line="515"/>
<source>XML files (*.xml)</source> <source>XML files (*.xml)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="546"/> <location filename="mainwindow.cpp" line="548"/>
<source>Cppcheck - %1</source> <source>Cppcheck - %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="563"/> <location filename="mainwindow.cpp" line="565"/>
<source>Failed to change language: <source>Failed to change language:
%1</source> %1</source>
@ -348,37 +348,17 @@ Stop the checking before exiting.</source>
<context> <context>
<name>QObject</name> <name>QObject</name>
<message> <message>
<location filename="translationhandler.cpp" line="12"/> <location filename="translationhandler.cpp" line="88"/>
<source>English</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="13"/>
<source>Finnish</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="14"/>
<source>Swedish</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="15"/>
<source>German</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="16"/>
<source>Russian</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="69"/>
<source>Incorrect language specified!</source> <source>Incorrect language specified!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="translationhandler.cpp" line="77"/> <location filename="translationhandler.cpp" line="95"/>
<source>Language file %1 not found!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="103"/>
<source>Failed to load language from file %1</source> <source>Failed to load language from file %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>

View File

@ -18,7 +18,7 @@
<source>Cppcheck - A tool for static C/C++ code analysis.</source> <source>Cppcheck - A tool for static C/C++ code analysis.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message utf8="true">
<location filename="about.ui" line="65"/> <location filename="about.ui" line="65"/>
<source>Copyright (C) 2007-2009 Daniel Marjamäki and cppcheck team.</source> <source>Copyright (C) 2007-2009 Daniel Marjamäki and cppcheck team.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -119,9 +119,9 @@ kate -l(line) (file)</source>
<message> <message>
<location filename="main.ui" line="26"/> <location filename="main.ui" line="26"/>
<location filename="mainwindow.cpp" line="239"/> <location filename="mainwindow.cpp" line="239"/>
<location filename="mainwindow.cpp" line="446"/> <location filename="mainwindow.cpp" line="448"/>
<location filename="mainwindow.cpp" line="544"/> <location filename="mainwindow.cpp" line="546"/>
<location filename="mainwindow.cpp" line="562"/> <location filename="mainwindow.cpp" line="564"/>
<source>Cppcheck</source> <source>Cppcheck</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -301,44 +301,44 @@ kate -l(line) (file)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="442"/> <location filename="mainwindow.cpp" line="444"/>
<source>Cannot exit while checking. <source>Cannot exit while checking.
Stop the checking before exiting.</source> Stop the checking before exiting.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="488"/> <location filename="mainwindow.cpp" line="490"/>
<source>License</source> <source>License</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="495"/> <location filename="mainwindow.cpp" line="497"/>
<source>Authors</source> <source>Authors</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="503"/> <location filename="mainwindow.cpp" line="505"/>
<source>XML files (*.xml);;Text files (*.txt)</source> <source>XML files (*.xml);;Text files (*.txt)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="505"/> <location filename="mainwindow.cpp" line="507"/>
<source>Save the report file</source> <source>Save the report file</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="513"/> <location filename="mainwindow.cpp" line="515"/>
<source>XML files (*.xml)</source> <source>XML files (*.xml)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="546"/> <location filename="mainwindow.cpp" line="548"/>
<source>Cppcheck - %1</source> <source>Cppcheck - %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="563"/> <location filename="mainwindow.cpp" line="565"/>
<source>Failed to change language: <source>Failed to change language:
%1</source> %1</source>
@ -348,37 +348,17 @@ Stop the checking before exiting.</source>
<context> <context>
<name>QObject</name> <name>QObject</name>
<message> <message>
<location filename="translationhandler.cpp" line="12"/> <location filename="translationhandler.cpp" line="88"/>
<source>English</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="13"/>
<source>Finnish</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="14"/>
<source>Swedish</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="15"/>
<source>German</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="16"/>
<source>Russian</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="69"/>
<source>Incorrect language specified!</source> <source>Incorrect language specified!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="translationhandler.cpp" line="77"/> <location filename="translationhandler.cpp" line="95"/>
<source>Language file %1 not found!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="103"/>
<source>Failed to load language from file %1</source> <source>Failed to load language from file %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>

View File

@ -19,6 +19,7 @@
#include "translationhandler.h" #include "translationhandler.h"
#include <QApplication> #include <QApplication>
#include <QFile>
#include <QDebug> #include <QDebug>
TranslationHandler::TranslationHandler(QObject *parent) : TranslationHandler::TranslationHandler(QObject *parent) :
@ -47,7 +48,7 @@ TranslationHandler::TranslationHandler(QObject *parent) :
} }
else else
{ {
qDebug() << "Failed to load english translation!"; qDebug() << "Failed to load English translation!";
delete english; delete english;
} }
} }
@ -88,6 +89,13 @@ bool TranslationHandler::SetLanguage(const int index, QString &error)
return false; return false;
} }
// Check translation file exists before trying to load it
if (!QFile::exists(mFiles[index]))
{
error = QObject::tr("Language file %1 not found!");
error = error.arg(mFiles[index]);
return false;
}
//Load the new language //Load the new language
if (!mTranslator->load(mFiles[index])) if (!mTranslator->load(mFiles[index]))