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,20 +37,22 @@
<File Id='qtcore4dll' Name='qtcore4.dll' Source='$(var.QtDllDir)\qtcore4.dll' />
<File Id='qtgui4dll' Name='qtgui4.dll' Source='$(var.QtDllDir)\qtgui4.dll' />
</Component>
<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' />
<File Id='cppcheck_fi.qm' Name='cppcheck_fi.qm' Source='$(var.TranslationsDir)\cppcheck_fi.qm' />
<File Id='cppcheck_fr.qm' Name='cppcheck_fr.qm' Source='$(var.TranslationsDir)\cppcheck_fr.qm' />
<File Id='cppcheck_it.qm' Name='cppcheck_it.qm' Source='$(var.TranslationsDir)\cppcheck_it.qm' />
<File Id='cppcheck_ja.qm' Name='cppcheck_ja.qm' Source='$(var.TranslationsDir)\cppcheck_ja.qm' />
<File Id='cppcheck_ko.qm' Name='cppcheck_ko.qm' Source='$(var.TranslationsDir)\cppcheck_ko.qm' />
<File Id='cppcheck_nl.qm' Name='cppcheck_nl.qm' Source='$(var.TranslationsDir)\cppcheck_nl.qm' />
<File Id='cppcheck_ru.qm' Name='cppcheck_ru.qm' Source='$(var.TranslationsDir)\cppcheck_ru.qm' />
<File Id='cppcheck_sv.qm' Name='cppcheck_sv.qm' Source='$(var.TranslationsDir)\cppcheck_sv.qm' />
<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 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' />
<File Id='cppcheck_fi.qm' Name='cppcheck_fi.qm' Source='$(var.TranslationsDir)\cppcheck_fi.qm' />
<File Id='cppcheck_fr.qm' Name='cppcheck_fr.qm' Source='$(var.TranslationsDir)\cppcheck_fr.qm' />
<File Id='cppcheck_it.qm' Name='cppcheck_it.qm' Source='$(var.TranslationsDir)\cppcheck_it.qm' />
<File Id='cppcheck_ja.qm' Name='cppcheck_ja.qm' Source='$(var.TranslationsDir)\cppcheck_ja.qm' />
<File Id='cppcheck_ko.qm' Name='cppcheck_ko.qm' Source='$(var.TranslationsDir)\cppcheck_ko.qm' />
<File Id='cppcheck_nl.qm' Name='cppcheck_nl.qm' Source='$(var.TranslationsDir)\cppcheck_nl.qm' />
<File Id='cppcheck_ru.qm' Name='cppcheck_ru.qm' Source='$(var.TranslationsDir)\cppcheck_ru.qm' />
<File Id='cppcheck_sv.qm' Name='cppcheck_sv.qm' Source='$(var.TranslationsDir)\cppcheck_sv.qm' />
<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' />