Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Empty .ts file after lupdate
Forum Updated to NodeBB v4.3 + New Features

Empty .ts file after lupdate

Scheduled Pinned Locked Moved Qt Creator and other tools
12 Posts 2 Posters 6.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Grunthor
    wrote on 14 Jan 2014, 11:11 last edited by
    #1

    So, I've ran into a problem. When I use lupdate on Qt Creator ( Tools -> External -> Linguist -> Update Translations (lupdate) ) or by terminal ( lupdate - recursive /localization/proj.pro) the .ts file is created but there is no data inside.

    what can be the reason that blank file is created without any data?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sierdzio
      Moderators
      wrote on 14 Jan 2014, 12:06 last edited by
      #2

      You have marked your strings with "tr", right? Then it is indeed strange that you are getting no output.

      (Z(:^

      1 Reply Last reply
      0
      • G Offline
        G Offline
        Grunthor
        wrote on 14 Jan 2014, 12:14 last edited by
        #3

        I marked every string by qsTr(becouse it's qml) and qt_tr_noop() -> elements of the lists.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          sierdzio
          Moderators
          wrote on 14 Jan 2014, 12:16 last edited by
          #4

          Maybe you have hit the old qmake/ lupdate bug: it does not send QML files to lupdate.

          Add this in your .pro file:
          @
          hack_for_lupdate { # or any other text - it does not matter.
          SOURCES += your/qml/files.qml
          }
          @

          (Z(:^

          1 Reply Last reply
          0
          • G Offline
            G Offline
            Grunthor
            wrote on 14 Jan 2014, 12:25 last edited by
            #5

            What should be the effect of this code?

            1 Reply Last reply
            0
            • S Offline
              S Offline
              sierdzio
              Moderators
              wrote on 14 Jan 2014, 12:27 last edited by
              #6

              Whwn building the project, qmake will completely ignore it. lupdate, however will now treat your QML files as real source files: and so it will parse them in search for translatable strings.

              I think this bug was fixed in Qt5, probably also in recent Qt 4 versions (4.8.x).

              (Z(:^

              1 Reply Last reply
              0
              • G Offline
                G Offline
                Grunthor
                wrote on 14 Jan 2014, 12:37 last edited by
                #7

                It's problem becouse I use QT5. Qt Creator 2.5.0 Based on Qt 4.8.2 (64 bit).
                Another problem is that I can't build this project on my computer(compiler problem with listing but will be solved in couple days).
                My project file:

                TEMPLATE = lib

                include(../smarteyeradar.pri)

                unix:DEFINES += _LINUX
                _x86
                BOOST_THREAD_USE_LIB

                win32:QMAKE_CXXFLAGS = -Zc:wchar_t

                QT += opengl gui core declarative sql network

                DEFINES += GUI_REVISION=\"$(REVISION)\"

                TARGET = gui-$(REVISION)

                unix:QMAKE_POST_LINK += ln -s -f $(TARGET) $$DESTDIR/libgui.a

                CONFIG += static

                HEADERS +=
                headers_files.h

                SOURCES +=
                files.cpp

                RESOURCES += resources.qrc

                hack_for_lupdate{
                OTHER_FILES +=
                \qml\qml_files.qml
                }
                TRANSLATIONS = gui3.ts

                Is it right? Becouse it doesn't work.

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  sierdzio
                  Moderators
                  wrote on 14 Jan 2014, 12:42 last edited by
                  #8

                  If you only have one QML file and it's path is "\qml\qml_files.qml", then yes - you just need to change that into SOURCES and not OTHER_FILES. Also, Qt expects you to use Unix paths (forward slashes "/"). Lastly, QtQuick1 (devlarative) module is deprecated in Qt5.2. You might consider porting to QtQuick2.

                  However, I don't see QMLFILES variable anywhere in this listing. I guess you need to create a small example application and see if it works there, then go over your config slowly and see what is wrong.

                  (Z(:^

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    Grunthor
                    wrote on 14 Jan 2014, 12:54 last edited by
                    #9

                    Project is much bigger but I don't want you to scroll all of this files thats why I call him "qml_filles.qml". All of files I put between {}.

                    Now it looks:
                    TEMPLATE = lib

                    include(../smarteyeradar.pri)

                    unix:DEFINES += _LINUX \ _x86 \ BOOST_THREAD_USE_LIB

                    win32:QMAKE_CXXFLAGS = -Zc:wchar_t

                    QT += opengl gui core declarative sql network

                    DEFINES += GUI_REVISION=\\”$(REVISION)\\”

                    TARGET = gui-$(REVISION)

                    unix:QMAKE_POST_LINK += ln -s -f $(TARGET) $$DESTDIR/libgui.a

                    CONFIG += static

                    HEADERS += headers_files.h

                    SOURCES += files.cpp

                    RESOURCES += resources.qrc

                    hack_for_lupdate{
                    OTHER_FILES +=
                    /qml/qml_files.qml
                    }
                    TRANSLATIONS = gui3.ts

                    It is still not working.

                    1 Reply Last reply
                    0
                    • G Offline
                      G Offline
                      Grunthor
                      wrote on 14 Jan 2014, 13:28 last edited by
                      #10

                      I installed the newest version of Qt and it isn't help me...

                      1 Reply Last reply
                      0
                      • G Offline
                        G Offline
                        Grunthor
                        wrote on 23 Jan 2014, 08:32 last edited by
                        #11

                        I got some progress but... When I use lupdate (even with -recursive) gui.pro the .ts file is empty. I tried to create the .ts file with one qml file and it's ok, the file is created.
                        What's wrong when I want to make the ts from all project file where are qml files...

                        The problem is that I haven't got in my file.pro SOURCES qml files with strings. QT locates those files in "OTHER FILES" and lupdate doesn't see them. I tried put them into SOURCES and it's ok but project doesn't compiling.

                        Solutions:

                        1. How can I tell lupdate to translate "OTHER FILES"??
                        2. Solving the problem with compiling

                        PS: -recursive does not help...

                        PLZ help

                        1 Reply Last reply
                        0
                        • G Offline
                          G Offline
                          Grunthor
                          wrote on 7 Feb 2014, 13:35 last edited by
                          #12

                          Lupdate doesn't care about conditionals, so you can do something like this in your.pro file:
                          evilhack{
                          SOURCES +=
                          qml\qmlfile1.qml
                          qml\qmlfile2.qml
                          qml\qmlfile3.qml
                          }
                          and it will be picked up by lupdate, but left out from compilations etc

                          1 Reply Last reply
                          0

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved