Re: how to add localization support?

You haven't given us anything to work with. Please provide a code sample, as well as a description of what you mean by "it doesn't work". Does the compiler complain? Does it compile but you aren't getting any of your strings in your .tr file? Do you get a .tr file but when you edit it for another language/locale it is not showing up properly?

Are you doing this in C++ or QML? If QML you need to use qsTr() instead of tr().

You won't get much help with such a vague question.

SuhairZain wrote:Hi, I tried using tr(), including every text within it. But it doesn't work. Any idea how to do it?

Developer of Built for BlackBerry certified multiFEED RSS/Atom feed reader and aggregator.

Re: how to add localization support?

Looks like you've done all the necessary steps with regards to the QML and tr files. But just to reiterate for others who come to this post looking for information, you need to make your text into a qstring and tell the UI to retranslate it based on whether the device's language change, whether the language or locale changed or whether just on locale change.

text: qsTr("I like turtles") + Retranslate + onLanguageChanged

next you have to go into your translations folder and open your .ts files. You will see this:

Re: how to add localization support?

@SuhairZain bmorr spend quite a fair amount of time to give you a comprehensive answer, it's good you marked it as the solution but please also click on the like button so he gets some recognition, you'll notice I also did as his answer was well constructed and obviously took time to write.

Re: how to add localization support?

the ide won't translate for you automatically (otherwise all our apps would support all languages!) Just take into account the amount of wording you will have in your app so that you can cut down on translating them. Maybe a few phrases can sufficiently explain somethign rather than a paragraph, etc. If you have small phrases google translate is fairly good at translating if that's your concern. I would be cautious about using it for long phrases or paragraphes though. IMO.