gpxlab: fix localization

(cherry picked from commit b931540229865e96ed515f0a041960c45a3069c2)
This commit is contained in:
Nikolay Korotkiy 2021-05-22 13:24:38 +03:00 committed by Bjørn Forsman
parent 4a6b102088
commit 3e1e2b277f
2 changed files with 27 additions and 5 deletions

View File

@ -1,4 +1,6 @@
{ stdenv, mkDerivation, lib, fetchFromGitHub, qmake, qttools, qttranslations }:
{ stdenv, mkDerivation, lib, fetchFromGitHub, substituteAll
, qmake, qttools, qttranslations
}:
mkDerivation rec {
pname = "gpxlab";
@ -11,8 +13,13 @@ mkDerivation rec {
sha256 = "080vnwcciqblfrbfyz9gjhl2lqw1hkdpbgr5qfrlyglkd4ynjd84";
};
nativeBuildInputs = [ qmake ];
buildInputs = [ qttools qttranslations ];
patches = (substituteAll {
# See https://github.com/NixOS/nixpkgs/issues/86054
src = ./fix-qttranslations-path.patch;
inherit qttranslations;
});
nativeBuildInputs = [ qmake qttools ];
preConfigure = ''
lrelease GPXLab/locale/*.ts
@ -24,8 +31,6 @@ mkDerivation rec {
wrapQtApp $out/Applications/GPXLab.app/Contents/MacOS/GPXLab
'';
enableParallelBuilding = true;
meta = with lib; {
homepage = "https://github.com/BourgeoisLab/GPXLab";
description = "Program to show and manipulate GPS tracks";

View File

@ -0,0 +1,17 @@
diff --git i/GPXLab/main.cpp w/GPXLab/main.cpp
index b12d2dd..58d37c5 100644
--- i/GPXLab/main.cpp
+++ w/GPXLab/main.cpp
@@ -19,10 +19,10 @@ int main(int argc, char *argv[])
app.installTranslator(&gpxlab);
QTranslator qt;
-#if defined(Q_OS_WIN32) || defined(Q_OS_MAC)
+#if defined(Q_OS_WIN32)
qt.load(QLocale::system(), "qt", "_", TRANSLATIONS_DIR);
#else
- qt.load(QLocale::system(), "qt", "_", QLibraryInfo::location(QLibraryInfo::TranslationsPath));
+ qt.load(QLocale::system(), "qt", "_", QLatin1String("@qttranslations@/translations"));
#endif
app.installTranslator(&qt);