Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In this tutorial you can see was used for the internationalisation of text in the Qml file. Today I checked this tutorial: where they use another technique (qsTr).

What is the difference between the two? What makes one better than the other in some situations?

share|improve this question
up vote 2 down vote accepted

The qsTr() method uses the standard Qt translations support, which is not using gettext. The method is from the Ubuntu SDK and is a wrapper around gettext. Many internationalization features in Ubuntu, and Linux distributions in general, are built around the GNU gettext system, and so using it provides the ability to use more tools and integrate better with other parts of the system, while the Qt translations system is specific to Qt.

share|improve this answer
I can see this general distinction, but this is not very specific... What will break if I choose to use qsTr? – alci Jan 22 '14 at 20:26
They are different tools, and they don't work together. Why are you assuming something breaks? – dobey Jan 22 '14 at 20:28
What I mean is: what are the advantages of over qsTr that I would not benefit from if I choose qsTr. One advantage of qsTr is that it is "standard" (meaning works in every qt target). – alci Jan 22 '14 at 20:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.