Problem with arg at QString.
-
[quote author="Leon" date="1309702921"]Yes but if get rid of "+" then the whole thing will be translatable.. I want only the "In random order" part to be..[/quote]
Try the same without those plusses and you will see youself.
Tr() cannot translate as you think when those plusses are there. Read the book and it will be all clear to you.[quote]P.S The second edition of the book is better? And the second is the one that is not free?[/quote]
It's almost the same. The first one is free as the webpage tells you.
-
Tr() will translate only the “In random order” part even if there are plusses.. I just checked it..
I just removed every "+" exactly the same problem. :/@QString written = QString(tr("In random order%1%2%3%4%5%6%7%8")).arg(":\n").arg("Leon Vytanos <").arg("<a ><span font-family:'Sans'; font-size:10pt; text-decoration: underline; color:#ff5500;"<span>%1%2%3%4%5</span></a>").arg("leon.check.me@gmail.com").arg(">\nAlex Solanos <").arg("<a ><span font-family:'Sans'; font-size:10pt; text-decoration: underline; color:#ff5500;"</a>").arg("alexsol.developer@gmail.com").arg(">");
@ -
Ok look the code.. I removed the <span>%1%2%3%4%5</span> because it was wrong.. So this should work..
@QString written = QString(tr("In random order%1%2%3%4%5%6%7")).arg(":\nLeon Vytanos <").arg("<a ><span font-family:'Sans'; font-size:10pt; text-decoration: underline; color:#ff5500;"</a>").arg("leon.check.me@gmail.com").arg(">\nAlex Solanos <").arg("<a ><span font-family:'Sans'; font-size:10pt; text-decoration: underline; color:#ff5500;"</a>").arg("alexsol.developer@gmail.com").arg(">");
@I putted the outpout at tomboy notes and it look like this.. "SCREENSHOT":http://img843.imageshack.us/img843/8437/screenshot4rp.png
:/
-
for instance :
@.arg("<a ><span font-family:'Sans'; font-size:10pt; text-decoration: underline; color:#ff5500;"</a>")@Do you need to translate this ?
@<a><span font-family:'Sans'; font-size:10pt; text-decoration: underline; color:#ff5500;"</a>")@
you should put everything in one string except the parts you want translated. put them in the arg()
i suggest you look at my example and experiment with it. Try to understand it. Read the books chapter.
-
I got it but same problem..
@QString written = QString(tr("In random order%1")).arg(":\nLeon Vytanos <<a ><span font-family:'Sans'; font-size:10pt; text-decoration: underline; color:#ff5500;"</a>leon.check.me@gmail.com>\nAlex Solanos <<a ><span font-family:'Sans'; font-size:10pt; text-decoration: underline; color:#ff5500;"</a>alexsol.developer@gmail.com>");
@The book at that point doesn't say anything more than what you have already told me..
-
It seems like the textbrowzer has a different type of html.. so i finally found a solution and it is:
@ QString written = QString("<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"><html><head><meta name="qrichtext" content="1" /><style type="text/css">p, li { white-space: pre-wrap; }</style></head><body font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"><p margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">%1%2").arg(tr("In random order")).arg(":</p><p margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span font-family:'Sans'; font-size:10pt;">Leon Vytanos <</span><a ><span font-family:'Sans'; font-size:10pt; text-decoration: underline; color:#ff5500;">leon.check.me@gmail.com</span></a><span font-family:'Sans'; font-size:10pt;">></span></p><p margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span font-family:'Sans'; font-size:10pt;">Alex Solanos <</span><a ><span font-family:'Sans'; font-size:10pt; text-decoration: underline; color:#ff5500;">alexsol.developer@gmail.com</span></a><span font-family:'Sans'; font-size:10pt;">></span></p></body></html>");
@But the
@ QString written = QString("<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">@
part if i remove it there will be no problem, Should it be with or without this line?