Language preference: remove the .qm suffix before handling locale

Otherwise things don't match as one might expect...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2016-09-20 12:47:31 -07:00
parent 5fdbc1ffc3
commit 6b181d6b85

View file

@ -82,11 +82,11 @@ QVariant LanguageModel::data(const QModelIndex &index, int role) const
return QVariant(); return QVariant();
switch (role) { switch (role) {
case Qt::DisplayRole: { case Qt::DisplayRole: {
QLocale l(currentString.remove("subsurface_")); QLocale l(currentString.remove("subsurface_").remove(".qm"));
return currentString == "English" ? currentString : QString("%1 (%2)").arg(l.languageToString(l.language())).arg(l.countryToString(l.country())); return currentString == "English" ? currentString : QString("%1 (%2)").arg(l.languageToString(l.language())).arg(l.countryToString(l.country()));
} }
case Qt::UserRole: case Qt::UserRole:
return currentString == "English" ? "en_US" : currentString.remove("subsurface_"); return currentString == "English" ? "en_US" : currentString.remove("subsurface_").remove(".qm");
} }
return QVariant(); return QVariant();
} }