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 <amir.abdol@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Joerg Bornemann 2023-09-12 08:46:59 +02:00
parent 36e043dde6
commit ff6eca0087
3 changed files with 32 additions and 0 deletions

View File

@ -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()

View File

@ -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

View File

@ -21,6 +21,7 @@ qt_standard_project_setup(
[REQUIRES <version>]
[SUPPORTS_UP_TO <version>]
[I18N_LANGUAGES <language...>]
[I18N_NATIVE_LANGUAGE <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