Weird Mobile App Locale String

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Weird Mobile App Locale String

csfahey
I have written a mobile app that has locale support built in.  I have tested it out on a desktop browser to ensure it runs properly.  However, while testing the mobile app out on an Android device under Chrome,  I am getting a strange value coming from the call to get the locale string:

qx.locale.Manager.getInstance().getLocale()  >>>>>  which returns "u5_24"

Does anyone know what this means or how to get the actual locale string?  I tried changing the locale under Android to Spanish / United States but the locale returned from the call didn't change.  Is there some initialization that is wrong or that I am missing that would make it come back correctly?
Reply | Threaded
Open this post in threaded view
|

Re: Weird Mobile App Locale String

Richard Sternagel
Hey csfahey,

open your browser console and evaluate "qx.$$locales".
What do you get in return?

You should get an Object with strings associated with
your locale:

{
  "C": {
     alternateQuotationEnd: "’",
     alternateQuotationStart: "‘",
     cldr_am: "AM"
     ...
  }
  "en": { ... }
}

What locale is set in your "config.json"?

Regards
Richard

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Weird Mobile App Locale String

csfahey
Both under Chrome on the desktop as well as on the mobile device:

Object {C: Object, en: Object, en_AU: Object, en_CA: Object, en_GB: Object…}
C: Object
en: Object
en_AU: Object
en_CA: Object
en_GB: Object
es: Object
es_US: Object
fr: Object
fr_CA: Object

just as you pointed out.  All objects seem to be filled in appropriately.

Locales set in my config.json match the values above.

"LOCALES"      : [ "en", "es", "fr", "en_AU", "en_CA", "en_GB", "es_US", "fr_CA" ]

Any where else that I might look?

Reply | Threaded
Open this post in threaded view
|

Re: Weird Mobile App Locale String

csfahey
In reply to this post by Richard Sternagel
Oh and one more interesting thing, on my phone, a Motorola XT1030 Mini, I get "u5_24" every time but on a Samsung Galaxy 5, I get "sm_g9" every time.
Reply | Threaded
Open this post in threaded view
|

Re: Weird Mobile App Locale String

csfahey
In reply to this post by Richard Sternagel
I ran the Playground app on my mobile phone as well and in the test area made the call to: qx.locale.Manager.getInstance().getLocale() and had the resulting string go to an alert box.

It returns the same code as my app which means that it is not inherent of my app but rather Android/Chrome or QooxDoo.

Here is the url to try on a cell phone.

http://tinyurl.com/qyv2e4o
Reply | Threaded
Open this post in threaded view
|

Re: Weird Mobile App Locale String

MartinWittemann
Administrator
This is strange in deed. I just checked the code we have in the framework to detect the locale. The locale is set in the manager [1] either to an default locale (which is „C“) or it detects the locale based on navigator.userLanguage || navigator.language [2]. Could you check those variables in your system and see if the error might be there?



Am 17.12.2014 um 16:14 schrieb csfahey <[hidden email]>:

I ran the Playground app on my mobile phone as well and in the test area made
the call to: qx.locale.Manager.getInstance().getLocale() and had the
resulting string go to an alert box.

It returns the same code as my app which means that it is not inherent of my
app but rather Android/Chrome or QooxDoo.

Here is the url to try on a cell phone.

http://tinyurl.com/qyv2e4o



--
View this message in context: http://qooxdoo.678.n2.nabble.com/Weird-Mobile-App-Locale-String-tp7586485p7586491.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Weird Mobile App Locale String

csfahey
I didn't know what to do to get around this bug using Qooxdoo so this is what I am using as a solution:

 var locale = drmobile.StringUtil.getLocaleDetails( qx.locale.Manager.getInstance().getLocale() );
 if( typeof locale.label == 'undefined' )
 {
          var lang = window.navigator.language;
          qx.locale.Manager.getInstance().setLocale( lang.replace("-","_" ) );
  }

where getLocaleDetails() performs a quick analysis on the string returned from Qooxdoo and returns the following structure:

{ code: code, territory: territory, label: language, value: locale }

So yes, the browser supplied variables contain the correct locale.  Perhaps your code isn't handling the "-" or the territory case and is messing up as a result since the browser returns the string as "xx-xx"
Reply | Threaded
Open this post in threaded view
|

Re: Weird Mobile App Locale String

MartinWittemann
Administrator
If its in the frameworks code, it is sure worth a bug report which should be fixed. Could you open one containing your description?

> Am 18.12.2014 um 14:58 schrieb csfahey <[hidden email]>:
>
> I didn't know what to do to get around this bug using Qooxdoo so this is what
> I am using as a solution:
>
> var locale = drmobile.StringUtil.getLocaleDetails(
> qx.locale.Manager.getInstance().getLocale() );
> if( typeof locale.label == 'undefined' )
> {
>          var lang = window.navigator.language;
>          qx.locale.Manager.getInstance().setLocale( lang.replace("-","_" )
> );
>  }
>
> where getLocaleDetails() performs a quick analysis on the string returned
> from Qooxdoo and returns the following structure:
>
> { code: code, territory: territory, label: language, value: locale }
>
> So yes, the browser supplied variables contain the correct locale.  Perhaps
> your code isn't handling the "-" or the territory case and is messing up as
> a result since the browser returns the string as "xx-xx"
>
>
>
> --
> View this message in context: http://qooxdoo.678.n2.nabble.com/Weird-Mobile-App-Locale-String-tp7586485p7586497.html
> Sent from the qooxdoo mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
> http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
> _______________________________________________
> qooxdoo-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel