Uploaded image for project: 'Qt Design Studio'
  1. Qt Design Studio
  2. QDS-8715

Generated CMakeLists.txt file should enable i18n for translations enabled (qsTrId) projects

    XMLWordPrintable

Details

    Description

      Summary of the issue

      It's quite hard for developer to come up with the way to activate the translations edited in the translations editor in QDS to the other development environment such as Qt Creator. It's better the CMakeLists.txt file QDS generates automatically includes the function to include the edited translations.  If adding the function to CMakeLists.txt is hard, it’s better to document how to do it somewhere.

      About how to enable the translations, following is an example code snippet of CMakeLists function I can see it works. (English and Japanese translation are included in the QDS project).

      qt_add_translations(${CMAKE_PROJECT_NAME}
          TS_FILES
          i18n/qml_ja.ts
          i18n/qml_en.ts
          RESOURCE_PREFIX Main/i18n
          LRELEASE_OPTIONS -idbased
      )

      Reproducible steps

      1. Create a QDS project (Qt 6.2 or later for the target).
      2. Change every qsTr based texts to qsTrId based texts. 
      3. By using Translations editor panel, add testing environment's native language to the project's language and add translations to each translation IDs by using the editor.
      4. Press translation editor panel's generate .ts and .qm button to generate .ts (and .qm) files for generating the translation files.
      5.  Press live preview button and make sure the translation works.
      6. Generate CMakeLists.txt file for the project through "File" -> "Export Project" -> "Generator CMakeLists.txt build files..."
      7. Open the CMakeLists.txt file through QtCreator
      8. Build and test the project through QtCreator 

      Expected behavior

      Translated texts are displayed in the app.

      Actual behavior

      TextIds are displayed in the app.

      Note

      There are miltiple inconsistency for multi-language support in Qt6. I took a note for it.

      About QML Multi-language support inconsistency - Qt Site Japan - Global Site

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            takujikawata Takuji Kawata
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes