GUI: Removed translations for english. There is no reason to translate a string from english to english.

This commit is contained in:
Daniel Marjamäki 2012-02-12 02:55:48 +01:00
parent 9043d95e72
commit 37305972fc
3 changed files with 7 additions and 1544 deletions

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,6 @@ FORMS = about.ui \
selectfilesdialog.ui selectfilesdialog.ui
TRANSLATIONS = cppcheck_de.ts \ TRANSLATIONS = cppcheck_de.ts \
cppcheck_en.ts \
cppcheck_es.ts \ cppcheck_es.ts \
cppcheck_fi.ts \ cppcheck_fi.ts \
cppcheck_fr.ts \ cppcheck_fr.ts \

View File

@ -25,7 +25,7 @@
TranslationHandler::TranslationHandler(QObject *parent) : TranslationHandler::TranslationHandler(QObject *parent) :
QObject(parent), QObject(parent),
mCurrentLanguage("en"), mCurrentLanguage("en"),
mTranslator(new QTranslator(this)) mTranslator(NULL)
{ {
// Add our available languages // Add our available languages
// Keep this list sorted // Keep this list sorted
@ -40,15 +40,6 @@ TranslationHandler::TranslationHandler(QObject *parent) :
AddTranslation(QT_TRANSLATE_NOOP("MainWindow", "Serbian"), "cppcheck_sr"); AddTranslation(QT_TRANSLATE_NOOP("MainWindow", "Serbian"), "cppcheck_sr");
AddTranslation(QT_TRANSLATE_NOOP("MainWindow", "Spanish"), "cppcheck_es"); AddTranslation(QT_TRANSLATE_NOOP("MainWindow", "Spanish"), "cppcheck_es");
AddTranslation(QT_TRANSLATE_NOOP("MainWindow", "Swedish"), "cppcheck_sv"); AddTranslation(QT_TRANSLATE_NOOP("MainWindow", "Swedish"), "cppcheck_sv");
//Load English as a fallback language
QTranslator *english = new QTranslator();
if (english->load("cppcheck_en")) {
qApp->installTranslator(english);
} else {
qDebug() << "Failed to load English translation!";
delete english;
}
} }
TranslationHandler::~TranslationHandler() TranslationHandler::~TranslationHandler()
@ -71,6 +62,8 @@ bool TranslationHandler::SetLanguage(const QString &code, QString &error)
//Just remove all extra translators //Just remove all extra translators
if (mTranslator) { if (mTranslator) {
qApp->removeTranslator(mTranslator); qApp->removeTranslator(mTranslator);
delete mTranslator;
mTranslator = NULL;
} }
mCurrentLanguage = code; mCurrentLanguage = code;
@ -84,6 +77,10 @@ bool TranslationHandler::SetLanguage(const QString &code, QString &error)
return false; return false;
} }
// Make sure there is a translator
if (!mTranslator)
mTranslator = new QTranslator(this);
//Load the new language //Load the new language
if (!mTranslator->load(mTranslations[index].mFilename)) { if (!mTranslator->load(mTranslations[index].mFilename)) {
//If it failed, lets check if the default file exists //If it failed, lets check if the default file exists