From 01d2f35b6988edacc741b358703d16d4cd8c199a Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 17 Jul 2018 17:57:55 +0200 Subject: qmake: Add support for running lrelease CONFIG+=lrelease enables that all .ts files in TRANSLATIONS or EXTRA_TRANSLATIONS are compiled by lrelease. EXTRA_TRANSLATIONS is a new variable that is only processed by lrelease, but not lupdate - this is useful for translation files that are supposed to be empty, because they match the language of the original translation sources. If embed_translations is also set, the generated .qm files will be made available through the Qt resource system under :/i18n/. Alternatively, the user can specify an installation target by setting QM_FILES_INSTALL_PATH. Note that relative paths in TRANSLATIONS are not taken into account. That is, TRANSLATIONS = component1/de.ts component2/de.ts will cause a conflict. [ChangeLog][qmake] New CONFIG options lrelease and embed_translations were added. CONFIG+=lrelease does run lrelease on translation files listed in TRANSLATIONS and EXTRA_TRANSLATIONS. CONFIG+=embed_translations does include the generated .qm files as resources under :/i18n/. Change-Id: I94db5b8431d07b24f59b2c332ede91450f9c0c58 Reviewed-by: Oswald Buddenhagen --- qmake/doc/src/qmake-manual.qdoc | 57 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'qmake/doc/src/qmake-manual.qdoc') diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc index fa907ef57f..22c34adccd 100644 --- a/qmake/doc/src/qmake-manual.qdoc +++ b/qmake/doc/src/qmake-manual.qdoc @@ -977,6 +977,14 @@ By default, they are enabled. \row \li depend_includepath \li Appending the value of INCLUDEPATH to DEPENDPATH is enabled. Set by default. + \row \li lrelease \li Run \c lrelease for all files listed in + \l TRANSLATIONS and \l EXTRA_TRANSLATIONS. If \c embed_translations + is not set, install the generated .qm files into + QM_FILES_INSTALL_PATH. Use QMAKE_LRELEASE_FLAGS to add options to + the lrelease call. Not set by default. + \row \li embed_translations \li Embed the generated translations from + \c lrelease in the executable, under \l{QM_FILES_RESOURCE_PREFIX}. + Requires \c lrelease to be set, too. Not set by default. \endtable When you use the \c debug_and_release option (which is the default under @@ -1162,6 +1170,24 @@ Specifies where to copy the \l{#TARGET}{target} dll. + \target EXTRA_TRANSLATIONS + \section1 EXTRA_TRANSLATIONS + + Specifies a list of translation (.ts) files that contain + translations of the user interface text into non-native languages. + + In contrast to \l TRANSLATIONS, translation files in \c EXTRA_TRANSLATIONS + will be processed only by \l{Using lrelease}{lrelease}, not + \l{Using lupdate}{lupdate}. + + You can use \l{CONFIG}{CONFIG += lrelease} to automatically compile the + files during the build, and + \l{CONFIG}{CONFIG += lrelease embed_translations} to make them available in + \l{The Qt Resource System}. + + See the \l{Qt Linguist Manual} for more information about + internationalization (i18n) and localization (l10n) with Qt. + \target FORMS \section1 FORMS @@ -1432,6 +1458,21 @@ \note Do not attempt to overwrite the value of this variable. + \target QM_FILES_RESOURCE_PREFIX + \section1 QM_FILES_RESOURCE_PREFIX + + Specifies the directory in the resource system where \c .qm files will + be made available by \l{CONFIG}{CONFIG += embed_translations}. + + The default is \c{:/i18n/}. + + \target QM_FILES_INSTALL_PATH + \section1 QM_FILES_INSTALL_PATH + + Specifies the target directory \c .qm files generated by + \l{CONFIG}{CONFIG += lrelease} will be installed to. Does not have any + effect if \l{CONFIG}{CONFIG += embed_translations} is set. + \target QMAKE_systemvariable \section1 QMAKE @@ -2147,6 +2188,12 @@ value of this variable is typically handled by qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + \target QMAKE_LRELEASE_FLAGS + \section1 QMAKE_LRELEASE_FLAGS + + List of additional options passed to \l{Using lrelease}{lrelease} when + enabled through \l{CONFIG}{CONFIG += lrelease}. + \section1 QMAKE_OBJECTIVE_CFLAGS Specifies the Objective C/C++ compiler flags for building @@ -2624,11 +2671,21 @@ determine how the project is built, it is necessary to declare TEMPLATE on the command line rather than use the \c -t option. + \target TRANSLATIONS \section1 TRANSLATIONS Specifies a list of translation (.ts) files that contain translations of the user interface text into non-native languages. + Translation files in \c TRANSLATIONS will be processed by both + \l{Using lrelease}{lrelease} and \l{Using lupdate} tools. Use + \l EXTRA_TRANSLATIONS if you want only \c lrelease to process a file. + + You can use \l{CONFIG}{CONFIG += lrelease} to automatically compile the + files during the build, and + \l{CONFIG}{CONFIG += lrelease embed_translations} to make them available in + \l{The Qt Resource System}. + See the \l{Qt Linguist Manual} for more information about internationalization (i18n) and localization (l10n) with Qt. -- cgit v1.2.3