From f95636a8203c7b6de6f166f9e0a0604f08bce239 Mon Sep 17 00:00:00 2001 From: Mats Honkamaa Date: Thu, 27 Jan 2022 15:09:26 +0200 Subject: Doc: Update multilanguage database docs Update reference docs and tutorial for the multilanguage database. Task-number: QDS-5966 Change-Id: I1aa3fa2fa8009bb0240ec787edbdc1589e87d5f1 Reviewed-by: Leena Miettinen --- .../examples/doc/images/imported-translations.png | Bin 9763 -> 8725 bytes doc/qtdesignstudio/examples/doc/multilanguage.qdoc | 23 +++----- doc/qtdesignstudio/images/enable-multilanguage.png | Bin 6486 -> 0 bytes .../images/studio-translations-view.png | Bin 79896 -> 9687 bytes doc/qtdesignstudio/images/translation-tester.png | Bin 26029 -> 3862 bytes .../src/views/studio-translations.qdoc | 58 ++++++++++++--------- 6 files changed, 40 insertions(+), 41 deletions(-) delete mode 100644 doc/qtdesignstudio/images/enable-multilanguage.png diff --git a/doc/qtdesignstudio/examples/doc/images/imported-translations.png b/doc/qtdesignstudio/examples/doc/images/imported-translations.png index 7609394b8e0..1d30eb7be02 100644 Binary files a/doc/qtdesignstudio/examples/doc/images/imported-translations.png and b/doc/qtdesignstudio/examples/doc/images/imported-translations.png differ diff --git a/doc/qtdesignstudio/examples/doc/multilanguage.qdoc b/doc/qtdesignstudio/examples/doc/multilanguage.qdoc index 27afb9d02b2..e749ab59675 100644 --- a/doc/qtdesignstudio/examples/doc/multilanguage.qdoc +++ b/doc/qtdesignstudio/examples/doc/multilanguage.qdoc @@ -39,8 +39,8 @@ translations from a JSON file. You need to download the starting project for this tutorial from - \l{https://git.qt.io/public-demos/qtdesign-studio/-/tree/master/examples/ - loginui2}{here} before you start. + \l{https://git.qt.io/public-demos/qtdesign-studio/-/tree/master/tutorial%20projects/multi-language%20tutorial/Loginui2}{here} + before you start. Download the project and open the \e loginui2.qmlproject file in \QDS to get started. @@ -48,8 +48,7 @@ This project consists of a login page with a couple of text elements. Additionally, you will use a JSON translation file in this tutorial. - Download it from \l{https://git.qt.io/public-demos/qtdesign-studio/-/tree/ - master/tutorial%20projects/multi-language}{here}. + Download it from \l{https://git.qt.io/public-demos/qtdesign-studio/-/tree/master/tutorial%20projects/multi-language}{here}. \section1 JSON Translation File @@ -133,10 +132,11 @@ First, you need to prepare your project for translation: \list 1 + \li In \uicontrol{Projects}, double-click \e{Screen01.ui.qml} to open it. \li All text strings that you want to translate need to be of \c qsTrId type. In this project the text strings are of \c qsTr type so you need to change them. Open \uicontrol{Text Editor}, find all five - occurrences of \c QsTr and replace them with \c{QsTrId}. For example, + occurrences of \c qsTr and replace them with \c{qsTrId}. For example, replace: \code text: qsTr("Qt Account") @@ -165,21 +165,14 @@ \li Go to \uicontrol View > \uicontrol Views and select \uicontrol Translations to open the \uicontrol Translations view. You can drag it to a workspace to dock it. - - When you open the \uicontrol Translations view for the first time, \QDS - prompts you to enable the multi-language database, select - \uicontrol{Yes}. - \image enable-multilanguage.png \li In \uicontrol Translations, select \inlineimage icons/select-languages.png . - - When you enable the multi-language database, an SQLite database named - \e translations.db is created in the project folder root. \li Select the languages that you want to support in your project, in this case \uicontrol{English - American English} and - \uicontrol{Swedish}. - \li Set \uicontrol English as primary language and select \uicontrol{OK}. + \uicontrol{Swedish - Svenska}. + \li Set \uicontrol{English - American English} as primary language and + select \uicontrol{Ok}. \li Select \inlineimage icons/import-json-translations.png and open the \e ml_translations.json file. Now you can see all your imported translations in the \uicontrol Translations view. diff --git a/doc/qtdesignstudio/images/enable-multilanguage.png b/doc/qtdesignstudio/images/enable-multilanguage.png deleted file mode 100644 index ebb528a81a2..00000000000 Binary files a/doc/qtdesignstudio/images/enable-multilanguage.png and /dev/null differ diff --git a/doc/qtdesignstudio/images/studio-translations-view.png b/doc/qtdesignstudio/images/studio-translations-view.png index 454e8ce2a23..d5a843d0df6 100644 Binary files a/doc/qtdesignstudio/images/studio-translations-view.png and b/doc/qtdesignstudio/images/studio-translations-view.png differ diff --git a/doc/qtdesignstudio/images/translation-tester.png b/doc/qtdesignstudio/images/translation-tester.png index 6b1e6f024df..6a3f7441805 100644 Binary files a/doc/qtdesignstudio/images/translation-tester.png and b/doc/qtdesignstudio/images/translation-tester.png differ diff --git a/doc/qtdesignstudio/src/views/studio-translations.qdoc b/doc/qtdesignstudio/src/views/studio-translations.qdoc index 75aaf32179f..c7767d98b8c 100644 --- a/doc/qtdesignstudio/src/views/studio-translations.qdoc +++ b/doc/qtdesignstudio/src/views/studio-translations.qdoc @@ -63,12 +63,14 @@ \li \l{Generating Qt Translation Source Files} \row \li \inlineimage icons/project-translation-test.png - \li Run project translation test. - \li \l{Running the Project Translation Test} + \li Run translation test for several documents and create a test report. + \li \l{Running Translation Test for Several Documents} \row \li \inlineimage icons/qml-translation-test.png - \li Run QML translation test to find missing and elided translations. - \li \l{Running the QML Translation Test} + \li Run translation test for the currently open document. This test + shows translation warnings in \uicontrol{From Editor} and creates a + test report. + \li \l{Running Translation Test for a Single Document} \row \li \inlineimage icons/export-translations.png \li Export all translations used in your project or all translations @@ -93,8 +95,8 @@ "translation": "Password" }, { - "language": "sv", - "translation": "Lösenord" + "language": "fi", + "translation": "Salasana" } ] } @@ -120,8 +122,8 @@ "translation": "Password" }, { - "language": "sv", - "translation": "Lösenord" + "language": "fi", + "translation": "Salasana" } ] \endcode @@ -139,14 +141,14 @@ in the \uicontrol Translations view. The files are generated in \e{/i18n}. - \section1 Running the QML Translation Test + \section1 Running Translation Test for a Single Document - You can run the QML language test to find missing - and elided translations. Running the QML language test - is a quick way to check the translations in the application you have open in - \uicontrol{Form Editor} as it highlights errors in the UI. + You can run the translation test to find missing translations + and translations where the text exceeds the text element boundaries. Running + the test is a quick way to check the translations in the document you have + open in \uicontrol{Form Editor} as it highlights errors in the UI. - To run the QML translation test: + To run the test for the currently open document: \list 1 \li In the \uicontrol Translations view, select @@ -155,12 +157,11 @@ \li Select the tests to run and the highlight color for each test: \list - \li \uicontrol{Show Translation Warnings} highlights missing - translations. - \li \uicontrol{Show Found Translations} highlights all translations - that are correct. - \li \uicontrol{Show Elide Warnings} highlights all translations where - the text is too long to fit in the text object and therefore is elided. + \li \uicontrol{Success} highlights translations without any warnings. + \li \uicontrol{Missing translation} highlights translations that are + missing for one or more languages. + \li \uicontrol{Exceeds boundaries} highlights translations where + the text is too long to fit in the text object. \endlist \image translation-tester.png \li Select \uicontrol{Run Tests}. @@ -205,16 +206,21 @@ The report shows the type of error as well as line and column of the affected text element in the \e{ui.qml} file. - \section1 Running the Project Translation Test + \section1 Running Translation Test for Several Documents You can run the project translation test on several \e{.ui.qml} files at the same time. \QDS runs the same tests as during the - \l{Running the QML Translation Test}{QML Translation Test} and generates the - same test reports but does not highlight errors in the UI. + \l{Running Translation Test for a Single Document}{Translation Test} and + generates the same test reports but does not highlight errors in the UI. - To run the project translation test, select - \inlineimage icons/project-translation-test.png - in the \uicontrol Translations view. + To run the translation test for several documents: + \list 1 + \li Select + \inlineimage icons/project-translation-test.png + in the \uicontrol Translations view. + \li Select the files that you want to include in the test. + \li Select \uicontrol{Run Tests}. + \endlist \section1 Exporting Translations in Other Ways -- cgit v1.2.3