- Qt 6.8
- Qt Linguist Manual
- CMake Directory Properties in Qt6 LinguistTools
- QT_EXCLUDE_FROM_TRANSLATION
- Qt 6.8.0 Reference Documentation

# QT_EXCLUDE_FROM_TRANSLATION

This property was introduced in Qt 6.7.

Set this directory property to `ON` to exclude all targets in the directory and its subdirectories from translation. The command qt_collect_translation_source_targets will skip such targets.

To exclude a single target, use the target property QT_EXCLUDE_FROM_TRANSLATION.

## Examples

In the following example, translatable strings will not be extracted from targets that are defined in the `tests` directory.

     add_subdirectory(app)
     add_subdirectory(tests)
     set_property(DIRECTORY tests PROPERTY QT_EXCLUDE_FROM_TRANSLATION ON)
     qt_add_translations(myapp)

Alternatively, you can set the directory property in the `CMakeLists.txt` of the `tests` subdirectory.

     # tests/CMakeLists.txt
     qt_add_executable(...)
     add_test(...)
     set_directory_properties(PROPERTIES QT_EXCLUDE_FROM_TRANSLATION ON)

See also QT_EXCLUDE_SOURCES_FROM_TRANSLATION.