Examples: Use the revisited qt_add_translations signature

Instead of specifying .ts files, we specify languages now.

The i18n/base.ts file is not supposed to be part of the project. It
serves as template for new translations. See the qml-i18n example's
documentation page.

Task-number: QTBUG-117463
Change-Id: I232c1a856e652fc6a31233e7119a1508fba49987
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Serg Kryvonos <serg.kryvonos@qt.io>
This commit is contained in:
Joerg Bornemann 2023-09-28 14:49:59 +02:00
parent 94727ece3b
commit 89458093b9
1 changed files with 4 additions and 8 deletions

View File

@ -4,9 +4,6 @@
cmake_minimum_required(VERSION 3.16)
project(qml-i18n LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@ -15,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/qml/qmli18n")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick Qml LinguistTools)
qt_standard_project_setup(I18N_LANGUAGES en en_AU fr)
qt_add_executable(qmli18n WIN32 MACOSX_BUNDLE main.cpp)
target_link_libraries(qmli18n PRIVATE
@ -32,11 +31,8 @@ qt_add_qml_module(qmli18n
)
qt_add_translations(qmli18n
TS_FILES
i18n/base.ts
i18n/qml_en.ts
i18n/qml_en_AU.ts
i18n/qml_fr.ts
TS_FILE_BASE qml
TS_FILE_DIR i18n
)
install(TARGETS qmli18n