From db30d294cb1cea28eb2bf9ba3fcc445783b7f6b1 Mon Sep 17 00:00:00 2001 From: Julien Cabieces Date: Thu, 7 Dec 2023 11:51:06 +0100 Subject: [PATCH] [PyQt6] make translations work with both Qt 6 and 5 --- i18n/CMakeLists.txt | 5 ++++- scripts/{ts2appinfo.py => ts2appinfo.py.in} | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) rename scripts/{ts2appinfo.py => ts2appinfo.py.in} (97%) diff --git a/i18n/CMakeLists.txt b/i18n/CMakeLists.txt index 1aa23217d96..d1eff5aca13 100644 --- a/i18n/CMakeLists.txt +++ b/i18n/CMakeLists.txt @@ -27,12 +27,15 @@ set(TS_FILES qgis_ar.ts qgis_az.ts qgis_bg.ts qgis_bs.ts qgis_ca.ts qgis_cs.ts q ADD_TRANSLATION_FILES (QM_FILES ${TS_FILES}) +# TODO QGIS 4.0: remove configure and call directly script +configure_file(${CMAKE_SOURCE_DIR}/scripts/ts2appinfo.py.in ${CMAKE_BINARY_DIR}/ts2appinfo.py) + if (UNIX AND NOT APPLE AND PYQT_FOUND) add_custom_command( OUTPUT ${CMAKE_BINARY_DIR}/org.qgis.qgis.desktop ${CMAKE_BINARY_DIR}/org.qgis.qgis.appdata.xml WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" COMMAND ${Python_EXECUTABLE} - ARGS ${CMAKE_SOURCE_DIR}/scripts/ts2appinfo.py "${CMAKE_BINARY_DIR}" + ARGS ${CMAKE_BINARY_DIR}/ts2appinfo.py "${CMAKE_BINARY_DIR}" COMMENT "Updating appinfo files..." DEPENDS ${QM_FILES} ${CMAKE_SOURCE_DIR}/linux/org.qgis.qgis.desktop.in ${CMAKE_SOURCE_DIR}/linux/org.qgis.qgis.appdata.xml.in ) diff --git a/scripts/ts2appinfo.py b/scripts/ts2appinfo.py.in similarity index 97% rename from scripts/ts2appinfo.py rename to scripts/ts2appinfo.py.in index ad602a9c4ff..92018f59912 100644 --- a/scripts/ts2appinfo.py +++ b/scripts/ts2appinfo.py.in @@ -22,7 +22,7 @@ import sys import os from glob import glob from xml.etree import ElementTree as et -from PyQt5.QtCore import QCoreApplication, QTranslator +from PyQt@PYQT_VERSION_MAJOR@.QtCore import QCoreApplication, QTranslator strings = {}