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

Web and WebWorks Development


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Retired
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

localized language in a WebWorks application?

Folks,

 

I wanted to ask whether anyone has written a WebWorks application that displays content localized to the language of the current user?

 

If so, what approach did you take to solve this problem (custom extension, user-selection options screen, AJAX magic, etc)?

 

Reason for asking is I want to get feedback from the community about how much interest there is in this topic and whether there is a most popular / desirable solution.  What are your opinions?

 

If anyone has written a JavaScript Extension for this already it would make an ideal contribution candidate for of the BlackBerry WebWorks Open Source project.  If so, please contact me.

 

Cheers,

Adam

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
Developer
Posts: 64
Registered: ‎02-12-2011
My Device: 9300
My Carrier: Yoigo

Re: localized language in a WebWorks application?

Hi Adam.

I'm currently developing one with i8n. My solution so far have been simple. The language is set as a user preference within the app.

However I want the default language to be set according to the user's phone display. I'll be writing a JavaScript extension for that. I'll need extensions in the future so it is a good starting point.

The resources are saved in a JavaScript hash, so you can do things like i8n[lang].BUTTON_LABEL where lang is the variable that holds the preference set before. I used JSON to define the hash easily.

I'd like to get rid of the [lang] part so it is hidden but haven't found a clean way yet.

What do you think? Any suggestions?

Cheers.
Developer
Posts: 817
Registered: ‎11-19-2009
My Device: Z10, Q10, 9900, 9790, PlayBook,
My Carrier: T-Mobile UK, Three, O2, Orange, Sunrise, Swisscom

Re: localized language in a WebWorks application?

[ Edited ]

I failed to find anything good enough for Sencha Touch 1, but we plan on using this for ST2 apps:

https://github.com/mitchellsimoens/Ux.locale.Manager

The strings are neatly organized in JSON files.

 

The plan is to detect the user's locale via a Webworks API and to offer a language selector in the preference panel as well. 

--
Olivier - interfaSys ltd
Developing for BlackBerry 10 devices using the Sencha Touch framework.
Highlighted
Retired
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: localized language in a WebWorks application?

Hi lagunex,

 

Thanks for your feedback!  Appreciate you sharing your solution.

 

 

As a tip, there is now a "Locale" extension published for developers to use in our Github Community APIs repo.  You should be able to use this to get the default language set by your users.

 

Smartphone extension:

https://github.com/blackberry/WebWorks-Community-APIs/tree/master/Smartphone/Locale

 

Tablet OS extension:

https://github.com/blackberry/WebWorks-Community-APIs/tree/master/Tablet/Locale

 

 

Best,

Adam

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.