警告: This function is deprecated. Consider using the target-based functions qt6_add_lupdate or qt6_add_translations 代替。
qt_create_translation(<VAR> ts-file-or-sources [ts-file-or-sources2 ...] [OPTIONS ...])
若
无版本命令
被禁用,使用
qt6_create_translation
代替。它支持如此命令的一组相同自变量。
Processes given sources (directories or individual files) to generate Qt Linguist
.ts
files. The
.ts
files are in turn compiled into
.qm
files of the same base name that are stored in the build directory. Paths to the generated
.qm
files are added to
<VAR>
.
The translation files to create or update need to have a
.ts
suffix. If the given file path is not absolute it is resolved relative to the current source directory. If no
.ts
file is passed as an argument, the macro does nothing.
Any arguments that do not have a
.ts
suffix are passed as input to the
lupdate
.
lupdate
accepts directories and source files as input. See also the
lupdate documentation
on further details.
可以设置额外
选项
that should be passed when
lupdate
is invoked. You can find possible options in the
lupdate documentation
.
Recursively look up Qt translations from source files in current directory and generate or update
helloworld_en.ts
and
helloworld_de.ts
file using
lupdate
. Compile said files into
helloworld_en.qm
and
helloworld.de.qm
files in the build directory:
qt_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} helloworld_en.ts helloworld_de.ts)