Display country in language list.

But only if the translation specifies one.
This commit is contained in:
Felix Geyer 2015-07-18 18:38:41 +02:00
parent 6327eaf587
commit 607007f94f

View File

@ -67,8 +67,15 @@ QList<QPair<QString, QString> > Translator::availableLanguages()
langcode = "en";
}
languages.append(QPair<QString, QString>(langcode,
QLocale::languageToString(QLocale(langcode).language())));
QLocale locale(langcode);
QString languageStr = QLocale::languageToString(locale.language());
QString countryStr;
if (langcode.contains("_")) {
countryStr = QString(" (%1)").arg(QLocale::countryToString(locale.country()));
}
QPair<QString, QString> language(langcode, languageStr + countryStr);
languages.append(language);
}
}
}