Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] lupdate fails to find correct strings and locations
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] lupdate fails to find correct strings and locations

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.7k 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.
  • L Offline
    L Offline
    lckappa
    wrote on last edited by
    #1

    Hi,

    I am new to Qt Project forums, not new to Qt though.
    I run into a problem with lupdate (version 4.7.4) that can be reproduced by "lupdating" the following dummy class:

    [MyObject.h]
    @
    #ifndef MYOBJECT_H
    #define MYOBJECT_H

    #include <QObject>

    class MyObject : public QObject
    {
    Q_OBJECT

    public:
    MyObject(QObject *parent);
    ~MyObject();
    QString firstOptionText( bool enabled = true );
    QString secondOptionText( bool enabled = true );
    QString thirdOptionText( bool enabled = true );

    private:

    };

    #endif // MYOBJECT_H
    @

    [MyObject.cpp]
    @
    #include "MyObject.h"

    MyObject::MyObject(QObject *parent)
    : QObject(parent)
    {

    }

    MyObject::~MyObject()
    {

    }

    QString MyObject::firstOptionText( bool enabled /*= true */ )
    {
    return enabled ? tr("First") : tr("No first");
    }

    QString MyObject::secondOptionText( bool enabled /*= true */ )
    {
    return enabled ? tr("Second") : tr("No second");
    }

    QString MyObject::thirdOptionText( bool enabled /*= true */ )
    {
    return enabled ? tr("Third") : tr("No third");
    }
    @

    Apparently, lupdate fails to recognize all these strings. In fact, relatively to the "MyObject" context, the .ts files look as follows:

    @
    <context>
    <name>MyObject</name>
    <message id="true">
    <location filename="MyObject.cpp" line="16"/>
    <location filename="MyObject.cpp" line="21"/>
    <location filename="MyObject.cpp" line="26"/>
    <source>First</source>
    <translation type="unfinished"></translation>
    </message>
    <message>
    <location filename="MyObject.cpp" line="16"/>
    <source>No first</source>
    <translation type="unfinished"></translation>
    </message>
    <message>
    <location filename="MyObject.cpp" line="21"/>
    <source>No second</source>
    <translation type="unfinished"></translation>
    </message>
    <message>
    <location filename="MyObject.cpp" line="26"/>
    <source>No third</source>
    <translation type="unfinished"></translation>
    </message>
    </context>
    @

    Same thing happens using "if(...) ... else ..." in place of the ternary operator "... ? ... : ...".

    Any help about this is appreciated.

    Thanks

    1 Reply Last reply
    0
    • IamSumitI Offline
      IamSumitI Offline
      IamSumit
      wrote on last edited by
      #2

      Hii..

      welcome to Qt devnet.

      i went through your problem .

      Remove old .ts file

      just remove /*= true */ comments and save it.

      and regenerate .ts file

      your problem would be solved.

      :)

      Be Cute

      1 Reply Last reply
      0
      • L Offline
        L Offline
        lckappa
        wrote on last edited by
        #3

        Many thanks!
        That worked!

        Is that related to lupdate not correctly handling C style comments /.../ in general? Or is that related to comments inside argument lists? Who knows... I will check that (since comments like those are automatically generated by the tool I use for automatic definition generation...).

        1 Reply Last reply
        0
        • IamSumitI Offline
          IamSumitI Offline
          IamSumit
          wrote on last edited by
          #4

          wow that's great..
          I guess..May be argument problem .

          and Don't forget to make your thread as [SOLVED].

          :)

          Be Cute

          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