mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Added 'English' and 'Use System Default' options.
These complete the ability to select languages from the preferences panel. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
7436178fe0
commit
9b7b477d7c
4 changed files with 101 additions and 61 deletions
|
@ -1772,24 +1772,24 @@ LanguageModel::LanguageModel(QObject* parent): QAbstractListModel(parent)
|
|||
if ( !s.endsWith(".qm") ){
|
||||
continue;
|
||||
}
|
||||
languages.push_back(s);
|
||||
languages.push_back( (s == "subsurface_source.qm") ? "English" : s);
|
||||
}
|
||||
}
|
||||
|
||||
QVariant LanguageModel::data(const QModelIndex& index, int role) const
|
||||
{
|
||||
QLocale loc;
|
||||
QString currentString = languages.at(index.row());
|
||||
if(!index.isValid())
|
||||
return QVariant();
|
||||
switch(role){
|
||||
case Qt::DisplayRole:{
|
||||
QString currentString = languages.at(index.row());
|
||||
QLocale l( currentString.remove("subsurface_"));
|
||||
return l.countryToString(l.country());
|
||||
return currentString == "English" ? currentString : l.countryToString(l.country());
|
||||
}break;
|
||||
case Qt::UserRole:{
|
||||
QString currentString = languages.at(index.row());
|
||||
return currentString.remove("subsurface_");
|
||||
return currentString == "English" ? "en_US" : currentString.remove("subsurface_");
|
||||
}break;
|
||||
}
|
||||
return QVariant();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue