Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

In this tutorial http://developer.ubuntu.com/resources/tutorials/getting-started/currency-converter-phone-app/ you can see i18n.tr was used for the internationalisation of text in the Qml file. Today I checked this tutorial: http://qt-project.org/doc/qt-5.0/qtquick/qtquick-internationalization.html 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

1 Answer 1

up vote 1 down vote accepted

The qsTr() method uses the standard Qt translations support, which is not using gettext. The i18n.tr() 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 at 20:26
    
They are different tools, and they don't work together. Why are you assuming something breaks? –  dobey Jan 22 at 20:28
1  
What I mean is: what are the advantages of i18n.tr 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 at 20:37

Your Answer

 
discard

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.