| Index: src/js/i18n.js
|
| diff --git a/src/js/i18n.js b/src/js/i18n.js
|
| index 1920bbb735a8b08a64ca840bf1fc7f4f0f099ede..f2b9dd4445e6179682a48584d3c60a0acafb593f 100644
|
| --- a/src/js/i18n.js
|
| +++ b/src/js/i18n.js
|
| @@ -947,16 +947,19 @@
|
| *
|
| * @constructor
|
| */
|
| -function Collator() {
|
| - var locales = %_Arguments(0);
|
| - var options = %_Arguments(1);
|
| -
|
| - if (IS_UNDEFINED(new.target)) return new Collator(locales, options);
|
| -
|
| - return initializeCollator(this, locales, options);
|
| -}
|
| -
|
| -%AddNamedProperty(Intl, 'Collator', Collator, DONT_ENUM);
|
| +%AddNamedProperty(Intl, 'Collator', function() {
|
| + var locales = %_Arguments(0);
|
| + var options = %_Arguments(1);
|
| +
|
| + if (!this || this === Intl) {
|
| + // Constructor is called as a function.
|
| + return new Intl.Collator(locales, options);
|
| + }
|
| +
|
| + return initializeCollator(TO_OBJECT(this), locales, options);
|
| + },
|
| + DONT_ENUM
|
| +);
|
|
|
|
|
| /**
|
| @@ -1186,15 +1189,19 @@
|
| *
|
| * @constructor
|
| */
|
| -function NumberFormat() {
|
| - var locales = %_Arguments(0);
|
| - var options = %_Arguments(1);
|
| -
|
| - if (IS_UNDEFINED(new.target)) return new NumberFormat(locales, options);
|
| -
|
| - return initializeNumberFormat(this, locales, options);
|
| -}
|
| -%AddNamedProperty(Intl, 'NumberFormat', NumberFormat, DONT_ENUM);
|
| +%AddNamedProperty(Intl, 'NumberFormat', function() {
|
| + var locales = %_Arguments(0);
|
| + var options = %_Arguments(1);
|
| +
|
| + if (!this || this === Intl) {
|
| + // Constructor is called as a function.
|
| + return new Intl.NumberFormat(locales, options);
|
| + }
|
| +
|
| + return initializeNumberFormat(TO_OBJECT(this), locales, options);
|
| + },
|
| + DONT_ENUM
|
| +);
|
|
|
|
|
| /**
|
| @@ -1584,15 +1591,19 @@
|
| *
|
| * @constructor
|
| */
|
| -function DateTimeFormat() {
|
| - var locales = %_Arguments(0);
|
| - var options = %_Arguments(1);
|
| -
|
| - if (IS_UNDEFINED(new.target)) return new DateTimeFormat(locales, options);
|
| -
|
| - return initializeDateTimeFormat(this, locales, options);
|
| -}
|
| -%AddNamedProperty(Intl, 'DateTimeFormat', DateTimeFormat, DONT_ENUM);
|
| +%AddNamedProperty(Intl, 'DateTimeFormat', function() {
|
| + var locales = %_Arguments(0);
|
| + var options = %_Arguments(1);
|
| +
|
| + if (!this || this === Intl) {
|
| + // Constructor is called as a function.
|
| + return new Intl.DateTimeFormat(locales, options);
|
| + }
|
| +
|
| + return initializeDateTimeFormat(TO_OBJECT(this), locales, options);
|
| + },
|
| + DONT_ENUM
|
| +);
|
|
|
|
|
| /**
|
|
|