Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-110129

Improvement request for sample application QML Examples - Internationalization

    XMLWordPrintable

Details

    • All

    Description

      Summary of the issue

      Qt Creator sample application qml-i18n (QML Examples - Internationalization) uses Qt core’s language file auto loading mechanism. The .qm files are placed under /i18n directory of Qt resource system and to match the automatic loading path ( <main qml’s base pash>/i18n ), the sample application places main qml file to the route path by specifying NO_RESOURCE_TARGET_PATH to the qt_add_qml_module.

      This technique works but is bit tricky way. I think place .qm files under main qml’s base directly is better.

      Reproducible steps

      1. At Qt Creator, load sample application "QML Examples - Internationalization"
      2. Check the CMakeLists.txt

      Expected behavior

      qt_add_translations function in CMakeLists.txt load i18n files under root qml's base directly by specifying RESOURCE_PREFIX option. Example:

       

      qt_add_translations(qmli18n
          TS_FILES
          i18n/base.ts
          i18n/qml_en.ts
          i18n/qml_en_AU.ts
          i18n/qml_fr.ts
          i18n/qml_ja.ts
          RESOURCE_PREFIX  i18n
      )
      

       

      qt_add_qml_module is defined as usual.

      qt_add_qml_module(qmli18n
          URI i18n
          VERSION 1.0
          QML_FILES
              qml-i18n.qml
      ) 

      Actual Result

      qt_add_qml_module has option NO_RESOURCE_TARGET_PATH to place root qml file into qrc root directly. It works but doesn't look a good practice as non multi langage app won't apply this option to root qml file.

       

      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

            kkohne Kai Köhne
            takujikawata Takuji Kawata
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes