Sur cette page

QT_DEPLOY_TRANSLATIONS_DIR

Sous-répertoire relatif au préfixe pour déployer les traductions de Qt sur certaines plates-formes cibles.

Cette variable est définie par le script nommé par QT_DEPLOY_SUPPORT. Elle ne doit être utilisée que dans le cadre du déploiement lors de l'installation ou d'une règle de post-construction.

Note : Il s'agit d'une variable API de déploiement de bas niveau, et ne doit être utilisée que dans des cas d'utilisation avancés qui ne sont pas couverts par les commandes API de plus haut niveau, comme qt_generate_deploy_app_script.

Cette variable a été introduite dans Qt 6.5.

Les projets devraient utiliser QT_DEPLOY_TRANSLATIONS_DIR dans leurs scripts de déploiement pour éviter de coder en dur un répertoire particulier sous lequel déployer les traductions.

QT_DEPLOY_TRANSLATIONS_DIR La valeur par défaut de cette variable est translations. Pour modifier la valeur de QT_DEPLOY_TRANSLATIONS_DIR, définissez-la dans le script de déploiement du projet avant que QT_DEPLOY_SUPPORT ne soit inclus.

Le chemin QT_DEPLOY_TRANSLATIONS_DIR est relatif à QT_DEPLOY_PREFIX.

Cette variable n'est pas significative lors du déploiement sur macOS ou Windows.

Exemple d'application

cmake_minimum_required(VERSION 3.16...3.22)
project(MyThings)

# The following CMAKE_INSTALL_*DIR variables are used to initialize their
# QT_DEPLOY_*_DIR counterparts.
set(CMAKE_INSTALL_BINDIR "mybindir")
set(CMAKE_INSTALL_LIBDIR "mylibdir")
set(CMAKE_INSTALL_LIBEXECDIR "mylibexecdir")

find_package(Qt6 REQUIRED COMPONENTS Core)
qt_standard_project_setup()

qt_add_executable(MyApp main.cpp)

set(deploy_script "${CMAKE_CURRENT_BINARY_DIR}/deploy_MyApp.cmake")
file(GENERATE OUTPUT ${deploy_script} CONTENT "

set(QT_DEPLOY_PLUGINS_DIR \"mypluginsdir\")
set(QT_DEPLOY_TRANSLATIONS_DIR \"i18n\")

include(\"${QT_DEPLOY_SUPPORT}\")

qt_deploy_runtime_dependencies(
    EXECUTABLE \"\${QT_DEPLOY_BIN_DIR}/$<TARGET_FILE_NAME:MyApp>\"
)")

install(SCRIPT ${deploy_script})

Voir aussi QT_DEPLOY_SUPPORT, QT_DEPLOY_PREFIX, QT_DEPLOY_BIN_DIR, QT_DEPLOY_LIB_DIR, QT_DEPLOY_LIBEXEC_DIR, QT_DEPLOY_PLUGINS_DIR, et QT_DEPLOY_QML_DIR.

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