{
    "version": "0.3.0",
    "name": "org.apache.cordova.globalization",
    "cordova_name": "Globalization",
    "description": "Cordova Globalization Plugin",
    "license": "Apache 2.0",
    "repo": "https://git-wip-us.apache.org/repos/asf/cordova-plugin-globalization.git",
    "issue": "https://issues.apache.org/jira/browse/CB/component/12320649",
    "keywords": [
        "cordova",
        "globalization"
    ],
    "platforms": [
        "android",
        "amazon-fireos",
        "ubuntu",
        "firefoxos",
        "ios",
        "wp7",
        "wp8",
        "tizen",
        "blackberry10"
    ],
    "engines": [],
    "englishdoc": "<!---\n    Licensed to the Apache Software Foundation (ASF) under one\n    or more contributor license agreements.  See the NOTICE file\n    distributed with this work for additional information\n    regarding copyright ownership.  The ASF licenses this file\n    to you under the Apache License, Version 2.0 (the\n    \"License\"); you may not use this file except in compliance\n    with the License.  You may obtain a copy of the License at\n\n      http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing,\n    software distributed under the License is distributed on an\n    \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n    KIND, either express or implied.  See the License for the\n    specific language governing permissions and limitations\n    under the License.\n-->\n\n# org.apache.cordova.globalization\n\nThis plugin obtains information and performs operations specific to the user's\nlocale, language, and timezone. Note the difference between locale and language:\nlocale controls how numbers, dates, and times are displayed for a region, while\nlanguage determines what language text appears as, independently of locale settings.\nOften developers use locale to set both settings, but there is no reason a user\ncouldn't set her language to \"English\" but locale to \"French\", so that text is\ndisplayed in English but dates, times, etc., are displayed as they are in France.\nUnfortunately, most mobile platforms currently do not make a distinction between\nthese settings. \n\n## Installation\n\n    cordova plugin add org.apache.cordova.globalization\n\n## Objects\n\n- GlobalizationError\n\n## Methods\n\n- navigator.globalization.getPreferredLanguage\n- navigator.globalization.getLocaleName\n- navigator.globalization.dateToString\n- navigator.globalization.stringToDate\n- navigator.globalization.getDatePattern\n- navigator.globalization.getDateNames\n- navigator.globalization.isDayLightSavingsTime\n- navigator.globalization.getFirstDayOfWeek\n- navigator.globalization.numberToString\n- navigator.globalization.stringToNumber\n- navigator.globalization.getNumberPattern\n- navigator.globalization.getCurrencyPattern\n\n## navigator.globalization.getPreferredLanguage\n\nGet the BCP 47 language tag for the client's current language.\n\n    navigator.globalization.getPreferredLanguage(successCallback, errorCallback);\n\n### Description\n\nReturns the BCP-47 compliant language identifier tag to the `successCallback` \nwith a `properties` object as a parameter. That object should have a `value`\nproperty with a `String` value.\n\nIf there is an error getting the language, then the `errorCallback`\nexecutes with a `GlobalizationError` object as a parameter. The\nerror's expected code is `GlobalizationError.UNKNOWN_ERROR`.\n\n### Supported Platforms\n\n- Amazon Fire OS\n- Android\n- BlackBerry 10\n- Firefox OS\n- iOS\n- Windows Phone 8\n\n### Example\n\nWhen the browser is set to the `en-US` language, this should display a\npopup dialog with the text `language: en-US`:\n\n    navigator.globalization.getPreferredLanguage(\n        function (language) {alert('language: ' + language.value + '\\n');},\n        function () {alert('Error getting language\\n');}\n    );\n\n### Android Quirks\n\n- Returns the ISO 639-1 two-letter language code, upper case ISO 3166-1 \ncountry code and variant separated by hyphens. Examples: \"en\", \"en-US\", \"US\"\n\n### Windows Phone 8 Quirks\n\n- Returns the ISO 639-1 two-letter language code and ISO 3166-1 country code\nof the regional variant corresponding to the \"Language\" setting, separated by\na hyphen.\n- Note that the regional variant is a property of the \"Language\" setting and\nnot determined by the unrelated \"Country/Region\" setting on Windows Phone.\n\n## navigator.globalization.getLocaleName\n\nReturns the BCP 47 compliant tag for the client's current locale setting.\n\n    navigator.globalization.getLocaleName(successCallback, errorCallback);\n\n### Description\n\nReturns the BCP 47 compliant locale identifier string to the `successCallback`\nwith a `properties` object as a parameter. That object should have a `value`\nproperty with a `String` value. The locale tag will consist of a two-letter lower\ncase language code, two-letter upper case country code, and (unspecified) variant\ncode, separated by a hyphen.\n\nIf there is an error getting the locale, then the `errorCallback`\nexecutes with a `GlobalizationError` object as a parameter. The\nerror's expected code is `GlobalizationError.UNKNOWN_ERROR`.\n\n### Supported Platforms\n\n- Amazon Fire OS\n- Android\n- BlackBerry 10\n- Firefox OS\n- iOS\n- Windows Phone 8\n\n### Example\n\nWhen the browser is set to the `en-US` locale, this displays a popup\ndialog with the text `locale: en-US`.\n\n    navigator.globalization.getLocaleName(\n        function (locale) {alert('locale: ' + locale.value + '\\n');},\n        function () {alert('Error getting locale\\n');}\n    );\n\n### Android Quirks\n\n- Java does not distinguish between a set \"langauge\" and set \"locale,\" so this\nmethod is essentially the same as `navigator.globalizatin.getPreferredLanguage()`.\n\n### Windows Phone 8 Quirks\n\n- Returns the ISO 639-1 two-letter language code and ISO 3166-1 country code\nof the regional variant corresponding to the \"Regional Format\" setting, separated\nby a hyphen.\n\n\n## navigator.globalization.dateToString\n\nReturns a date formatted as a string according to the client's locale and timezone.\n\n    navigator.globalization.dateToString(date, successCallback, errorCallback, options);\n\n### Description\n\nReturns the formatted date `String` via a `value` property accessible\nfrom the object passed as a parameter to the `successCallback`.\n\nThe inbound `date` parameter should be of type `Date`.\n\nIf there is an error formatting the date, then the `errorCallback`\nexecutes with a `GlobalizationError` object as a parameter. The\nerror's expected code is `GlobalizationError.FORMATTING_ERROR`.\n\nThe `options` parameter is optional, and its default values are:\n\n    {formatLength:'short', selector:'date and time'}\n\nThe `options.formatLength` can be `short`, `medium`, `long`, or `full`.\n\nThe `options.selector` can be `date`, `time` or `date and time`.\n\n### Supported Platforms\n\n- Amazon Fire OS\n- Android\n- BlackBerry 10\n- Firefox OS\n- iOS\n- Windows Phone 8\n\n### Example\n\nIf the browser is set to the `en_US` locale, this displays a popup\ndialog with text similar to `date: 9/25/2012 4:21PM` using the default\noptions:\n\n    navigator.globalization.dateToString(\n        new Date(),\n        function (date) { alert('date: ' + date.value + '\\n'); },\n        function () { alert('Error getting dateString\\n'); },\n        { formatLength: 'short', selector: 'date and time' }\n    );\n\n### Windows Phone 8 Quirks\n\n- The `formatLength` option supports only `short` and `full` values.\n\n### Firefox OS Quirks\n\n- `formatLength` is not distinguishing `long` and `full` \n- only one method of displaying date (no `long` or `full` version)\n\n## navigator.globalization.getCurrencyPattern\n\nReturns a pattern string to format and parse currency values according\nto the client's user preferences and ISO 4217 currency code.\n\n     navigator.globalization.getCurrencyPattern(currencyCode, successCallback, errorCallback);\n\n### Description\n\nReturns the pattern to the `successCallback` with a `properties` object\nas a parameter. That object should contain the following properties:\n\n- __pattern__: The currency pattern to format and parse currency values.  The patterns follow [Unicode Technical Standard #35](http://unicode.org/reports/tr35/tr35-4.html). _(String)_\n\n- __code__: The ISO 4217 currency code for the pattern. _(String)_\n\n- __fraction__: The number of fractional digits to use when parsing and formatting currency. _(Number)_\n\n- __rounding__: The rounding increment to use when parsing and formatting. _(Number)_\n\n- __decimal__: The decimal symbol to use for parsing and formatting. _(String)_\n\n- __grouping__: The grouping symbol to use for parsing and formatting. _(String)_\n\nThe inbound `currencyCode` parameter should be a `String` of one of\nthe ISO 4217 currency codes, for example 'USD'.\n\nIf there is an error obtaining the pattern, then the `errorCallback`\nexecutes with a `GlobalizationError` object as a parameter. The\nerror's expected code is `GlobalizationError.FORMATTING_ERROR`.\n\n### Supported Platforms\n\n- Amazon Fire OS\n- Android\n- BlackBerry 10\n- iOS\n\n### Example\n\nWhen the browser is set to the `en_US` locale and the selected\ncurrency is United States Dollars, this example displays a popup\ndialog with text similar to the results that follow:\n\n    navigator.globalization.getCurrencyPattern(\n        'USD',\n        function (pattern) {\n            alert('pattern: '  + pattern.pattern  + '\\n' +\n                  'code: '     + pattern.code     + '\\n' +\n                  'fraction: ' + pattern.fraction + '\\n' +\n                  'rounding: ' + pattern.rounding + '\\n' +\n                  'decimal: '  + pattern.decimal  + '\\n' +\n                  'grouping: ' + pattern.grouping);\n        },\n        function () { alert('Error getting pattern\\n'); }\n    );\n\nExpected result:\n\n    pattern: $#,##0.##;($#,##0.##)\n    code: USD\n    fraction: 2\n    rounding: 0\n    decimal: .\n    grouping: ,\n\n\n## navigator.globalization.getDateNames\n\nReturns an array of the names of the months or days of the week,\ndepending on the client's user preferences and calendar.\n\n    navigator.globalization.getDateNames(successCallback, errorCallback, options);\n\n### Description\n\nReturns the array of names to the `successCallback` with a\n`properties` object as a parameter. That object contains a `value`\nproperty with an `Array` of `String` values. The array features names\nstarting from either the first month in the year or the first day of\nthe week, depending on the option selected.\n\nIf there is an error obtaining the names, then the `errorCallback`\nexecutes with a `GlobalizationError` object as a parameter. The\nerror's expected code is `GlobalizationError.UNKNOWN_ERROR`.\n\nThe `options` parameter is optional, and its default values are:\n\n    {type:'wide', item:'months'}\n\nThe value of `options.type` can be `narrow` or `wide`.\n\nThe value of `options.item` can be `months` or `days`.\n\n### Supported Platforms\n\n- Amazon Fire OS\n- Android\n- BlackBerry 10\n- Firefox OS\n- iOS\n- Windows Phone 8\n\n### Example\n\nWhen the browser is set to the `en_US` locale, this example displays\na series of twelve popup dialogs, one per month, with text similar to\n`month: January`:\n\n    navigator.globalization.getDateNames(\n        function (names) {\n            for (var i = 0; i < names.value.length; i++) {\n                alert('month: ' + names.value[i] + '\\n');\n            }\n        },\n        function () { alert('Error getting names\\n'); },\n        { type: 'wide', item: 'months' }\n    );\n\n### Firefox OS Quirks\n\n- `options.type` supports a `genitive` value, important for some languages\n\n\n## navigator.globalization.getDatePattern\n\nReturns a pattern string to format and parse dates according to the\nclient's user preferences.\n\n    navigator.globalization.getDatePattern(successCallback, errorCallback, options);\n\n### Description\n\nReturns the pattern to the `successCallback`. The object passed in as\na parameter contains the following properties:\n\n- __pattern__: The date and time pattern to format and parse dates. The patterns follow [Unicode Technical Standard #35](http://unicode.org/reports/tr35/tr35-4.html). _(String)_\n\n- __timezone__: The abbreviated name of the time zone on the client. _(String)_\n\n- __utc_offset__: The current difference in seconds between the client's time zone and coordinated universal time. _(Number)_\n\n- __dst_offset__: The current daylight saving time offset in seconds between the client's non-daylight saving's time zone and the client's daylight saving's time zone. _(Number)_\n\nIf there is an error obtaining the pattern, the `errorCallback`\nexecutes with a `GlobalizationError` object as a parameter. The\nerror's expected code is `GlobalizationError.PATTERN_ERROR`.\n\nThe `options` parameter is optional, and defaults to the following values:\n\n    {formatLength:'short', selector:'date and time'}\n\nThe `options.formatLength` can be `short`, `medium`, `long`, or\n`full`.  The `options.selector` can be `date`, `time` or `date and\ntime`.\n\n### Supported Platforms\n\n- Amazon Fire OS\n- Android\n- BlackBerry 10\n- iOS\n- Windows Phone 8\n\n### Example\n\nWhen the browser is set to the `en_US` locale, this example displays\na popup dialog with text such as `pattern: M/d/yyyy h:mm a`:\n\n    function checkDatePattern() {\n        navigator.globalization.getDatePattern(\n            function (date) { alert('pattern: ' + date.pattern + '\\n'); },\n            function () { alert('Error getting pattern\\n'); },\n            { formatLength: 'short', selector: 'date and time' }\n        );\n    }\n\n### Windows Phone 8 Quirks\n\n- The `formatLength` supports only `short` and `full` values.\n\n- The `pattern` for `date and time` pattern returns only full datetime format.\n\n- The `timezone` returns the full time zone name.\n\n- The `dst_offset` property is not supported, and always returns zero.\n\n\n## navigator.globalization.getFirstDayOfWeek\n\nReturns the first day of the week according to the client's user\npreferences and calendar.\n\n    navigator.globalization.getFirstDayOfWeek(successCallback, errorCallback);\n\n### Description\n\nThe days of the week are numbered starting from 1, where 1 is assumed\nto be Sunday.  Returns the day to the `successCallback` with a\n`properties` object as a parameter. That object should have a `value`\nproperty with a `Number` value.\n\nIf there is an error obtaining the pattern, then the `errorCallback`\nexecutes with a `GlobalizationError` object as a parameter. The\nerror's expected code is `GlobalizationError.UNKNOWN_ERROR`.\n\n### Supported Platforms\n\n- Amazon Fire OS\n- Android\n- BlackBerry 10\n- Firefox OS\n- iOS\n- Windows Phone 8\n\n### Example\n\nWhen the browser is set to the `en_US` locale, this displays a\npopup dialog with text similar to `day: 1`.\n\n    navigator.globalization.getFirstDayOfWeek(\n        function (day) {alert('day: ' + day.value + '\\n');},\n        function () {alert('Error getting day\\n');}\n    );\n\n\n## navigator.globalization.getNumberPattern\n\nReturns a pattern string to format and parse numbers according to the client's user preferences.\n\n    navigator.globalization.getNumberPattern(successCallback, errorCallback, options);\n\n### Description\n\nReturns the pattern to the `successCallback` with a `properties` object\nas a parameter. That object contains the following properties:\n\n- __pattern__: The number pattern to format and parse numbers.  The patterns follow [Unicode Technical Standard #35](http://unicode.org/reports/tr35/tr35-4.html). _(String)_\n\n- __symbol__: The symbol to use when formatting and parsing, such as a percent or currency symbol. _(String)_\n\n- __fraction__: The number of fractional digits to use when parsing and formatting numbers. _(Number)_\n\n- __rounding__: The rounding increment to use when parsing and formatting. _(Number)_\n\n- __positive__: The symbol to use for positive numbers when parsing and formatting. _(String)_\n\n- __negative__: The symbol to use for negative numbers when parsing and formatting. _(String)_\n\n- __decimal__: The decimal symbol to use for parsing and formatting. _(String)_\n\n- __grouping__: The grouping symbol to use for parsing and formatting. _(String)_\n\nIf there is an error obtaining the pattern, then the `errorCallback`\nexecutes with a `GlobalizationError` object as a parameter. The\nerror's expected code is `GlobalizationError.PATTERN_ERROR`.\n\nThe `options` parameter is optional, and default values are:\n\n    {type:'decimal'}\n\nThe `options.type` can be `decimal`, `percent`, or `currency`.\n\n### Supported Platforms\n\n- Amazon Fire OS\n- Android\n- BlackBerry 10\n- iOS\n- Windows Phone 8\n\n### Example\n\nWhen the browser is set to the `en_US` locale, this should display a\npopup dialog with text similar to the results that follow:\n\n    navigator.globalization.getNumberPattern(\n        function (pattern) {alert('pattern: '  + pattern.pattern  + '\\n' +\n                                  'symbol: '   + pattern.symbol   + '\\n' +\n                                  'fraction: ' + pattern.fraction + '\\n' +\n                                  'rounding: ' + pattern.rounding + '\\n' +\n                                  'positive: ' + pattern.positive + '\\n' +\n                                  'negative: ' + pattern.negative + '\\n' +\n                                  'decimal: '  + pattern.decimal  + '\\n' +\n                                  'grouping: ' + pattern.grouping);},\n        function () {alert('Error getting pattern\\n');},\n        {type:'decimal'}\n    );\n\nResults:\n\n    pattern: #,##0.###\n    symbol: .\n    fraction: 0\n    rounding: 0\n    positive:\n    negative: -\n    decimal: .\n    grouping: ,\n\n\n### Windows Phone 8 Quirks\n\n- The `pattern` property is not supported, and retuens an empty string.\n\n- The `fraction` property is not supported, and returns zero.\n\n\n## navigator.globalization.isDayLightSavingsTime\n\nIndicates whether daylight savings time is in effect for a given date\nusing the client's time zone and calendar.\n\n    navigator.globalization.isDayLightSavingsTime(date, successCallback, errorCallback);\n\n### Description\n\nIndicates whether or not daylight savings time is in effect to the\n`successCallback` with a `properties` object as a parameter. That object\nshould have a `dst` property with a `Boolean` value. A `true` value\nindicates that daylight savings time is in effect for the given date,\nand `false` indicates that it is not.\n\nThe inbound parameter `date` should be of type `Date`.\n\nIf there is an error reading the date, then the `errorCallback`\nexecutes. The error's expected code is `GlobalizationError.UNKNOWN_ERROR`.\n\n### Supported Platforms\n\n- Amazon Fire OS\n- Android\n- BlackBerry 10\n- Firefox OS\n- iOS\n- Windows Phone 8\n\n### Example\n\nDuring the summer, and if the browser is set to a DST-enabled\ntimezone, this should display a popup dialog with text similar to\n`dst: true`:\n\n    navigator.globalization.isDayLightSavingsTime(\n        new Date(),\n        function (date) {alert('dst: ' + date.dst + '\\n');},\n        function () {alert('Error getting names\\n');}\n    );\n\n\n\n## navigator.globalization.numberToString\n\nReturns a number formatted as a string according to the client's user preferences.\n\n    navigator.globalization.numberToString(number, successCallback, errorCallback, options);\n\n### Description\n\nReturns the formatted number string to the `successCallback` with a\n`properties` object as a parameter. That object should have a `value`\nproperty with a `String` value.\n\nIf there is an error formatting the number, then the `errorCallback`\nexecutes with a `GlobalizationError` object as a parameter. The\nerror's expected code is `GlobalizationError.FORMATTING_ERROR`.\n\nThe `options` parameter is optional, and its default values are:\n\n    {type:'decimal'}\n\nThe `options.type` can be 'decimal', 'percent', or 'currency'.\n\n### Supported Platforms\n\n- Amazon Fire OS\n- Android\n- BlackBerry 10\n- iOS\n- Windows Phone 8\n\n### Example\n\nWhen the browser is set to the `en_US` locale, this displays a popup\ndialog with text similar to `number: 3.142`:\n\n    navigator.globalization.numberToString(\n        3.1415926,\n        function (number) {alert('number: ' + number.value + '\\n');},\n        function () {alert('Error getting number\\n');},\n        {type:'decimal'}\n    );\n\n\n## navigator.globalization.stringToDate\n\nParses a date formatted as a string, according to the client's user\npreferences and calendar using the time zone of the client, and\nreturns the corresponding date object.\n\n    navigator.globalization.stringToDate(dateString, successCallback, errorCallback, options);\n\n### Description\n\nReturns the date to the success callback with a `properties` object as\na parameter. That object should have the following properties:\n\n- __year__: The four digit year. _(Number)_\n\n- __month__: The month from (0-11). _(Number)_\n\n- __day__: The day from (1-31). _(Number)_\n\n- __hour__: The hour from (0-23). _(Number)_\n\n- __minute__: The minute from (0-59). _(Number)_\n\n- __second__: The second from (0-59). _(Number)_\n\n- __millisecond__: The milliseconds (from 0-999), not available on all platforms. _(Number)_\n\nThe inbound `dateString` parameter should be of type `String`.\n\nThe `options` parameter is optional, and defaults to the following\nvalues:\n\n    {formatLength:'short', selector:'date and time'}\n\nThe `options.formatLength` can be `short`, `medium`, `long`, or\n`full`.  The `options.selector` can be `date`, `time` or `date and\ntime`.\n\nIf there is an error parsing the date string, then the `errorCallback`\nexecutes with a `GlobalizationError` object as a parameter. The\nerror's expected code is `GlobalizationError.PARSING_ERROR`.\n\n### Supported Platforms\n\n- Amazon Fire OS\n- Android\n- BlackBerry 10\n- Firefox OS\n- iOS\n- Windows Phone 8\n\n### Example\n\nWhen the browser is set to the `en_US` locale, this displays a\npopup dialog with text similar to `month:8 day:25 year:2012`. Note\nthat the month integer is one less than the string, as the month\ninteger represents an array index.\n\n    navigator.globalization.stringToDate(\n        '9/25/2012',\n        function (date) {alert('month:' + date.month +\n                               ' day:'  + date.day   +\n                               ' year:' + date.year  + '\\n');},\n        function () {alert('Error getting date\\n');},\n        {selector: 'date'}\n    );\n\n\n### Windows Phone 8 Quirks\n\n- The `formatLength` option supports only `short` and `full` values.\n\n## navigator.globalization.stringToNumber\n\nParses a number formatted as a string according to the client's user\npreferences and returns the corresponding number.\n\n    navigator.globalization.stringToNumber(string, successCallback, errorCallback, options);\n\n### Description\n\nReturns the number to the `successCallback` with a `properties` object\nas a parameter. That object should have a `value` property with a\n`Number` value.\n\nIf there is an error parsing the number string, then the\n`errorCallback` executes with a `GlobalizationError` object as a\nparameter. The error's expected code is\n`GlobalizationError.PARSING_ERROR`.\n\nThe `options` parameter is optional, and defaults to the following\nvalues:\n\n    {type:'decimal'}\n\nThe `options.type` can be `decimal`, `percent`, or `currency`.\n\n### Supported Platforms\n\n- Amazon Fire OS\n- Android\n- BlackBerry 10\n- iOS\n- Windows Phone 8\n\n### Example\n\nWhen the browser is set to the `en_US` locale, this should display a\npopup dialog with text similar to `number: 1234.56`:\n\n    navigator.globalization.stringToNumber(\n        '1234.56',\n        function (number) {alert('number: ' + number.value + '\\n');},\n        function () {alert('Error getting number\\n');},\n        {type:'decimal'}\n    );\n\n\n## GlobalizationError\n\nAn object representing a error from the Globalization API.\n\n### Properties\n\n- __code__:  One of the following codes representing the error type _(Number)_\n  - GlobalizationError.UNKNOWN_ERROR: 0\n  - GlobalizationError.FORMATTING_ERROR: 1\n  - GlobalizationError.PARSING_ERROR: 2\n  - GlobalizationError.PATTERN_ERROR: 3\n- __message__:  A text message that includes the error's explanation and/or details _(String)_\n\n### Description\n\nThis object is created and populated by Cordova, and returned to a callback in the case of an error.\n\n### Supported Platforms\n\n- Amazon Fire OS\n- Android\n- BlackBerry 10\n- Firefox OS\n- iOS\n\n### Example\n\nWhen the following error callback executes, it displays a\npopup dialog with the text similar to `code: 3` and `message:`\n\n    function errorCallback(error) {\n        alert('code: ' + error.code + '\\n' +\n              'message: ' + error.message + '\\n');\n    };\n\n\n"
}