1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

QML Plugins: Fix exporting i18n functions

This commit is contained in:
David Rosca 2019-03-20 11:53:31 +01:00
parent 71b54b5bbf
commit 797e4c12a2
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
2 changed files with 7 additions and 4 deletions

View File

@ -130,6 +130,9 @@ if (PySide2_FOUND AND Shiboken2_FOUND AND PythonLibs_FOUND)
endif() endif()
find_package(Intl) find_package(Intl)
if (Intl_FOUND)
set(HAVE_LIBINTL TRUE)
endif()
# Git revision # Git revision
if (EXISTS "${CMAKE_SOURCE_DIR}/.git") if (EXISTS "${CMAKE_SOURCE_DIR}/.git")

View File

@ -69,10 +69,10 @@ void QmlPluginLoader::initEngineAndComponent()
#if HAVE_LIBINTL #if HAVE_LIBINTL
auto i18n = new QmlI18n(m_name); auto i18n = new QmlI18n(m_name);
m_engine->globalObject().setProperty(QSL("__falkon_i18n"), m_engine->newQObject(i18n)); m_engine->globalObject().setProperty(QSL("__falkon_i18n"), m_engine->newQObject(i18n));
m_engine->globalObject().setProperty(QSL("i18n"), m_engine->evaluate(QSL("function (s) { return __falkon_i18n.i18n(s) }"))); m_engine->evaluate(QSL("i18n = function (s) { return __falkon_i18n.i18n(s) };"));
m_engine->globalObject().setProperty(QSL("i18np"), m_engine->evaluate(QSL("function (s1, s2) { return __falkon_i18n.i18np(s1, s2) }"))); m_engine->evaluate(QSL("i18np = function (s1, s2) { return __falkon_i18n.i18np(s1, s2) }"));
#else #else
m_engine->globalObject().setProperty(QSL("i18n"), m_engine->evaluate(QSL("function (s) { return s }"))); m_engine->evaluate(QSL("i18n = function (s) { return s; };"));
m_engine->globalObject().setProperty(QSL("i18np"), m_engine->evaluate(QSL("function (s1, s2) { return s1 }"))); m_engine->evaluate(QSL("i18np = function (s1, s2) { return s1; }"));
#endif #endif
} }