In questa pagina

QT_EXCLUDE_FROM_TRANSLATION

Questa proprietà è stata introdotta in Qt 6.7.

Impostare questa proprietà della directory su ON per escludere dalla traduzione tutti i target presenti nella directory e nelle sue sottodirectory. Il comando qt_collect_translation_source_targets() ignorerà tali target.

Per escludere un singolo target, utilizzare la proprietà del target QT_EXCLUDE_FROM_TRANSLATION.

Esempi

Nell'esempio seguente, le stringhe traducibili non verranno estratte dai target definiti nella directory tests.

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

In alternativa, è possibile impostare la proprietà directory in ` CMakeLists.txt ` della sottodirectory ` tests `.

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

Vedi anche QT_EXCLUDE_SOURCES_FROM_TRANSLATION.

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