From ff6eca00875bcf455e8b79e539be22e49fa7f053 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 12 Sep 2023 08:46:59 +0200 Subject: [PATCH] CMake: Add I18N_NATIVE_LANGUAGE keyword to qt_standard_project_setup [ChangeLog][CMake] Added variable QT_I18N_NATIVE_LANGUAGE to specify the native language that is used in the source code for translatable strings. [ChangeLog][CMake] Added keyword I18N_NATIVE_LANGUAGE to qt_standard_project_setup to conveniently set QT_I18N_NATIVE_LANGUAGE. Task-number: QTBUG-115845 Change-Id: I079256507685afe5eccda78beffff819292494bf Reviewed-by: Amir Masoud Abdol Reviewed-by: Alexandru Croitor --- src/corelib/Qt6CoreMacros.cmake | 4 ++++ .../src/cmake/cmake-configure-variables.qdoc | 24 +++++++++++++++++++ .../src/cmake/qt_standard_project_setup.qdoc | 4 ++++ 3 files changed, 32 insertions(+) diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake index 9f8e6bb591..24ff7911e1 100644 --- a/src/corelib/Qt6CoreMacros.cmake +++ b/src/corelib/Qt6CoreMacros.cmake @@ -2968,6 +2968,7 @@ macro(qt6_standard_project_setup) set(__qt_sps_args_single REQUIRES SUPPORTS_UP_TO + I18N_NATIVE_LANGUAGE ) set(__qt_sps_args_multi I18N_LANGUAGES @@ -3075,6 +3076,9 @@ macro(qt6_standard_project_setup) if(DEFINED __qt_sps_arg_I18N_LANGUAGES AND NOT DEFINED QT_I18N_LANGUAGES) set(QT_I18N_LANGUAGES ${__qt_sps_arg_I18N_LANGUAGES}) endif() + if(DEFINED __qt_sps_arg_I18N_NATIVE_LANGUAGE AND NOT DEFINED QT_I18N_NATIVE_LANGUAGE) + set(QT_I18N_NATIVE_LANGUAGE ${__qt_sps_arg_I18N_NATIVE_LANGUAGE}) + endif() endif() endmacro() diff --git a/src/corelib/doc/src/cmake/cmake-configure-variables.qdoc b/src/corelib/doc/src/cmake/cmake-configure-variables.qdoc index a947c87a05..61a62ba4fb 100644 --- a/src/corelib/doc/src/cmake/cmake-configure-variables.qdoc +++ b/src/corelib/doc/src/cmake/cmake-configure-variables.qdoc @@ -506,6 +506,30 @@ This variable can be conveniently set with the \sa {qt6_add_translations}{qt_add_translations()} */ +/*! +\page cmake-variable-qt-i18n-native-language.html +\ingroup cmake-variables-qtcore + +\title QT_I18N_NATIVE_LANGUAGE +\target cmake-variable-QT_I18N_NATIVE_LANGUAGE + +\summary {Specifies the language of translatable strings} + +\cmakevariablesince 6.7 + +This variable specifies the language of translatable strings in the source code. +The language must be compatible with the string-based \l QLocale constructor. + +Together with \c{QT_I18N_LANGUAGES}, this variable is used to determine the +names of \c{.ts} files for \l{qt6_add_translations}{qt_add_translations()}. + +This variable can be conveniently set with the +{qt6_standard_project_setup}{qt_standard_project_setup()} command. + +\sa {qt6_standard_project_setup}{qt_standard_project_setup()} +\sa {qt6_add_translations}{qt_add_translations()} +*/ + /*! \page cmake-variable-qt-ios-launch-screen.html \ingroup cmake-variables-qtcore diff --git a/src/corelib/doc/src/cmake/qt_standard_project_setup.qdoc b/src/corelib/doc/src/cmake/qt_standard_project_setup.qdoc index 9dcbab6dc5..e478148d2e 100644 --- a/src/corelib/doc/src/cmake/qt_standard_project_setup.qdoc +++ b/src/corelib/doc/src/cmake/qt_standard_project_setup.qdoc @@ -21,6 +21,7 @@ qt_standard_project_setup( [REQUIRES ] [SUPPORTS_UP_TO ] [I18N_LANGUAGES ] + [I18N_NATIVE_LANGUAGE ] ) \endcode @@ -88,6 +89,9 @@ Since Qt 6.7, it is possible to specify the languages that are used for project internationalization with the \c I18N_LANGUAGES argument. See \l QT_I18N_LANGUAGES for details. +Use I18N_NATIVE_LANGUAGE to specify the native language that translatable +strings are written in. See \l QT_I18N_NATIVE_LANGUAGE for details. + \section1 Example \include cmake-generate-deploy-app-script.qdocinc