aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorFilipe Azevedo <filipe.azevedo@kdab.com>2017-03-10 16:49:03 +0100
committerVolker Krause <volker.krause@kdab.com>2017-03-14 10:40:19 +0000
commit6207e63d7c0e79c3507f40db3f9ad54f536a7dd2 (patch)
tree00f67ac472c1c0e7bc4184bad9880388c2c2b055 /plugins
parentf98a3c2764182e8dda061667ebd78fe5761a18d4 (diff)
Handle translations update and release from qmake
This deprecate usage of external scripts. Task-number: QTAUTO-280 Change-Id: I445234cb7dd1cf573057671c73f0c57ff416421f Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/comtqci18ndemo/comtqci18ndemo.pro48
1 files changed, 47 insertions, 1 deletions
diff --git a/plugins/comtqci18ndemo/comtqci18ndemo.pro b/plugins/comtqci18ndemo/comtqci18ndemo.pro
index c29a44d..3f4034f 100644
--- a/plugins/comtqci18ndemo/comtqci18ndemo.pro
+++ b/plugins/comtqci18ndemo/comtqci18ndemo.pro
@@ -30,5 +30,51 @@ isEmpty(INSTALL_PREFIX) {
qmldir.files = qmldir
installPath = $$INSTALL_PREFIX/neptune/imports/shared/$$replace(uri, \\., /)
qmldir.path = $$installPath
+
+# var, prepend, append
+defineReplace(prependAll) {
+ for(a,$$1):result += $$2$${a}$$3
+ return($$result)
+}
+
+qmlAppPath = $$PWD/../../apps/com.theqtcompany.i18ndemo
+# See qml files to scan while running lupdate/lrelease
+lupdate_only {
+ SOURCES += $$files($$shell_quote($$shell_path($${qmlAppPath}/))*.qml, true)
+}
+
target.path = $$installPath
-INSTALLS += target qmldir
+
+supportedLocales = \
+ ar_AR \
+ de_DE \
+ en_GB \
+ fi_FI \
+ fr_FR \
+ ja_JP \
+ ko_KR \
+ ru_RU \
+ zh_CN \
+ zh_TW
+
+TRANSLATIONS = $$prependAll(supportedLocales, $$qmlAppPath/translations/i18napp_, .ts)
+
+qtPrepareTool(LUPDATE, lupdate)
+qtPrepareTool(LRELEASE, lrelease)
+
+ts.commands = $$LUPDATE $$shell_quote($$_PRO_FILE_)
+QMAKE_EXTRA_TARGETS += ts
+
+qm.input = TRANSLATIONS
+qm.output = $$shadowed($$qmlAppPath/translations)/${QMAKE_FILE_BASE}.qm
+qm.variable_out = PRE_TARGETDEPS
+qm.commands = $${LRELEASE} -idbased ${QMAKE_FILE_IN} -qm ${QMAKE_FILE_OUT}
+qm.name = LRELEASE ${QMAKE_FILE_IN}
+qm.CONFIG += no_link
+QMAKE_EXTRA_COMPILERS += qm
+
+qmfiles.files = $$prependAll(supportedLocales, $$shadowed($$qmlAppPath/translations)/i18napp_, .qm)
+qmfiles.path = $$INSTALL_PREFIX/neptune/apps/com.theqtcompany.i18ndemo/translations
+qmfiles.CONFIG += no_check_exist
+
+INSTALLS += target qmldir qmfiles