Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Posts: 85
Registered: ‎06-22-2013
My Device: N/A
My Carrier: N/A

Re: localization

Localize the image path to be included at the TS file.

imageSource: qStr("asset:///images/bot-N-3.png")

Posts: 125
Registered: ‎06-19-2012
My Device: PlayBook + Red Z10 + BB10 Dev Alpha C
My Carrier: none

Re: localization

Yes, but that requires a translation for each file. The way I have described it above requires you only to stick to a naming convention (for instance file_en.png and file_es.png) but keeps the translation files clean (only requires you to provide the language code for each supported language). You use it like this:


QString lang = tr("kLoc_lang");

QString filename = QString("file_%1.png").arg(lang);


BlackBerry Development Advisor
Posts: 50
Registered: ‎09-27-2012
My Device: Passport
My Carrier: Bell

Re: localization

[ Edited ]

Your string translation and locale formats are taken care of if you use the localization APIs that the platform supports. 

For the language specific images, you can detect/listen to the system locale(e.g. language) and load the image based on the locale/language settings.  

My advice is to use if-else statement for checking and loading the language dependent images. 





Hope this was helpful. Happy Coding!
EK @echotown
Posts: 358
Registered: ‎04-13-2013
My Device: Z10
My Carrier: Telus

Re: localization

[ Edited ]

you can also add localization for different data sources based on localization if you're interested:


source: "tutorial.xml"


with localization:


source: qsTr("tutorial.xml") + Retranslate.onLanguageChanged


than in your translation file you can change it to a different source based on language :