Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-8966

globalization.getPreferredLanguage returns inconsistent structures

    XMLWordPrintableJSON

    Details

      Description

      When using "getPreferredLanguage" the language value returned is a combination of the user language and also the users current region.

      Affected versions :

      org.apache.cordova.globalization 0.3.4 "Globalization"
      org.apache.cordova.globalization 1.0.0 "Globalization"

      This is a problem when the user sets their language to say, French and has their location set up as United states. The result is a language code of fr-US, however if you set the language to Chinese, Hong-Kong you get the full language code zh-hk

      Its the inconsistency which I find a problem, knowing if the language code is a full language code "zh-hk" vs a language code region "fr-US"

      May be the return objects could be expended to include a little more details. for example.

      return {
      env : "ios",
      code : 'fr',
      region : 'US'
      }

      return {
      env : "ios",
      code : 'zh-hk',
      region : 'US'
      }

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              Cadey Neil Cadman
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: