From 1167001b0b742b6cc34a4d15857df4ee0cd01af9 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Thu, 25 Jan 2018 11:17:53 +0100 Subject: [PATCH] don't autmatically run translations compiler instead add a manual "translations" target --- debian/guh-translations.install | 1 + debian/rules | 2 +- guh.pro | 20 ++++++++++++++++++- plugins/guh-generateplugininfo | 7 ------- plugins/mock/mock.pro | 4 ---- ...4a9a-c187-446f-aadf-f1b2220607d1-de_DE.ts} | 0 ...4a9a-c187-446f-aadf-f1b2220607d1-en_US.ts} | 0 plugins/plugins.pri | 18 ++++------------- server/server.pro | 20 ------------------- 9 files changed, 25 insertions(+), 47 deletions(-) rename plugins/mock/translations/{de_DE.ts => 727a4a9a-c187-446f-aadf-f1b2220607d1-de_DE.ts} (100%) rename plugins/mock/translations/{en_US.ts => 727a4a9a-c187-446f-aadf-f1b2220607d1-en_US.ts} (100%) diff --git a/debian/guh-translations.install b/debian/guh-translations.install index e513e702..489b5881 100644 --- a/debian/guh-translations.install +++ b/debian/guh-translations.install @@ -1,2 +1,3 @@ translations/*.qm usr/share/guh/translations +plugins/mock/translations/*.qm usr/share/guh/translations diff --git a/debian/rules b/debian/rules index 19de33ef..90284b86 100755 --- a/debian/rules +++ b/debian/rules @@ -11,7 +11,7 @@ else endif $(info Building with DEB_BUILD_OPTIONS: [${DEB_BUILD_OPTIONS}]) -MAKE_TARGETS=all +MAKE_TARGETS=all lrelease ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS))) MAKE_TARGETS += doc endif diff --git a/guh.pro b/guh.pro index 2f4d491e..08412b41 100644 --- a/guh.pro +++ b/guh.pro @@ -20,7 +20,25 @@ licensecheck.commands = $$top_srcdir/tests/auto/checklicenseheaders.sh $$top_src test.depends = licensecheck test.commands = LD_LIBRARY_PATH=$$top_builddir/libguh-core:$$top_builddir/libguh make check -QMAKE_EXTRA_TARGETS += licensecheck doc test +# Translations: +# make lupdate to update .ts files +TRANSLATIONS += $$files(translations/*.ts, true) +TRANSLATIONS += $$files(plugins/mock/translations/*.ts, true) +lupdate.depends = FORCE +lupdate.commands = $$[QT_INSTALL_BINS]/lupdate -recursive -no-obsolete $$_FILE_; + +# make lrelease to compile .ts to .qm +lrelease.depends = FORCE +lrelease.commands = $$[QT_INSTALL_BINS]/lrelease $$_FILE_; \ + rsync -a $$top_srcdir/translations/*.qm $$top_builddir/translations/; + +# Install translation files +translations.path = /usr/share/guh/translations +translations.files = $$[QT_SOURCE_TREE]/translations/*.qm +translations.depends = lrelease +INSTALLS += translations + +QMAKE_EXTRA_TARGETS += licensecheck doc test lupdate lrelease # Inform about guh build message(============================================) diff --git a/plugins/guh-generateplugininfo b/plugins/guh-generateplugininfo index 909c18c5..624bc2d2 100755 --- a/plugins/guh-generateplugininfo +++ b/plugins/guh-generateplugininfo @@ -267,9 +267,6 @@ def addTranslationString(string, comment): #----------------------------------------------------------------------------------------------------------------- def writeTranslationStrings(): - if len(args.translations) is 0: - return - if len(translationStrings) is not 0: writeToFile('// Translation strings') writeToFile('const QString translations[] {') @@ -337,10 +334,6 @@ def writePluginInfoFile(): outputFile.close() print(' --> Generated successfully \"%s\"' % (args.output)) - # Translate - if len(translationStrings) is not 0: - createTranslationFiles() - #----------------------------------------------------------------------------------------------------------------- def writeExternPluginInfoFile(): diff --git a/plugins/mock/mock.pro b/plugins/mock/mock.pro index 7af0e85a..5289f4c9 100644 --- a/plugins/mock/mock.pro +++ b/plugins/mock/mock.pro @@ -1,7 +1,3 @@ -TRANSLATIONS = translations/en_US.ts \ - translations/de_DE.ts - -# Note: include after the TRANSLATIONS definition include(../plugins.pri) QT+= network diff --git a/plugins/mock/translations/de_DE.ts b/plugins/mock/translations/727a4a9a-c187-446f-aadf-f1b2220607d1-de_DE.ts similarity index 100% rename from plugins/mock/translations/de_DE.ts rename to plugins/mock/translations/727a4a9a-c187-446f-aadf-f1b2220607d1-de_DE.ts diff --git a/plugins/mock/translations/en_US.ts b/plugins/mock/translations/727a4a9a-c187-446f-aadf-f1b2220607d1-en_US.ts similarity index 100% rename from plugins/mock/translations/en_US.ts rename to plugins/mock/translations/727a4a9a-c187-446f-aadf-f1b2220607d1-en_US.ts diff --git a/plugins/plugins.pri b/plugins/plugins.pri index e258cd06..b05d04e6 100644 --- a/plugins/plugins.pri +++ b/plugins/plugins.pri @@ -7,6 +7,7 @@ QT += network bluetooth INCLUDEPATH += $$top_srcdir/libguh LIBS += -L../../libguh -lguh +HEADERS += plugininfo.h # Create plugininfo file JSONFILES = deviceplugin"$$TARGET".json @@ -18,11 +19,7 @@ plugininfo.commands = touch ${QMAKE_FILE_OUT}; $$top_srcdir/plugins/guh-generate --filetype i \ --jsonfile ${QMAKE_FILE_NAME} \ --output ${QMAKE_FILE_OUT} \ - --builddir $$OUT_PWD \ - --translations $$TRANSLATIONS; \ - rsync -a "$$OUT_PWD"/translations/*.qm $$top_builddir/translations/; -PRE_TARGETDEPS += -QMAKE_EXTRA_COMPILERS += + --builddir $$OUT_PWD; externplugininfo.target = extern-plugininfo.h externplugininfo.output = extern-plugininfo.h @@ -32,17 +29,10 @@ externplugininfo.commands = touch ${QMAKE_FILE_OUT}; $$top_srcdir/plugins/guh-ge --filetype e \ --jsonfile ${QMAKE_FILE_NAME} \ --output ${QMAKE_FILE_OUT} \ - --builddir $$OUT_PWD \ - --translations $$TRANSLATIONS; + --builddir $$OUT_PWD; PRE_TARGETDEPS += compiler_plugininfo_make_all compiler_externplugininfo_make_all QMAKE_EXTRA_COMPILERS += plugininfo externplugininfo - -# Install translation files -translations.path = /usr/share/guh/translations -translations.files = $$[QT_SOURCE_TREE]/translations/*.qm - # Install plugin target.path = $$GUH_PLUGINS_PATH -INSTALLS += target translations - +INSTALLS += target diff --git a/server/server.pro b/server/server.pro index 20a3a3da..ae6b5472 100644 --- a/server/server.pro +++ b/server/server.pro @@ -12,26 +12,6 @@ QT *= sql xml websockets bluetooth dbus network LIBS += -L$$top_builddir/libguh/ -lguh -L$$top_builddir/libguh-core -lguh-core -lssl -lcrypto -laws-iot-sdk-cpp -lmbedtls -lmbedx509 -lmbedcrypto -# Translations -TRANSLATIONS *= $$top_srcdir/translations/guhd-en_US.ts \ - $$top_srcdir/translations/guhd-de_DE.ts - -# Update ts files and create translation qm files -lrelease.input = TRANSLATIONS -lrelease.CONFIG += no_link -lrelease.output = $$top_srcdir/${QMAKE_FILE_BASE}.qm -lrelease.commands = $$[QT_INSTALL_BINS]/lupdate -recursive -no-obsolete $$_FILE_; \ - $$[QT_INSTALL_BINS]/lrelease ${QMAKE_FILE_IN} -qm ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}.qm; \ - rsync -a $$top_srcdir/translations/*.qm $$top_builddir/translations/; - -QMAKE_EXTRA_COMPILERS += lrelease -PRE_TARGETDEPS += compiler_lrelease_make_all - -# Install translation files -translations.path = /usr/share/guh/translations -translations.files = $$[QT_SOURCE_TREE]/translations/*.qm -INSTALLS += translations - # Server files include(qtservice/qtservice.pri)