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

Reply
Retired
astanley
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
lagunex
Posts: 64
Registered: ‎02-12-2011
My Device: 9300

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
interfaSys
Posts: 817
Registered: ‎11-19-2009
My Device: Z10, Q10, 9900, 9790, PlayBook,

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.
Retired
astanley
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.