Add targets to generate or update Qt Linguist .ts files.
命令的定义在
LinguistTools
组件对于
Qt6
package. Load the package with:
find_package(Qt6 REQUIRED COMPONENTS LinguistTools)
该命令在 Qt 6.2 引入。
qt_add_lupdate(target TS_FILES file1.ts [file2.ts ...] [SOURCES source1.cpp [sources2.cpp ...]] [INCLUDE_DIRECTORIES directory1 [directory2 ...]] [NO_GLOBAL_TARGET] [OPTIONS ...])
若
无版本命令
被禁用,使用
qt6_add_lupdate()
代替。它支持如此命令的一组相同自变量。
Creates a target
${target}_lupdate
to generate or update Qt Linguist
.ts
files with
lupdate
.
参数
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 .
默认情况下,
qt_add_lupdate
extracts the source files and include directories from the given target and passes them to
lupdate
.
采用
SOURCES
you can explicitly specify source files that contain translatable strings. This turns off the automatic extraction of source files from the target.
可以使用
INCLUDE_DIRECTORIES
to explicitly specify include directories. This turns off the automatic extraction of include directories from the target.
可以设置额外
选项
that should be passed when
lupdate
is invoked. You can find possible options in the
lupdate documentation
.
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
.
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)