Commit 734b150c authored by Pino Toscano's avatar Pino Toscano

Use KLocalizedString::languages() for language list

If ki18n >= 5.20.0 is available, use KLocalizedString::languages()
to get the list of configured languages for translations.
This fixes the lookup of translated content, such as TOCs, mirroring
what was done with commit 37bc9831fe097b01bb100f622ecd0ef19f77b80f in
kio.git.
parent 568111a0
......@@ -29,6 +29,7 @@
#include "htmlsearch.h"
#include "docentrytraverser.h"
#include <KLocalizedString>
#include <ki18n_version.h>
using namespace KHC;
......@@ -150,7 +151,11 @@ void DocMetaInfo::scanMetaInfo( bool force )
{
if ( mLoaded && !force ) return;
#if KI18N_VERSION >= QT_VERSION_CHECK(5, 20, 0)
QStringList langs = KLocalizedString::languages();
#else
QStringList langs = QLocale().uiLanguages();
#endif
mDefaultLanguage = langs.first();
QStringList::ConstIterator it;
......
......@@ -12,6 +12,7 @@
#include <KHTMLSettings>
#include <KHTMLView>
#include <KToolBarPopupAction>
#include <ki18n_version.h>
#include <QFileInfo>
#include <QClipboard>
......@@ -95,7 +96,11 @@ QString View::langLookup( const QString &fname )
// assemble the local search paths
const QStringList localDoc = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("doc/HTML"), QStandardPaths::LocateDirectory);
#if KI18N_VERSION >= QT_VERSION_CHECK(5, 20, 0)
QStringList langs = KLocalizedString::languages();
#else
QStringList langs = QLocale().uiLanguages();
#endif
langs.append(QStringLiteral("en"));
langs.removeAll(QStringLiteral("C"));
......
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