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

lupdate/lrelease "filesystem usage" documentation should be improved



    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 5.0.0, 5.13
    • Fix Version/s: 5.13
    • Component/s: Documentation
    • Labels:
    • Commits:


      https://doc.qt.io/qt-5/linguist-manager.html#using-lupdate is very focused on .pro files and doesn't mention Qt Quick. As this is one of the first pages that users wanting to learn how to set up translations will read, it should provide examples of using lupdate with non-.pro-based projects and Qt Quick projects. This is especially important for people using non-qmake build systems (CMake, Qbs).

      For example...

      To process an individual QML file:

      ~/dev/qt5-slate-fw/qtbase/bin/lupdate /Users/mitch/dev/slate/app/qml/main.qml -ts /Users/mitch/dev/slate/translations/slate_en.ts

      Thanks to this answer, I discovered that you can even pass in a .qrc file and have all of its QML files picked up automatically by lupdate:

      ~/dev/qt5-slate-fw/qtbase/bin/lupdate /Users/mitch/dev/slate/app/qml/qml.qrc -ts /Users/mitch/dev/slate/translations/slate_en.ts

      https://doc.qt.io/qt-5/qtqml-qml-i18n-example.html explains how to run lupdate on a QML file, so that would be good to link to.

      If your app's user-facing strings lie mostly in QML files, but you have some in C++:

      ~/dev/qt5-slate-fw/qtbase/bin/lupdate /Users/mitch/dev/slate/app/qml/qml.qrc /Users/mitch/dev/slate/lib/filevalidator.cpp -ts /Users/mitch/dev/slate/translations/slate_en.ts

      Also, https://doc.qt.io/qt-5/linguist-manager.html#creating-translation-files says:

      For lupdate to work successfully, it must know which translation files to produce. The files are listed in the application's .pro Qt project file.

      This is a bit misleading. It should be updated to mention that it's also possible to specify the translation files via the command line without the need for a .pro file. For example, to generate .ts files that will be used for English and French:

      ~/dev/qt5-slate-fw/qtbase/bin/lupdate /Users/mitch/dev/slate/app/qml/qml.qrc /Users/mitch/dev/slate/lib/filevalidator.cpp -ts /Users/mitch/dev/slate/translations/slate_en.ts /Users/mitch/dev/slate/translations/slate_fr.ts

      The same applies to lrelease:


      There should be examples of running it without a .pro file.


        For Gerrit Dashboard: QTBUG-76289
        # Subject Branch Project Status CR V



            • Assignee:
              vertries Nico Vertriest
              mitch_curtis Mitch Curtis
            • Votes:
              1 Vote for this issue
              2 Start watching this issue


              • Created:

                Gerrit Reviews

                There are no open Gerrit changes