CMake: Add I18N_LANGUAGES keyword to qt_standard_project_setup
[ChangeLog][CMake] Added variable QT_I18N_LANGUAGES to specify the languages that are used for i18n in the project. [ChangeLog][CMake] Added keyword I18N_LANGUAGES to qt_standard_project_setup to conveniently set QT_I18N_LANGUAGES. The call qt_standard_project_setup(I18N_LANGUAGES hi ho) sets the variable QT_I18N_LANGUAGES. The target finalizers use this variable to set up CFBundleLocalizations on Apple platforms. qt_add_translations will be extended to read QT_I18N_LANGUAGES as well to determine the names of .ts files if TS_FILES is not given. Fixes: QTBUG-116716 Change-Id: I76f0753d10efb9c32947d9239e43382c9d85eb51 Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
This commit is contained in:
parent
e5c136c179
commit
fe182c1541
@ -618,9 +618,12 @@ function(_qt_internal_set_apple_localizations target)
|
||||
return()
|
||||
endif()
|
||||
|
||||
get_target_property(supported_languages "${target}" _qt_apple_supported_languages)
|
||||
if("${supported_languages}" STREQUAL "supported_languages-NOTFOUND")
|
||||
return()
|
||||
set(supported_languages "${QT_I18N_LANGUAGES}")
|
||||
if("${QT_I18N_LANGUAGES}" STREQUAL "")
|
||||
get_target_property(supported_languages "${target}" _qt_apple_supported_languages)
|
||||
if("${supported_languages}" STREQUAL "supported_languages-NOTFOUND")
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
get_target_property(plist_file "${target}" MACOSX_BUNDLE_INFO_PLIST)
|
||||
if (NOT plist_file)
|
||||
|
@ -2969,7 +2969,9 @@ macro(qt6_standard_project_setup)
|
||||
REQUIRES
|
||||
SUPPORTS_UP_TO
|
||||
)
|
||||
set(__qt_sps_args_multi)
|
||||
set(__qt_sps_args_multi
|
||||
I18N_LANGUAGES
|
||||
)
|
||||
cmake_parse_arguments(__qt_sps_arg
|
||||
"${__qt_sps_args_option}"
|
||||
"${__qt_sps_args_single}"
|
||||
@ -3068,6 +3070,11 @@ macro(qt6_standard_project_setup)
|
||||
set_property(GLOBAL PROPERTY AUTOGEN_TARGETS_FOLDER ${__qt_qt_targets_folder})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# I18N support.
|
||||
if(DEFINED __qt_sps_arg_I18N_LANGUAGES AND NOT DEFINED QT_I18N_LANGUAGES)
|
||||
set(QT_I18N_LANGUAGES ${__qt_sps_arg_I18N_LANGUAGES})
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
@ -477,6 +477,35 @@ methods provided by CMake.
|
||||
\sa {qt6_standard_project_setup}{qt_standard_project_setup()}
|
||||
*/
|
||||
|
||||
/*!
|
||||
\page cmake-variable-qt-i18n-languages.html
|
||||
\ingroup cmake-variables-qtcore
|
||||
|
||||
\title QT_I18N_LANGUAGES
|
||||
\target cmake-variable-QT_I18N_LANGUAGES
|
||||
|
||||
\summary {List of languages to be used for project internationalization}
|
||||
|
||||
\cmakevariablesince 6.7
|
||||
|
||||
This variable specifies a list of languages that are used for project
|
||||
internationalization. The single languages must be compatible with the
|
||||
string-based \l QLocale constructor.
|
||||
|
||||
The languages in \c QT_I18N_LANGUAGES are used to
|
||||
\list
|
||||
\li Set up executable targets for consuming \c{.qm} files.
|
||||
\li Automatically construct \c{.ts} file names in
|
||||
\l{qt6_add_translations}{qt_add_translations()}.
|
||||
\endlist
|
||||
|
||||
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
|
||||
|
@ -20,6 +20,7 @@
|
||||
qt_standard_project_setup(
|
||||
[REQUIRES <version>]
|
||||
[SUPPORTS_UP_TO <version>]
|
||||
[I18N_LANGUAGES <language...>]
|
||||
)
|
||||
\endcode
|
||||
|
||||
@ -81,6 +82,12 @@ setting the \l{QT_NO_STANDARD_PROJECT_SETUP} variable to true.
|
||||
\sa {qt6_generate_deploy_app_script}{qt_generate_deploy_app_script()}
|
||||
\sa qt_policy
|
||||
|
||||
\section1 Internationalization
|
||||
|
||||
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.
|
||||
|
||||
\section1 Example
|
||||
|
||||
\include cmake-generate-deploy-app-script.qdocinc
|
||||
|
Loading…
x
Reference in New Issue
Block a user