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

lupdate/lrelease "filesystem usage" documentation should be improved

    XMLWordPrintable

    Details

    • 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:
      None
    • Commits:
       17b3136bd2e707d84240ac74a04adf66794c1921

      Description

      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:

      https://doc.qt.io/qt-5/linguist-manager.html#using-lrelease

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

        Attachments

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

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes