Return-Path: X-Original-To: apmail-cordova-issues-archive@minotaur.apache.org Delivered-To: apmail-cordova-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 597BC101E6 for ; Tue, 29 Apr 2014 16:07:33 +0000 (UTC) Received: (qmail 28612 invoked by uid 500); 29 Apr 2014 16:07:30 -0000 Delivered-To: apmail-cordova-issues-archive@cordova.apache.org Received: (qmail 28563 invoked by uid 500); 29 Apr 2014 16:07:28 -0000 Mailing-List: contact issues-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list issues@cordova.apache.org Received: (qmail 28432 invoked by uid 99); 29 Apr 2014 16:07:18 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 29 Apr 2014 16:07:18 +0000 Date: Tue, 29 Apr 2014 16:07:18 +0000 (UTC) From: "Mike Billau (JIRA)" To: issues@cordova.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CB-4602) getPreferredLanguage platform inconsistencies MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CB-4602?page=3Dcom.atlassian.ji= ra.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1398443= 7#comment-13984437 ]=20 Mike Billau commented on CB-4602: --------------------------------- I made some changes to the implementation above. I found out that Java 7 im= plements a method called Locale#toLanguageTag(), so I followed that as much= as possible. I pushed up a new branch to the globalization plugin because = there are a few other changes that we are in the process of making, so we w= ill just commit to that branch and then bump the major version once.=20 https://github.com/apache/cordova-plugin-globalization/commit/baea8a295daeb= db6cc2bfcdcb612d6c988a8e08a Somehow git reverted some of the previous changes (changing new Long() to L= ong.valueOf), so I'll figure out why and fix that. > getPreferredLanguage platform inconsistencies > --------------------------------------------- > > Key: CB-4602 > URL: https://issues.apache.org/jira/browse/CB-4602 > Project: Apache Cordova > Issue Type: Bug > Components: Android, Plugin Globalization > Affects Versions: 2.6.0, 3.0.0 > Environment: Android > Reporter: Jon Whitlock > Assignee: Mike Billau > Priority: Minor > > In; > https://github.com/apache/cordova-docs/blob/master/docs/en/edge/cordova/g= lobalization/globalization.getPreferredLanguage.md > "Returns the language identifier string to the successCallback with a pro= perties object as a parameter. That object should have a value property wit= h 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" for English or "=E4=B8=AD=E6=96=87" for Japanese. Naturally this= is less than ideal for subsequent string operations, furthermore on that p= age "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_l= ist.php) > Android seems to support 639-2 http://developer.android.com/reference/jav= a/util/Locale.html#getISO3Language() > I have no idea what it returns on other platforms, but to keep client cod= e consistent I guess it would good if this could be normalised in the API. > Have tested this on v3.0 and 2.6, is the same. > As an aside, the locale is not really what I want here, as the user may b= e in the US but have Japanese as their preferred language. > Thanks, > jon > (first go at using Jira, apols if I got something wrong!) -- This message was sent by Atlassian JIRA (v6.2#6252)