Socket
Socket
Sign inDemoInstall

@lingui/core

Package Overview
Dependencies
Maintainers
1
Versions
151
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lingui/core - npm Package Compare versions

Comparing version 3.10.4 to 3.11.0

1

cjs/context.d.ts
import { CompiledMessage, Locales } from "./i18n";
export declare const UNICODE_REGEX: RegExp;
export declare function interpolate(translation: CompiledMessage, locale: string, locales: Locales, localeData: Object): (values: Object, formats?: Object) => string;
//# sourceMappingURL=context.d.ts.map

6

cjs/core.development.js

@@ -97,2 +97,4 @@ 'use strict';

var UNICODE_REGEX = /\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/g;
var defaultFormats = function defaultFormats(locale, locales) {

@@ -230,3 +232,3 @@ var localeData = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {

var result = formatMessage(translation);
if (isString(result) && /\\u[a-fA-F0-9]{4}/g.test(result)) return JSON.parse("\"".concat(result.trim(), "\""));
if (isString(result) && UNICODE_REGEX.test(result)) return JSON.parse("\"".concat(result.trim(), "\""));
if (isString(result)) return result.trim();

@@ -474,3 +476,3 @@ return result;

if (isString(translation) && /\\u[a-fA-F0-9]{4}/g.test(translation)) return JSON.parse("\"".concat(translation, "\""));
if (isString(translation) && UNICODE_REGEX.test(translation)) return JSON.parse("\"".concat(translation, "\""));
if (isString(translation)) return translation;

@@ -477,0 +479,0 @@ return interpolate(translation, this.locale, this.locales, this.localeData)(values, formats);

@@ -1,2 +0,2 @@

"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},g=function(e){return"function"==typeof e},y=new Map,p=new Map;function _(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=p.get(a);if(l)return l.format(n);var o=new Intl.DateTimeFormat(e,t);return p.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=y.get(a);if(l)return l.format(n);var o=new Intl.NumberFormat(e,t);return y.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:_,number:b});function A(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=g(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 _(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=g(i)?i(e):i;return Array.isArray(s)?s.join(""):s}}function O(e,t,r,n){return function(a){var l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=A({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)&&/\\u[a-fA-F0-9]{4}/g.test(s)?JSON.parse('"'.concat(s.trim(),'"')):m(s)?s.trim():s}}var j=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;m(e)||(t=e.values||t,n=e.message,e=e.id);var l=this.messages[e]||n||e,o=this._missing;return o&&!this.messages[e]?g(o)?o(this.locale,e):o:(this.messages[e]||this.emit("missing",{id:e,locale:this._locale}),m(l)&&/\\u[a-fA-F0-9]{4}/g.test(l)?JSON.parse('"'.concat(l,'"')):m(l)?l:O(l,this.locale,this.locales,this.localeData)(t,a))}},{key:"date",value:function(e,t){return _(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}(j);function q(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new L(e)}var x=q();exports.I18n=L,exports.formats=k,exports.i18n=x,exports.setupI18n=q;
"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},g=function(e){return"function"==typeof e},y=new Map,p=new Map;function _(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=p.get(a);if(l)return l.format(n);var o=new Intl.DateTimeFormat(e,t);return p.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=y.get(a);if(l)return l.format(n);var o=new Intl.NumberFormat(e,t);return y.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:_,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=g(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 _(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=g(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 w=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 x(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=x(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;m(e)||(t=e.values||t,n=e.message,e=e.id);var l=this.messages[e]||n||e,o=this._missing;return o&&!this.messages[e]?g(o)?o(this.locale,e):o:(this.messages[e]||this.emit("missing",{id:e,locale:this._locale}),m(l)&&A.test(l)?JSON.parse('"'.concat(l,'"')):m(l)?l:j(l,this.locale,this.locales,this.localeData)(t,a))}},{key:"date",value:function(e,t){return _(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}(w);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;
//# sourceMappingURL=core.production.min.js.map

@@ -97,2 +97,4 @@ 'use strict';

var UNICODE_REGEX = /\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/g;
var defaultFormats = function defaultFormats(locale, locales) {

@@ -230,3 +232,3 @@ var localeData = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {

var result = formatMessage(translation);
if (isString(result) && /\\u[a-fA-F0-9]{4}/g.test(result)) return JSON.parse("\"".concat(result.trim(), "\""));
if (isString(result) && UNICODE_REGEX.test(result)) return JSON.parse("\"".concat(result.trim(), "\""));
if (isString(result)) return result.trim();

@@ -474,3 +476,3 @@ return result;

if (isString(translation) && /\\u[a-fA-F0-9]{4}/g.test(translation)) return JSON.parse("\"".concat(translation, "\""));
if (isString(translation) && UNICODE_REGEX.test(translation)) return JSON.parse("\"".concat(translation, "\""));
if (isString(translation)) return translation;

@@ -477,0 +479,0 @@ return interpolate(translation, this.locale, this.locales, this.localeData)(values, formats);

@@ -1,2 +0,2 @@

"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},g=function(e){return"function"==typeof e},y=new Map,p=new Map;function _(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=p.get(a);if(l)return l.format(n);var o=new Intl.DateTimeFormat(e,t);return p.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=y.get(a);if(l)return l.format(n);var o=new Intl.NumberFormat(e,t);return y.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:_,number:b});function A(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=g(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 _(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=g(i)?i(e):i;return Array.isArray(s)?s.join(""):s}}function O(e,t,r,n){return function(a){var l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=A({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)&&/\\u[a-fA-F0-9]{4}/g.test(s)?JSON.parse('"'.concat(s.trim(),'"')):m(s)?s.trim():s}}var j=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;m(e)||(t=e.values||t,n=e.message,e=e.id);var l=this.messages[e]||n||e,o=this._missing;return o&&!this.messages[e]?g(o)?o(this.locale,e):o:(this.messages[e]||this.emit("missing",{id:e,locale:this._locale}),m(l)&&/\\u[a-fA-F0-9]{4}/g.test(l)?JSON.parse('"'.concat(l,'"')):m(l)?l:O(l,this.locale,this.locales,this.localeData)(t,a))}},{key:"date",value:function(e,t){return _(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}(j);function q(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new L(e)}var x=q();exports.I18n=L,exports.formats=k,exports.i18n=x,exports.setupI18n=q;
"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},g=function(e){return"function"==typeof e},y=new Map,p=new Map;function _(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=p.get(a);if(l)return l.format(n);var o=new Intl.DateTimeFormat(e,t);return p.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=y.get(a);if(l)return l.format(n);var o=new Intl.NumberFormat(e,t);return y.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:_,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=g(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 _(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=g(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 w=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 x(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=x(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;m(e)||(t=e.values||t,n=e.message,e=e.id);var l=this.messages[e]||n||e,o=this._missing;return o&&!this.messages[e]?g(o)?o(this.locale,e):o:(this.messages[e]||this.emit("missing",{id:e,locale:this._locale}),m(l)&&A.test(l)?JSON.parse('"'.concat(l,'"')):m(l)?l:j(l,this.locale,this.locales,this.localeData)(t,a))}},{key:"date",value:function(e,t){return _(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}(w);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;
//# sourceMappingURL=dev.production.min.js.map
import { CompiledMessage, Locales } from "./i18n";
export declare const UNICODE_REGEX: RegExp;
export declare function interpolate(translation: CompiledMessage, locale: string, locales: Locales, localeData: Object): (values: Object, formats?: Object) => string;
//# sourceMappingURL=context.d.ts.map

@@ -82,2 +82,4 @@ import _classCallCheck from '@babel/runtime/helpers/classCallCheck';

var UNICODE_REGEX = /\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/g;
var defaultFormats = function defaultFormats(locale, locales) {

@@ -215,3 +217,3 @@ var localeData = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {

var result = formatMessage(translation);
if (isString(result) && /\\u[a-fA-F0-9]{4}/g.test(result)) return JSON.parse("\"".concat(result.trim(), "\""));
if (isString(result) && UNICODE_REGEX.test(result)) return JSON.parse("\"".concat(result.trim(), "\""));
if (isString(result)) return result.trim();

@@ -459,3 +461,3 @@ return result;

if (isString(translation) && /\\u[a-fA-F0-9]{4}/g.test(translation)) return JSON.parse("\"".concat(translation, "\""));
if (isString(translation) && UNICODE_REGEX.test(translation)) return JSON.parse("\"".concat(translation, "\""));
if (isString(translation)) return translation;

@@ -462,0 +464,0 @@ return interpolate(translation, this.locale, this.locales, this.localeData)(values, formats);

@@ -1,2 +0,2 @@

import e from"@babel/runtime/helpers/classCallCheck";import t from"@babel/runtime/helpers/createClass";import r from"@babel/runtime/helpers/inherits";import n 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]:{},r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return function(n){if(i(n)&&(n=new Date(n)),r){var a=v(e,t),o=c.get(a);if(o)return o.format(n);var l=new Intl.DateTimeFormat(e,t);return c.set(a,l),l.format(n)}var s=new Intl.DateTimeFormat(e,t);return s.format(n)}}function h(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=v(e,t),o=u.get(a);if(o)return o.format(n);var l=new Intl.NumberFormat(e,t);return u.set(a,l),l.format(n)}var i=new Intl.NumberFormat(e,t);return i.format(n)}}function v(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 m=Object.freeze({__proto__:null,date:f,number:h});function g(e){var t=e.locale,r=e.locales,n=e.values,a=e.formats,o=e.localeData,u=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,o=function(e){return i(e)?n[e]||{style:e}:e},u=function(e,r){return function(n){var a=s(r)?r(n):r,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 r=t.offset,n=void 0===r?0:r,o=l(t,["offset"]),i=o[e]||o[null==a?void 0:a(e-n)]||o.other;return u(e-n,i)},selectordinal:function(e,t){var r=t.offset,n=void 0===r?0:r,o=l(t,["offset"]),i=o[e]||o[null==a?void 0:a(e-n,!0)]||o.other;return u(e-n,i)},select:function(e,t){return t[e]||t.other},number:function(e,r){return h(t,o(r))(e)},date:function(e,r){return f(t,o(r))(e)},undefined:function(e){return e}}}(t,r,o,a);return function e(t,r,a){var o=n[t],l=u[r](o,a),i=s(l)?l(e):l;return Array.isArray(i)?i.join(""):i}}function d(e,t,r,n){return function(a){var l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=g({locale:t,locales:r,localeData:n,formats:l,values:a}),u=function e(t){return Array.isArray(t)?t.reduce((function(t,r){if(i(r))return t+r;var n=o(r,3),a=n[0],l=n[1],u=n[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)&&/\\u[a-fA-F0-9]{4}/g.test(c)?JSON.parse('"'.concat(c.trim(),'"')):i(c)?c.trim():c}}var p=function(){function r(){e(this,r),this._events={}}return t(r,[{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])}}]),r}();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 r,o=a(e);if(t){var l=a(this).constructor;r=Reflect.construct(o,arguments,l)}else r=o.apply(this,arguments);return n(this,r)}}var _=function(n){r(o,n);var a=y(o);function o(t){var r;return e(this,o),r=a.call(this),r._messages={},r._localeData={},null!=t.missing&&(r._missing=t.missing),null!=t.messages&&r.load(t.messages),null!=t.localeData&&r.loadLocaleData(t.localeData),null==t.locale&&null==t.locales||r.activate(t.locale,t.locales),r}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 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;i(e)||(t=e.values||t,n=e.message,e=e.id);var o=this.messages[e]||n||e,l=this._missing;return l&&!this.messages[e]?s(l)?l(this.locale,e):l:(this.messages[e]||this.emit("missing",{id:e,locale:this._locale}),i(o)&&/\\u[a-fA-F0-9]{4}/g.test(o)?JSON.parse('"'.concat(o,'"')):i(o)?o:d(o,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 b(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new _(e)}var D=b();export{_ as I18n,m as formats,D as i18n,b as setupI18n};
import e from"@babel/runtime/helpers/classCallCheck";import t from"@babel/runtime/helpers/createClass";import r from"@babel/runtime/helpers/inherits";import n 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]:{},r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return function(n){if(i(n)&&(n=new Date(n)),r){var a=v(e,t),o=c.get(a);if(o)return o.format(n);var l=new Intl.DateTimeFormat(e,t);return c.set(a,l),l.format(n)}var s=new Intl.DateTimeFormat(e,t);return s.format(n)}}function h(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=v(e,t),o=u.get(a);if(o)return o.format(n);var l=new Intl.NumberFormat(e,t);return u.set(a,l),l.format(n)}var i=new Intl.NumberFormat(e,t);return i.format(n)}}function v(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 m=Object.freeze({__proto__:null,date:f,number:h}),g=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/g;function d(e){var t=e.locale,r=e.locales,n=e.values,a=e.formats,o=e.localeData,u=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,o=function(e){return i(e)?n[e]||{style:e}:e},u=function(e,r){return function(n){var a=s(r)?r(n):r,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 r=t.offset,n=void 0===r?0:r,o=l(t,["offset"]),i=o[e]||o[null==a?void 0:a(e-n)]||o.other;return u(e-n,i)},selectordinal:function(e,t){var r=t.offset,n=void 0===r?0:r,o=l(t,["offset"]),i=o[e]||o[null==a?void 0:a(e-n,!0)]||o.other;return u(e-n,i)},select:function(e,t){return t[e]||t.other},number:function(e,r){return h(t,o(r))(e)},date:function(e,r){return f(t,o(r))(e)},undefined:function(e){return e}}}(t,r,o,a);return function e(t,r,a){var o=n[t],l=u[r](o,a),i=s(l)?l(e):l;return Array.isArray(i)?i.join(""):i}}function p(e,t,r,n){return function(a){var l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=d({locale:t,locales:r,localeData:n,formats:l,values:a}),u=function e(t){return Array.isArray(t)?t.reduce((function(t,r){if(i(r))return t+r;var n=o(r,3),a=n[0],l=n[1],u=n[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 y=function(){function r(){e(this,r),this._events={}}return t(r,[{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])}}]),r}();function _(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,o=a(e);if(t){var l=a(this).constructor;r=Reflect.construct(o,arguments,l)}else r=o.apply(this,arguments);return n(this,r)}}var b=function(n){r(o,n);var a=_(o);function o(t){var r;return e(this,o),r=a.call(this),r._messages={},r._localeData={},null!=t.missing&&(r._missing=t.missing),null!=t.messages&&r.load(t.messages),null!=t.localeData&&r.loadLocaleData(t.localeData),null==t.locale&&null==t.locales||r.activate(t.locale,t.locales),r}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 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;i(e)||(t=e.values||t,n=e.message,e=e.id);var o=this.messages[e]||n||e,l=this._missing;return l&&!this.messages[e]?s(l)?l(this.locale,e):l:(this.messages[e]||this.emit("missing",{id:e,locale:this._locale}),i(o)&&g.test(o)?JSON.parse('"'.concat(o,'"')):i(o)?o:p(o,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}(y);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};
//# sourceMappingURL=core.production.min.js.map

@@ -82,2 +82,4 @@ import _classCallCheck from '@babel/runtime/helpers/classCallCheck';

var UNICODE_REGEX = /\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/g;
var defaultFormats = function defaultFormats(locale, locales) {

@@ -215,3 +217,3 @@ var localeData = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {

var result = formatMessage(translation);
if (isString(result) && /\\u[a-fA-F0-9]{4}/g.test(result)) return JSON.parse("\"".concat(result.trim(), "\""));
if (isString(result) && UNICODE_REGEX.test(result)) return JSON.parse("\"".concat(result.trim(), "\""));
if (isString(result)) return result.trim();

@@ -459,3 +461,3 @@ return result;

if (isString(translation) && /\\u[a-fA-F0-9]{4}/g.test(translation)) return JSON.parse("\"".concat(translation, "\""));
if (isString(translation) && UNICODE_REGEX.test(translation)) return JSON.parse("\"".concat(translation, "\""));
if (isString(translation)) return translation;

@@ -462,0 +464,0 @@ return interpolate(translation, this.locale, this.locales, this.localeData)(values, formats);

@@ -1,2 +0,2 @@

import e from"@babel/runtime/helpers/classCallCheck";import t from"@babel/runtime/helpers/createClass";import r from"@babel/runtime/helpers/inherits";import n 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]:{},r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return function(n){if(i(n)&&(n=new Date(n)),r){var a=v(e,t),o=c.get(a);if(o)return o.format(n);var l=new Intl.DateTimeFormat(e,t);return c.set(a,l),l.format(n)}var s=new Intl.DateTimeFormat(e,t);return s.format(n)}}function h(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=v(e,t),o=u.get(a);if(o)return o.format(n);var l=new Intl.NumberFormat(e,t);return u.set(a,l),l.format(n)}var i=new Intl.NumberFormat(e,t);return i.format(n)}}function v(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 m=Object.freeze({__proto__:null,date:f,number:h});function g(e){var t=e.locale,r=e.locales,n=e.values,a=e.formats,o=e.localeData,u=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,o=function(e){return i(e)?n[e]||{style:e}:e},u=function(e,r){return function(n){var a=s(r)?r(n):r,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 r=t.offset,n=void 0===r?0:r,o=l(t,["offset"]),i=o[e]||o[null==a?void 0:a(e-n)]||o.other;return u(e-n,i)},selectordinal:function(e,t){var r=t.offset,n=void 0===r?0:r,o=l(t,["offset"]),i=o[e]||o[null==a?void 0:a(e-n,!0)]||o.other;return u(e-n,i)},select:function(e,t){return t[e]||t.other},number:function(e,r){return h(t,o(r))(e)},date:function(e,r){return f(t,o(r))(e)},undefined:function(e){return e}}}(t,r,o,a);return function e(t,r,a){var o=n[t],l=u[r](o,a),i=s(l)?l(e):l;return Array.isArray(i)?i.join(""):i}}function d(e,t,r,n){return function(a){var l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=g({locale:t,locales:r,localeData:n,formats:l,values:a}),u=function e(t){return Array.isArray(t)?t.reduce((function(t,r){if(i(r))return t+r;var n=o(r,3),a=n[0],l=n[1],u=n[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)&&/\\u[a-fA-F0-9]{4}/g.test(c)?JSON.parse('"'.concat(c.trim(),'"')):i(c)?c.trim():c}}var p=function(){function r(){e(this,r),this._events={}}return t(r,[{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])}}]),r}();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 r,o=a(e);if(t){var l=a(this).constructor;r=Reflect.construct(o,arguments,l)}else r=o.apply(this,arguments);return n(this,r)}}var _=function(n){r(o,n);var a=y(o);function o(t){var r;return e(this,o),r=a.call(this),r._messages={},r._localeData={},null!=t.missing&&(r._missing=t.missing),null!=t.messages&&r.load(t.messages),null!=t.localeData&&r.loadLocaleData(t.localeData),null==t.locale&&null==t.locales||r.activate(t.locale,t.locales),r}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 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;i(e)||(t=e.values||t,n=e.message,e=e.id);var o=this.messages[e]||n||e,l=this._missing;return l&&!this.messages[e]?s(l)?l(this.locale,e):l:(this.messages[e]||this.emit("missing",{id:e,locale:this._locale}),i(o)&&/\\u[a-fA-F0-9]{4}/g.test(o)?JSON.parse('"'.concat(o,'"')):i(o)?o:d(o,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 b(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new _(e)}var D=b();export{_ as I18n,m as formats,D as i18n,b as setupI18n};
import e from"@babel/runtime/helpers/classCallCheck";import t from"@babel/runtime/helpers/createClass";import r from"@babel/runtime/helpers/inherits";import n 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]:{},r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return function(n){if(i(n)&&(n=new Date(n)),r){var a=v(e,t),o=c.get(a);if(o)return o.format(n);var l=new Intl.DateTimeFormat(e,t);return c.set(a,l),l.format(n)}var s=new Intl.DateTimeFormat(e,t);return s.format(n)}}function h(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=v(e,t),o=u.get(a);if(o)return o.format(n);var l=new Intl.NumberFormat(e,t);return u.set(a,l),l.format(n)}var i=new Intl.NumberFormat(e,t);return i.format(n)}}function v(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 m=Object.freeze({__proto__:null,date:f,number:h}),g=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/g;function d(e){var t=e.locale,r=e.locales,n=e.values,a=e.formats,o=e.localeData,u=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,o=function(e){return i(e)?n[e]||{style:e}:e},u=function(e,r){return function(n){var a=s(r)?r(n):r,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 r=t.offset,n=void 0===r?0:r,o=l(t,["offset"]),i=o[e]||o[null==a?void 0:a(e-n)]||o.other;return u(e-n,i)},selectordinal:function(e,t){var r=t.offset,n=void 0===r?0:r,o=l(t,["offset"]),i=o[e]||o[null==a?void 0:a(e-n,!0)]||o.other;return u(e-n,i)},select:function(e,t){return t[e]||t.other},number:function(e,r){return h(t,o(r))(e)},date:function(e,r){return f(t,o(r))(e)},undefined:function(e){return e}}}(t,r,o,a);return function e(t,r,a){var o=n[t],l=u[r](o,a),i=s(l)?l(e):l;return Array.isArray(i)?i.join(""):i}}function p(e,t,r,n){return function(a){var l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=d({locale:t,locales:r,localeData:n,formats:l,values:a}),u=function e(t){return Array.isArray(t)?t.reduce((function(t,r){if(i(r))return t+r;var n=o(r,3),a=n[0],l=n[1],u=n[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 y=function(){function r(){e(this,r),this._events={}}return t(r,[{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])}}]),r}();function _(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,o=a(e);if(t){var l=a(this).constructor;r=Reflect.construct(o,arguments,l)}else r=o.apply(this,arguments);return n(this,r)}}var b=function(n){r(o,n);var a=_(o);function o(t){var r;return e(this,o),r=a.call(this),r._messages={},r._localeData={},null!=t.missing&&(r._missing=t.missing),null!=t.messages&&r.load(t.messages),null!=t.localeData&&r.loadLocaleData(t.localeData),null==t.locale&&null==t.locales||r.activate(t.locale,t.locales),r}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 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;i(e)||(t=e.values||t,n=e.message,e=e.id);var o=this.messages[e]||n||e,l=this._missing;return l&&!this.messages[e]?s(l)?l(this.locale,e):l:(this.messages[e]||this.emit("missing",{id:e,locale:this._locale}),i(o)&&g.test(o)?JSON.parse('"'.concat(o,'"')):i(o)?o:p(o,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}(y);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};
//# sourceMappingURL=dev.production.min.js.map
{
"name": "@lingui/core",
"version": "3.10.4",
"version": "3.11.0",
"sideEffects": false,
"description": "I18n tools for javascript",

@@ -5,0 +6,0 @@ "main": "index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc