qt5_add_translation

Synopsis

qt5_add_translation(<VAR> file1.ts [file2.ts ...]
                    [OPTIONS ...])

Description

Calls lrelease on each .ts file passed as an argument, generating .qm files. The paths of the generated files are added to <VAR>.

Options

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

By default, the qm files will be placed in the root level of the build directory. To change this, you can set OUTPUT_LOCATION as a property of the source .ts file.

Examples

Generating helloworld_en.qm, helloworld_de.qm in the build directory:

qt5_add_translation(qmFiles helloworld_en.ts helloworld_de.ts)

Generating helloworld_en.qm, helloworld_de.qm in a l10n sub-directory:

set(TS_FILES helloworld_en.ts helloworld_de.ts)
set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION "l10n")
qt5_add_translation(qmFiles ${TS_FILES})

© 2020 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.