[SOLVED] lupdate fails to find correct strings and locations
-
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_OBJECTpublic:
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
-
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.
:)
-
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...).
-
wow that's great..
I guess..May be argument problem .and Don't forget to make your thread as [SOLVED].
:)