Re: [flexcoders] How to get the right locale in IE?

Friday, December 16, 2011

 

The first thing I'd do is write a test html page with some JS and try to get it to alert the right answer.


On 12/15/11 1:22 PM, "michael_regert@dell.com" <michael_regert@dell.com> wrote:


 
 
   

I'm trying to get the locale from IE 9.  I've written the following, but it is not working as expected.  In IE 9, I can add more than one language, so I can add [de], then [de_DE], then [en_US] (listed in that order).
 
If I call 'navigator.userLanguage.toString', then IE returns en-us, even though I know German is listed first and working (Google comes up in German).  I thought maybe it was because it was trying to return an Array of languages, so I changed my code to look for an Array or an Object.  Nothing works.
 
 
var l10NCodes:Object = null;
var l10nCode:String = null;
 
/* Try to get the language code from the browser first.  The browser returns both
the language code and the country code rather than just the language code alone. */

if (ExternalInterface.available) {
       l10NCodes = ExternalInterface.call('navigator.userLanguage');
     ! ;  l10nCode = ExternalInterface.call('navigator.userLanguage.toString');
}


 
 
 
Michael J. Regert

 
   



--
Alex Harui
Flex SDK Team
Adobe System, Inc.
http://blogs.adobe.com/aharui

__._,_.___
Recent Activity:
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___

0 comments:

Post a Comment