QT_EXCLUDE_FROM_TRANSLATION
このプロパティは Qt 6.7 で導入されました。
このディレクトリプロパティを `ON ` に設定すると、そのディレクトリおよびそのサブディレクトリ内のすべてのターゲットが翻訳対象から除外されます。コマンド `qt_collect_translation_source_targets()` は、そのようなターゲットをスキップします。
単一のターゲットを除外するには、ターゲットプロパティQT_EXCLUDE_FROM_TRANSLATION を使用してください。
例
次の例では、tests ディレクトリに定義されているターゲットからは、翻訳可能な文字列が抽出されません。
add_subdirectory(app)
add_subdirectory(tests)
set_property(DIRECTORY tests PROPERTY QT_EXCLUDE_FROM_TRANSLATION ON)
qt_add_translations(myapp)あるいは、`CMakeLists.txt ` 内の `tests ` サブディレクトリで、ディレクトリプロパティを設定することもできます。
# tests/CMakeLists.txt
qt_add_executable(...)
add_test(...)
set_directory_properties(PROPERTIES QT_EXCLUDE_FROM_TRANSLATION ON)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.