qt_add_lupdate

Add targets to generate or update Qt Linguist .ts files.

The command is defined in the LinguistTools component of the Qt6 package. Load the package with:

find_package(Qt6 REQUIRED COMPONENTS LinguistTools)

This command was introduced in Qt 6.2.

Synopsis

qt_add_lupdate(target TS_FILES file1.ts [file2.ts ...]
               [SOURCES source1.cpp [sources2.cpp ...]]
               [INCLUDE_DIRECTORIES directory1 [directory2 ...]]
               [NO_GLOBAL_TARGET]
               [OPTIONS ...])

If versionless commands are disabled, use qt6_add_lupdate() instead. It supports the same set of arguments as this command.

Description

Creates a target ${target}_lupdate to generate or update Qt Linguist .ts files with lupdate.

The parameter target is an existing executable or library target that contains sources with translatable strings.

The .ts files must be specified with the argument TS_FILES.

This function is designed to be used in conjunction with qt_add_lrelease. See also the convenience wrapper qt_add_translations.

Sources and Include Directories

By default, qt_add_lupdate extracts the source files and include directories from the given target and passes them to lupdate.

With SOURCES one may explicitly specify source files that contain translatable strings. This turns off the automatic extraction of source files from the target.

INCLUDE_DIRECTORIES can be used to explicitly specify include directories. This turns off the automatic extraction of include directories from the target.

Options

You can set additional OPTIONS that should be passed when lupdate is invoked. You can find possible options in the lupdate documentation.

Umbrella Target

In addition to the target ${target}_lupdate, an umbrella target update_translations is created. This target will build all ${target}_lupdate targets that were created with qt_add_lupdate.

Pass NO_GLOBAL_TARGET to qt_add_lupdate to prevent this behavior.

The name of this target can be overridden by setting the variable QT_GLOBAL_LUPDATE_TARGET before calling qt_add_lupdate.

Examples

Add the targets myapp_lupdate and update_translations for updating the .ts file of an application myapp.

qt_add_lupdate(myapp TS_FILES myapp_de.ts)

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.