File Fix-translation-lookup-in-stock-Linux-deployments.patch of Package kseexpr

From 27355bcea93bab88954188cd53f1dce2796a0a49 Mon Sep 17 00:00:00 2001
From: "L. E. Segovia" <amy@amyspark.me>
Date: Tue, 1 Dec 2020 01:23:31 +0000
Subject: [PATCH] Fix translation lookup in stock Linux deployments

BUG: 429782
---
 src/KSeExprUI/ECMQmLoader-seexpr2_qt.cpp | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/KSeExprUI/ECMQmLoader-seexpr2_qt.cpp b/src/KSeExprUI/ECMQmLoader-seexpr2_qt.cpp
index 0bddaf2..6781bdf 100644
--- a/src/KSeExprUI/ECMQmLoader-seexpr2_qt.cpp
+++ b/src/KSeExprUI/ECMQmLoader-seexpr2_qt.cpp
@@ -35,9 +35,13 @@ namespace {
             return false;
         }
 #else
-        const QString fullPath = QStandardPaths::locate(QStandardPaths::DataLocation, subPath);
+        // Use application's own data directory (e.g. Krita on AppImage, Windows)
+        QString fullPath = QStandardPaths::locate(QStandardPaths::DataLocation, subPath);
         if (fullPath.isEmpty()) {
-            return false;
+            // Try falling back to stock folder
+            fullPath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, subPath);
+            if (fullPath.isEmpty())
+                return false;
         }
 #endif
         QTranslator *translator = new QTranslator(QCoreApplication::instance());
@@ -61,7 +65,8 @@ namespace {
 #if defined(Q_OS_ANDROID)
         const auto paths = QStringLiteral("assets:/share/");
 #else
-        const auto paths = QStandardPaths::standardLocations(QStandardPaths::DataLocation);
+        auto paths = QStandardPaths::standardLocations(QStandardPaths::DataLocation);
+        paths << QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation);
 #endif
         dbgSeExpr << "Base paths for translations: " << paths;
 
-- 
GitLab

openSUSE Build Service is sponsored by