nixpkgs/pkgs/applications/gis/qmapshack/fix-qttranslations-path.patch
2021-11-12 12:26:48 +03:00

74 lines
3.6 KiB
Diff

diff --git i/src/qmapshack/setup/CAppSetupLinux.cpp w/src/qmapshack/setup/CAppSetupLinux.cpp
index 63ea06c0..3a03b816 100644
--- i/src/qmapshack/setup/CAppSetupLinux.cpp
+++ w/src/qmapshack/setup/CAppSetupLinux.cpp
@@ -30,7 +30,7 @@ void CAppSetupLinux::initQMapShack()
prepareGdal("", "");
// setup translators
- QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
+ QLatin1String resourceDir = QLatin1String("@qttranslations@/translations");
QString translationPath = QCoreApplication::applicationDirPath();
translationPath.replace(QRegExp("bin$"), "share/qmapshack/translations");
prepareTranslator(resourceDir, "qt_");
diff --git i/src/qmapshack/setup/CAppSetupMac.cpp w/src/qmapshack/setup/CAppSetupMac.cpp
index ad9b21e9..9dca8a1e 100644
--- i/src/qmapshack/setup/CAppSetupMac.cpp
+++ w/src/qmapshack/setup/CAppSetupMac.cpp
@@ -63,7 +63,7 @@ void CAppSetupMac::initQMapShack()
// setup translators
QString translationPath = getApplicationDir(relTranslationDir).absolutePath();
- prepareTranslator(translationPath, "qt_");
+ prepareTranslator(QLatin1String("@qttranslations@/translations"), "qt_");
prepareTranslator(translationPath, "qmapshack_");
// load and apply style sheet
diff --git i/src/qmaptool/setup/CAppSetupLinux.cpp w/src/qmaptool/setup/CAppSetupLinux.cpp
index dea1c4f3..8da95574 100644
--- i/src/qmaptool/setup/CAppSetupLinux.cpp
+++ w/src/qmaptool/setup/CAppSetupLinux.cpp
@@ -29,7 +29,7 @@ void CAppSetupLinux::initQMapTool()
prepareGdal("", "");
// setup translators
- QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
+ QLatin1String resourceDir = QLatin1String("@qttranslations@/translations");
QString translationPath = QCoreApplication::applicationDirPath();
translationPath.replace(QRegExp("bin$"), "share/qmaptool/translations");
prepareTranslator(resourceDir, "qt_");
diff --git i/src/qmaptool/setup/CAppSetupMac.cpp w/src/qmaptool/setup/CAppSetupMac.cpp
index 02b27e07..fae27748 100644
--- i/src/qmaptool/setup/CAppSetupMac.cpp
+++ w/src/qmaptool/setup/CAppSetupMac.cpp
@@ -64,7 +64,7 @@ void CAppSetupMac::initQMapTool()
// setup translators
QString translationPath = getApplicationDir(relTranslationDir).absolutePath();
- prepareTranslator(translationPath, "qt_");
+ prepareTranslator(QLatin1String("@qttranslations@/translations"), "qt_");
prepareTranslator(translationPath, "qmaptool_");
migrateDirContent(defaultCachePath());
diff --git i/src/qmt_rgb2pct/main.cpp w/src/qmt_rgb2pct/main.cpp
index 21267d03..d539cec8 100644
--- i/src/qmt_rgb2pct/main.cpp
+++ w/src/qmt_rgb2pct/main.cpp
@@ -50,7 +50,7 @@ static void prepareTranslator(QString translationPath, QString translationPrefix
static void loadTranslations()
{
#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) || defined(__FreeBSD_kernel__) || defined(__GNU__) || defined(Q_OS_CYGWIN)
- QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
+ QLatin1String resourceDir = QLatin1String("@qttranslations@/translations");
QString translationPath = QCoreApplication::applicationDirPath();
translationPath.replace(QRegExp("bin$"), "share/" APP_STR "/translations");
prepareTranslator(resourceDir, "qt_");
@@ -61,7 +61,7 @@ static void loadTranslations()
// os x
static QString relTranslationDir = "Resources/translations"; // app
QString translationPath = getApplicationDir(relTranslationDir).absolutePath();
- prepareTranslator(translationPath, "qt_");
+ prepareTranslator(QLatin1String("@qttranslations@/translations"), "qt_");
prepareTranslator(translationPath, APP_STR "_");
#endif