summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2024-02-19 16:36:49 +0100
committerJoerg Bornemann <joerg.bornemann@qt.io>2024-02-26 17:28:19 +0100
commitae1a8519652d6ac88f2737da6b339b8465a553f4 (patch)
tree9b5ed401007c427579e601516bd871c04b10e1e1
parent251ea84ae6a6f87502a522e098f317f69fd247c7 (diff)
CMake: Rename NATIVE_TS_FILE arguments to PLURALS_TS_FILE
...in qt_add_translations and qt_add_lupdate, according to CMake API review. Task-number: QTBUG-122396 Change-Id: I01b62a96a4ac6c9a19b39c9e1b8ac5b046172420 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> (cherry picked from commit 13a6934efd8e4bb3c2539b8bc8c16c60ad1eae3e) Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
-rw-r--r--src/linguist/Qt6LinguistToolsMacros.cmake44
-rw-r--r--src/linguist/linguist/doc/cmake-macros.qdoc6
-rw-r--r--tests/auto/cmake/linguist/CMakeLists.txt2
-rw-r--r--tests/auto/cmake/linguist/test_i18n_source_language/CMakeLists.txt (renamed from tests/auto/cmake/linguist/test_i18n_native_language/CMakeLists.txt)12
-rw-r--r--tests/auto/cmake/linguist/test_i18n_source_language/check_ts_files.cmake (renamed from tests/auto/cmake/linguist/test_i18n_native_language/check_ts_files.cmake)0
-rw-r--r--tests/auto/cmake/linguist/test_i18n_source_language/lib.cpp (renamed from tests/auto/cmake/linguist/test_i18n_native_language/lib.cpp)0
-rw-r--r--tests/auto/cmake/linguist/test_i18n_source_language/lib2_en.ts.in (renamed from tests/auto/cmake/linguist/test_i18n_native_language/lib2_en.ts.in)0
7 files changed, 32 insertions, 32 deletions
diff --git a/src/linguist/Qt6LinguistToolsMacros.cmake b/src/linguist/Qt6LinguistToolsMacros.cmake
index b0dc6f0fc..555b18d21 100644
--- a/src/linguist/Qt6LinguistToolsMacros.cmake
+++ b/src/linguist/Qt6LinguistToolsMacros.cmake
@@ -206,7 +206,7 @@ function(qt6_add_lupdate)
set(options
NO_GLOBAL_TARGET)
set(oneValueArgs
- NATIVE_TS_FILE
+ PLURALS_TS_FILE
LUPDATE_TARGET)
set(multiValueArgs
TARGETS
@@ -256,14 +256,14 @@ function(qt6_add_lupdate)
set(lupdate_work_dir "${CMAKE_CURRENT_BINARY_DIR}/.lupdate")
qt_internal_make_paths_absolute(ts_files "${arg_TS_FILES}")
- set(native_ts_file "")
- set(raw_native_ts_file "")
- if(NOT "${arg_NATIVE_TS_FILE}" STREQUAL "")
- qt_internal_make_paths_absolute(native_ts_file "${arg_NATIVE_TS_FILE}")
- _qt_internal_ensure_ts_file(TS_FILE "${native_ts_file}")
- get_filename_component(raw_native_ts_file "${native_ts_file}" NAME)
- string(PREPEND raw_native_ts_file "${lupdate_work_dir}/")
- list(APPEND ts_files "${raw_native_ts_file}")
+ set(plurals_ts_file "")
+ set(raw_plurals_ts_file "")
+ if(NOT "${arg_PLURALS_TS_FILE}" STREQUAL "")
+ qt_internal_make_paths_absolute(plurals_ts_file "${arg_PLURALS_TS_FILE}")
+ _qt_internal_ensure_ts_file(TS_FILE "${plurals_ts_file}")
+ get_filename_component(raw_plurals_ts_file "${plurals_ts_file}" NAME)
+ string(PREPEND raw_plurals_ts_file "${lupdate_work_dir}/")
+ list(APPEND ts_files "${raw_plurals_ts_file}")
endif()
set(lupdate_project_base "${lupdate_work_dir}/${lupdate_target}_project")
@@ -303,11 +303,11 @@ set(lupdate_subproject${n}_excluded \"${excluded}\")
$<TARGET_FILE:${QT_CMAKE_EXPORT_NAMESPACE}::lupdate>)
set(prepare_native_ts_command "")
set(finish_native_ts_command "")
- if(NOT native_ts_file STREQUAL "")
+ if(NOT plurals_ts_file STREQUAL "")
# Copy the existing .ts file to preserve already translated strings.
set(prepare_native_ts_command
COMMAND
- "${CMAKE_COMMAND}" -E copy "${native_ts_file}" "${raw_native_ts_file}"
+ "${CMAKE_COMMAND}" -E copy "${plurals_ts_file}" "${raw_plurals_ts_file}"
)
# Filter out the non-numerus forms with lconvert.
@@ -316,8 +316,8 @@ set(lupdate_subproject${n}_excluded \"${excluded}\")
"${tool_wrapper}"
$<TARGET_FILE:${QT_CMAKE_EXPORT_NAMESPACE}::lconvert>
-pluralonly
- -i "${raw_native_ts_file}"
- -o "${native_ts_file}"
+ -i "${raw_plurals_ts_file}"
+ -o "${plurals_ts_file}"
)
endif()
add_custom_target(${lupdate_target}
@@ -548,7 +548,7 @@ function(qt6_add_translations)
TS_FILES
TS_FILE_BASE
TS_FILE_DIR
- NATIVE_TS_FILE
+ PLURALS_TS_FILE
SOURCES
INCLUDE_DIRECTORIES
LUPDATE_OPTIONS
@@ -566,12 +566,12 @@ function(qt6_add_translations)
message(FATAL_ERROR "No targets provided.")
endif()
if(NOT DEFINED arg_TS_FILES
- AND NOT DEFINED arg_NATIVE_TS_FILE
+ AND NOT DEFINED arg_PLURALS_TS_FILE
AND "${QT_I18N_TRANSLATED_LANGUAGES}" STREQUAL ""
AND "${QT_I18N_SOURCE_LANGUAGE}" STREQUAL "")
message(FATAL_ERROR
"One of QT_I18N_TRANSLATED_LANGUAGES, QT_I18N_SOURCE_LANGUAGE, TS_FILES, "
- "or NATIVE_TS_FILE must be provided.")
+ "or PLURALS_TS_FILE must be provided.")
endif()
if(DEFINED arg_RESOURCE_PREFIX AND DEFINED arg_QM_FILES_OUTPUT_VARIABLE)
message(FATAL_ERROR "QM_FILES_OUTPUT_VARIABLE cannot be specified "
@@ -600,8 +600,8 @@ function(qt6_add_translations)
endforeach()
# Determine the path to the native .ts file if necessary.
- if(NOT DEFINED arg_NATIVE_TS_FILE AND NOT "${QT_I18N_SOURCE_LANGUAGE}" STREQUAL "")
- set(arg_NATIVE_TS_FILE
+ if(NOT DEFINED arg_PLURALS_TS_FILE AND NOT "${QT_I18N_SOURCE_LANGUAGE}" STREQUAL "")
+ set(arg_PLURALS_TS_FILE
"${arg_TS_FILE_DIR}/${arg_TS_FILE_BASE}_${QT_I18N_SOURCE_LANGUAGE}.ts")
endif()
endif()
@@ -628,7 +628,7 @@ function(qt6_add_translations)
# Predict the names of generated .qm files.
if(DEFINED arg_QM_FILES_OUTPUT_VARIABLE)
set(qm_files "")
- foreach(ts_file IN LISTS arg_TS_FILES arg_NATIVE_TS_FILE)
+ foreach(ts_file IN LISTS arg_TS_FILES arg_PLURALS_TS_FILE)
_qt_internal_generated_qm_file_path(qm_file "${ts_file}")
list(APPEND qm_files "${qm_file}")
endforeach()
@@ -648,7 +648,7 @@ function(qt6_add_translations)
set(to_forward ${oneValueArgs} ${multiValueArgs})
set(path_variables
TS_FILES
- NATIVE_TS_FILE
+ PLURALS_TS_FILE
SOURCES
INCLUDE_DIRECTORIES
)
@@ -688,14 +688,14 @@ function(qt6_add_translations)
TARGETS "${source_targets}"
LUPDATE_TARGET "${arg_LUPDATE_TARGET}"
TS_FILES "${arg_TS_FILES}"
- NATIVE_TS_FILE "${arg_NATIVE_TS_FILE}"
+ PLURALS_TS_FILE "${arg_PLURALS_TS_FILE}"
SOURCES "${arg_SOURCES}"
INCLUDE_DIRECTORIES "${arg_INCLUDE_DIRECTORIES}"
OPTIONS "${arg_LUPDATE_OPTIONS}"
)
qt6_add_lrelease(
LRELEASE_TARGET "${arg_LRELEASE_TARGET}"
- TS_FILES "${arg_TS_FILES}" ${arg_NATIVE_TS_FILE}
+ TS_FILES "${arg_TS_FILES}" ${arg_PLURALS_TS_FILE}
QM_FILES_OUTPUT_VARIABLE qm_files
OPTIONS "${arg_LRELEASE_OPTIONS}")
diff --git a/src/linguist/linguist/doc/cmake-macros.qdoc b/src/linguist/linguist/doc/cmake-macros.qdoc
index c1b368cb3..c29bb1415 100644
--- a/src/linguist/linguist/doc/cmake-macros.qdoc
+++ b/src/linguist/linguist/doc/cmake-macros.qdoc
@@ -142,7 +142,7 @@ files in the build directory:
Since 6.7:
\badcode
qt_add_lupdate(TS_FILES file1.ts [file2.ts ...]
- [NATIVE_TS_FILE file.ts]
+ [PLURALS_TS_FILE file.ts]
[TARGETS target1 [target2 ...]]
[SOURCES source1.cpp [sources2.cpp ...]]
[INCLUDE_DIRECTORIES directory1 [directory2 ...]]
@@ -220,7 +220,7 @@ strings are written. For handling plural forms correctly, create an additional
\c{.ts} file for that language that only contains translatable strings for
plural forms. See \l{Handle Plural Forms} for details.
-With \c NATIVE_TS_FILE you can specify the \c{.ts} file for the native language.
+With \c PLURALS_TS_FILE you can specify the \c{.ts} file for the native language.
This file will only contain plural forms.
//! [ts-native-language]
@@ -360,7 +360,7 @@ qt_add_translations([target]
[TS_FILE_BASE name]
[TS_FILE_DIR directory]
[TS_FILES file1.ts [file2.ts ...]]
- [NATIVE_TS_FILE file.ts]
+ [PLURALS_TS_FILE file.ts]
[RESOURCE_PREFIX prefix]
[OUTPUT_TARGETS variable-name]
[QM_FILES_OUTPUT_VARIABLE variable-name]
diff --git a/tests/auto/cmake/linguist/CMakeLists.txt b/tests/auto/cmake/linguist/CMakeLists.txt
index 799c226f8..90be96016 100644
--- a/tests/auto/cmake/linguist/CMakeLists.txt
+++ b/tests/auto/cmake/linguist/CMakeLists.txt
@@ -63,4 +63,4 @@ _qt_internal_test_expect_pass(test_create_translation_same_base_names)
_qt_internal_test_expect_pass(test_translation_api)
_qt_internal_test_expect_pass(test_i18n_auto_ts_file_names)
_qt_internal_test_expect_pass(test_i18n_exclusion)
-_qt_internal_test_expect_pass(test_i18n_native_language)
+_qt_internal_test_expect_pass(test_i18n_source_language)
diff --git a/tests/auto/cmake/linguist/test_i18n_native_language/CMakeLists.txt b/tests/auto/cmake/linguist/test_i18n_source_language/CMakeLists.txt
index 4b97e7a3a..98a8bf652 100644
--- a/tests/auto/cmake/linguist/test_i18n_native_language/CMakeLists.txt
+++ b/tests/auto/cmake/linguist/test_i18n_source_language/CMakeLists.txt
@@ -2,7 +2,7 @@
# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
-project(test_i18n_native_language)
+project(test_i18n_source_language)
# Set up the project structure.
find_package(Qt6 REQUIRED COMPONENTS Core Gui LinguistTools)
@@ -18,7 +18,7 @@ endfunction()
my_add_library(lib1 STATIC lib.cpp)
qt_add_lupdate(
TARGETS lib1
- NATIVE_TS_FILE "${CMAKE_CURRENT_BINARY_DIR}/lib1_en.ts"
+ PLURALS_TS_FILE "${CMAKE_CURRENT_BINARY_DIR}/lib1_en.ts"
)
# qt_add_lupdate with just the native translation which has already been translated.
@@ -27,7 +27,7 @@ my_add_library(lib2 STATIC lib.cpp)
configure_file(lib2_en.ts.in lib2_en.ts COPYONLY)
qt_add_lupdate(
TARGETS lib2
- NATIVE_TS_FILE "${CMAKE_CURRENT_BINARY_DIR}/lib2_en.ts"
+ PLURALS_TS_FILE "${CMAKE_CURRENT_BINARY_DIR}/lib2_en.ts"
)
# qt_add_lupdate with regular translations and the native translation.
@@ -35,7 +35,7 @@ my_add_library(lib3 STATIC lib.cpp)
qt_add_lupdate(
TARGETS lib3
TS_FILES "${CMAKE_CURRENT_BINARY_DIR}/lib3_hi.ts" "${CMAKE_CURRENT_BINARY_DIR}/lib3_ho.ts"
- NATIVE_TS_FILE "${CMAKE_CURRENT_BINARY_DIR}/lib3_en.ts"
+ PLURALS_TS_FILE "${CMAKE_CURRENT_BINARY_DIR}/lib3_en.ts"
)
# qt_add_translations with just the native translation.
@@ -43,7 +43,7 @@ my_add_library(lib4 STATIC lib.cpp)
qt_add_translations(
TARGETS lib4
SOURCE_TARGETS lib4
- NATIVE_TS_FILE "${CMAKE_CURRENT_BINARY_DIR}/lib4_en.ts"
+ PLURALS_TS_FILE "${CMAKE_CURRENT_BINARY_DIR}/lib4_en.ts"
)
# qt_add_translations with regular translations and the native translation.
@@ -52,7 +52,7 @@ qt_add_translations(
TARGETS lib5
SOURCE_TARGETS lib5
TS_FILES "${CMAKE_CURRENT_BINARY_DIR}/lib5_hi.ts" "${CMAKE_CURRENT_BINARY_DIR}/lib5_ho.ts"
- NATIVE_TS_FILE "${CMAKE_CURRENT_BINARY_DIR}/lib5_en.ts"
+ PLURALS_TS_FILE "${CMAKE_CURRENT_BINARY_DIR}/lib5_en.ts"
)
# Find out how many targets we created above.
diff --git a/tests/auto/cmake/linguist/test_i18n_native_language/check_ts_files.cmake b/tests/auto/cmake/linguist/test_i18n_source_language/check_ts_files.cmake
index 4427682f7..4427682f7 100644
--- a/tests/auto/cmake/linguist/test_i18n_native_language/check_ts_files.cmake
+++ b/tests/auto/cmake/linguist/test_i18n_source_language/check_ts_files.cmake
diff --git a/tests/auto/cmake/linguist/test_i18n_native_language/lib.cpp b/tests/auto/cmake/linguist/test_i18n_source_language/lib.cpp
index 66cdaa8d0..66cdaa8d0 100644
--- a/tests/auto/cmake/linguist/test_i18n_native_language/lib.cpp
+++ b/tests/auto/cmake/linguist/test_i18n_source_language/lib.cpp
diff --git a/tests/auto/cmake/linguist/test_i18n_native_language/lib2_en.ts.in b/tests/auto/cmake/linguist/test_i18n_source_language/lib2_en.ts.in
index bf74b249c..bf74b249c 100644
--- a/tests/auto/cmake/linguist/test_i18n_native_language/lib2_en.ts.in
+++ b/tests/auto/cmake/linguist/test_i18n_source_language/lib2_en.ts.in