GitHub user mbillau opened a pull request:

    https://github.com/apache/cordova-plugin-globalization/pull/9

    Android should return BCP47 tag, not localized string

    For https://issues.apache.org/jira/browse/CB-4602
    I still want to test the consistency with iOS.
    Return the Locale.getDefault().toString() which according to the Android 
docs [1], contains a two-letter lowercase ISO language code (ISO 639-1) 
followed by an underscore, followed by the two-letter uppercase country code 
(ISO 3166-1). As best I can tell, these two specs (and some more) are what make 
up BCP 47, therefore we should be able to assume that this will always return 
BCP 47 compliant language tags. 
    
    I did notice that sometimes toString() will leave out country or language 
codes if they don't exist. For example, if you set locale to be Locale.CHINESE, 
then you'll get back "zh" - no country code. I'm not sure if this is BCP 47, or 
if there is anything we can do about it.
    
    Finally, since this changes an API, would we have to do a major bump to the 
plugin version number? I thought about deprecating the old code and/or creating 
a new API method but chose against that since this is a bug fix and not a 
feature request. I think the version number should be bumped though...
    
    [1]  http://developer.android.com/reference/java/util/Locale.html
    
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/mbillau/cordova-plugin-globalization CB-4602

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-plugin-globalization/pull/9.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #9
    
----
commit 64734dbd067330a8a787724a8df0a73325c96276
Author: mbillau <[email protected]>
Date:   2014-04-28T19:02:39Z

    Android should return BCP47 tag, not localized string

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to