Vladimir Tsyshnatiy
Vladimir Tsyshnatiy

Reputation: 1069

Qt translation is missing for class with tr

I'm using visual studio + qt plugin for my project.
Created MyClass inherited from QAbstractTableModel.
That class is a part of a dll library.
I've overridden QAbstractTableModel::headerData, added tr("string") inside.
However tr did not work, no context was created and no name was added to the generated ts file.

Could anyone please help with that issue?

Upvotes: 2

Views: 626

Answers (2)

Vladimir Tsyshnatiy
Vladimir Tsyshnatiy

Reputation: 1069

Found the solution.
Just forgot to add library which contains my class to ts lupdate / lrelease list.

Upvotes: 1

ganeshredcobra
ganeshredcobra

Reputation: 2081

try calling

QObject::tr("string") 

or add

#include <QObject>

and call tr directly.

Upvotes: 1

Related Questions