GUI: fix SuggestLanguage for zh_CN
This commit is contained in:
parent
ec034c1d59
commit
50d0aa1870
|
@ -146,13 +146,8 @@ QString TranslationHandler::GetCurrentLanguage() const
|
|||
|
||||
QString TranslationHandler::SuggestLanguage() const
|
||||
{
|
||||
/*
|
||||
Get language from system locale's name
|
||||
QLocale::languageToString would return the languages full name and we
|
||||
only want two-letter ISO 639 language code so we'll get it from
|
||||
locale's name.
|
||||
*/
|
||||
QString language = QLocale::system().name().left(2);
|
||||
//Get language from system locale's name ie sv_SE or zh_CN
|
||||
QString language = QLocale::system().name();
|
||||
//qDebug()<<"Your language is"<<language;
|
||||
|
||||
//And see if we can find it from our list of language files
|
||||
|
@ -171,7 +166,8 @@ void TranslationHandler::AddTranslation(const char *name, const char *filename)
|
|||
TranslationInfo info;
|
||||
info.mName = name;
|
||||
info.mFilename = filename;
|
||||
info.mCode = QString(filename).right(2);
|
||||
int codeLength = QString(filename).length() - QString(filename).indexOf('_') - 1;
|
||||
info.mCode = QString(filename).right(codeLength);
|
||||
mTranslations.append(info);
|
||||
}
|
||||
|
||||
|
@ -183,6 +179,10 @@ int TranslationHandler::GetLanguageIndexByCode(const QString &code) const
|
|||
index = i;
|
||||
break;
|
||||
}
|
||||
else if (mTranslations[i].mCode == code.left(2)) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue