qt_exclude_sources_from_translation
该属性在 Qt 6.7 中引入。
此目标属性指定了从翻译中排除的源文件路径列表。lupdate
将忽略与该排除列表中的模式匹配的源文件。
路径可以是绝对路径,也可以是相对于CMAKE_CURRENT_SOURCE_DIR
的路径。路径可以包含通配符,其格式可被QRegularExpression::wildcardToRegularExpression 接受。
示例
排除untranslatable.cpp
以及3rdparty
目录下的所有文件。
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/* )
另请参阅 qt_add_lupdate、目标属性 QT_EXCLUDE_FROM_TRANSLATION 和目录属性 QT_EXCLUDE_FROM_TRANSLATION。
© 2025 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.