i18n vs qsTr (what is the difference)

In this tutorial you can see i18n.tr 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?

1 Answer

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.

3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like