Official website for Linux User & Developer
FOLLOW US ON:
Jul
22

Internationalise your apps using Qt

by Kunal Deo

After putting so much effort into creating an application it would be shame to see it not being used just because it was only available in English. The bottom line is; most people pay more attention and give more respect to a product which is available in their own language.If you want a global audience for your software, it is very important that you localise your application for your users. Here’s how…

With the translated file, it’s time to compile it to produce a .qm file. This can be done by using the lrelease command:

$ lrelease feedback_fr.ts

You should have the feedback_fr.qm file in the project directory. Your application is now internationalised. Time to run and test it.

Compile the application:

$ qmake
$ make

Run the application:

$ ./feedback

To see the French interface for the application, set the system locale to French. We can do this by the following command:

$ export LANG=fr

And finally, we can run the application:

$ ./feedback

Voila, our application now has a French interface.

Qt has excellent support for writing applications for an international audience and has become a vital GUI toolkit to reach global users. Sure, there are other toolkits, but in my book, nothing come close to the power and the ease of use of Qt…

Click here to see what else was in issue 89 of Linux User & Developer

twitter follow us
Pages: 1 2 3 4 5 6 7 8
  • Tell a Friend
  • Follow our Twitter to find out about all the latest Linux news, reviews, previews, interviews, features and a whole more.

    One Comment »

    • Emil Beli said:

      This is the right way to do it. However it is very very very daunting. Depending on size of application, if smaller, it may be viable to use other methods.
      My personal favorite is to make translation function which recieves ID of a message, and return it in appropriate language. If I say that lang 1 will be english, 2 french and 3 portugese I make ID as:
      LANGID * 100000 + MSGID

      so message translate(1) will give back value, depending on laguage
      100001 = “English”
      200001 = “Français”
      300001 = “Português”

    What's your opinion?

    Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

    Be nice. Keep it clean. Stay on topic. No spam.

    * Required fields