Hello community, here is the log from the commit of package ki18n for openSUSE:Factory checked in at 2018-08-24 16:53:34 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ki18n (Old) and /work/SRC/openSUSE:Factory/.ki18n.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ki18n" Fri Aug 24 16:53:34 2018 rev:60 rq:630611 version:5.49.0 Changes: -------- --- /work/SRC/openSUSE:Factory/ki18n/ki18n.changes 2018-07-21 10:13:09.759129633 +0200 +++ /work/SRC/openSUSE:Factory/.ki18n.new/ki18n.changes 2018-08-24 16:53:34.341323774 +0200 @@ -1,0 +2,19 @@ +Sun Aug 19 09:19:07 UTC 2018 - christo...@krop.fr + +- Update to 5.49.0 + * New feature release + * For more details please see: + * https://www.kde.org/announcements/kde-frameworks-5.49.0.php +- Changes since 5.48.0: + * Reuse function that already does the same + * Fix the catalog handling and locale detection on Android + * Readability, skip no-op statements + * Fix KCatalog::translate when translation is same as original text + * a file has been renamed + * Let ki18n macro file name follow style of other find_package related files + * Fix the configure check for _nl_msg_cat_cntr + * Don't generate files in the source directory + * libintl: Determine if _nl_msg_cat_cntr exists before use (kde#365917) + * Fix the binary-factory builds. + +------------------------------------------------------------------- Old: ---- ki18n-5.48.0.tar.xz New: ---- ki18n-5.49.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ki18n.spec ++++++ --- /var/tmp/diff_new_pack.jGnLo3/_old 2018-08-24 16:53:34.909324444 +0200 +++ /var/tmp/diff_new_pack.jGnLo3/_new 2018-08-24 16:53:34.909324444 +0200 @@ -16,16 +16,24 @@ # -%bcond_without lang %define lname libKF5I18n5 -%define _tar_path 5.48 +%define _tar_path 5.49 # Full KF5 version (e.g. 5.33.0) %{!?_kf5_version: %global _kf5_version %{version}} # Last major and minor KF5 version (e.g. 5.33) %{!?_kf5_bugfix_version: %define _kf5_bugfix_version %(echo %{_kf5_version} | awk -F. '{print $1"."$2}')} +%bcond_without lang Name: ki18n -Version: 5.48.0 +Version: 5.49.0 Release: 0 +Summary: KDE Gettext-based UI text internationalization +License: LGPL-2.1-or-later +Group: System/GUI/KDE +URL: http://www.kde.org +Source: http://download.kde.org/stable/frameworks/%{_tar_path}/%{name}-%{version}.tar.xz +Source1: baselibs.conf +# PATCH-FIX-OPENSUSE fallbackLang.diff -- look for translations in locale/kf5 also +Patch0: fallbackLang.diff BuildRequires: cmake >= 3.0 BuildRequires: extra-cmake-modules >= %{_kf5_bugfix_version} BuildRequires: fdupes @@ -37,15 +45,6 @@ BuildRequires: cmake(Qt5Qml) >= 5.6.0 BuildRequires: cmake(Qt5Script) >= 5.6.0 BuildRequires: cmake(Qt5Test) >= 5.6.0 -Summary: KDE Gettext-based UI text internationalization -License: LGPL-2.1-or-later -Group: System/GUI/KDE -Url: http://www.kde.org -Source: http://download.kde.org/stable/frameworks/%{_tar_path}/%{name}-%{version}.tar.xz -Source1: baselibs.conf -# PATCH-FIX-OPENSUSE fallbackLang.diff -- look for translations in locale/kf5 also -Patch0: fallbackLang.diff -BuildRoot: %{_tmppath}/%{name}-%{version}-build %description KI18n provides functionality for internationalizing user interface text @@ -53,17 +52,17 @@ It wraps the standard Gettext functionality, so that the programmers and translators can use the familiar Gettext tools and workflows. -%package -n %lname +%package -n %{lname} Summary: KDE Gettext-based UI text internationalization Group: System/GUI/KDE +%requires_ge libQt5Core5 +%requires_ge libQt5Script5 Obsoletes: libKF5I18n4 %if %{with lang} -Recommends: %lname-lang = %{version} +Recommends: %{lname}-lang = %{version} %endif -%requires_ge libQt5Core5 -%requires_ge libQt5Script5 -%description -n %lname +%description -n %{lname} KI18n provides functionality for internationalizing user interface text in applications, based on the GNU Gettext translation system. It wraps the standard Gettext functionality, so that the programmers @@ -72,7 +71,7 @@ %package devel Summary: KDE Gettext-based UI text internationalization Group: Development/Libraries/KDE -Requires: %lname = %{version} +Requires: %{lname} = %{version} Requires: extra-cmake-modules Requires: gettext-runtime Requires: gettext-tools @@ -85,7 +84,8 @@ and translators can use the familiar Gettext tools and workflows. Development files. -%lang_package -n %lname +%lang_package -n %{lname} + %prep %setup -q %autopatch -p1 @@ -110,22 +110,21 @@ done %endif -%post -n %lname -p /sbin/ldconfig - -%postun -n %lname -p /sbin/ldconfig +%post -n %{lname} -p /sbin/ldconfig +%postun -n %{lname} -p /sbin/ldconfig %if %{with lang} -%files -n %lname-lang -f %{name}5.lang +%files -n %{lname}-lang -f %{name}5.lang %endif -%files -n %lname -%defattr(-,root,root) -%doc COPYING* README* +%files -n %{lname} +%license COPYING* +%doc README* %{_kf5_libdir}/libKF5I18n.so.* %{_kf5_plugindir}/ %files devel -%defattr(-,root,root) +%license COPYING* %{_kf5_libdir}/libKF5I18n.so %{_kf5_libdir}/cmake/KF5I18n/ %{_kf5_includedir}/ ++++++ fallbackLang.diff ++++++ --- /var/tmp/diff_new_pack.jGnLo3/_old 2018-08-24 16:53:34.937324477 +0200 +++ /var/tmp/diff_new_pack.jGnLo3/_new 2018-08-24 16:53:34.937324477 +0200 @@ -1,8 +1,8 @@ -Index: ki18n-5.36.0git.20170711T131800~4c95ac8/src/kcatalog.cpp -=================================================================== ---- ki18n-5.36.0git.20170711T131800~4c95ac8.orig/src/kcatalog.cpp -+++ ki18n-5.36.0git.20170711T131800~4c95ac8/src/kcatalog.cpp -@@ -117,9 +117,22 @@ KCatalog::~KCatalog() +diff --git a/src/kcatalog.cpp b/src/kcatalog.cpp +index 8b8feb3..98b393d 100644 +--- a/src/kcatalog.cpp ++++ b/src/kcatalog.cpp +@@ -118,9 +118,22 @@ KCatalog::~KCatalog() QString KCatalog::catalogLocaleDir(const QByteArray &domain, const QString &language) { @@ -26,24 +26,15 @@ { QMutexLocker lock(&catalogStaticData->mutex); const QString customLocaleDir = catalogStaticData->customCatalogDirs.value(domain); -@@ -130,22 +143,36 @@ QString KCatalog::catalogLocaleDir(const +@@ -137,7 +150,6 @@ QString KCatalog::catalogLocaleDir(const QByteArray &domain, QString file = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("locale/") + relpath); - QString localeDir; -- if (file.isEmpty()) { -- localeDir = QString(); -- } else { -+ if (!file.isEmpty()) { - // Path of the locale/ directory must be returned. - localeDir = QFileInfo(file.left(file.size() - relpath.size())).absolutePath(); -+ return localeDir; - } -+ // No translation around -+ localeDir = QString(); - return localeDir; - } - + if (!file.isEmpty()) { + #if defined(Q_OS_ANDROID) + // The exact file name must be returned on Android because libintl-lite loads a catalog by filename with bindtextdomain() +@@ -153,9 +165,23 @@ QString KCatalog::catalogLocaleDir(const QByteArray &domain, QSet<QString> KCatalog::availableCatalogLanguages(const QByteArray &domain_) { QString domain = QFile::decodeName(domain_); ++++++ ki18n-5.48.0.tar.xz -> ki18n-5.49.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ki18n-5.48.0/CMakeLists.txt new/ki18n-5.49.0/CMakeLists.txt --- old/ki18n-5.48.0/CMakeLists.txt 2018-07-08 00:31:00.000000000 +0200 +++ new/ki18n-5.49.0/CMakeLists.txt 2018-08-04 12:58:36.000000000 +0200 @@ -1,11 +1,11 @@ cmake_minimum_required(VERSION 3.0) -set(KF5_VERSION "5.48.0") # handled by release scripts +set(KF5_VERSION "5.49.0") # handled by release scripts project(KI18n VERSION ${KF5_VERSION}) # ECM setup include(FeatureSummary) -find_package(ECM 5.48.0 NO_MODULE) +find_package(ECM 5.49.0 NO_MODULE) set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://projects.kde.org/projects/kdesupport/extra-cmake-modules") feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES) @@ -46,12 +46,12 @@ PURPOSE "Needed for building KI18n unless glibc is the system libc implementation" ) -# KF5I18NMacros.cmake only needs to know the python executable path. -# Due to CMake caching the variables, and KF5I18NMacros being included by KF5I18nConfig, +# KF5I18nMacros.cmake only needs to know the python executable path. +# Due to CMake caching the variables, and KF5I18nMacros being included by KF5I18nConfig, # we have to hardcode the PYTHON_EXECUTABLE path or anything depending on KF5I18n # would be unable to find another Python version. find_package(PythonInterp REQUIRED) -configure_file(cmake/KF5I18NMacros.cmake.in ${KI18n_BINARY_DIR}/cmake/KF5I18NMacros.cmake @ONLY) +configure_file(cmake/KF5I18nMacros.cmake.in ${KI18n_BINARY_DIR}/cmake/KF5I18nMacros.cmake @ONLY) # Needed to build the ki18n translations and run the autotests file(COPY ${KI18n_SOURCE_DIR}/cmake/build-pofiles.cmake DESTINATION ${KI18n_BINARY_DIR}/cmake) file(COPY ${KI18n_SOURCE_DIR}/cmake/build-tsfiles.cmake DESTINATION ${KI18n_BINARY_DIR}/cmake) @@ -59,9 +59,9 @@ file(COPY ${KI18n_SOURCE_DIR}/cmake/kf5i18nuic.cmake DESTINATION ${KI18n_BINARY_DIR}/cmake) # usually is called using find_package(KF5I18n), -# KF5I18NMacros.cmake needs to know the scripts directory +# KF5I18nMacros.cmake needs to know the scripts directory set(KF5I18n_DIR ${CMAKE_CURRENT_LIST_DIR}/cmake) -include(${KI18n_BINARY_DIR}/cmake/KF5I18NMacros.cmake) +include(${KI18n_BINARY_DIR}/cmake/KF5I18nMacros.cmake) remove_definitions(-DQT_NO_CAST_FROM_BYTEARRAY) if(MSVC) @@ -79,6 +79,9 @@ add_subdirectory(autotests) endif() +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in" + "${CMAKE_CURRENT_BINARY_DIR}/src/config.h") + # create a Config.cmake and a ConfigVersion.cmake file and install them set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5I18n") @@ -108,7 +111,7 @@ DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5} COMPONENT Devel) install( FILES - ${KI18n_BINARY_DIR}/cmake/KF5I18NMacros.cmake + ${KI18n_BINARY_DIR}/cmake/KF5I18nMacros.cmake cmake/kf5i18nuic.cmake cmake/build-pofiles.cmake cmake/build-tsfiles.cmake diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ki18n-5.48.0/KF5I18nConfig.cmake.in new/ki18n-5.49.0/KF5I18nConfig.cmake.in --- old/ki18n-5.48.0/KF5I18nConfig.cmake.in 2018-07-08 00:31:00.000000000 +0200 +++ new/ki18n-5.49.0/KF5I18nConfig.cmake.in 2018-08-04 12:58:36.000000000 +0200 @@ -6,5 +6,5 @@ include("${CMAKE_CURRENT_LIST_DIR}/KF5I18nTargets.cmake") @PACKAGE_INCLUDE_QCHTARGETS@ -include("${CMAKE_CURRENT_LIST_DIR}/KF5I18NMacros.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/KF5I18nMacros.cmake") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ki18n-5.48.0/autotests/ki18n_install/CMakeLists.txt new/ki18n-5.49.0/autotests/ki18n_install/CMakeLists.txt --- old/ki18n-5.48.0/autotests/ki18n_install/CMakeLists.txt 2018-07-08 00:31:00.000000000 +0200 +++ new/ki18n-5.49.0/autotests/ki18n_install/CMakeLists.txt 2018-08-04 12:58:36.000000000 +0200 @@ -1,6 +1,6 @@ project(ki18n_install) cmake_minimum_required(VERSION 3.0) -include(KF5I18NMacros) +include(KF5I18nMacros) ki18n_install(${CMAKE_CURRENT_SOURCE_DIR}/po) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ki18n-5.48.0/autotests/klocalizedstringtest.cpp new/ki18n-5.49.0/autotests/klocalizedstringtest.cpp --- old/ki18n-5.48.0/autotests/klocalizedstringtest.cpp 2018-07-08 00:31:00.000000000 +0200 +++ new/ki18n-5.49.0/autotests/klocalizedstringtest.cpp 2018-08-04 12:58:36.000000000 +0200 @@ -41,6 +41,14 @@ KLocalizedString::setApplicationDomain("ki18n-test"); m_hasFrench = true; + m_hasCatalan = true; + + setlocale(LC_ALL, "ca_ES.utf8"); + if (setlocale(LC_ALL, nullptr) != QByteArray("ca_ES.utf8")) { + qDebug() << "Failed to set locale to ca_ES.utf8."; + m_hasCatalan = false; + } + if (m_hasFrench) { setlocale(LC_ALL, "fr_FR.utf8"); if (setlocale(LC_ALL, nullptr) != QByteArray("fr_FR.utf8")) { @@ -56,7 +64,10 @@ } QDir dataDir(m_tempDir.path()); if (m_hasFrench) { - m_hasFrench = compileCatalogs({QFINDTESTDATA("po/fr/ki18n-test.po"), QFINDTESTDATA("po/fr/ki18n-test-qt.po")}, dataDir); + m_hasFrench = compileCatalogs({QFINDTESTDATA("po/fr/ki18n-test.po"), QFINDTESTDATA("po/fr/ki18n-test-qt.po")}, dataDir, "fr"); + } + if (m_hasCatalan) { + m_hasCatalan = compileCatalogs({QFINDTESTDATA("po/ca/ki18n-test.po")}, dataDir, "ca"); } if (m_hasFrench) { qputenv("XDG_DATA_DIRS", @@ -76,9 +87,10 @@ #endif } -bool KLocalizedStringTest::compileCatalogs(const QStringList &testPoPaths, const QDir &dataDir) +bool KLocalizedStringTest::compileCatalogs(const QStringList &testPoPaths, const QDir &dataDir, const QString &lang) { - if (!dataDir.mkpath("locale/fr/LC_MESSAGES")) { + const QString lcMessages = QString("locale/%1/LC_MESSAGES").arg(lang); + if (!dataDir.mkpath(lcMessages)) { qDebug() << "Failed to create locale subdirectory " "inside temporary directory."; return false; @@ -93,8 +105,8 @@ int pos_2 = testPoPath.lastIndexOf(QLatin1Char('.')); QString domain = testPoPath.mid(pos_1 + 1, pos_2 - pos_1 - 1); QString testMoPath; - testMoPath = QString::fromLatin1("%1/locale/fr/LC_MESSAGES/%2.mo") - .arg(dataDir.path(), domain); + testMoPath = QString::fromLatin1("%1/%3/%2.mo") + .arg(dataDir.path(), domain, lcMessages); QProcess process; QStringList arguments; arguments << testPoPath << QLatin1String("-o") << testMoPath; @@ -438,6 +450,9 @@ QSet<QString> availableLanguages; availableLanguages.insert("fr"); availableLanguages.insert("en_US"); + if (m_hasCatalan) { + availableLanguages.insert("ca"); + } QCOMPARE(KLocalizedString::availableApplicationTranslations(), availableLanguages); } @@ -521,7 +536,7 @@ QSKIP("French test files not usable."); } QTemporaryDir dir; - compileCatalogs({QFINDTESTDATA("po/fr/ki18n-test2.po")}, dir.path()); + compileCatalogs({QFINDTESTDATA("po/fr/ki18n-test2.po")}, dir.path(), "fr"); KLocalizedString::addDomainLocaleDir("ki18n-test2", dir.path() + "/locale"); QSet<QString> expectedAvailableTranslations({"en_US", "fr"}); @@ -529,6 +544,28 @@ QCOMPARE(i18nd("ki18n-test2", "Cheese"), QString::fromUtf8("Fromage")); } +void KLocalizedStringTest::multipleLanguages() +{ + if (!m_hasFrench || !m_hasCatalan) { + QSKIP("French or Catalan test files not usable."); + } + KLocalizedString::setLanguages({"ca"}); + QCOMPARE(i18n("Job"), QString::fromUtf8("Job")); // This is not the actual catalan translation but who cares + KLocalizedString::setLanguages({"fr"}); + QCOMPARE(i18n("Job"), QString::fromUtf8("Tâche")); + KLocalizedString::setLanguages({"ca", "fr"}); + QCOMPARE(i18n("Job"), QString::fromUtf8("Job")); // This is not the actual catalan translation but who cares + + + KLocalizedString::setLanguages({"ca"}); + QCOMPARE(i18n("Loadable modules"), QString::fromUtf8("Loadable modules")); // The po doesn't have a translation so we get the English text + KLocalizedString::setLanguages({"fr"}); + QCOMPARE(i18n("Loadable modules"), QString::fromUtf8("Modules chargeables")); + KLocalizedString::setLanguages({"ca", "fr"}); + QCOMPARE(i18n("Loadable modules"), QString::fromUtf8("Modules chargeables")); // The Catalan po doesn't have a translation so we get the English text +} + + #include <QThreadPool> #include <QtConcurrentRun> #include <QFutureSynchronizer> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ki18n-5.48.0/autotests/klocalizedstringtest.h new/ki18n-5.49.0/autotests/klocalizedstringtest.h --- old/ki18n-5.48.0/autotests/klocalizedstringtest.h 2018-07-08 00:31:00.000000000 +0200 +++ new/ki18n-5.49.0/autotests/klocalizedstringtest.h 2018-08-04 12:58:36.000000000 +0200 @@ -40,11 +40,13 @@ void testLocalizedTranslator(); void semanticTags(); + void multipleLanguages(); private: bool m_hasFrench; + bool m_hasCatalan; QTemporaryDir m_tempDir; - bool compileCatalogs(const QStringList &catalogs, const QDir &dataDir); + bool compileCatalogs(const QStringList &catalogs, const QDir &dataDir, const QString &language); }; #endif // KLOCALIZEDSTRINGTEST_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ki18n-5.48.0/autotests/po/ca/ki18n-test.po new/ki18n-5.49.0/autotests/po/ca/ki18n-test.po --- old/ki18n-5.48.0/autotests/po/ca/ki18n-test.po 1970-01-01 01:00:00.000000000 +0100 +++ new/ki18n-5.49.0/autotests/po/ca/ki18n-test.po 2018-08-04 12:58:36.000000000 +0200 @@ -0,0 +1,21 @@ +msgid "" +msgstr "" +"Project-Id-Version: ki18n-test\n" +"POT-Creation-Date: 2012-01-01 00:00+0100\n" +"PO-Revision-Date: 2012-01-01 12:00+0100\n" +"Last-Translator: Catalunya <p...@qwyx123.cat>\n" +"Language-Team: Catalan <lal...@qwyx123.cat>\n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +# This is not a real Catalan translation, but +# who cares, it makes the test easier +msgid "Job" +msgstr "Job" + +# Untranslated on purpose +msgid "Loadable modules" +msgstr "" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ki18n-5.48.0/cmake/FindLibIntl.cmake new/ki18n-5.49.0/cmake/FindLibIntl.cmake --- old/ki18n-5.48.0/cmake/FindLibIntl.cmake 2018-07-08 00:31:00.000000000 +0200 +++ new/ki18n-5.49.0/cmake/FindLibIntl.cmake 2018-08-04 12:58:36.000000000 +0200 @@ -62,3 +62,7 @@ message(STATUS "libintl is a separate library.") find_package_handle_standard_args(LibIntl REQUIRED_VARS LibIntl_INCLUDE_DIRS LibIntl_LIBRARIES) endif() + +# make sure we have -Wl,--no-undefined here, otherwise this test will always pass +set(CMAKE_REQUIRED_LIBRARIES ${LibIntl_LIBRARIES} ${CMAKE_SHARED_LINKER_FLAGS}) +check_cxx_source_compiles("extern \"C\" int _nl_msg_cat_cntr; int main(void) { ++_nl_msg_cat_cntr; return 0; }" HAVE_NL_MSG_CAT_CNTR) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ki18n-5.48.0/cmake/KF5I18NMacros.cmake.in new/ki18n-5.49.0/cmake/KF5I18NMacros.cmake.in --- old/ki18n-5.48.0/cmake/KF5I18NMacros.cmake.in 2018-07-08 00:31:00.000000000 +0200 +++ new/ki18n-5.49.0/cmake/KF5I18NMacros.cmake.in 1970-01-01 01:00:00.000000000 +0100 @@ -1,190 +0,0 @@ - -# Copyright (c) 2006, Alexander Neundorf, <neund...@kde.org> -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. Neither the name of the University nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. - -find_package(Gettext REQUIRED) - -set(KI18N_PYTHON_EXECUTABLE "@PYTHON_EXECUTABLE@") - -set(_ki18n_pmap_compile_script ${CMAKE_CURRENT_LIST_DIR}/ts-pmap-compile.py) -set(_ki18n_uic_script ${CMAKE_CURRENT_LIST_DIR}/kf5i18nuic.cmake) -set(_ki18n_build_pofiles_script ${CMAKE_CURRENT_LIST_DIR}/build-pofiles.cmake) -set(_ki18n_build_tsfiles_script ${CMAKE_CURRENT_LIST_DIR}/build-tsfiles.cmake) - -#create the implementation files from the ui files and add them to the list of sources -#usage: KI18N_WRAP_UI(foo_SRCS ${ui_files}) -macro (KI18N_WRAP_UI _sources ) - foreach (_current_FILE ${ARGN}) - - get_filename_component(_tmp_FILE ${_current_FILE} ABSOLUTE) - get_filename_component(_basename ${_tmp_FILE} NAME_WE) - set(_header ${CMAKE_CURRENT_BINARY_DIR}/ui_${_basename}.h) - - get_target_property(QT_UIC_EXECUTABLE Qt5::uic LOCATION) - # we need to run uic and replace some things in the generated file - # this is done by executing the cmake script kf5i18nuic.cmake - add_custom_command(OUTPUT ${_header} - COMMAND ${CMAKE_COMMAND} - ARGS - -DKDE_UIC_EXECUTABLE:FILEPATH=${QT_UIC_EXECUTABLE} - -DKDE_UIC_FILE:FILEPATH=${_tmp_FILE} - -DKDE_UIC_H_FILE:FILEPATH=${_header} - -DKDE_UIC_BASENAME:STRING=${_basename} - -P ${_ki18n_uic_script} - MAIN_DEPENDENCY ${_tmp_FILE} - ) - set_source_files_properties(${_header} PROPERTIES SKIP_AUTOMOC ON) - list(APPEND ${_sources} ${_header}) - endforeach (_current_FILE) -endmacro (KI18N_WRAP_UI) - -# KI18N_INSTALL(podir) -# Search for .po files and scripting modules and install them to the standard -# location. -# -# This is a convenience function which relies on the following directory -# structure: -# -# <podir>/ -# <lang>/ -# scripts/ -# <domain>/ -# *.js -# *.po -# -# .po files are passed to build-pofiles.cmake -# -# .js files are installed using build-tsfiles.cmake -# -# For example, given the following directory structure: -# -# po/ -# fr/ -# scripts/ -# kfoo/ -# kfoo.js -# kfoo.po -# -# KI18N_INSTALL(po) does the following: -# - Compiles kfoo.po into kfoo.mo and installs it in -# ${LOCALE_INSTALL_DIR}/fr/LC_MESSAGES or share/locale/fr/LC_MESSAGES if -# ${LOCALE_INSTALL_DIR} is not set. -# - Installs kfoo.js in ${LOCALE_INSTALL_DIR}/fr/LC_SCRIPTS/kfoo -# -# KI18N_INSTALL_TS_FILES() is deprecated, use KI18N_INSTALL() -# -function(KI18N_INSTALL podir) - if (NOT LOCALE_INSTALL_DIR) - set(LOCALE_INSTALL_DIR share/locale) - endif() - - get_filename_component(dirname ${LOCALE_INSTALL_DIR} NAME) - get_filename_component(destname ${LOCALE_INSTALL_DIR} DIRECTORY) - - get_filename_component(absolute_podir ${podir} ABSOLUTE) - string(MD5 pathmd5 ${absolute_podir}) - - # Nothing to do if there's no podir and it would create an empty - # LOCALE_INSTALL_DIR in that case. - if (EXISTS "${absolute_podir}" AND IS_DIRECTORY "${absolute_podir}") - add_custom_target(pofiles-${pathmd5} ALL - COMMENT "Generating mo..." - COMMAND ${CMAKE_COMMAND} - -DGETTEXT_MSGFMT_EXECUTABLE=${GETTEXT_MSGFMT_EXECUTABLE} - -DCOPY_TO=${CMAKE_CURRENT_BINARY_DIR}/${dirname} - -DPO_DIR=${absolute_podir} - -P ${_ki18n_build_pofiles_script} - ) - add_custom_target(tsfiles-${pathmd5} ALL - COMMENT "Generating ts..." - COMMAND ${CMAKE_COMMAND} - -DPYTHON_EXECUTABLE=${KI18N_PYTHON_EXECUTABLE} - -D_ki18n_pmap_compile_script=${_ki18n_pmap_compile_script} - -DCOPY_TO=${CMAKE_CURRENT_BINARY_DIR}/${dirname} - -DPO_DIR=${absolute_podir} - -P ${_ki18n_build_tsfiles_script} - ) - - if (NOT TARGET pofiles) - add_custom_target(pofiles) - endif() - if (NOT TARGET tsfiles) - add_custom_target(tsfiles) - endif() - add_dependencies(pofiles pofiles-${pathmd5}) - add_dependencies(tsfiles tsfiles-${pathmd5}) - - file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${dirname}) - install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${dirname} DESTINATION ${destname}) - endif() -endfunction() - -#install the scripts for a given language in the target folder -#usage: KI18N_INSTALL_TS_FILES("ja" ${scripts_dir}) -function(KI18N_INSTALL_TS_FILES lang scripts_dir) - file(GLOB_RECURSE ts_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${scripts_dir}/*) - set(pmapc_files) - foreach(ts_file ${ts_files}) - string(REGEX MATCH "\\.svn/" in_svn ${ts_file}) - if(NOT in_svn) - # If ts_file is "path/to/foo/bar.js" - # We want subpath to contain "foo" - get_filename_component(subpath ${ts_file} DIRECTORY) - get_filename_component(subpath ${subpath} NAME) - install(FILES ${ts_file} - DESTINATION ${LOCALE_INSTALL_DIR}/${lang}/LC_SCRIPTS/${subpath}) - # If current file is a pmap, also install the compiled version. - get_filename_component(ts_ext ${ts_file} EXT) - if(ts_ext STREQUAL ".pmap") - set(pmap_file ${ts_file}) - get_filename_component(pmap_basename ${ts_file} NAME) - set(pmapc_basename "${pmap_basename}c") - set(pmapc_file "${lang}-${subpath}-${pmapc_basename}") - add_custom_command(OUTPUT ${pmapc_file} - COMMAND ${KI18N_PYTHON_EXECUTABLE} - ARGS - -B - ${_ki18n_pmap_compile_script} - ${CMAKE_CURRENT_SOURCE_DIR}/${pmap_file} - ${pmapc_file} - DEPENDS ${pmap_file}) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${pmapc_file} - DESTINATION ${LOCALE_INSTALL_DIR}/${lang}/LC_SCRIPTS/${subpath} - RENAME ${pmapc_basename}) - list(APPEND pmapc_files ${pmapc_file}) - endif() - endif() - endforeach() - if(pmapc_files) - if(NOT TARGET pmapfiles) - add_custom_target(pmapfiles) - endif() - set(pmapc_target "pmapfiles-${lang}") - string(REPLACE "@" "_" pmapc_target ${pmapc_target}) - add_custom_target(${pmapc_target} ALL DEPENDS ${pmapc_files}) - add_dependencies(pmapfiles ${pmapc_target}) - endif() -endfunction() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ki18n-5.48.0/cmake/KF5I18nMacros.cmake.in new/ki18n-5.49.0/cmake/KF5I18nMacros.cmake.in --- old/ki18n-5.48.0/cmake/KF5I18nMacros.cmake.in 1970-01-01 01:00:00.000000000 +0100 +++ new/ki18n-5.49.0/cmake/KF5I18nMacros.cmake.in 2018-08-04 12:58:36.000000000 +0200 @@ -0,0 +1,197 @@ + +# Copyright (c) 2006, Alexander Neundorf, <neund...@kde.org> +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of the University nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +find_package(Gettext REQUIRED) + +# The Python executable used for building ki18n will be used as a fallback +# solution if it cannot be found in $PATH when building applications. +set(_KI18N_PYTHON_EXECUTABLE "@PYTHON_EXECUTABLE@") + +find_program(KI18N_PYTHON_EXECUTABLE NAMES python3 python2 python) +if(NOT KI18N_PYTHON_EXECUTABLE) + set(KI18N_PYTHON_EXECUTABLE "${_KI18N_PYTHON_EXECUTABLE}") +endif() + +set(_ki18n_pmap_compile_script ${CMAKE_CURRENT_LIST_DIR}/ts-pmap-compile.py) +set(_ki18n_uic_script ${CMAKE_CURRENT_LIST_DIR}/kf5i18nuic.cmake) +set(_ki18n_build_pofiles_script ${CMAKE_CURRENT_LIST_DIR}/build-pofiles.cmake) +set(_ki18n_build_tsfiles_script ${CMAKE_CURRENT_LIST_DIR}/build-tsfiles.cmake) + +#create the implementation files from the ui files and add them to the list of sources +#usage: KI18N_WRAP_UI(foo_SRCS ${ui_files}) +macro (KI18N_WRAP_UI _sources ) + foreach (_current_FILE ${ARGN}) + + get_filename_component(_tmp_FILE ${_current_FILE} ABSOLUTE) + get_filename_component(_basename ${_tmp_FILE} NAME_WE) + set(_header ${CMAKE_CURRENT_BINARY_DIR}/ui_${_basename}.h) + + get_target_property(QT_UIC_EXECUTABLE Qt5::uic LOCATION) + # we need to run uic and replace some things in the generated file + # this is done by executing the cmake script kf5i18nuic.cmake + add_custom_command(OUTPUT ${_header} + COMMAND ${CMAKE_COMMAND} + ARGS + -DKDE_UIC_EXECUTABLE:FILEPATH=${QT_UIC_EXECUTABLE} + -DKDE_UIC_FILE:FILEPATH=${_tmp_FILE} + -DKDE_UIC_H_FILE:FILEPATH=${_header} + -DKDE_UIC_BASENAME:STRING=${_basename} + -P ${_ki18n_uic_script} + MAIN_DEPENDENCY ${_tmp_FILE} + ) + set_source_files_properties(${_header} PROPERTIES SKIP_AUTOMOC ON) + list(APPEND ${_sources} ${_header}) + endforeach (_current_FILE) +endmacro (KI18N_WRAP_UI) + +# KI18N_INSTALL(podir) +# Search for .po files and scripting modules and install them to the standard +# location. +# +# This is a convenience function which relies on the following directory +# structure: +# +# <podir>/ +# <lang>/ +# scripts/ +# <domain>/ +# *.js +# *.po +# +# .po files are passed to build-pofiles.cmake +# +# .js files are installed using build-tsfiles.cmake +# +# For example, given the following directory structure: +# +# po/ +# fr/ +# scripts/ +# kfoo/ +# kfoo.js +# kfoo.po +# +# KI18N_INSTALL(po) does the following: +# - Compiles kfoo.po into kfoo.mo and installs it in +# ${LOCALE_INSTALL_DIR}/fr/LC_MESSAGES or share/locale/fr/LC_MESSAGES if +# ${LOCALE_INSTALL_DIR} is not set. +# - Installs kfoo.js in ${LOCALE_INSTALL_DIR}/fr/LC_SCRIPTS/kfoo +# +# KI18N_INSTALL_TS_FILES() is deprecated, use KI18N_INSTALL() +# +function(KI18N_INSTALL podir) + if (NOT LOCALE_INSTALL_DIR) + set(LOCALE_INSTALL_DIR share/locale) + endif() + + get_filename_component(dirname ${LOCALE_INSTALL_DIR} NAME) + get_filename_component(destname ${LOCALE_INSTALL_DIR} DIRECTORY) + + get_filename_component(absolute_podir ${podir} ABSOLUTE) + string(MD5 pathmd5 ${absolute_podir}) + + # Nothing to do if there's no podir and it would create an empty + # LOCALE_INSTALL_DIR in that case. + if (EXISTS "${absolute_podir}" AND IS_DIRECTORY "${absolute_podir}") + add_custom_target(pofiles-${pathmd5} ALL + COMMENT "Generating mo..." + COMMAND ${CMAKE_COMMAND} + -DGETTEXT_MSGFMT_EXECUTABLE=${GETTEXT_MSGFMT_EXECUTABLE} + -DCOPY_TO=${CMAKE_CURRENT_BINARY_DIR}/${dirname} + -DPO_DIR=${absolute_podir} + -P ${_ki18n_build_pofiles_script} + ) + add_custom_target(tsfiles-${pathmd5} ALL + COMMENT "Generating ts..." + COMMAND ${CMAKE_COMMAND} + -DPYTHON_EXECUTABLE=${KI18N_PYTHON_EXECUTABLE} + -D_ki18n_pmap_compile_script=${_ki18n_pmap_compile_script} + -DCOPY_TO=${CMAKE_CURRENT_BINARY_DIR}/${dirname} + -DPO_DIR=${absolute_podir} + -P ${_ki18n_build_tsfiles_script} + ) + + if (NOT TARGET pofiles) + add_custom_target(pofiles) + endif() + if (NOT TARGET tsfiles) + add_custom_target(tsfiles) + endif() + add_dependencies(pofiles pofiles-${pathmd5}) + add_dependencies(tsfiles tsfiles-${pathmd5}) + + file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${dirname}) + install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${dirname} DESTINATION ${destname}) + endif() +endfunction() + +#install the scripts for a given language in the target folder +#usage: KI18N_INSTALL_TS_FILES("ja" ${scripts_dir}) +function(KI18N_INSTALL_TS_FILES lang scripts_dir) + file(GLOB_RECURSE ts_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${scripts_dir}/*) + set(pmapc_files) + foreach(ts_file ${ts_files}) + string(REGEX MATCH "\\.svn/" in_svn ${ts_file}) + if(NOT in_svn) + # If ts_file is "path/to/foo/bar.js" + # We want subpath to contain "foo" + get_filename_component(subpath ${ts_file} DIRECTORY) + get_filename_component(subpath ${subpath} NAME) + install(FILES ${ts_file} + DESTINATION ${LOCALE_INSTALL_DIR}/${lang}/LC_SCRIPTS/${subpath}) + # If current file is a pmap, also install the compiled version. + get_filename_component(ts_ext ${ts_file} EXT) + if(ts_ext STREQUAL ".pmap") + set(pmap_file ${ts_file}) + get_filename_component(pmap_basename ${ts_file} NAME) + set(pmapc_basename "${pmap_basename}c") + set(pmapc_file "${lang}-${subpath}-${pmapc_basename}") + add_custom_command(OUTPUT ${pmapc_file} + COMMAND ${KI18N_PYTHON_EXECUTABLE} + ARGS + -B + ${_ki18n_pmap_compile_script} + ${CMAKE_CURRENT_SOURCE_DIR}/${pmap_file} + ${pmapc_file} + DEPENDS ${pmap_file}) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${pmapc_file} + DESTINATION ${LOCALE_INSTALL_DIR}/${lang}/LC_SCRIPTS/${subpath} + RENAME ${pmapc_basename}) + list(APPEND pmapc_files ${pmapc_file}) + endif() + endif() + endforeach() + if(pmapc_files) + if(NOT TARGET pmapfiles) + add_custom_target(pmapfiles) + endif() + set(pmapc_target "pmapfiles-${lang}") + string(REPLACE "@" "_" pmapc_target ${pmapc_target}) + add_custom_target(${pmapc_target} ALL DEPENDS ${pmapc_files}) + add_dependencies(pmapfiles ${pmapc_target}) + endif() +endfunction() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ki18n-5.48.0/po/pt/ki18n5.po new/ki18n-5.49.0/po/pt/ki18n5.po --- old/ki18n-5.48.0/po/pt/ki18n5.po 2018-07-08 00:31:00.000000000 +0200 +++ new/ki18n-5.49.0/po/pt/ki18n5.po 2018-08-04 12:58:36.000000000 +0200 @@ -485,7 +485,7 @@ #, kde-format msgctxt "tag-format-pattern <para> rich" msgid "<p>%1</p>" -msgstr "<b>%1</b>" +msgstr "<p>%1</p>" #. i18n: KUIT pattern, see the comment to the first of these entries above. #: kuitmarkup.cpp:778 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ki18n-5.48.0/po/uk/ki18n5.po new/ki18n-5.49.0/po/uk/ki18n5.po --- old/ki18n-5.48.0/po/uk/ki18n5.po 2018-07-08 00:31:00.000000000 +0200 +++ new/ki18n-5.49.0/po/uk/ki18n5.po 2018-08-04 12:58:36.000000000 +0200 @@ -1,5 +1,5 @@ # Translation of ki18n5.po to Ukrainian -# Copyright (C) 2014 This_file_is_part_of_KDE +# Copyright (C) 2018 This_file_is_part_of_KDE # This file is distributed under the license LGPL version 2.1 or # version 3 or later versions approved by the membership of KDE e.V. # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ki18n-5.48.0/po/zh_CN/ki18n5.po new/ki18n-5.49.0/po/zh_CN/ki18n5.po --- old/ki18n-5.48.0/po/zh_CN/ki18n5.po 2018-07-08 00:31:00.000000000 +0200 +++ new/ki18n-5.49.0/po/zh_CN/ki18n5.po 2018-08-04 12:58:36.000000000 +0200 @@ -16,7 +16,7 @@ "Project-Id-Version: kdeorg\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" "POT-Creation-Date: 2018-04-29 03:26+0200\n" -"PO-Revision-Date: 2018-07-03 17:35\n" +"PO-Revision-Date: 2018-07-24 08:41\n" "Last-Translator: guoyunhebrave <guoyunhebr...@gmail.com>\n" "Language-Team: Chinese Simplified\n" "Language: zh_CN\n" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ki18n-5.48.0/src/config.h.in new/ki18n-5.49.0/src/config.h.in --- old/ki18n-5.48.0/src/config.h.in 1970-01-01 01:00:00.000000000 +0100 +++ new/ki18n-5.49.0/src/config.h.in 2018-08-04 12:58:36.000000000 +0200 @@ -0,0 +1,25 @@ +/* This file is part of the KDE libraries + Copyright (c) 2016 A. Wilcox <awil...@adelielinux.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef KI18N_CONFIG_H +#define KI18N_CONFIG_H + +#cmakedefine HAVE_NL_MSG_CAT_CNTR + +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ki18n-5.48.0/src/kcatalog.cpp new/ki18n-5.49.0/src/kcatalog.cpp --- old/ki18n-5.48.0/src/kcatalog.cpp 2018-07-08 00:31:00.000000000 +0200 +++ new/ki18n-5.49.0/src/kcatalog.cpp 2018-08-04 12:58:36.000000000 +0200 @@ -21,6 +21,7 @@ #include <stdlib.h> #include <locale.h> #include "gettext.h" +#include "config.h" #include <qstandardpaths.h> #include <QByteArray> @@ -41,7 +42,7 @@ #endif #endif -#if defined(__USE_GNU_GETTEXT) +#if defined(HAVE_NL_MSG_CAT_CNTR) extern "C" int Q_DECL_IMPORT _nl_msg_cat_cntr; #endif @@ -123,19 +124,28 @@ { QMutexLocker lock(&catalogStaticData->mutex); const QString customLocaleDir = catalogStaticData->customCatalogDirs.value(domain); - if (!customLocaleDir.isEmpty() && QFileInfo::exists(customLocaleDir + QLatin1Char('/') + relpath)) { + const QString filename = customLocaleDir + QLatin1Char('/') + relpath; + if (!customLocaleDir.isEmpty() && QFileInfo::exists(filename)) { +#if defined(Q_OS_ANDROID) + // The exact file name must be returned on Android because libintl-lite loads a catalog by filename with bindtextdomain() + return filename; +#else return customLocaleDir; +#endif } } QString file = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("locale/") + relpath); QString localeDir; - if (file.isEmpty()) { - localeDir = QString(); - } else { + if (!file.isEmpty()) { +#if defined(Q_OS_ANDROID) + // The exact file name must be returned on Android because libintl-lite loads a catalog by filename with bindtextdomain() + localeDir = file; +#else // Path of the locale/ directory must be returned. localeDir = QFileInfo(file.left(file.size() - relpath.size())).absolutePath(); +#endif } return localeDir; } @@ -190,9 +200,9 @@ //qDebug() << "bindtextdomain" << domain << localeDir; bindtextdomain(domain, localeDir); +#if defined(HAVE_NL_MSG_CAT_CNTR) // Magic to make sure GNU Gettext doesn't use stale cached translation // from previous language. -#if defined(__USE_GNU_GETTEXT) ++_nl_msg_cat_cntr; #endif } @@ -210,9 +220,10 @@ if (!d->localeDir.isEmpty()) { QMutexLocker locker(&catalogStaticData()->mutex); d->setupGettextEnv(); - const char *msgstr = dgettext(d->domain.constData(), msgid.constData()); + const char *msgid_char = msgid.constData(); + const char *msgstr = dgettext(d->domain.constData(), msgid_char); d->resetSystemLanguage(); - return msgstr != msgid + return msgstr != msgid_char // Yes we want pointer comparison ? QString::fromUtf8(msgstr) : QString(); } else { @@ -226,9 +237,10 @@ if (!d->localeDir.isEmpty()) { QMutexLocker locker(&catalogStaticData()->mutex); d->setupGettextEnv(); - const char *msgstr = dpgettext_expr(d->domain.constData(), msgctxt.constData(), msgid.constData()); + const char *msgid_char = msgid.constData(); + const char *msgstr = dpgettext_expr(d->domain.constData(), msgctxt.constData(), msgid_char); d->resetSystemLanguage(); - return msgstr != msgid + return msgstr != msgid_char // Yes we want pointer comparison ? QString::fromUtf8(msgstr) : QString(); } else { @@ -243,14 +255,16 @@ if (!d->localeDir.isEmpty()) { QMutexLocker locker(&catalogStaticData()->mutex); d->setupGettextEnv(); - const char *msgstr = dngettext(d->domain.constData(), msgid.constData(), msgid_plural.constData(), n); + const char *msgid_char = msgid.constData(); + const char *msgid_plural_char = msgid_plural.constData(); + const char *msgstr = dngettext(d->domain.constData(), msgid_char, msgid_plural_char, n); d->resetSystemLanguage(); // If original and translation are same, dngettext will return // the original pointer, which is generally fine, except in // the corner cases where e.g. msgstr[1] is same as msgid. // Therefore check for pointer difference only with msgid or // only with msgid_plural, and not with both. - return (n == 1 && msgstr != msgid) || (n != 1 && msgstr != msgid_plural) + return (n == 1 && msgstr != msgid_char) || (n != 1 && msgstr != msgid_plural_char) ? QString::fromUtf8(msgstr) : QString(); } else { @@ -266,9 +280,11 @@ if (!d->localeDir.isEmpty()) { QMutexLocker locker(&catalogStaticData()->mutex); d->setupGettextEnv(); - const char *msgstr = dnpgettext_expr(d->domain.constData(), msgctxt.constData(), msgid.constData(), msgid_plural.constData(), n); + const char *msgid_char = msgid.constData(); + const char *msgid_plural_char = msgid_plural.constData(); + const char *msgstr = dnpgettext_expr(d->domain.constData(), msgctxt.constData(), msgid_char, msgid_plural_char, n); d->resetSystemLanguage(); - return (n == 1 && msgstr != msgid) || (n != 1 && msgstr != msgid_plural) + return (n == 1 && msgstr != msgid_char) || (n != 1 && msgstr != msgid_plural_char) ? QString::fromUtf8(msgstr) : QString(); } else { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ki18n-5.48.0/src/klocalizedstring.cpp new/ki18n-5.49.0/src/klocalizedstring.cpp --- old/ki18n-5.48.0/src/klocalizedstring.cpp 2018-07-08 00:31:00.000000000 +0200 +++ new/ki18n-5.49.0/src/klocalizedstring.cpp 2018-08-04 12:58:36.000000000 +0200 @@ -140,7 +140,7 @@ } } -#ifndef Q_OS_UNIX +#if !defined(Q_OS_UNIX) || defined(Q_OS_ANDROID) static void appendLanguagesFromQLocale(QStringList &languages, const QLocale &locale) { const QStringList uiLangs = locale.uiLanguages(); @@ -363,7 +363,7 @@ appendLanguagesFromVariable(localeLanguages, "LC_ALL"); appendLanguagesFromVariable(localeLanguages, "LC_MESSAGES"); appendLanguagesFromVariable(localeLanguages, "LANG"); -#ifndef Q_OS_UNIX +#if !defined(Q_OS_UNIX) || defined(Q_OS_ANDROID) // For non UNIX platforms the environment variables might not // suffice so we add system locale UI languages, too. appendLanguagesFromQLocale(localeLanguages, QLocale::system()); @@ -1313,15 +1313,7 @@ QSet<QString> KLocalizedString::availableApplicationTranslations() { - KLocalizedStringPrivateStatics *s = staticsKLSP(); - QSet<QString> availableLanguages; - QByteArray domain = s->applicationDomain; - if (!domain.isEmpty()) { - availableLanguages = KCatalog::availableCatalogLanguages(domain); - availableLanguages.insert(s->codeLanguage); - } - - return availableLanguages; + return availableDomainTranslations(staticsKLSP()->applicationDomain); } QSet<QString> KLocalizedString::availableDomainTranslations(const QByteArray &domain)