diff options
-rw-r--r-- | examples/linguist/arrowpad/CMakeLists.txt | 9 | ||||
-rw-r--r-- | examples/linguist/doc/snippets/doc_src_examples_arrowpad.qdoc | 4 | ||||
-rw-r--r-- | examples/linguist/doc/snippets/doc_src_examples_hellotr.qdoc | 4 | ||||
-rw-r--r-- | examples/linguist/doc/src/arrowpad.qdoc | 11 | ||||
-rw-r--r-- | examples/linguist/doc/src/hellotr.qdoc | 11 | ||||
-rw-r--r-- | examples/linguist/hellotr/CMakeLists.txt | 9 | ||||
-rw-r--r-- | examples/linguist/trollprint/CMakeLists.txt | 6 |
7 files changed, 54 insertions, 0 deletions
diff --git a/examples/linguist/arrowpad/CMakeLists.txt b/examples/linguist/arrowpad/CMakeLists.txt index 94b003262..882136b95 100644 --- a/examples/linguist/arrowpad/CMakeLists.txt +++ b/examples/linguist/arrowpad/CMakeLists.txt @@ -18,12 +18,21 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/linguist/arrowpad") find_package(Qt6 COMPONENTS Core) find_package(Qt6 COMPONENTS Gui) find_package(Qt6 COMPONENTS Widgets) +#! [0] +find_package(Qt6 REQUIRED COMPONENTS LinguistTools) +#! [0] qt_add_executable(arrowpad arrowpad.cpp arrowpad.h main.cpp mainwindow.cpp mainwindow.h ) +#! [1] +qt6_add_translations(arrowpad + TS_FILES arrowpad_fr.ts arrowpad_nl.ts + QM_FILES_OUTPUT_VARIABLE qm_files) +install(FILES ${qm_files} DESTINATION ${INSTALL_EXAMPLEDIR}) +#! [1] set_target_properties(arrowpad PROPERTIES WIN32_EXECUTABLE TRUE MACOSX_BUNDLE TRUE diff --git a/examples/linguist/doc/snippets/doc_src_examples_arrowpad.qdoc b/examples/linguist/doc/snippets/doc_src_examples_arrowpad.qdoc index ddb17bdbe..4f3bcbbd7 100644 --- a/examples/linguist/doc/snippets/doc_src_examples_arrowpad.qdoc +++ b/examples/linguist/doc/snippets/doc_src_examples_arrowpad.qdoc @@ -62,3 +62,7 @@ setenv LANG fr //! [3] set LANG=fr //! [3] + +//! [4] +make update_translations +//! [4] diff --git a/examples/linguist/doc/snippets/doc_src_examples_hellotr.qdoc b/examples/linguist/doc/snippets/doc_src_examples_hellotr.qdoc index a32a64915..5ea44562f 100644 --- a/examples/linguist/doc/snippets/doc_src_examples_hellotr.qdoc +++ b/examples/linguist/doc/snippets/doc_src_examples_hellotr.qdoc @@ -79,3 +79,7 @@ linguist hellotr_la.ts //! [4] <translation>Orbis, te saluto!</translation> //! [4] + +//! [5] +make update_translations +//! [5] diff --git a/examples/linguist/doc/src/arrowpad.qdoc b/examples/linguist/doc/src/arrowpad.qdoc index 926aeead9..6e64addfa 100644 --- a/examples/linguist/doc/src/arrowpad.qdoc +++ b/examples/linguist/doc/src/arrowpad.qdoc @@ -46,6 +46,17 @@ \c arrowpad_fr.ts and \c arrowpad_nl.ts. These files will contain all the source texts marked for translation with \c tr() calls and their contexts. + It is also possible to produce translations using the + \l{cmake-macros-qtlinguisttools}{Qt6::LinguistTools CMake commands}. + The relevant lines in \c CMakeLists.txt are: + \snippet arrowpad/CMakeLists.txt 0 + \codeline + \snippet arrowpad/CMakeLists.txt 1 + + After configuring and building, the translations are produced by running: + + \snippet doc/snippets/doc_src_examples_arrowpad.qdoc 4 + See the \l{Qt Linguist Manual} for more information about translating Qt application. diff --git a/examples/linguist/doc/src/hellotr.qdoc b/examples/linguist/doc/src/hellotr.qdoc index 924950731..f845ae4d9 100644 --- a/examples/linguist/doc/src/hellotr.qdoc +++ b/examples/linguist/doc/src/hellotr.qdoc @@ -93,6 +93,17 @@ maintain. In this example, we just maintain one set of translations, namely Latin. + It is also possible to produce translations using the + \l{cmake-macros-qtlinguisttools}{Qt6::LinguistTools CMake commands}. + One needs to add the following to the \c CMakeLists.txt: + \snippet hellotr/CMakeLists.txt 0 + \codeline + \snippet hellotr/CMakeLists.txt 1 + + After configuring and building, the translations are produced by running: + + \snippet doc/snippets/doc_src_examples_hellotr.qdoc 5 + Note that the file extension is \c .ts, not \c .qm. The \c .ts translation source format is designed for use during the application's development. Programmers or release managers run diff --git a/examples/linguist/hellotr/CMakeLists.txt b/examples/linguist/hellotr/CMakeLists.txt index 74cb0e05a..9f9fb085d 100644 --- a/examples/linguist/hellotr/CMakeLists.txt +++ b/examples/linguist/hellotr/CMakeLists.txt @@ -18,10 +18,19 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/linguist/hellotr") find_package(Qt6 COMPONENTS Core) find_package(Qt6 COMPONENTS Gui) find_package(Qt6 COMPONENTS Widgets) +#! [0] +find_package(Qt6 REQUIRED COMPONENTS LinguistTools) +#! [0] qt_add_executable(hellotr main.cpp ) +#! [1] +qt6_add_translations(hellotr + TS_FILES hellotr_la.ts + QM_FILES_OUTPUT_VARIABLE qm_files) +install(FILES ${qm_files} DESTINATION ${INSTALL_EXAMPLEDIR}) +#! [1] set_target_properties(hellotr PROPERTIES WIN32_EXECUTABLE TRUE MACOSX_BUNDLE TRUE diff --git a/examples/linguist/trollprint/CMakeLists.txt b/examples/linguist/trollprint/CMakeLists.txt index bb378111f..42d26a75d 100644 --- a/examples/linguist/trollprint/CMakeLists.txt +++ b/examples/linguist/trollprint/CMakeLists.txt @@ -18,12 +18,18 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/linguist/trollprint") find_package(Qt6 COMPONENTS Core) find_package(Qt6 COMPONENTS Gui) find_package(Qt6 COMPONENTS Widgets) +find_package(Qt6 REQUIRED COMPONENTS LinguistTools) qt_add_executable(trollprint main.cpp mainwindow.cpp mainwindow.h printpanel.cpp printpanel.h ) +qt6_add_translations(trollprint + TS_FILES trollprint_pt.ts + QM_FILES_OUTPUT_VARIABLE qm_files) +install(FILES ${qm_files} DESTINATION ${INSTALL_EXAMPLEDIR}) + set_target_properties(trollprint PROPERTIES WIN32_EXECUTABLE TRUE MACOSX_BUNDLE TRUE |