@lingui/core 3.13.0 → 3.13.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/core.development.js +4 -4
- package/cjs/core.production.min.js +1 -1
- package/cjs/dev.development.js +4 -4
- package/cjs/dev.production.min.js +1 -1
- package/esm/core.development.js +4 -4
- package/esm/core.production.min.js +1 -1
- package/esm/dev.development.js +4 -4
- package/esm/dev.production.min.js +1 -1
- package/package.json +1 -1
package/cjs/core.development.js
CHANGED
|
@@ -460,7 +460,7 @@ var I18n = /*#__PURE__*/function (_EventEmitter) {
|
|
|
460
460
|
var missing = this._missing;
|
|
461
461
|
|
|
462
462
|
if (missing && messageUnreachable) {
|
|
463
|
-
return isFunction(missing) ? missing(this.
|
|
463
|
+
return isFunction(missing) ? missing(this._locale, id, context) : missing;
|
|
464
464
|
}
|
|
465
465
|
|
|
466
466
|
if (messageUnreachable) {
|
|
@@ -487,17 +487,17 @@ var I18n = /*#__PURE__*/function (_EventEmitter) {
|
|
|
487
487
|
|
|
488
488
|
if (isString(translation) && UNICODE_REGEX.test(translation)) return JSON.parse("\"".concat(translation, "\""));
|
|
489
489
|
if (isString(translation)) return translation;
|
|
490
|
-
return interpolate(translation, this.
|
|
490
|
+
return interpolate(translation, this._locale, this._locales, this.localeData)(values, formats);
|
|
491
491
|
}
|
|
492
492
|
}, {
|
|
493
493
|
key: "date",
|
|
494
494
|
value: function date$1(value, format) {
|
|
495
|
-
return date(this.
|
|
495
|
+
return date(this._locales || this._locale, format)(value);
|
|
496
496
|
}
|
|
497
497
|
}, {
|
|
498
498
|
key: "number",
|
|
499
499
|
value: function number$1(value, format) {
|
|
500
|
-
return number(this.
|
|
500
|
+
return number(this._locales || this._locale, format)(value);
|
|
501
501
|
}
|
|
502
502
|
}, {
|
|
503
503
|
key: "locale",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/classCallCheck"),t=require("@babel/runtime/helpers/createClass"),r=require("@babel/runtime/helpers/inherits"),n=require("@babel/runtime/helpers/possibleConstructorReturn"),a=require("@babel/runtime/helpers/getPrototypeOf"),l=require("@babel/runtime/helpers/slicedToArray"),o=require("@babel/runtime/helpers/objectWithoutProperties");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=i(e),u=i(t),c=i(r),f=i(n),h=i(a),v=i(l),d=i(o),m=function(e){return"string"==typeof e},
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/classCallCheck"),t=require("@babel/runtime/helpers/createClass"),r=require("@babel/runtime/helpers/inherits"),n=require("@babel/runtime/helpers/possibleConstructorReturn"),a=require("@babel/runtime/helpers/getPrototypeOf"),l=require("@babel/runtime/helpers/slicedToArray"),o=require("@babel/runtime/helpers/objectWithoutProperties");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=i(e),u=i(t),c=i(r),f=i(n),h=i(a),v=i(l),d=i(o),m=function(e){return"string"==typeof e},_=function(e){return"function"==typeof e},g=new Map,y=new Map;function p(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return function(n){if(m(n)&&(n=new Date(n)),r){var a=D(e,t),l=y.get(a);if(l)return l.format(n);var o=new Intl.DateTimeFormat(e,t);return y.set(a,o),o.format(n)}var i=new Intl.DateTimeFormat(e,t);return i.format(n)}}function b(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return function(n){if(r){var a=D(e,t),l=g.get(a);if(l)return l.format(n);var o=new Intl.NumberFormat(e,t);return g.set(a,o),o.format(n)}var i=new Intl.NumberFormat(e,t);return i.format(n)}}function D(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Array.isArray(e)?e.sort().join("-"):e;return"".concat(r,"-").concat(JSON.stringify(t))}var k=Object.freeze({__proto__:null,date:p,number:b}),A=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/g;function O(e){var t=e.locale,r=e.locales,n=e.values,a=e.formats,l=e.localeData,o=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{plurals:void 0},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};t=t||e;var a=r.plurals,l=function(e){return m(e)?n[e]||{style:e}:e},o=function(e,r){return function(n){var a=_(r)?r(n):r,l=Array.isArray(a)?a:[a],o=b(t)(e);return l.map((function(e){return m(e)?e.replace("#",o):e}))}};return a||console.error("Plurals for locale ".concat(e," aren't loaded. Use i18n.loadLocaleData method to load plurals for specific locale. Using other plural rule as a fallback.")),{plural:function(e,t){var r=t.offset,n=void 0===r?0:r,l=d.default(t,["offset"]),i=l[e]||l[null==a?void 0:a(e-n)]||l.other;return o(e-n,i)},selectordinal:function(e,t){var r=t.offset,n=void 0===r?0:r,l=d.default(t,["offset"]),i=l[e]||l[null==a?void 0:a(e-n,!0)]||l.other;return o(e-n,i)},select:function(e,t){return t[e]||t.other},number:function(e,r){return b(t,l(r))(e)},date:function(e,r){return p(t,l(r))(e)},undefined:function(e){return e}}}(t,r,l,a);return function e(t,r,a){var l=n[t],i=o[r](l,a),s=_(i)?i(e):i;return Array.isArray(s)?s.join(""):s}}function j(e,t,r,n){return function(a){var l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=O({locale:t,locales:r,localeData:n,formats:l,values:a}),i=function e(t){return Array.isArray(t)?t.reduce((function(t,r){if(m(r))return t+r;var n=v.default(r,3),a=n[0],l=n[1],i=n[2],s={};null==i||m(i)?s=i:Object.keys(i).forEach((function(t){s[t]=e(i[t])}));var u=o(a,l,s);return null==u?t:t+u}),""):t},s=i(e);return m(s)&&A.test(s)?JSON.parse('"'.concat(s.trim(),'"')):m(s)?s.trim():s}}var x=function(){function e(){s.default(this,e),this._events={}}return u.default(e,[{key:"on",value:function(e,t){var r=this;return this._hasEvent(e)||(this._events[e]=[]),this._events[e].push(t),function(){return r.removeListener(e,t)}}},{key:"removeListener",value:function(e,t){if(this._hasEvent(e)){var r=this._events[e].indexOf(t);~r&&this._events[e].splice(r,1)}}},{key:"emit",value:function(e){for(var t=this,r=arguments.length,n=new Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];this._hasEvent(e)&&this._events[e].map((function(e){return e.apply(t,n)}))}},{key:"_hasEvent",value:function(e){return Array.isArray(this._events[e])}}]),e}();function w(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=h.default(e);if(t){var a=h.default(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return f.default(this,r)}}var L=function(e){c.default(r,e);var t=w(r);function r(e){var n;return s.default(this,r),n=t.call(this),n._messages={},n._localeData={},null!=e.missing&&(n._missing=e.missing),null!=e.messages&&n.load(e.messages),null!=e.localeData&&n.loadLocaleData(e.localeData),null==e.locale&&null==e.locales||n.activate(e.locale,e.locales),n}return u.default(r,[{key:"_loadLocaleData",value:function(e,t){null==this._localeData[e]?this._localeData[e]=t:Object.assign(this._localeData[e],t)}},{key:"loadLocaleData",value:function(e,t){var r=this;null!=t?this._loadLocaleData(e,t):Object.keys(e).forEach((function(t){return r._loadLocaleData(t,e[t])})),this.emit("change")}},{key:"_load",value:function(e,t){null==this._messages[e]?this._messages[e]=t:Object.assign(this._messages[e],t)}},{key:"load",value:function(e,t){var r=this;null!=t?this._load(e,t):Object.keys(e).forEach((function(t){return r._load(t,e[t])})),this.emit("change")}},{key:"activate",value:function(e,t){this._locale=e,this._locales=t,this.emit("change")}},{key:"_",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.message,a=r.formats,l=r.context;m(e)||(t=e.values||t,n=e.message,l=e.context,e=e.id);var o,i=!l&&!this.messages[e],s=l&&!this.messages[l][e],u=s||i,c=this._missing;return c&&u?_(c)?c(this._locale,e,l):c:(u&&this.emit("missing",{id:e,context:l,locale:this._locale}),o=l&&!s?this.messages[l][e]||n||e:this.messages[e]||n||e,m(o)&&A.test(o)?JSON.parse('"'.concat(o,'"')):m(o)?o:j(o,this._locale,this._locales,this.localeData)(t,a))}},{key:"date",value:function(e,t){return p(this._locales||this._locale,t)(e)}},{key:"number",value:function(e,t){return b(this._locales||this._locale,t)(e)}},{key:"locale",get:function(){return this._locale}},{key:"locales",get:function(){return this._locales}},{key:"messages",get:function(){var e;return null!==(e=this._messages[this._locale])&&void 0!==e?e:{}}},{key:"localeData",get:function(){var e;return null!==(e=this._localeData[this._locale])&&void 0!==e?e:{}}}]),r}(x);function q(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new L(e)}var E=q();exports.I18n=L,exports.formats=k,exports.i18n=E,exports.setupI18n=q;
|
|
2
2
|
//# sourceMappingURL=core.production.min.js.map
|
package/cjs/dev.development.js
CHANGED
|
@@ -460,7 +460,7 @@ var I18n = /*#__PURE__*/function (_EventEmitter) {
|
|
|
460
460
|
var missing = this._missing;
|
|
461
461
|
|
|
462
462
|
if (missing && messageUnreachable) {
|
|
463
|
-
return isFunction(missing) ? missing(this.
|
|
463
|
+
return isFunction(missing) ? missing(this._locale, id, context) : missing;
|
|
464
464
|
}
|
|
465
465
|
|
|
466
466
|
if (messageUnreachable) {
|
|
@@ -487,17 +487,17 @@ var I18n = /*#__PURE__*/function (_EventEmitter) {
|
|
|
487
487
|
|
|
488
488
|
if (isString(translation) && UNICODE_REGEX.test(translation)) return JSON.parse("\"".concat(translation, "\""));
|
|
489
489
|
if (isString(translation)) return translation;
|
|
490
|
-
return interpolate(translation, this.
|
|
490
|
+
return interpolate(translation, this._locale, this._locales, this.localeData)(values, formats);
|
|
491
491
|
}
|
|
492
492
|
}, {
|
|
493
493
|
key: "date",
|
|
494
494
|
value: function date$1(value, format) {
|
|
495
|
-
return date(this.
|
|
495
|
+
return date(this._locales || this._locale, format)(value);
|
|
496
496
|
}
|
|
497
497
|
}, {
|
|
498
498
|
key: "number",
|
|
499
499
|
value: function number$1(value, format) {
|
|
500
|
-
return number(this.
|
|
500
|
+
return number(this._locales || this._locale, format)(value);
|
|
501
501
|
}
|
|
502
502
|
}, {
|
|
503
503
|
key: "locale",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/classCallCheck"),t=require("@babel/runtime/helpers/createClass"),r=require("@babel/runtime/helpers/inherits"),n=require("@babel/runtime/helpers/possibleConstructorReturn"),a=require("@babel/runtime/helpers/getPrototypeOf"),l=require("@babel/runtime/helpers/slicedToArray"),o=require("@babel/runtime/helpers/objectWithoutProperties");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=i(e),u=i(t),c=i(r),f=i(n),h=i(a),v=i(l),d=i(o),m=function(e){return"string"==typeof e},
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/classCallCheck"),t=require("@babel/runtime/helpers/createClass"),r=require("@babel/runtime/helpers/inherits"),n=require("@babel/runtime/helpers/possibleConstructorReturn"),a=require("@babel/runtime/helpers/getPrototypeOf"),l=require("@babel/runtime/helpers/slicedToArray"),o=require("@babel/runtime/helpers/objectWithoutProperties");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=i(e),u=i(t),c=i(r),f=i(n),h=i(a),v=i(l),d=i(o),m=function(e){return"string"==typeof e},_=function(e){return"function"==typeof e},g=new Map,y=new Map;function p(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return function(n){if(m(n)&&(n=new Date(n)),r){var a=D(e,t),l=y.get(a);if(l)return l.format(n);var o=new Intl.DateTimeFormat(e,t);return y.set(a,o),o.format(n)}var i=new Intl.DateTimeFormat(e,t);return i.format(n)}}function b(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return function(n){if(r){var a=D(e,t),l=g.get(a);if(l)return l.format(n);var o=new Intl.NumberFormat(e,t);return g.set(a,o),o.format(n)}var i=new Intl.NumberFormat(e,t);return i.format(n)}}function D(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Array.isArray(e)?e.sort().join("-"):e;return"".concat(r,"-").concat(JSON.stringify(t))}var k=Object.freeze({__proto__:null,date:p,number:b}),A=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/g;function O(e){var t=e.locale,r=e.locales,n=e.values,a=e.formats,l=e.localeData,o=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{plurals:void 0},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};t=t||e;var a=r.plurals,l=function(e){return m(e)?n[e]||{style:e}:e},o=function(e,r){return function(n){var a=_(r)?r(n):r,l=Array.isArray(a)?a:[a],o=b(t)(e);return l.map((function(e){return m(e)?e.replace("#",o):e}))}};return a||console.error("Plurals for locale ".concat(e," aren't loaded. Use i18n.loadLocaleData method to load plurals for specific locale. Using other plural rule as a fallback.")),{plural:function(e,t){var r=t.offset,n=void 0===r?0:r,l=d.default(t,["offset"]),i=l[e]||l[null==a?void 0:a(e-n)]||l.other;return o(e-n,i)},selectordinal:function(e,t){var r=t.offset,n=void 0===r?0:r,l=d.default(t,["offset"]),i=l[e]||l[null==a?void 0:a(e-n,!0)]||l.other;return o(e-n,i)},select:function(e,t){return t[e]||t.other},number:function(e,r){return b(t,l(r))(e)},date:function(e,r){return p(t,l(r))(e)},undefined:function(e){return e}}}(t,r,l,a);return function e(t,r,a){var l=n[t],i=o[r](l,a),s=_(i)?i(e):i;return Array.isArray(s)?s.join(""):s}}function j(e,t,r,n){return function(a){var l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=O({locale:t,locales:r,localeData:n,formats:l,values:a}),i=function e(t){return Array.isArray(t)?t.reduce((function(t,r){if(m(r))return t+r;var n=v.default(r,3),a=n[0],l=n[1],i=n[2],s={};null==i||m(i)?s=i:Object.keys(i).forEach((function(t){s[t]=e(i[t])}));var u=o(a,l,s);return null==u?t:t+u}),""):t},s=i(e);return m(s)&&A.test(s)?JSON.parse('"'.concat(s.trim(),'"')):m(s)?s.trim():s}}var x=function(){function e(){s.default(this,e),this._events={}}return u.default(e,[{key:"on",value:function(e,t){var r=this;return this._hasEvent(e)||(this._events[e]=[]),this._events[e].push(t),function(){return r.removeListener(e,t)}}},{key:"removeListener",value:function(e,t){if(this._hasEvent(e)){var r=this._events[e].indexOf(t);~r&&this._events[e].splice(r,1)}}},{key:"emit",value:function(e){for(var t=this,r=arguments.length,n=new Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];this._hasEvent(e)&&this._events[e].map((function(e){return e.apply(t,n)}))}},{key:"_hasEvent",value:function(e){return Array.isArray(this._events[e])}}]),e}();function w(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=h.default(e);if(t){var a=h.default(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return f.default(this,r)}}var L=function(e){c.default(r,e);var t=w(r);function r(e){var n;return s.default(this,r),n=t.call(this),n._messages={},n._localeData={},null!=e.missing&&(n._missing=e.missing),null!=e.messages&&n.load(e.messages),null!=e.localeData&&n.loadLocaleData(e.localeData),null==e.locale&&null==e.locales||n.activate(e.locale,e.locales),n}return u.default(r,[{key:"_loadLocaleData",value:function(e,t){null==this._localeData[e]?this._localeData[e]=t:Object.assign(this._localeData[e],t)}},{key:"loadLocaleData",value:function(e,t){var r=this;null!=t?this._loadLocaleData(e,t):Object.keys(e).forEach((function(t){return r._loadLocaleData(t,e[t])})),this.emit("change")}},{key:"_load",value:function(e,t){null==this._messages[e]?this._messages[e]=t:Object.assign(this._messages[e],t)}},{key:"load",value:function(e,t){var r=this;null!=t?this._load(e,t):Object.keys(e).forEach((function(t){return r._load(t,e[t])})),this.emit("change")}},{key:"activate",value:function(e,t){this._locale=e,this._locales=t,this.emit("change")}},{key:"_",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.message,a=r.formats,l=r.context;m(e)||(t=e.values||t,n=e.message,l=e.context,e=e.id);var o,i=!l&&!this.messages[e],s=l&&!this.messages[l][e],u=s||i,c=this._missing;return c&&u?_(c)?c(this._locale,e,l):c:(u&&this.emit("missing",{id:e,context:l,locale:this._locale}),o=l&&!s?this.messages[l][e]||n||e:this.messages[e]||n||e,m(o)&&A.test(o)?JSON.parse('"'.concat(o,'"')):m(o)?o:j(o,this._locale,this._locales,this.localeData)(t,a))}},{key:"date",value:function(e,t){return p(this._locales||this._locale,t)(e)}},{key:"number",value:function(e,t){return b(this._locales||this._locale,t)(e)}},{key:"locale",get:function(){return this._locale}},{key:"locales",get:function(){return this._locales}},{key:"messages",get:function(){var e;return null!==(e=this._messages[this._locale])&&void 0!==e?e:{}}},{key:"localeData",get:function(){var e;return null!==(e=this._localeData[this._locale])&&void 0!==e?e:{}}}]),r}(x);function q(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new L(e)}var E=q();exports.I18n=L,exports.formats=k,exports.i18n=E,exports.setupI18n=q;
|
|
2
2
|
//# sourceMappingURL=dev.production.min.js.map
|
package/esm/core.development.js
CHANGED
|
@@ -445,7 +445,7 @@ var I18n = /*#__PURE__*/function (_EventEmitter) {
|
|
|
445
445
|
var missing = this._missing;
|
|
446
446
|
|
|
447
447
|
if (missing && messageUnreachable) {
|
|
448
|
-
return isFunction(missing) ? missing(this.
|
|
448
|
+
return isFunction(missing) ? missing(this._locale, id, context) : missing;
|
|
449
449
|
}
|
|
450
450
|
|
|
451
451
|
if (messageUnreachable) {
|
|
@@ -472,17 +472,17 @@ var I18n = /*#__PURE__*/function (_EventEmitter) {
|
|
|
472
472
|
|
|
473
473
|
if (isString(translation) && UNICODE_REGEX.test(translation)) return JSON.parse("\"".concat(translation, "\""));
|
|
474
474
|
if (isString(translation)) return translation;
|
|
475
|
-
return interpolate(translation, this.
|
|
475
|
+
return interpolate(translation, this._locale, this._locales, this.localeData)(values, formats);
|
|
476
476
|
}
|
|
477
477
|
}, {
|
|
478
478
|
key: "date",
|
|
479
479
|
value: function date$1(value, format) {
|
|
480
|
-
return date(this.
|
|
480
|
+
return date(this._locales || this._locale, format)(value);
|
|
481
481
|
}
|
|
482
482
|
}, {
|
|
483
483
|
key: "number",
|
|
484
484
|
value: function number$1(value, format) {
|
|
485
|
-
return number(this.
|
|
485
|
+
return number(this._locales || this._locale, format)(value);
|
|
486
486
|
}
|
|
487
487
|
}, {
|
|
488
488
|
key: "locale",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"@babel/runtime/helpers/classCallCheck";import t from"@babel/runtime/helpers/createClass";import n from"@babel/runtime/helpers/inherits";import r from"@babel/runtime/helpers/possibleConstructorReturn";import a from"@babel/runtime/helpers/getPrototypeOf";import o from"@babel/runtime/helpers/slicedToArray";import l from"@babel/runtime/helpers/objectWithoutProperties";var i=function(e){return"string"==typeof e},s=function(e){return"function"==typeof e},u=new Map,c=new Map;function f(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return function(r){if(i(r)&&(r=new Date(r)),n){var a=v(e,t),o=c.get(a);if(o)return o.format(r);var l=new Intl.DateTimeFormat(e,t);return c.set(a,l),l.format(r)}var s=new Intl.DateTimeFormat(e,t);return s.format(r)}}function h(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return function(r){if(n){var a=v(e,t),o=u.get(a);if(o)return o.format(r);var l=new Intl.NumberFormat(e,t);return u.set(a,l),l.format(r)}var i=new Intl.NumberFormat(e,t);return i.format(r)}}function v(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Array.isArray(e)?e.sort().join("-"):e;return"".concat(n,"-").concat(JSON.stringify(t))}var m=Object.freeze({__proto__:null,date:f,number:h}),g=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/g;function
|
|
1
|
+
import e from"@babel/runtime/helpers/classCallCheck";import t from"@babel/runtime/helpers/createClass";import n from"@babel/runtime/helpers/inherits";import r from"@babel/runtime/helpers/possibleConstructorReturn";import a from"@babel/runtime/helpers/getPrototypeOf";import o from"@babel/runtime/helpers/slicedToArray";import l from"@babel/runtime/helpers/objectWithoutProperties";var i=function(e){return"string"==typeof e},s=function(e){return"function"==typeof e},u=new Map,c=new Map;function f(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return function(r){if(i(r)&&(r=new Date(r)),n){var a=v(e,t),o=c.get(a);if(o)return o.format(r);var l=new Intl.DateTimeFormat(e,t);return c.set(a,l),l.format(r)}var s=new Intl.DateTimeFormat(e,t);return s.format(r)}}function h(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return function(r){if(n){var a=v(e,t),o=u.get(a);if(o)return o.format(r);var l=new Intl.NumberFormat(e,t);return u.set(a,l),l.format(r)}var i=new Intl.NumberFormat(e,t);return i.format(r)}}function v(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Array.isArray(e)?e.sort().join("-"):e;return"".concat(n,"-").concat(JSON.stringify(t))}var m=Object.freeze({__proto__:null,date:f,number:h}),g=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/g;function _(e){var t=e.locale,n=e.locales,r=e.values,a=e.formats,o=e.localeData,u=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{plurals:void 0},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};t=t||e;var a=n.plurals,o=function(e){return i(e)?r[e]||{style:e}:e},u=function(e,n){return function(r){var a=s(n)?n(r):n,o=Array.isArray(a)?a:[a],l=h(t)(e);return o.map((function(e){return i(e)?e.replace("#",l):e}))}};return a||console.error("Plurals for locale ".concat(e," aren't loaded. Use i18n.loadLocaleData method to load plurals for specific locale. Using other plural rule as a fallback.")),{plural:function(e,t){var n=t.offset,r=void 0===n?0:n,o=l(t,["offset"]),i=o[e]||o[null==a?void 0:a(e-r)]||o.other;return u(e-r,i)},selectordinal:function(e,t){var n=t.offset,r=void 0===n?0:n,o=l(t,["offset"]),i=o[e]||o[null==a?void 0:a(e-r,!0)]||o.other;return u(e-r,i)},select:function(e,t){return t[e]||t.other},number:function(e,n){return h(t,o(n))(e)},date:function(e,n){return f(t,o(n))(e)},undefined:function(e){return e}}}(t,n,o,a);return function e(t,n,a){var o=r[t],l=u[n](o,a),i=s(l)?l(e):l;return Array.isArray(i)?i.join(""):i}}function d(e,t,n,r){return function(a){var l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=_({locale:t,locales:n,localeData:r,formats:l,values:a}),u=function e(t){return Array.isArray(t)?t.reduce((function(t,n){if(i(n))return t+n;var r=o(n,3),a=r[0],l=r[1],u=r[2],c={};null==u||i(u)?c=u:Object.keys(u).forEach((function(t){c[t]=e(u[t])}));var f=s(a,l,c);return null==f?t:t+f}),""):t},c=u(e);return i(c)&&g.test(c)?JSON.parse('"'.concat(c.trim(),'"')):i(c)?c.trim():c}}var p=function(){function n(){e(this,n),this._events={}}return t(n,[{key:"on",value:function(e,t){var n=this;return this._hasEvent(e)||(this._events[e]=[]),this._events[e].push(t),function(){return n.removeListener(e,t)}}},{key:"removeListener",value:function(e,t){if(this._hasEvent(e)){var n=this._events[e].indexOf(t);~n&&this._events[e].splice(n,1)}}},{key:"emit",value:function(e){for(var t=this,n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];this._hasEvent(e)&&this._events[e].map((function(e){return e.apply(t,r)}))}},{key:"_hasEvent",value:function(e){return Array.isArray(this._events[e])}}]),n}();function y(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=a(e);if(t){var l=a(this).constructor;n=Reflect.construct(o,arguments,l)}else n=o.apply(this,arguments);return r(this,n)}}var b=function(r){n(o,r);var a=y(o);function o(t){var n;return e(this,o),n=a.call(this),n._messages={},n._localeData={},null!=t.missing&&(n._missing=t.missing),null!=t.messages&&n.load(t.messages),null!=t.localeData&&n.loadLocaleData(t.localeData),null==t.locale&&null==t.locales||n.activate(t.locale,t.locales),n}return t(o,[{key:"_loadLocaleData",value:function(e,t){null==this._localeData[e]?this._localeData[e]=t:Object.assign(this._localeData[e],t)}},{key:"loadLocaleData",value:function(e,t){var n=this;null!=t?this._loadLocaleData(e,t):Object.keys(e).forEach((function(t){return n._loadLocaleData(t,e[t])})),this.emit("change")}},{key:"_load",value:function(e,t){null==this._messages[e]?this._messages[e]=t:Object.assign(this._messages[e],t)}},{key:"load",value:function(e,t){var n=this;null!=t?this._load(e,t):Object.keys(e).forEach((function(t){return n._load(t,e[t])})),this.emit("change")}},{key:"activate",value:function(e,t){this._locale=e,this._locales=t,this.emit("change")}},{key:"_",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.message,a=n.formats,o=n.context;i(e)||(t=e.values||t,r=e.message,o=e.context,e=e.id);var l,u=!o&&!this.messages[e],c=o&&!this.messages[o][e],f=c||u,h=this._missing;return h&&f?s(h)?h(this._locale,e,o):h:(f&&this.emit("missing",{id:e,context:o,locale:this._locale}),l=o&&!c?this.messages[o][e]||r||e:this.messages[e]||r||e,i(l)&&g.test(l)?JSON.parse('"'.concat(l,'"')):i(l)?l:d(l,this._locale,this._locales,this.localeData)(t,a))}},{key:"date",value:function(e,t){return f(this._locales||this._locale,t)(e)}},{key:"number",value:function(e,t){return h(this._locales||this._locale,t)(e)}},{key:"locale",get:function(){return this._locale}},{key:"locales",get:function(){return this._locales}},{key:"messages",get:function(){var e;return null!==(e=this._messages[this._locale])&&void 0!==e?e:{}}},{key:"localeData",get:function(){var e;return null!==(e=this._localeData[this._locale])&&void 0!==e?e:{}}}]),o}(p);function D(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new b(e)}var k=D();export{b as I18n,m as formats,k as i18n,D as setupI18n};
|
|
2
2
|
//# sourceMappingURL=core.production.min.js.map
|
package/esm/dev.development.js
CHANGED
|
@@ -445,7 +445,7 @@ var I18n = /*#__PURE__*/function (_EventEmitter) {
|
|
|
445
445
|
var missing = this._missing;
|
|
446
446
|
|
|
447
447
|
if (missing && messageUnreachable) {
|
|
448
|
-
return isFunction(missing) ? missing(this.
|
|
448
|
+
return isFunction(missing) ? missing(this._locale, id, context) : missing;
|
|
449
449
|
}
|
|
450
450
|
|
|
451
451
|
if (messageUnreachable) {
|
|
@@ -472,17 +472,17 @@ var I18n = /*#__PURE__*/function (_EventEmitter) {
|
|
|
472
472
|
|
|
473
473
|
if (isString(translation) && UNICODE_REGEX.test(translation)) return JSON.parse("\"".concat(translation, "\""));
|
|
474
474
|
if (isString(translation)) return translation;
|
|
475
|
-
return interpolate(translation, this.
|
|
475
|
+
return interpolate(translation, this._locale, this._locales, this.localeData)(values, formats);
|
|
476
476
|
}
|
|
477
477
|
}, {
|
|
478
478
|
key: "date",
|
|
479
479
|
value: function date$1(value, format) {
|
|
480
|
-
return date(this.
|
|
480
|
+
return date(this._locales || this._locale, format)(value);
|
|
481
481
|
}
|
|
482
482
|
}, {
|
|
483
483
|
key: "number",
|
|
484
484
|
value: function number$1(value, format) {
|
|
485
|
-
return number(this.
|
|
485
|
+
return number(this._locales || this._locale, format)(value);
|
|
486
486
|
}
|
|
487
487
|
}, {
|
|
488
488
|
key: "locale",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"@babel/runtime/helpers/classCallCheck";import t from"@babel/runtime/helpers/createClass";import n from"@babel/runtime/helpers/inherits";import r from"@babel/runtime/helpers/possibleConstructorReturn";import a from"@babel/runtime/helpers/getPrototypeOf";import o from"@babel/runtime/helpers/slicedToArray";import l from"@babel/runtime/helpers/objectWithoutProperties";var i=function(e){return"string"==typeof e},s=function(e){return"function"==typeof e},u=new Map,c=new Map;function f(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return function(r){if(i(r)&&(r=new Date(r)),n){var a=v(e,t),o=c.get(a);if(o)return o.format(r);var l=new Intl.DateTimeFormat(e,t);return c.set(a,l),l.format(r)}var s=new Intl.DateTimeFormat(e,t);return s.format(r)}}function h(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return function(r){if(n){var a=v(e,t),o=u.get(a);if(o)return o.format(r);var l=new Intl.NumberFormat(e,t);return u.set(a,l),l.format(r)}var i=new Intl.NumberFormat(e,t);return i.format(r)}}function v(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Array.isArray(e)?e.sort().join("-"):e;return"".concat(n,"-").concat(JSON.stringify(t))}var m=Object.freeze({__proto__:null,date:f,number:h}),g=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/g;function
|
|
1
|
+
import e from"@babel/runtime/helpers/classCallCheck";import t from"@babel/runtime/helpers/createClass";import n from"@babel/runtime/helpers/inherits";import r from"@babel/runtime/helpers/possibleConstructorReturn";import a from"@babel/runtime/helpers/getPrototypeOf";import o from"@babel/runtime/helpers/slicedToArray";import l from"@babel/runtime/helpers/objectWithoutProperties";var i=function(e){return"string"==typeof e},s=function(e){return"function"==typeof e},u=new Map,c=new Map;function f(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return function(r){if(i(r)&&(r=new Date(r)),n){var a=v(e,t),o=c.get(a);if(o)return o.format(r);var l=new Intl.DateTimeFormat(e,t);return c.set(a,l),l.format(r)}var s=new Intl.DateTimeFormat(e,t);return s.format(r)}}function h(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return function(r){if(n){var a=v(e,t),o=u.get(a);if(o)return o.format(r);var l=new Intl.NumberFormat(e,t);return u.set(a,l),l.format(r)}var i=new Intl.NumberFormat(e,t);return i.format(r)}}function v(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Array.isArray(e)?e.sort().join("-"):e;return"".concat(n,"-").concat(JSON.stringify(t))}var m=Object.freeze({__proto__:null,date:f,number:h}),g=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/g;function _(e){var t=e.locale,n=e.locales,r=e.values,a=e.formats,o=e.localeData,u=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{plurals:void 0},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};t=t||e;var a=n.plurals,o=function(e){return i(e)?r[e]||{style:e}:e},u=function(e,n){return function(r){var a=s(n)?n(r):n,o=Array.isArray(a)?a:[a],l=h(t)(e);return o.map((function(e){return i(e)?e.replace("#",l):e}))}};return a||console.error("Plurals for locale ".concat(e," aren't loaded. Use i18n.loadLocaleData method to load plurals for specific locale. Using other plural rule as a fallback.")),{plural:function(e,t){var n=t.offset,r=void 0===n?0:n,o=l(t,["offset"]),i=o[e]||o[null==a?void 0:a(e-r)]||o.other;return u(e-r,i)},selectordinal:function(e,t){var n=t.offset,r=void 0===n?0:n,o=l(t,["offset"]),i=o[e]||o[null==a?void 0:a(e-r,!0)]||o.other;return u(e-r,i)},select:function(e,t){return t[e]||t.other},number:function(e,n){return h(t,o(n))(e)},date:function(e,n){return f(t,o(n))(e)},undefined:function(e){return e}}}(t,n,o,a);return function e(t,n,a){var o=r[t],l=u[n](o,a),i=s(l)?l(e):l;return Array.isArray(i)?i.join(""):i}}function d(e,t,n,r){return function(a){var l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=_({locale:t,locales:n,localeData:r,formats:l,values:a}),u=function e(t){return Array.isArray(t)?t.reduce((function(t,n){if(i(n))return t+n;var r=o(n,3),a=r[0],l=r[1],u=r[2],c={};null==u||i(u)?c=u:Object.keys(u).forEach((function(t){c[t]=e(u[t])}));var f=s(a,l,c);return null==f?t:t+f}),""):t},c=u(e);return i(c)&&g.test(c)?JSON.parse('"'.concat(c.trim(),'"')):i(c)?c.trim():c}}var p=function(){function n(){e(this,n),this._events={}}return t(n,[{key:"on",value:function(e,t){var n=this;return this._hasEvent(e)||(this._events[e]=[]),this._events[e].push(t),function(){return n.removeListener(e,t)}}},{key:"removeListener",value:function(e,t){if(this._hasEvent(e)){var n=this._events[e].indexOf(t);~n&&this._events[e].splice(n,1)}}},{key:"emit",value:function(e){for(var t=this,n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];this._hasEvent(e)&&this._events[e].map((function(e){return e.apply(t,r)}))}},{key:"_hasEvent",value:function(e){return Array.isArray(this._events[e])}}]),n}();function y(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=a(e);if(t){var l=a(this).constructor;n=Reflect.construct(o,arguments,l)}else n=o.apply(this,arguments);return r(this,n)}}var b=function(r){n(o,r);var a=y(o);function o(t){var n;return e(this,o),n=a.call(this),n._messages={},n._localeData={},null!=t.missing&&(n._missing=t.missing),null!=t.messages&&n.load(t.messages),null!=t.localeData&&n.loadLocaleData(t.localeData),null==t.locale&&null==t.locales||n.activate(t.locale,t.locales),n}return t(o,[{key:"_loadLocaleData",value:function(e,t){null==this._localeData[e]?this._localeData[e]=t:Object.assign(this._localeData[e],t)}},{key:"loadLocaleData",value:function(e,t){var n=this;null!=t?this._loadLocaleData(e,t):Object.keys(e).forEach((function(t){return n._loadLocaleData(t,e[t])})),this.emit("change")}},{key:"_load",value:function(e,t){null==this._messages[e]?this._messages[e]=t:Object.assign(this._messages[e],t)}},{key:"load",value:function(e,t){var n=this;null!=t?this._load(e,t):Object.keys(e).forEach((function(t){return n._load(t,e[t])})),this.emit("change")}},{key:"activate",value:function(e,t){this._locale=e,this._locales=t,this.emit("change")}},{key:"_",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.message,a=n.formats,o=n.context;i(e)||(t=e.values||t,r=e.message,o=e.context,e=e.id);var l,u=!o&&!this.messages[e],c=o&&!this.messages[o][e],f=c||u,h=this._missing;return h&&f?s(h)?h(this._locale,e,o):h:(f&&this.emit("missing",{id:e,context:o,locale:this._locale}),l=o&&!c?this.messages[o][e]||r||e:this.messages[e]||r||e,i(l)&&g.test(l)?JSON.parse('"'.concat(l,'"')):i(l)?l:d(l,this._locale,this._locales,this.localeData)(t,a))}},{key:"date",value:function(e,t){return f(this._locales||this._locale,t)(e)}},{key:"number",value:function(e,t){return h(this._locales||this._locale,t)(e)}},{key:"locale",get:function(){return this._locale}},{key:"locales",get:function(){return this._locales}},{key:"messages",get:function(){var e;return null!==(e=this._messages[this._locale])&&void 0!==e?e:{}}},{key:"localeData",get:function(){var e;return null!==(e=this._localeData[this._locale])&&void 0!==e?e:{}}}]),o}(p);function D(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new b(e)}var k=D();export{b as I18n,m as formats,k as i18n,D as setupI18n};
|
|
2
2
|
//# sourceMappingURL=dev.production.min.js.map
|