Moved GUI translations into subdirectory /lang

This commit is contained in:
PKEuS 2013-08-03 20:10:28 +02:00
parent 197046b761
commit 2413655d3d
2 changed files with 22 additions and 18 deletions

View File

@ -97,18 +97,20 @@ bool TranslationHandler::SetLanguage(const QString &code)
mTranslator = new QTranslator(this);
//Load the new language
if (!mTranslator->load(mTranslations[index].mFilename) && !failure) {
QString translationFile = "lang/" + mTranslations[index].mFilename;
if (!mTranslator->load(translationFile) && !failure) {
translationFile += ".qm";
//If it failed, lets check if the default file exists
if (!QFile::exists(mTranslations[index].mFilename + ".qm")) {
if (!QFile::exists(translationFile)) {
error = QObject::tr("Language file %1 not found!");
error = error.arg(mTranslations[index].mFilename + ".qm");
error = error.arg(translationFile);
failure = true;
}
//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(mTranslations[index].mName);
error = error.arg(mTranslations[index].mFilename + ".qm");
error = error.arg(translationFile);
}
if (failure) {

View File

@ -37,6 +37,7 @@
<File Id='qtcore4dll' Name='qtcore4.dll' Source='$(var.QtDllDir)\qtcore4.dll' />
<File Id='qtgui4dll' Name='qtgui4.dll' Source='$(var.QtDllDir)\qtgui4.dll' />
</Component>
<Directory Id='TranslationsFolder' Name='lang'>
<Component Id='GuiTranslations' Guid='$(var.guiTranslationsGUID)'>
<File Id='cppcheck_de.qm' Name='cppcheck_de.qm' Source='$(var.TranslationsDir)\cppcheck_de.qm' />
<File Id='cppcheck_es.qm' Name='cppcheck_es.qm' Source='$(var.TranslationsDir)\cppcheck_es.qm' />
@ -51,6 +52,7 @@
<File Id='cppcheck_sr.qm' Name='cppcheck_sr.qm' Source='$(var.TranslationsDir)\cppcheck_sr.qm' />
<File Id='cppcheck_zh_CN.qm' Name='cppcheck_zh_CN.qm' Source='$(var.TranslationsDir)\cppcheck_zh_CN.qm' />
</Component>
</Directory>
<Directory Id='CfgsFolder' Name='cfg'>
<Component Id='Cfgs' Guid='$(var.cfgsGUID)'>
<File Id='std.cfg' Name='std.cfg' Source='$(var.CfgsDir)\std.cfg' />