QT_EXCLUDE_SOURCES_FROM_TRANSLATION

This property was introduced in Qt 6.7.

This target property specifies a list of source file paths that are excluded from translation. Source files that match the patterns in this exclusion list are ignored by lupdate.

The paths may be absolute or relative to CMAKE_CURRENT_SOURCE_DIR. The paths may contain wildcards in a format that is accepted by QRegularExpression::wildcardToRegularExpression.

Examples

Exclude untranslatable.cpp and recursively every file under the 3rdparty directory.

 qt_add_executable(myapp
     main.cpp
     untranslatable.cpp
     3rdparty/sqlite/sqlite3.h
     3rdparty/sqlite/sqlite3.c
     3rdparty/zlib/src/gzlib.c
     3rdparty/zlib/src/zlib.h
 )
 set_property(TARGET myapp PROPERTY QT_EXCLUDE_SOURCES_FROM_TRANSLATION
     untranslatable.cpp
     3rdparty/*
 )

See also qt_add_lupdate, target property QT_EXCLUDE_FROM_TRANSLATION, and directory property QT_EXCLUDE_FROM_TRANSLATION.