user1541092
user1541092

Reputation: 1

QTranslator tr() - problem with initial blank spaces?

I have the following snip of code:

QString invalidMsg = tr("Please select"); //"Selectionner" in *.ts file
if(m_buildVersionPortion == "") {
   if(m_isSeededByReleasesOnly) {
      invalidMsg += tr(" Release");        // " Version"       "    "   "
   }
}
if(m_configNamePortion == "") {
   if(!isValid) {
      invalidMsg += tr(" and");            // " et"            "    "   "
   }
   invalidMsg += tr(" Config");            // " Configuration" "    "   "
}

If I run in French then I can see the following QString: "Selectionner Version et Configuration" (correct)

BUT, the original English version gives me the following: "Please selectReleaseandConfig (incorrect)"

If I modify the code to remove the first tr() call then - in English - I get: "Please select ReleaseandConfig" (which is correct for the first part and what I want)

Does tr() strip away the initial blank space from any of the original (English) text?

Upvotes: 0

Views: 39

Answers (1)

user1541092
user1541092

Reputation: 1

The problem was in the English *.ts file. While the correct translation was present in the French *.ts file - it was incorrect in the other which resulted in the error.

Upvotes: 0

Related Questions