Merge pull request #145470 from sikmir/qmapshack
qmapshack: fix localization
This commit is contained in:
commit
f529b6f954
2 changed files with 84 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
|||
{ mkDerivation, lib, fetchFromGitHub, cmake
|
||||
, qtscript, qtwebengine, gdal, proj, routino, quazip }:
|
||||
{ mkDerivation, lib, fetchFromGitHub, cmake, substituteAll
|
||||
, qtscript, qttranslations, qtwebengine, gdal, proj, routino, quazip }:
|
||||
|
||||
mkDerivation rec {
|
||||
pname = "qmapshack";
|
||||
|
@ -12,6 +12,14 @@ mkDerivation rec {
|
|||
sha256 = "1yzgkdjxwyg8ggbxyjwr0zjrx99ckrbz2p2524iii9i7qqn8wfsx";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# See https://github.com/NixOS/nixpkgs/issues/86054
|
||||
(substituteAll {
|
||||
src = ./fix-qttranslations-path.patch;
|
||||
inherit qttranslations;
|
||||
})
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
|
||||
buildInputs = [ qtscript qtwebengine gdal proj routino quazip ];
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
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
|
||||
|
Loading…
Reference in a new issue