From 0d961ecbdf176fd4fe91c19b5479195e87ec5899 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Mon, 24 Sep 2018 12:57:15 +0200 Subject: Android: Make sure Qm translations get loaded Summary: Use a similar strategy as D14528 to find qm files. Test Plan: Analitza parts of KAlgebra are translated too. Reviewers: #frameworks, aacid Reviewed By: aacid Subscribers: svuorela, aacid, kde-frameworks-devel, kde-buildsystem Tags: #frameworks, #build_system Differential Revision: https://phabricator.kde.org/D14529 --- modules/ECMQmLoader.cpp.in | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/ECMQmLoader.cpp.in b/modules/ECMQmLoader.cpp.in index f636ecc4..003512d1 100644 --- a/modules/ECMQmLoader.cpp.in +++ b/modules/ECMQmLoader.cpp.in @@ -35,16 +35,25 @@ #include #include #include +#include namespace { bool loadTranslation(const QString &localeDirName) { QString subPath = QStringLiteral("locale/") + localeDirName + QStringLiteral("/LC_MESSAGES/@QM_LOADER_CATALOG_NAME@.qm"); - QString fullPath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, subPath); + +#if defined(Q_OS_ANDROID) + const QString fullPath = QDir::homePath()+QStringLiteral("/../qt-reserved-files/share/") + subPath; + if (!QFile::exists(fullPath)) { + return false; + } +#else + const QString fullPath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, subPath); if (fullPath.isEmpty()) { return false; } +#endif QTranslator *translator = new QTranslator(QCoreApplication::instance()); if (!translator->load(fullPath)) { delete translator; -- cgit v1.2.1