You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2015/03/16 14:50:39 UTC
[2/2] cordova-plugin-globalization git commit: CB-7960 Add
cordova-plugin-globalization support for browser platform
CB-7960 Add cordova-plugin-globalization support for browser platform
Added Browser platform support
Updated the docs
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-globalization/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-globalization/commit/e268328f
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-globalization/tree/e268328f
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-globalization/diff/e268328f
Branch: refs/heads/master
Commit: e268328fd454080aa0aee984304db29555596bb9
Parents: 202af0b
Author: daserge <da...@yandex.ru>
Authored: Thu Jan 15 13:27:20 2015 +0300
Committer: Vladimir Kotikov <v-...@microsoft.com>
Committed: Mon Mar 16 14:20:26 2015 +0300
----------------------------------------------------------------------
README.md | 57 +
plugin.xml | 10 +
src/browser/GlobalizationProxy.js | 301 +
tests/tests.js | 58 +-
www/browser/moment.js | 9394 ++++++++++++++++++++++++++++++++
5 files changed, 9808 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-globalization/blob/e268328f/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index dd702ce..213a3ca 100644
--- a/README.md
+++ b/README.md
@@ -88,6 +88,7 @@ error's expected code is `GlobalizationError.UNKNOWN_ERROR`.
- iOS
- Windows Phone 8
- Windows
+- Browser
### Example
@@ -118,6 +119,10 @@ not determined by the unrelated "Country/Region" setting on Windows Phone.
of the regional variant corresponding to the "Language" setting, separated by
a hyphen.
+### Browser Quirks
+
+- Falls back on getLocaleName
+
## navigator.globalization.getLocaleName
Returns the BCP 47 compliant tag for the client's current locale setting.
@@ -145,6 +150,7 @@ error's expected code is `GlobalizationError.UNKNOWN_ERROR`.
- iOS
- Windows Phone 8
- Windows
+- Browser
### Example
@@ -173,6 +179,9 @@ by a hyphen.
-> Region -> Formats -> Format,
and in Settings -> Region -> Regional Format on Windows Phone 8.1.
+### Browser Quirks
+
+- IE returns the locale of operating system. Chrome and Firefox return browser language tag.
## navigator.globalization.dateToString
@@ -208,6 +217,7 @@ The `options.selector` can be `date`, `time` or `date and time`.
- iOS
- Windows Phone 8
- Windows
+- Browser
### Example
@@ -246,6 +256,14 @@ options:
- The returned value may be not completely aligned with ICU depending on a user locale.
+### Browser Quirks
+
+- Only 79 locales are supported because moment.js is used in this method.
+
+- The returned value may be not completely aligned with ICU depending on a user locale.
+
+- `time` selector supports `full` and `short` formatLength only.
+
### Firefox OS Quirks
- `formatLength` is not distinguishing `long` and `full`
@@ -359,6 +377,7 @@ The value of `options.item` can be `months` or `days`.
- iOS
- Windows Phone 8
- Windows
+- Browser
### Example
@@ -390,6 +409,11 @@ a series of twelve popup dialogs, one per month, with text similar to
- The array of months contains 12 elements.
- The returned array may be not completely aligned with ICU depending on a user locale.
+### Browser Quirks
+
+- Date names are not completely aligned with ICU
+- The array of months contains 12 elements.
+
## navigator.globalization.getDatePattern
Returns a pattern string to format and parse dates according to the
@@ -430,6 +454,7 @@ time`.
- iOS
- Windows Phone 8
- Windows
+- Browser
### Example
@@ -468,6 +493,13 @@ a popup dialog with text such as `pattern: M/d/yyyy h:mm a`:
- The pattern may be not completely aligned with ICU depending on a user locale.
+### Browser Quirks
+
+- The 'pattern' property is not supported and returns empty string.
+
+- Only Chrome returns 'timezone' property. Its format is "Part of the world/{City}".
+Other browsers return empty string.
+
## navigator.globalization.getFirstDayOfWeek
Returns the first day of the week according to the client's user
@@ -495,6 +527,7 @@ error's expected code is `GlobalizationError.UNKNOWN_ERROR`.
- iOS
- Windows Phone 8
- Windows
+- Browser
### Example
@@ -511,6 +544,10 @@ popup dialog with text similar to `day: 1`.
- On Windows 8.0/8.1 the value depends on user' calendar preferences. On Windows Phone 8.1
the value depends on current locale.
+### Browser Quirks
+
+- Only 79 locales are supported because moment.js is used in this method.
+
## navigator.globalization.getNumberPattern
Returns a pattern string to format and parse numbers according to the client's user preferences.
@@ -556,6 +593,7 @@ The `options.type` can be `decimal`, `percent`, or `currency`.
- iOS
- Windows Phone 8
- Windows
+- Browser
### Example
@@ -598,6 +636,10 @@ Results:
- The `pattern` property is not supported, and returns an empty string.
+### Browser Quirks
+
+- getNumberPattern is supported in Chrome only; the only defined property is `pattern`.
+
## navigator.globalization.isDayLightSavingsTime
Indicates whether daylight savings time is in effect for a given date
@@ -627,6 +669,7 @@ executes. The error's expected code is `GlobalizationError.UNKNOWN_ERROR`.
- iOS
- Windows Phone 8
- Windows
+- Browser
### Example
@@ -672,6 +715,7 @@ The `options.type` can be 'decimal', 'percent', or 'currency'.
- iOS
- Windows Phone 8
- Windows
+- Browser
### Example
@@ -693,6 +737,10 @@ dialog with text similar to `number: 3.142`:
- `percent` numbers are not grouped as they can't be parsed in stringToNumber if grouped.
+### Browser Quirks
+
+- `currency` type is not supported.
+
## navigator.globalization.stringToDate
Parses a date formatted as a string, according to the client's user
@@ -744,6 +792,7 @@ error's expected code is `GlobalizationError.PARSING_ERROR`.
- iOS
- Windows Phone 8
- Windows
+- Browser
### Example
@@ -779,6 +828,14 @@ This pattern may be not completely aligned with ICU depending on a user locale.
- The inbound `dateString` parameter should be formed in compliance with a pattern returned by getDatePattern.
This pattern may be not completely aligned with ICU depending on a user locale.
+### Browser Quirks
+
+- Only 79 locales are supported because moment.js is used in this method.
+
+- Inbound string should be aligned with `dateToString` output format and may not completely aligned with ICU depending on a user locale.
+
+- `time` selector supports `full` and `short` formatLength only.
+
## navigator.globalization.stringToNumber
Parses a number formatted as a string according to the client's user
http://git-wip-us.apache.org/repos/asf/cordova-plugin-globalization/blob/e268328f/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index aff8558..94b6a98 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -136,4 +136,14 @@
<lib-file src="src/blackberry10/native/device/libGlobalization.so" arch="device" />
<lib-file src="src/blackberry10/native/simulator/libGlobalization.so" arch="simulator" />
</platform>
+
+ <!-- browser -->
+ <platform name="browser">
+ <js-module src="www/browser/moment.js" name="moment">
+ <runs/>
+ </js-module>
+ <js-module src="src/browser/GlobalizationProxy.js" name="GlobalizationProxy">
+ <runs/>
+ </js-module>
+ </platform>
</plugin>
http://git-wip-us.apache.org/repos/asf/cordova-plugin-globalization/blob/e268328f/src/browser/GlobalizationProxy.js
----------------------------------------------------------------------
diff --git a/src/browser/GlobalizationProxy.js b/src/browser/GlobalizationProxy.js
new file mode 100644
index 0000000..b2d3754
--- /dev/null
+++ b/src/browser/GlobalizationProxy.js
@@ -0,0 +1,301 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+var GlobalizationError = require('./GlobalizationError');
+var moment = require('org.apache.cordova.globalization.moment');
+
+function getCrossPlatformLocale() {
+ // userLanguage is for IE, which corresponds to selected regional format
+ return navigator.userLanguage || navigator.language;
+}
+
+function stdTimezoneOffset(date) {
+ var jan = new Date(date.getFullYear(), 0, 20);
+ var jul = new Date(date.getFullYear(), 6, 20);
+ return Math.max(jan.getTimezoneOffset(), jul.getTimezoneOffset());
+}
+
+function dst(date) {
+ return date.getTimezoneOffset() < stdTimezoneOffset(date);
+}
+
+function dstOffsetAbs(date) {
+ var janOffset = new Date(date.getFullYear(), 0, 20).getTimezoneOffset();
+ var julOffset = new Date(date.getFullYear(), 6, 20).getTimezoneOffset();
+ if (janOffset < 0) { janOffset = -janOffset; }
+ if (julOffset < 0) { julOffset = -julOffset; }
+ var offset = janOffset - julOffset;
+ if (offset < 0) { offset = -offset; }
+ return offset;
+}
+
+function getWeekDayNames(locale, options) {
+ var result = [];
+ for (i = 0; i < 7; i++) {
+ date = new Date(2014, 5, i + 1, 0, 0, 0, 0);
+ result[i] = date.toLocaleDateString(locale, options);
+ }
+ return result;
+}
+
+function convertToIntlNumberFormatOptions(options) {
+ switch (options.type) {
+ case 'decimal':
+ return { style: 'decimal' };
+ case 'currency':
+ throw '\'currency\' number type is not supported';
+ case 'percent':
+ return { style: 'percent' };
+ default:
+ throw 'The options.type can be \'decimal\', \'percent\' or \'currency\'';
+ }
+}
+
+function convertToMomentLocalizedFormat(options) {
+ var selectorError = 'The options.selector can be \'date\', \'time\' or \'date and time\'';
+ var formatLengthError = 'The options.formatLength can be \'short\', \'medium\', \'long\', or \'full\'';
+
+ switch (options.formatLength) {
+ case 'short':
+ switch(options.selector) {
+ case 'date and time': return 'lll';
+ case 'date': return 'l';
+ case 'time': return 'LT'
+ default:
+ throw selectorError;
+ }
+ case 'medium':
+ switch(options.selector) {
+ case 'date and time': return 'LLL';
+ case 'date': return 'L';
+ case 'time':
+ throw '\'time\' selector does not support \'medium\' formatLength';
+ default:
+ throw selectorError;
+ }
+ case 'long':
+ switch(options.selector) {
+ case 'date and time': return 'llll';
+ case 'date': return 'll';
+ case 'time':
+ throw '\'time\' selector does not support \'long\' formatLength';
+ default:
+ throw selectorError;
+ }
+ case 'full':
+ switch(options.selector) {
+ case 'date and time': return 'LLLL';
+ case 'date': return 'LL';
+ case 'time': return 'LTS';
+ default:
+ throw selectorError;
+ }
+ default:
+ throw formatLengthError;
+ }
+}
+
+function prepareAndGetDateOptions(options) {
+ var options = options || {formatLength:'short', selector:'date and time'};
+ options.formatLength = options.formatLength || 'short';
+ options.selector = options.selector || 'date and time';
+
+ return convertToMomentLocalizedFormat(options);
+}
+
+var globalization = {
+ getLocaleName: function(win, fail) {
+ try {
+ win( { value: getCrossPlatformLocale() });
+ } catch (e) {
+ fail({ code: 0, message: e.hasOwnProperty('message')? e.message : e });
+ }
+ },
+
+ numberToString: function(win, fail, args) {
+ try {
+ var options = args[0].options || { type : 'decimal' };
+ options.type = options.type || 'decimal';
+
+ options = convertToIntlNumberFormatOptions(options);
+
+ var formatter = new Intl.NumberFormat(getCrossPlatformLocale(), options);
+ win( { value: formatter.format(args[0].number) });
+ } catch (e) {
+ fail(new GlobalizationError(GlobalizationError.FORMATTING_ERROR,
+ e.hasOwnProperty('message')? e.message : e));
+ }
+ },
+
+ isDayLightSavingsTime: function(win, fail, args) {
+ try {
+ var date = new Date(args[0].date);
+ win({ dst: dst(date) });
+ } catch (e) {
+ fail({ code: 0, message: e.hasOwnProperty('message')? e.message : e });
+ }
+ },
+
+ getFirstDayOfWeek: function(win, fail) {
+ try {
+ var locale = getCrossPlatformLocale();
+ moment.locale(locale);
+ // Converting ISO format (Monday = 1, Sunday = 7) to what Cordova expects (Sunday = 1, Monday = 2, Saturday = 7)
+ var shiftDay = moment().weekday(0).isoWeekday() + 1;
+ win({ value: shiftDay % 8 + Math.floor(shiftDay / 8) });
+ } catch (e) {
+ fail({ code: 0, message: e.hasOwnProperty('message')? e.message : e });
+ }
+ },
+
+ getDateNames: function (win, fail, args) {
+ try {
+ var options = args[0].options || { type: 'wide', item: 'months' };
+ var type = options.type || 'wide';
+ var item = options.item || 'item';
+
+ var locale = getCrossPlatformLocale();
+
+ if (item === 'months' && type === 'wide') {
+ var options = { month: 'long' };
+ } else if (item === 'months' && type === 'narrow') {
+ options = { month: 'short'};
+ } else if (item === 'days' && type === 'wide') {
+ options = { weekday: 'long'};
+ } else if (item === 'days' && type === 'narrow') {
+ options = { weekday: 'short'};
+ } else {
+ throw 'Incorrect type or item';
+ }
+
+ var result = [];
+ if (item === 'months') {
+ for (var i = 0; i < 12; i++) {
+ var date = new Date(2014, i, 20, 0, 0, 0, 0);
+ result[i] = date.toLocaleDateString(locale, options);
+ }
+ } else {
+ result = getWeekDayNames(locale, options);
+ }
+
+ win({ value: result });
+ } catch (e) {
+ fail({ code: 0, message: e.hasOwnProperty('message')? e.message : e });
+ }
+ },
+
+ getDatePattern: function(win, fail) {
+ try {
+ var formatter = new Intl.DateTimeFormat(getCrossPlatformLocale());
+ var timezone = formatter.hasOwnProperty('resolved') ? formatter.resolved.timeZone : '';
+ var dstOffset = dstOffsetAbs(new Date());
+
+ win( {
+ utc_offset: new Date().getTimezoneOffset() * (-60),
+ dst_offset: dstOffset * 60,
+ timezone: timezone,
+ pattern: '',
+ });
+ } catch (e) {
+ fail(new GlobalizationError(GlobalizationError.PATTERN_ERROR,
+ e.hasOwnProperty('message')? e.message : e));
+ }
+ },
+
+ getNumberPattern: function(win, fail, args) {
+ try {
+ var options = args[0].options || { type : 'decimal'};
+ options.type = options.type || 'decimal';
+
+ options = convertToIntlNumberFormatOptions(options);
+
+ var formatter = new Intl.NumberFormat(getCrossPlatformLocale(), options);
+
+ if (!formatter.hasOwnProperty('resolved')) { fail('Not supported'); return; };
+ var pattern = formatter.resolved.pattern;
+ win( {
+ pattern: pattern,
+ symbol: '',
+ fraction: 0,
+ rounding: 0,
+ positive: '',
+ negative: '',
+ decimal: '',
+ grouping: '',
+ });
+ } catch (e) {
+ fail(new GlobalizationError(GlobalizationError.PATTERN_ERROR,
+ e.hasOwnProperty('message')? e.message : e));
+ }
+ },
+
+ getPreferredLanguage: function(win, fail, args) {
+ // Falling back on locale
+ globalization.getLocaleName(win, fail);
+ },
+
+ getCurrencyPattern: function(win, fail, args) {
+ fail('Not supported');
+ },
+
+ stringToDate: function(win, fail, args) {
+ try {
+ var options = prepareAndGetDateOptions(args[0].options);
+ moment.locale(getCrossPlatformLocale());
+
+ var date = moment(args[0].dateString, options).toDate();
+
+ win({
+ year: date.getFullYear(),
+ month: date.getMonth(),
+ day: date.getDate(),
+ hour: date.getHours(),
+ minute: date.getMinutes(),
+ second: date.getSeconds(),
+ millisecond: date.getMilliseconds()
+ });
+ } catch (e) {
+ fail(new GlobalizationError(GlobalizationError.PARSING_ERROR,
+ e.hasOwnProperty('message')? e.message : e));
+ }
+ },
+
+ stringToNumber: function(win, fail, args) {
+ fail('Not supported');
+ },
+
+ dateToString: function(win, fail, args) {
+ try {
+ var date = new Date(args[0].date);
+ var options = prepareAndGetDateOptions(args[0].options);
+ moment.locale(getCrossPlatformLocale());
+
+ win({ value : moment(date).format(options)});
+ } catch (e) {
+ fail(new GlobalizationError(GlobalizationError.FORMATTING_ERROR,
+ e.hasOwnProperty('message')? e.message : e));
+ }
+ }
+};
+
+module.exports = globalization;
+
+require('cordova/exec/proxy').add('Globalization', module.exports);
http://git-wip-us.apache.org/repos/asf/cordova-plugin-globalization/blob/e268328f/tests/tests.js
----------------------------------------------------------------------
diff --git a/tests/tests.js b/tests/tests.js
index 1c257a7..98fd31d 100644
--- a/tests/tests.js
+++ b/tests/tests.js
@@ -21,7 +21,8 @@
exports.defineAutoTests = function () {
var isWindowsPhone = cordova.platformId == 'windowsphone',
- isWindows = (cordova.platformId === "windows") || (cordova.platformId === "windows8");
+ isWindows = (cordova.platformId === "windows") || (cordova.platformId === "windows8"),
+ isBrowser = cordova.platformId === "browser";
var fail = function (done) {
expect(true).toBe(false);
@@ -89,8 +90,13 @@ exports.defineAutoTests = function () {
navigator.globalization.getLocaleName(function (a) {
checkLocaleName(a);
expect(a.value.indexOf('_')).toBe(-1);
- expect(a.value.indexOf('-')).toBeGreaterThan(0);
- done()
+ if (!isBrowser){
+ // The browser implementation returns non-BCP 47 compatible
+ // value in Chrome so we need to skip this expectation. See
+ // https://github.com/MSOpenTech/cordova-plugin-globalization/blob/21f8a0ffa5aa2497ee970b6b5092b4c65fc4bf7e/README.md#browser-quirks-1
+ expect(a.value.indexOf('-')).toBeGreaterThan(0);
+ }
+ done();
}, fail.bind(null, done));
});
});
@@ -240,9 +246,19 @@ exports.defineAutoTests = function () {
expect(typeof a).toBe('object');
expect(a.pattern).toBeDefined();
expect(typeof a.pattern).toBe('string');
- expect(a.pattern.length > 0).toBe(true);
+ if (!isBrowser) {
+ // In browser the 'pattern' property is not supported and returns empty string.
+ // https://github.com/MSOpenTech/cordova-plugin-globalization/blob/21f8a0ffa5aa2497ee970b6b5092b4c65fc4bf7e/README.md#browser-quirks-4
+ expect(a.pattern.length > 0).toBe(true);
+ }
expect(a.timezone).toBeDefined();
expect(typeof a.timezone).toBe('string');
+ if (!isBrowser) {
+ // The browser platform partially supports 'timezone'. Only Chrome returns 'timezone' property.
+ // Its format is "Part of the world/{City}". Other browsers return empty string.
+ // https://github.com/MSOpenTech/cordova-plugin-globalization/blob/21f8a0ffa5aa2497ee970b6b5092b4c65fc4bf7e/README.md#browser-quirks-4
+ expect(a.pattern.length > 0).toBe(true);
+ }
expect(a.timezone.length > 0).toBe(true);
expect(a.utc_offset).toBeDefined();
expect(typeof a.utc_offset).toBe('number');
@@ -375,6 +391,11 @@ exports.defineAutoTests = function () {
{ type: 'percent' });
});
it("globalization.spec.32 numberToString using type=currency options, should be called with a Properties object", function (done) {
+ // the numberToString using type=currency is not supported on browser
+ // https://github.com/MSOpenTech/cordova-plugin-globalization/blob/21f8a0ffa5aa2497ee970b6b5092b4c65fc4bf7e/README.md#browser-quirks-7
+ if (isBrowser) {
+ pending();
+ }
navigator.globalization.numberToString(5.20, function (a) {
checkNumberToString(a);
done();
@@ -396,6 +417,11 @@ exports.defineAutoTests = function () {
expect(typeof navigator.globalization.stringToNumber == 'function').toBe(true);
});
it("globalization.spec.34 stringToNumber using default options, should be called with a Properties object", function (done) {
+ // the stringToNumber is not supported on browser
+ // https://github.com/MSOpenTech/cordova-plugin-globalization/blob/21f8a0ffa5aa2497ee970b6b5092b4c65fc4bf7e/README.md#supported-platforms-11
+ if (isBrowser) {
+ pending();
+ }
var win = function (a) {
checkStringToNumber(a);
done();
@@ -406,6 +432,11 @@ exports.defineAutoTests = function () {
}, fail.bind(null, done));
});
it("globalization.spec.35 stringToNumber using type=percent options, should be called with a Properties object", function (done) {
+ // the stringToNumber is not supported on browser
+ // https://github.com/MSOpenTech/cordova-plugin-globalization/blob/21f8a0ffa5aa2497ee970b6b5092b4c65fc4bf7e/README.md#supported-platforms-11
+ if (isBrowser) {
+ pending();
+ }
var win = function (a) {
checkStringToNumber(a);
done();
@@ -446,9 +477,10 @@ exports.defineAutoTests = function () {
expect(typeof navigator.globalization.getNumberPattern == 'function').toBe(true);
});
it("globalization.spec.37 getNumberPattern using default options, success callback should be called with a Properties object", function (done) {
- // the pattern property is not supported on windows and windows phone
+ // the pattern property is not supported on windows, windows phone and browser
// https://github.com/apache/cordova-plugin-globalization/blob/master/doc/index.md#windows-phone-8-quirks-5
- if (isWindows || isWindowsPhone) {
+ // https://github.com/MSOpenTech/cordova-plugin-globalization/blob/21f8a0ffa5aa2497ee970b6b5092b4c65fc4bf7e/README.md#browser-quirks-6
+ if (isWindows || isWindowsPhone || isBrowser) {
pending();
}
navigator.globalization.getNumberPattern(function (a) {
@@ -457,9 +489,10 @@ exports.defineAutoTests = function () {
}, fail.bind(null, done));
});
it("globalization.spec.38 getNumberPattern using type=percent, success callback should be called with a Properties object", function (done) {
- // the pattern property is not supported on windows and windows phone
+ // the pattern property is not supported on windows, windows phone and browser
// https://github.com/apache/cordova-plugin-globalization/blob/master/doc/index.md#windows-phone-8-quirks-5
- if (isWindows || isWindowsPhone) {
+ // https://github.com/MSOpenTech/cordova-plugin-globalization/blob/21f8a0ffa5aa2497ee970b6b5092b4c65fc4bf7e/README.md#browser-quirks-6
+ if (isWindows || isWindowsPhone || isBrowser) {
pending();
}
navigator.globalization.getNumberPattern(function (a) {
@@ -468,9 +501,10 @@ exports.defineAutoTests = function () {
}, fail.bind(null, done), { type: 'percent' });
});
it("globalization.spec.39 getNumberPattern using type=currency, success callback should be called with a Properties object", function (done) {
- // the pattern property is not supported on windows and windows phone
+ // the pattern property is not supported on windows, windows phone and browser
// https://github.com/apache/cordova-plugin-globalization/blob/master/doc/index.md#windows-phone-8-quirks-5
- if (isWindows || isWindowsPhone) {
+ // https://github.com/MSOpenTech/cordova-plugin-globalization/blob/21f8a0ffa5aa2497ee970b6b5092b4c65fc4bf7e/README.md#browser-quirks-6
+ if (isWindows || isWindowsPhone || isBrowser) {
pending();
}
navigator.globalization.getNumberPattern(function (a) {
@@ -492,8 +526,8 @@ exports.defineAutoTests = function () {
it("globalization.spec.41 getCurrencyPattern using EUR for currency, success callback should be called with a Properties object", function (done) {
// only `code` and `fraction` properties are supported on windows
// https://github.com/apache/cordova-plugin-globalization/blob/master/doc/index.md#windows-quirks-3
- // wp8 is unsupported
- if (isWindowsPhone || isWindows) {
+ // wp8 and browser are unsupported
+ if (isWindowsPhone || isWindows || isBrowser) {
pending();
}
navigator.globalization.getCurrencyPattern("EUR", function (a) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org