July 3, 2011

Leon Leon
Robot Herder
400 posts

Help with what should i include for translation at my app.

 

So i am trying to add/remove tr(”“) at every text that i have at my app..
But i bumped into some problems..
First: I have a buttongroup and it is called buttongroup. At Qt Linguist i see that i can translate “buttongroup”. Why? How can i disable it?
Second: What about html codes? Should i leave the translation point like this?

  1. <a href="http://www.google.com/"><span>WebSite</span></a>

Or how can i point the translation only at “Website”
Third: What about the licence? Should it be translatable? License is very long and i don’t think anyone would translate the licence too.

Thanks again, Leon

14 replies

July 3, 2011

Eddy Eddy
Area 51 Engineer
1295 posts

1) just don’t translate buttongroup if you don’t see it in your program.

2) try using the arg function on your html code string

3) IANAL but in my opinion the licence should not be translated. Have a look at the GPGL website for instance. Several people have translated it, but the english version says it’s the only official one.

 Signature 

Qt Certified Specialist
Qt Ambassador

July 3, 2011

Leon Leon
Robot Herder
400 posts

1. I don’t want to ignore it.. Can’t i somehow disable it to be translatable?

2. What exactly do you mean?

  1. <a href="http://www.wallch.t35.com/"><span>.<arg>WebSite</arg></span></a>

?

3. Ok thanks

4. Should i translate this when showing a dialog?

  1. tr("%1 Files (*.%2);;All Files (*)")

July 3, 2011

Alexandr Ekimov Alexandr Ekimov
Lab Rat
7 posts

1. You don’t want to translate, don’t want to ignore. What do you want? :)
2. QString::arg()
4. Why not?

 Signature 

Ekimov Alexander,
http://www.ekimoff.com

July 3, 2011

Leon Leon
Robot Herder
400 posts

1 Eddy said to me not to translate it. So basically ignore it. I don’t want to ignore it.. I just don’t want to be translatable.
2.Something like this?

  1. ui->label_5->setText(QString::arg("<a href="http://www.wallch.t35.com/"><span>WebSite</span></a>"));

Which of course doesn’t work..
4.Ok

July 3, 2011

Eddy Eddy
Area 51 Engineer
1295 posts

2. try this. it works for me.

EDIT :
QString www(“website”);

QString str = QString(”
<
a
href
=
\“http://www.google.com/\”><span>%1</span></a>”).arg(www);

EDIT : now you can use it like this
ui->label_5->setText(str);

Hint : mention the \” to get it as one string including “ characters

PS : i’ve put the solution one character per line to avoid the editor hiding the details. So just put them on one line and go!

 Signature 

Qt Certified Specialist
Qt Ambassador

July 3, 2011

Alexandr Ekimov Alexandr Ekimov
Lab Rat
7 posts

2.

  1. QString site =  QString("Bla %1 bla").arg(tr("Website"))

P.S. All it contains in the documentation.

 Signature 

Ekimov Alexander,
http://www.ekimoff.com

July 3, 2011

Leon Leon
Robot Herder
400 posts

I added an orange color too.

  1. QString str = QString("<a ><span font-family:'Sans'; font-size:10pt; text-decoration: underline; color:#ff5500;\"<span>%1</span></a>").arg(tr("Website"));
  2.     ui->label_5->setText(str);

The editor hides some things as Eddy said..

EDIT:
Another Question:
What about this [img38.imageshack.us]?
I don’t think i should do it the same way, :/

July 3, 2011

Eddy Eddy
Area 51 Engineer
1295 posts

Hi Leon,

I don’t understand your question you added by EDIT.

What do you want exactly?

Maybe it’s better to ask in another topic if it’s another specific question?

 Signature 

Qt Certified Specialist
Qt Ambassador

July 3, 2011

Leon Leon
Robot Herder
400 posts

Ok i will..

July 3, 2011

Leon Leon
Robot Herder
400 posts

I found solution for 1.

<attribute name=“buttonGroup”>
<string>mybuttongroup</string>
</attribute>

This string needs the notr=“true” flag so it doesn’t appear in Linguist :)

July 3, 2011

Eddy Eddy
Area 51 Engineer
1295 posts

Good for you!

Thanks for sharing, but could you use several lines like i did. I think some of the code has dissapeared because the editor interprets it.

 Signature 

Qt Certified Specialist
Qt Ambassador

July 3, 2011

Leon Leon
Robot Herder
400 posts

No i just checked it and nothing has disappeared :)

July 3, 2011

Eddy Eddy
Area 51 Engineer
1295 posts

Ok thanks,

I asked because i didn’t see a not true flag.

 Signature 

Qt Certified Specialist
Qt Ambassador

July 3, 2011

Leon Leon
Robot Herder
400 posts

Using the arg function with tr() i see that at qt linquist i see the %1%2 part…
Is it a problem?
Is there a way not be able to see %1%2?

EDIT: What about dots and “!”?
EDIT2: What about unicode text? How can this be translatable? I mean something like this:

  1. QString::fromUtf8("and it will change every ½ hour")

 
  ‹‹ [Solved] Showing "Loading" widget while heavy processing...      QObject question please, it’s simple but I can’t get it!! ››

You must log in to post a reply. Not a member yet? Register here!