From 6207e63d7c0e79c3507f40db3f9ad54f536a7dd2 Mon Sep 17 00:00:00 2001 From: Filipe Azevedo Date: Fri, 10 Mar 2017 16:49:03 +0100 Subject: Handle translations update and release from qmake This deprecate usage of external scripts. Task-number: QTAUTO-280 Change-Id: I445234cb7dd1cf573057671c73f0c57ff416421f Reviewed-by: Samuli Piippo --- plugins/comtqci18ndemo/comtqci18ndemo.pro | 48 ++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) (limited to 'plugins') 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 -- cgit v1.2.3