qt5_create_translation

Synopsis

 qt5_create_translation(<VAR> ts-file-or-sources [ts-file-or-sources2 ...]
                        [OPTIONS ...])

Description

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.

Options

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

Examples

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:

 qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} helloworld_en.ts helloworld_de.ts)