Fix Failed to load translation for English (#3351)

Upon the first start of cppcheck-gui, the following message appears,
if the language of the OS is English:
  Failed to load the user interface language:
  Failed to load translation for language English from file
  cppcheck_en.qm
  The user interface language has been reset to English.

- Update translationhandler.cpp and check if the language code starts
  with "en". The code can be e.g. "en_US"
This commit is contained in:
Wolfgang Stöggl 2021-07-23 19:27:53 +02:00 committed by GitHub
parent 4baf221a6b
commit 8d5249e3b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -86,8 +86,8 @@ bool TranslationHandler::setLanguage(const QString &code)
bool failure = false; bool failure = false;
QString error; QString error;
//If English is the language //If English is the language. Code can be e.g. en_US
if (code == "en") { if (code.indexOf("en") == 0) {
//Just remove all extra translators //Just remove all extra translators
if (mTranslator) { if (mTranslator) {
qApp->removeTranslator(mTranslator); qApp->removeTranslator(mTranslator);