Re: lupdate not loading all strings
Hello!
I recently started working with translations and I noticed that some of my strings weren't compiled to the .ts files by lupdate, notably those which were generated inside a for() loop translating the strings from an array:
Code:
const char* myStrings[] = { "String 1", "String 2", "String 3" };
for (int aaa = 0; aaa < 3; aaa++)
{
myLabel[aaa]->setText(tr(myStrings[aaa]));
}
I did some research in the Qt Linguist Manual and I noticed that it repeatedly talks about "human readable strings" or "user-visible text". Does this means that strings set to translation as in the code above would never work? And I need to write them separatedly? :
Code:
myLabel[0]->setText(tr("String 1"));
myLabel[1]->setText(tr("String 2"));
myLabel[2]->setText(tr("String 3"));
Thanks,
Momergil
Added after 1 47 minutes:
I found the answer I seek: use QT_TRANSLATE_NOOP or QT_TR_NOOP arround the strings of the array.
Re: lupdate not loading all strings
For further readers, I just found this old post (it's about Qt3 \o/) that give some tips about translating with Qt, including commentaries about not using the two macros I just presented as solution to my problem :p. I'll still testing the shown alternatives, but they seem reasonable.
Re: lupdate not loading all strings
The paper doesn't say anywhere you shouldn't use QT_TR_NOOP. It says you should use it together with tr().