Deploy Qt translations needed by an executable.
命令的定义在
核心
组件对于
Qt6
包,可以像这样加载:
find_package(Qt6 REQUIRED COMPONENTS Core)
Unlike most other CMake commands provided by Qt,
qt_deploy_translations()
can only be called from a deployment script. It cannot be called directly by the project during the configure stage.
This command was introduced in Qt 6.5.
注意: This command is in technology preview and may change in future releases.
注意: This command does not usually need to be called directly. It is used internally by other higher level commands, but projects wishing to implement more customized deployment logic may find it useful.
qt_deploy_translations( [CATALOGS catalogs] [LOCALES locales] [LCONVERT lconvert_executable] [VERBOSE] )
When installing an application, it may be desirable to also install the translations that belong to the used Qt modules. The
qt_deploy_translations
command collects the necessary
.qm
file from the Qt installation and compiles them into one
qt_${language}.qm
file per language. The
.qm
files are installed into
QT_DEPLOY_TRANSLATIONS_DIR
.
The
LOCALES
argument specifies for which locales translations should be deployed. This is a list of language/region combinations as described in
Qt Linguist's manual for translators
. Examples for valid locales are:
de
,
pl
,或
pt_BR
.
若
LOCALES
is omitted, then all available locales are deployed.
The
CATALOGS
argument specifies a list of
translation catalogs
to be deployed. If this argument is omitted, then all catalogs are deployed that belong to any Qt module that is used in the project via
find_package
.
The
LCONVERT
argument specifies the
lconvert
executable that is used to combine the catalogs. By default, the Qt installation's
lconvert
被使用。
For debugging purposes, the
VERBOSE
argument can be set to turn on diagnostic messages.
The following example deploys Danish and German translations of the Qt libraries.
qt_deploy_translations( LOCALES da de )
另请参阅 QT_DEPLOY_TRANSLATIONS_DIR .