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

Friday, December 16, 2011

 

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

 

__._,_.___
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