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: 246
Registered: ‎01-31-2013
My Device: Developer
Accepted Solution

localisation on sqlite contents



I'm in the process of trying to localise my app into another language,  my app uses an internal Sqlite database among other things to read the contents of a category table in order to display avaiable categoriesvia a listview.  What I would like to know is if anything exists similar to QsTr("") where I could easier tell the app to pull the contents for the categories from a different field in the same table based upon the language being used.. This way I could have a CategoryNameEng field, a CategoryNameFr field etc...


If this doesn't exist any recommendation on how best to handle this would be great..




GeoYeo - Free Local classifieds - Built for Blackberry 10, if you like it please Rate It and Share it!
Posts: 1,746
Registered: ‎04-08-2010
My Device: Passport Silver, PRIV
My Carrier: Telekom.de, O2, Vodafone

Re: localisation on sqlite contents

create yourn table structure so you have those localized text in an extra table together with the locale itself as key ('de' 'en' ...)

then use the current locale as part of your query to find the right one


only one way  to do this

always not easy to localize content from databases

ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development native Mobile Business Apps
BlackBerry 10 | Qt Mobile (Android, iOS)
Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org
mobile-development: http://appbus.org Twitter: @ekkescorner
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: localisation on sqlite contents

As ekke says plenty of ways to do this but none particularly nice.


You might like to separate the 'translatable' tables out in to separate databases, doing it this way would improve the access speed and minimise memory use. You would just select and load the correct database once when the language check is done rather than putting it in to a query.


Also the translation process wouldn't risk corrupting the other data then as well.


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Posts: 246
Registered: ‎01-31-2013
My Device: Developer

Re: localisation on sqlite contents

Thank you,


for your suggestions and using them, I going to try the following:


-1- I created an addtional field named i.e "fr" within my table.

-2- then I use the alias name in my ListItemData.NametoUse

-3- and then my query is something like this: Select fr AS NametoUse,* from Categories and the 'fr' is being passed as whatever the current locale should I want to with from the default "en"


GeoYeo - Free Local classifieds - Built for Blackberry 10, if you like it please Rate It and Share it!