Welcome!

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

Reply
Contributor
Posts: 17
Registered: ‎05-27-2011
My Device: Blackberry tablet

Best way to handling Text in BB10 apps

[ Edited ]

Hi All,

 

I am really interested to hear your guys opinion on the following.

What is the best way to handle your text in BB10 apps if you are building a whitelable app?

 

I built an app that uses QML for the UI and handles all the business logic and data handling through C++.

At the moment when I am setting my texts in QML I am using qsTr("something").

 

So my question being. If I want to make a whitelable app and I wanna be able to quickly change the Text.

Is there any sexy solution in BB10 something like Android does (String.xml)or something similar that early BB dev did? or a key value pair solution where just grab the key am after am think of something like the following

 

qsTr(MY_KEY)

 

so that way I can edit my text in one doc instead of screening through all the UI elements I built.

 

Any Ideas? Or could I just store them in a JS file or in raw txt or is there any more elegant solution?

 

I am keen to hear your guys thoughts.

Highlighted
Retired
Posts: 74
Registered: ‎07-22-2008
My Device: BlackBerry Z10
My Carrier: N/A

Re: Best way to handling Text in BB10 apps

Have you looked into Cascades localiztion APIs?  You can essentially store all your text in translation files and load them on the fly.  I don't know if this will exactly address your use case but definitely worth a look:

 

https://developer.blackberry.com/cascades/documentation/device_platform/internationalization/localiz...

 

Thanks,
Pratik Sapra
Gaming & Apps Consultant
Developer Relations
@pratiksapra
Contributor
Posts: 17
Registered: ‎05-27-2011
My Device: Blackberry tablet

Re: Best way to handling Text in BB10 apps

Cheers for the tip. It should do this already as I did set up a project initially like this. However .ts does not get populated with content on build. Any ideas?

 

I've tried force it with lupdate command. I looks generates all the locals, but something automaticlly get rid of after a 2 of sec. I dont even have the time to save it. hmmmm very strange. Any idea?