I reverted back the translation file checking.

Allthough I put it after QTranslator had failed to load the translation.
This still allows QTranslator to try and open the file with several
variations of the file. To user we'll tell that the default file is missing.
This commit is contained in:
Vesa Pikki 2009-07-04 12:06:31 +03:00
parent f603dfde82
commit a7c1d99d01
6 changed files with 259 additions and 150 deletions

View File

@ -18,7 +18,7 @@
<source>Cppcheck - A tool for static C/C++ code analysis.</source>
<translation type="unfinished"></translation>
</message>
<message utf8="true">
<message>
<location filename="about.ui" line="65"/>
<source>Copyright (C) 2007-2009 Daniel Marjamäki and cppcheck team.</source>
<translation type="unfinished"></translation>
@ -116,10 +116,10 @@ kate -l(line) (file)</source>
<name>MainWindow</name>
<message>
<location filename="main.ui" line="26"/>
<location filename="mainwindow.cpp" line="239"/>
<location filename="mainwindow.cpp" line="448"/>
<location filename="mainwindow.cpp" line="546"/>
<location filename="mainwindow.cpp" line="564"/>
<location filename="mainwindow.cpp" line="238"/>
<location filename="mainwindow.cpp" line="456"/>
<location filename="mainwindow.cpp" line="554"/>
<location filename="mainwindow.cpp" line="572"/>
<source>Cppcheck</source>
<translation type="unfinished"></translation>
</message>
@ -284,59 +284,59 @@ kate -l(line) (file)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="202"/>
<location filename="mainwindow.cpp" line="201"/>
<source>Select files to check</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="211"/>
<location filename="mainwindow.cpp" line="210"/>
<source>Select directory to check</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="240"/>
<location filename="mainwindow.cpp" line="239"/>
<source>No suitable files found to check!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="444"/>
<location filename="mainwindow.cpp" line="452"/>
<source>Cannot exit while checking.
Stop the checking before exiting.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="490"/>
<location filename="mainwindow.cpp" line="498"/>
<source>License</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="497"/>
<location filename="mainwindow.cpp" line="505"/>
<source>Authors</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="505"/>
<location filename="mainwindow.cpp" line="513"/>
<source>XML files (*.xml);;Text files (*.txt)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="507"/>
<location filename="mainwindow.cpp" line="515"/>
<source>Save the report file</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="515"/>
<location filename="mainwindow.cpp" line="523"/>
<source>XML files (*.xml)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="548"/>
<location filename="mainwindow.cpp" line="556"/>
<source>Cppcheck - %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="565"/>
<location filename="mainwindow.cpp" line="573"/>
<source>Failed to change the language:
%1
@ -347,6 +347,31 @@ Stop the checking before exiting.</source>
%1</oldsource>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="32"/>
<source>Finnish</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="31"/>
<source>English</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="33"/>
<source>Swedish</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="34"/>
<source>German</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="35"/>
<source>Russian</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
@ -356,13 +381,15 @@ Stop the checking before exiting.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="96"/>
<source>Language file %1.qm not found!</source>
<location filename="translationhandler.cpp" line="98"/>
<source>Language file %1 not found!</source>
<oldsource>Language file %1.qm not found!</oldsource>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="104"/>
<source>Failed to load language from file %1</source>
<source>Failed to load translation for language %1 from file %2</source>
<oldsource>Failed to load translation for language %1 from file %2.qm</oldsource>
<translation type="unfinished"></translation>
</message>
</context>

View File

@ -18,7 +18,7 @@
<source>Cppcheck - A tool for static C/C++ code analysis.</source>
<translation>Cppcheck - A tool for static C/C++ code analysis.</translation>
</message>
<message utf8="true">
<message>
<location filename="about.ui" line="65"/>
<source>Copyright (C) 2007-2009 Daniel Marjamäki and cppcheck team.</source>
<translation>Copyright (C) 2007-2009 Daniel Marjamäki and cppcheck team.</translation>
@ -129,10 +129,10 @@ kate -l(line) (file)</translation>
<name>MainWindow</name>
<message>
<location filename="main.ui" line="26"/>
<location filename="mainwindow.cpp" line="239"/>
<location filename="mainwindow.cpp" line="448"/>
<location filename="mainwindow.cpp" line="546"/>
<location filename="mainwindow.cpp" line="564"/>
<location filename="mainwindow.cpp" line="238"/>
<location filename="mainwindow.cpp" line="456"/>
<location filename="mainwindow.cpp" line="554"/>
<location filename="mainwindow.cpp" line="572"/>
<source>Cppcheck</source>
<translation>Cppcheck</translation>
</message>
@ -297,22 +297,22 @@ kate -l(line) (file)</translation>
<translation>&amp;Help</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="202"/>
<location filename="mainwindow.cpp" line="201"/>
<source>Select files to check</source>
<translation>Select files to check</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="211"/>
<location filename="mainwindow.cpp" line="210"/>
<source>Select directory to check</source>
<translation>Select directory to check</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="240"/>
<location filename="mainwindow.cpp" line="239"/>
<source>No suitable files found to check!</source>
<translation>No suitable files found to check!</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="444"/>
<location filename="mainwindow.cpp" line="452"/>
<source>Cannot exit while checking.
Stop the checking before exiting.</source>
@ -321,37 +321,37 @@ Stop the checking before exiting.</source>
Stop the checking before exiting.</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="490"/>
<location filename="mainwindow.cpp" line="498"/>
<source>License</source>
<translation>License</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="497"/>
<location filename="mainwindow.cpp" line="505"/>
<source>Authors</source>
<translation>Authors</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="505"/>
<location filename="mainwindow.cpp" line="513"/>
<source>XML files (*.xml);;Text files (*.txt)</source>
<translation>XML files (*.xml);;Text files (*.txt)</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="507"/>
<location filename="mainwindow.cpp" line="515"/>
<source>Save the report file</source>
<translation>Save the report file</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="515"/>
<location filename="mainwindow.cpp" line="523"/>
<source>XML files (*.xml)</source>
<translation>XML files (*.xml)</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="548"/>
<location filename="mainwindow.cpp" line="556"/>
<source>Cppcheck - %1</source>
<translation>Cppcheck - %1</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="565"/>
<location filename="mainwindow.cpp" line="573"/>
<source>Failed to change the language:
%1
@ -360,47 +360,54 @@ Stop the checking before exiting.</translation>
<oldsource>Failed to change language:
%1</oldsource>
<translation type="unfinished">Failed to change language:
<translation>Failed to change language:
%1</translation>
</message>
<message>
<location filename="translationhandler.cpp" line="32"/>
<source>Finnish</source>
<translation>Finnish</translation>
</message>
<message>
<location filename="translationhandler.cpp" line="31"/>
<source>English</source>
<translation>English</translation>
</message>
<message>
<location filename="translationhandler.cpp" line="33"/>
<source>Swedish</source>
<translation>Swedish</translation>
</message>
<message>
<location filename="translationhandler.cpp" line="34"/>
<source>German</source>
<translation>German</translation>
</message>
<message>
<location filename="translationhandler.cpp" line="35"/>
<source>Russian</source>
<translation>Russian</translation>
</message>
</context>
<context>
<name>QObject</name>
<message>
<source>English</source>
<translation type="obsolete">English</translation>
</message>
<message>
<source>Finnish</source>
<translation type="obsolete">Finnish</translation>
</message>
<message>
<source>Swedish</source>
<translation type="obsolete">Swedish</translation>
</message>
<message>
<source>German</source>
<translation type="obsolete">German</translation>
</message>
<message>
<source>Russian</source>
<translation type="obsolete">Russian</translation>
</message>
<message>
<location filename="translationhandler.cpp" line="88"/>
<source>Incorrect language specified!</source>
<translation>Incorrect language specified!</translation>
</message>
<message>
<location filename="translationhandler.cpp" line="96"/>
<source>Language file %1.qm not found!</source>
<translation type="unfinished"></translation>
<location filename="translationhandler.cpp" line="98"/>
<source>Language file %1 not found!</source>
<oldsource>Language file %1.qm not found!</oldsource>
<translation>Could not find the file: %1!</translation>
</message>
<message>
<location filename="translationhandler.cpp" line="104"/>
<source>Failed to load language from file %1</source>
<translation>Failed to load language from file %1</translation>
<source>Failed to load translation for language %1 from file %2</source>
<oldsource>Failed to load translation for language %1 from file %2.qm</oldsource>
<translation>Failed to load translation for language %1 from file %2</translation>
</message>
</context>
<context>
@ -453,7 +460,7 @@ Stop the checking before exiting.</translation>
<location filename="resultstree.cpp" line="426"/>
<source>Configure the text file viewer program in Cppcheck preferences/Applications.</source>
<oldsource>You can open this error by specifying applications in program&apos;s settings.</oldsource>
<translation type="unfinished">You can open this error by specifying applications in program&apos;s settings.</translation>
<translation>You can open this error by specifying applications in program&apos;s settings.</translation>
</message>
<message>
<location filename="resultstree.cpp" line="471"/>

View File

@ -18,7 +18,7 @@
<source>Cppcheck - A tool for static C/C++ code analysis.</source>
<translation>Cppcheck - Työkalu C/C++ koodin staattiseen analysointiin.</translation>
</message>
<message utf8="true">
<message>
<location filename="about.ui" line="65"/>
<source>Copyright (C) 2007-2009 Daniel Marjamäki and cppcheck team.</source>
<translation>Copyright (C) 2007-2009 Daniel Marjamäki ja cppcheck tiimi.</translation>
@ -131,10 +131,10 @@ kate -l(line) (file)
<name>MainWindow</name>
<message>
<location filename="main.ui" line="26"/>
<location filename="mainwindow.cpp" line="239"/>
<location filename="mainwindow.cpp" line="448"/>
<location filename="mainwindow.cpp" line="546"/>
<location filename="mainwindow.cpp" line="564"/>
<location filename="mainwindow.cpp" line="238"/>
<location filename="mainwindow.cpp" line="456"/>
<location filename="mainwindow.cpp" line="554"/>
<location filename="mainwindow.cpp" line="572"/>
<source>Cppcheck</source>
<translation>Cppcheck</translation>
</message>
@ -299,22 +299,22 @@ kate -l(line) (file)
<translation>&amp;Ohje</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="202"/>
<location filename="mainwindow.cpp" line="201"/>
<source>Select files to check</source>
<translation>Valitse tarkistettavat tiedostot</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="211"/>
<location filename="mainwindow.cpp" line="210"/>
<source>Select directory to check</source>
<translation>Valitse tarkistettava hakemisto</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="240"/>
<location filename="mainwindow.cpp" line="239"/>
<source>No suitable files found to check!</source>
<translation>Tarkistettavaksi sopivia tiedostoja ei löytynyt!</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="444"/>
<location filename="mainwindow.cpp" line="452"/>
<source>Cannot exit while checking.
Stop the checking before exiting.</source>
@ -323,37 +323,37 @@ Stop the checking before exiting.</source>
Lopeta tarkistus ennen ohjelman sammuttamista.</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="490"/>
<location filename="mainwindow.cpp" line="498"/>
<source>License</source>
<translation>Lisenssi</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="497"/>
<location filename="mainwindow.cpp" line="505"/>
<source>Authors</source>
<translation>Tekijät</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="505"/>
<location filename="mainwindow.cpp" line="513"/>
<source>XML files (*.xml);;Text files (*.txt)</source>
<translation>XML-tiedostot (*.xml);;Tekstitiedostot (*.txt)</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="507"/>
<location filename="mainwindow.cpp" line="515"/>
<source>Save the report file</source>
<translation>Tallenna raportti</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="515"/>
<location filename="mainwindow.cpp" line="523"/>
<source>XML files (*.xml)</source>
<translation>XML-tiedostot (*xml)</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="548"/>
<location filename="mainwindow.cpp" line="556"/>
<source>Cppcheck - %1</source>
<translation>Cppcheck - %1</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="565"/>
<location filename="mainwindow.cpp" line="573"/>
<source>Failed to change the language:
%1
@ -362,45 +362,56 @@ Lopeta tarkistus ennen ohjelman sammuttamista.</translation>
<oldsource>Failed to change language:
%1</oldsource>
<translation type="unfinished">Kielen %1 vaihto epäonnistui</translation>
<translation>Ohjelman kielen vaihtaminen epäonnistui:
%1
</translation>
</message>
<message>
<location filename="translationhandler.cpp" line="32"/>
<source>Finnish</source>
<translation>Suomi</translation>
</message>
<message>
<location filename="translationhandler.cpp" line="31"/>
<source>English</source>
<translation>Englanti</translation>
</message>
<message>
<location filename="translationhandler.cpp" line="33"/>
<source>Swedish</source>
<translation>Ruotsi</translation>
</message>
<message>
<location filename="translationhandler.cpp" line="34"/>
<source>German</source>
<translation>Saksa</translation>
</message>
<message>
<location filename="translationhandler.cpp" line="35"/>
<source>Russian</source>
<translation>Venäjä</translation>
</message>
</context>
<context>
<name>QObject</name>
<message>
<source>English</source>
<translation type="obsolete">Englanti</translation>
</message>
<message>
<source>Finnish</source>
<translation type="obsolete">Suomi</translation>
</message>
<message>
<source>Swedish</source>
<translation type="obsolete">Ruotsi</translation>
</message>
<message>
<source>German</source>
<translation type="obsolete">Saksa</translation>
</message>
<message>
<source>Russian</source>
<translation type="obsolete">Venäjä</translation>
</message>
<message>
<location filename="translationhandler.cpp" line="88"/>
<source>Incorrect language specified!</source>
<translation>Virheellinen kieli valittu!</translation>
</message>
<message>
<location filename="translationhandler.cpp" line="96"/>
<source>Language file %1.qm not found!</source>
<translation type="unfinished"></translation>
<location filename="translationhandler.cpp" line="98"/>
<source>Language file %1 not found!</source>
<oldsource>Language file %1.qm not found!</oldsource>
<translation>Käännöstiedostoa %1 ei löytynyt!</translation>
</message>
<message>
<location filename="translationhandler.cpp" line="104"/>
<source>Failed to load language from file %1</source>
<translation>Kielen lataaminen tiedostosta %1 epäonnistui</translation>
<source>Failed to load translation for language %1 from file %2</source>
<oldsource>Failed to load translation for language %1 from file %2.qm</oldsource>
<translation>Käänöksen lataaminen kielelle %1 tiedostosta %2 epäonnistui</translation>
</message>
</context>
<context>
@ -453,7 +464,7 @@ Lopeta tarkistus ennen ohjelman sammuttamista.</translation>
<location filename="resultstree.cpp" line="426"/>
<source>Configure the text file viewer program in Cppcheck preferences/Applications.</source>
<oldsource>You can open this error by specifying applications in program&apos;s settings.</oldsource>
<translation type="unfinished">Voit asetuksista määritellä muita ohjelmia joilla avata tämän virheen sisältävän tiedoston.</translation>
<translation>Voit asetuksista määritellä muita ohjelmia joilla avata tämän virheen sisältävän tiedoston.</translation>
</message>
<message>
<location filename="resultstree.cpp" line="471"/>

View File

@ -18,7 +18,7 @@
<source>Cppcheck - A tool for static C/C++ code analysis.</source>
<translation type="unfinished"></translation>
</message>
<message utf8="true">
<message>
<location filename="about.ui" line="65"/>
<source>Copyright (C) 2007-2009 Daniel Marjamäki and cppcheck team.</source>
<translation type="unfinished"></translation>
@ -118,10 +118,10 @@ kate -l(line) (file)</source>
<name>MainWindow</name>
<message>
<location filename="main.ui" line="26"/>
<location filename="mainwindow.cpp" line="239"/>
<location filename="mainwindow.cpp" line="448"/>
<location filename="mainwindow.cpp" line="546"/>
<location filename="mainwindow.cpp" line="564"/>
<location filename="mainwindow.cpp" line="238"/>
<location filename="mainwindow.cpp" line="456"/>
<location filename="mainwindow.cpp" line="554"/>
<location filename="mainwindow.cpp" line="572"/>
<source>Cppcheck</source>
<translation type="unfinished"></translation>
</message>
@ -286,59 +286,59 @@ kate -l(line) (file)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="202"/>
<location filename="mainwindow.cpp" line="201"/>
<source>Select files to check</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="211"/>
<location filename="mainwindow.cpp" line="210"/>
<source>Select directory to check</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="240"/>
<location filename="mainwindow.cpp" line="239"/>
<source>No suitable files found to check!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="444"/>
<location filename="mainwindow.cpp" line="452"/>
<source>Cannot exit while checking.
Stop the checking before exiting.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="490"/>
<location filename="mainwindow.cpp" line="498"/>
<source>License</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="497"/>
<location filename="mainwindow.cpp" line="505"/>
<source>Authors</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="505"/>
<location filename="mainwindow.cpp" line="513"/>
<source>XML files (*.xml);;Text files (*.txt)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="507"/>
<location filename="mainwindow.cpp" line="515"/>
<source>Save the report file</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="515"/>
<location filename="mainwindow.cpp" line="523"/>
<source>XML files (*.xml)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="548"/>
<location filename="mainwindow.cpp" line="556"/>
<source>Cppcheck - %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="565"/>
<location filename="mainwindow.cpp" line="573"/>
<source>Failed to change the language:
%1
@ -349,6 +349,31 @@ Stop the checking before exiting.</source>
%1</oldsource>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="32"/>
<source>Finnish</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="31"/>
<source>English</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="33"/>
<source>Swedish</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="34"/>
<source>German</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="35"/>
<source>Russian</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
@ -358,13 +383,15 @@ Stop the checking before exiting.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="96"/>
<source>Language file %1.qm not found!</source>
<location filename="translationhandler.cpp" line="98"/>
<source>Language file %1 not found!</source>
<oldsource>Language file %1.qm not found!</oldsource>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="104"/>
<source>Failed to load language from file %1</source>
<source>Failed to load translation for language %1 from file %2</source>
<oldsource>Failed to load translation for language %1 from file %2.qm</oldsource>
<translation type="unfinished"></translation>
</message>
</context>

View File

@ -18,7 +18,7 @@
<source>Cppcheck - A tool for static C/C++ code analysis.</source>
<translation type="unfinished"></translation>
</message>
<message utf8="true">
<message>
<location filename="about.ui" line="65"/>
<source>Copyright (C) 2007-2009 Daniel Marjamäki and cppcheck team.</source>
<translation type="unfinished"></translation>
@ -118,10 +118,10 @@ kate -l(line) (file)</source>
<name>MainWindow</name>
<message>
<location filename="main.ui" line="26"/>
<location filename="mainwindow.cpp" line="239"/>
<location filename="mainwindow.cpp" line="448"/>
<location filename="mainwindow.cpp" line="546"/>
<location filename="mainwindow.cpp" line="564"/>
<location filename="mainwindow.cpp" line="238"/>
<location filename="mainwindow.cpp" line="456"/>
<location filename="mainwindow.cpp" line="554"/>
<location filename="mainwindow.cpp" line="572"/>
<source>Cppcheck</source>
<translation type="unfinished"></translation>
</message>
@ -286,59 +286,59 @@ kate -l(line) (file)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="202"/>
<location filename="mainwindow.cpp" line="201"/>
<source>Select files to check</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="211"/>
<location filename="mainwindow.cpp" line="210"/>
<source>Select directory to check</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="240"/>
<location filename="mainwindow.cpp" line="239"/>
<source>No suitable files found to check!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="444"/>
<location filename="mainwindow.cpp" line="452"/>
<source>Cannot exit while checking.
Stop the checking before exiting.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="490"/>
<location filename="mainwindow.cpp" line="498"/>
<source>License</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="497"/>
<location filename="mainwindow.cpp" line="505"/>
<source>Authors</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="505"/>
<location filename="mainwindow.cpp" line="513"/>
<source>XML files (*.xml);;Text files (*.txt)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="507"/>
<location filename="mainwindow.cpp" line="515"/>
<source>Save the report file</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="515"/>
<location filename="mainwindow.cpp" line="523"/>
<source>XML files (*.xml)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="548"/>
<location filename="mainwindow.cpp" line="556"/>
<source>Cppcheck - %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="565"/>
<location filename="mainwindow.cpp" line="573"/>
<source>Failed to change the language:
%1
@ -349,6 +349,31 @@ Stop the checking before exiting.</source>
%1</oldsource>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="32"/>
<source>Finnish</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="31"/>
<source>English</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="33"/>
<source>Swedish</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="34"/>
<source>German</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="35"/>
<source>Russian</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
@ -358,13 +383,15 @@ Stop the checking before exiting.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="96"/>
<source>Language file %1.qm not found!</source>
<location filename="translationhandler.cpp" line="98"/>
<source>Language file %1 not found!</source>
<oldsource>Language file %1.qm not found!</oldsource>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="translationhandler.cpp" line="104"/>
<source>Failed to load language from file %1</source>
<source>Failed to load translation for language %1 from file %2</source>
<oldsource>Failed to load translation for language %1 from file %2.qm</oldsource>
<translation type="unfinished"></translation>
</message>
</context>

View File

@ -28,11 +28,11 @@ TranslationHandler::TranslationHandler(QObject *parent) :
mTranslator(new QTranslator(this))
{
//Add our default languages
mNames << "English"
<< "Finnish"
<< "Swedish"
<< "German"
<< "Russian";
mNames << QT_TRANSLATE_NOOP("MainWindow","English")
<< QT_TRANSLATE_NOOP("MainWindow","Finnish")
<< QT_TRANSLATE_NOOP("MainWindow","Swedish")
<< QT_TRANSLATE_NOOP("MainWindow","German")
<< QT_TRANSLATE_NOOP("MainWindow","Russian");
mFiles << "cppcheck_en"
<< "cppcheck_fi"
@ -92,8 +92,18 @@ bool TranslationHandler::SetLanguage(const int index, QString &error)
//Load the new language
if (!mTranslator->load(mFiles[index]))
{
error = QObject::tr("Failed to load language from file %1");
error = error.arg(mFiles[index]);
//If it failed, lets check if the default file exists
if (!QFile::exists(mFiles[index]+".qm"))
{
error = QObject::tr("Language file %1 not found!");
error = error.arg(mFiles[index]+".qm");
return false;
}
//If file exists, there's something wrong with it
error = QObject::tr("Failed to load translation for language %1 from file %2");
error = error.arg(mNames[index]);
error = error.arg(mFiles[index]+".qm");
return false;
}