apache/cordova-plugin-globalization — pull request #9 by mbillau (2014-04-28 19:11:35+00:00)
Title: 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