Commit a263c32a authored by Albert Astals Cid's avatar Albert Astals Cid

Use KLanguageName instead of kf5_all_languages

kf5_all_languages is part of kdelibs4support and will eventually disappear
parent 30d66981
......@@ -10,7 +10,7 @@ set (RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE
project(lokalize VERSION ${RELEASE_SERVICE_VERSION})
set(QT_MIN_VERSION "5.14.0")
set(KF5_MIN_VERSION "5.71.0")
set(KF5_MIN_VERSION "5.74.0")
# search packages used
find_package(ECM ${KF5_MIN_VERSION} REQUIRED CONFIG)
......
......@@ -24,8 +24,8 @@
#include "languagelistmodel.h"
#include <kconfig.h>
#include <kconfiggroup.h>
#include <klanguagename.h>
#include <klocalizedstring.h>
#include <QStringBuilder>
#include <QCoreApplication>
......@@ -64,9 +64,8 @@ LanguageListModel* LanguageListModel::emptyLangInstance()
LanguageListModel::LanguageListModel(ModelType type, QObject* parent)
: QStringListModel(parent)
, m_sortModel(new QSortFilterProxyModel(this))
, m_systemLangList(new KConfig(QLatin1String("locale/kf5_all_languages"), KConfig::NoGlobals, QStandardPaths::GenericDataLocation))
{
setStringList(m_systemLangList->groupList());
setStringList(KLanguageName::allLanguageCodes());
if (type == WithEmptyLang) insertRows(rowCount(), 1);
#if 0 //KDE5PORT
......@@ -105,7 +104,7 @@ QVariant LanguageListModel::data(const QModelIndex& index, int role) const
if (displayNames.at(index.row()).length())
return displayNames.at(index.row());
return QVariant::fromValue<QString>(
displayNames[index.row()] = KConfigGroup(m_systemLangList, code).readEntry("Name") + QStringLiteral(" (") + code + ')');
displayNames[index.row()] = i18nc("%1 is a language name, e.g. Irish, %2 is language code, e.g. ga", "%1 (%2)", KLanguageName::nameForCode(code), code));
}
return QStringListModel::data(index, role);
}
......
......@@ -28,7 +28,6 @@
#include <QStringListModel>
class QSortFilterProxyModel;
class KConfig;
class LanguageListModel: public QStringListModel
{
......@@ -47,7 +46,6 @@ private:
LanguageListModel(ModelType type = Default, QObject* parent = nullptr);
QSortFilterProxyModel* m_sortModel;
KConfig* m_systemLangList;
public:
QVariant data(const QModelIndex& index, int role) const override;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment