cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon MacDonald <simon.macdon...@gmail.com>
Subject Re: getPreferredLanguage platform inconsistencies
Date Tue, 02 Jul 2013 15:27:46 GMT
This is a really good bug description. Can you open on at:

https://issues.apache.org/jira/browse/CB


Simon Mac Donald
http://hi.im/simonmacdonald


On Tue, Jul 2, 2013 at 11:23 AM, Jon Whitlock
<jon.whitlock@ostmodern.co.uk>wrote:

> Hi folks,
>
> Am currently playing with getPreferredLanguage on Android and am unsure if
> I have found an "issue".
>
> In;
>
> https://github.com/apache/cordova-docs/blob/master/docs/en/edge/cordova/globalization/globalization.getPreferredLanguage.md
>
> "Returns the language identifier string to the successCallback with a
> properties object as a parameter. That object should have a value property
> with a String value."
>
> navigator.globalization.getPreferredLanguage(
>     function (language) {alert('language: ' + language.value + '\n');},
>     function () {alert('Error getting language\n');}
> );
>
>
> On Android the function doesn't seem to return an identifier as such, it
> returns a string describing the language localised to that language, e.g.
> "English" or "中文" for Japanese.  Naturally this is less than ideal for
> subsequent string operations, furthermore on that page "Windows Phone 8
> Quirks - Returns the ISO 639-1 two-letter code for the current language"
> which is an identifier, and also what I would expect (or an ISO 639-2 code,
> as per http://www.loc.gov/standards/iso639-2/php/code_list.php)
>
> Android seems to support 639-2
> http://developer.android.com/reference/java/util/Locale.html#getISO3Language()
>
> I have no idea what it returns on other platforms, but to keep client code
> consistent it would be great if this could be normalised in the API.
>
>
> As an aside, the locale is not really what I want here, as the user may be
> in the US but have Japanese as their preferred language.
>
> Thanks,
> jon
>
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message