View Full Version : qobject::tr() matching problem

22nd September 2011, 20:39
I'm having a problem in which tr() is returning the wrong translation for a given string (QT 3.3).
I have the following two strings in my qm file:

In the following code:
QString registrationStr = QObject::tr("Rigid");

The result that is returned is the translation for "Right".

Is there some kind of matching algorithm that is used in tr() in which the function is searching translation dictionary based on the length of the english string + the first 3 characters rather than an exact match?

The only way around this was to add a comment to the tr() call like:
QString registrationStr = QObject::tr("Rigid","rigid algorithm");