Build language list from Subsurface translations

On Windows platform translation/ folder contains Qt translation
files as well. This results in extra languages in preferences.
From now we filter these translations and choose only those matching
^subsurface_*.qm$

Fixes #339

Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Sergey Starosek 2013-12-07 21:50:15 +02:00 committed by Dirk Hohndel
parent b144e64b9b
commit 4623d7098b

View file

@ -1756,10 +1756,9 @@ LanguageModel::LanguageModel(QObject* parent): QAbstractListModel(parent)
QDir d(getSubsurfaceDataPath("translations"));
QStringList result = d.entryList();
Q_FOREACH(const QString& s, result){
if ( !s.endsWith(".qm") ){
continue;
if ( s.startsWith("subsurface_") && s.endsWith(".qm") ){
languages.push_back( (s == "subsurface_source.qm") ? "English" : s);
}
languages.push_back( (s == "subsurface_source.qm") ? "English" : s);
}
}