Merge pull request #218 from crumblingstatue/embedded-lang
gui: Embed the language files into the executable
This commit is contained in:
commit
adc8713ab3
|
@ -40,6 +40,9 @@ win32 {
|
|||
}
|
||||
}
|
||||
|
||||
# Generate the translations before we embed them
|
||||
system("lrelease gui.pro")
|
||||
|
||||
RESOURCES = gui.qrc
|
||||
FORMS = about.ui \
|
||||
application.ui \
|
||||
|
|
13
gui/gui.qrc
13
gui/gui.qrc
|
@ -32,5 +32,18 @@
|
|||
<file alias="cfg/posix.cfg">../cfg/posix.cfg</file>
|
||||
<file alias="cfg/std.cfg">../cfg/std.cfg</file>
|
||||
<file alias="cfg/windows.cfg">../cfg/windows.cfg</file>
|
||||
|
||||
<file>cppcheck_de.qm</file>
|
||||
<file>cppcheck_es.qm</file>
|
||||
<file>cppcheck_fi.qm</file>
|
||||
<file>cppcheck_fr.qm</file>
|
||||
<file>cppcheck_it.qm</file>
|
||||
<file>cppcheck_ja.qm</file>
|
||||
<file>cppcheck_ko.qm</file>
|
||||
<file>cppcheck_nl.qm</file>
|
||||
<file>cppcheck_ru.qm</file>
|
||||
<file>cppcheck_sr.qm</file>
|
||||
<file>cppcheck_sv.qm</file>
|
||||
<file>cppcheck_zh_CN.qm</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -97,7 +97,7 @@ bool TranslationHandler::SetLanguage(const QString &code)
|
|||
mTranslator = new QTranslator(this);
|
||||
|
||||
//Load the new language
|
||||
QString translationFile = "lang/" + mTranslations[index].mFilename;
|
||||
QString translationFile = ":/" + mTranslations[index].mFilename;
|
||||
if (!mTranslator->load(translationFile) && !failure) {
|
||||
translationFile += ".qm";
|
||||
//If it failed, lets check if the default file exists
|
||||
|
|
Loading…
Reference in New Issue