Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lingui/react

Package Overview
Dependencies
Maintainers
1
Versions
157
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lingui/react - npm Package Compare versions

Comparing version 2.7.0 to 2.7.1

43

cjs/react.production.min.js

@@ -1,24 +0,19 @@

'use strict';var e=e||{};e.scope={};e.ASSUME_ES5=!1;e.ASSUME_NO_NATIVE_MAP=!1;e.ASSUME_NO_NATIVE_SET=!1;e.defineProperty=e.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)};e.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};e.global=e.getGlobal(this);e.SYMBOL_PREFIX="jscomp_symbol_";
e.initSymbol=function(){e.initSymbol=function(){};e.global.Symbol||(e.global.Symbol=e.Symbol)};e.Symbol=function(){var a=0;return function(b){return e.SYMBOL_PREFIX+(b||"")+a++}}();e.initSymbolIterator=function(){e.initSymbol();var a=e.global.Symbol.iterator;a||(a=e.global.Symbol.iterator=e.global.Symbol("iterator"));"function"!=typeof Array.prototype[a]&&e.defineProperty(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return e.arrayIterator(this)}});e.initSymbolIterator=function(){}};
e.arrayIterator=function(a){var b=0;return e.iteratorPrototype(function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}})};e.iteratorPrototype=function(a){e.initSymbolIterator();a={next:a};a[e.global.Symbol.iterator]=function(){return this};return a};
e.iteratorFromArray=function(a,b){e.initSymbolIterator();a instanceof String&&(a+="");var c=0,f={next:function(){if(c<a.length){var d=c++;return{value:b(d,a[d]),done:!1}}f.next=function(){return{done:!0,value:void 0}};return f.next()}};f[Symbol.iterator]=function(){return f};return f};
e.polyfill=function(a,b){if(b){var c=e.global;a=a.split(".");for(var f=0;f<a.length-1;f++){var d=a[f];d in c||(c[d]={});c=c[d]}a=a[a.length-1];f=c[a];b=b(f);b!=f&&null!=b&&e.defineProperty(c,a,{configurable:!0,writable:!0,value:b})}};e.polyfill("Array.prototype.values",function(a){return a?a:function(){return e.iteratorFromArray(this,function(a,c){return c})}},"es8","es3");Object.defineProperty(exports,"__esModule",{value:!0});
function h(a){return a&&"object"===typeof a&&"default"in a?a["default"]:a}
var l=h(require("babel-runtime/core-js/object/get-prototype-of")),n=h(require("babel-runtime/helpers/classCallCheck")),q=h(require("babel-runtime/helpers/createClass")),r=h(require("babel-runtime/helpers/possibleConstructorReturn")),t=h(require("babel-runtime/helpers/inherits")),u=require("react"),w=h(require("prop-types")),y=h(require("hash-sum")),A=require("@lingui/core"),B=h(require("babel-runtime/helpers/extends")),C=h(require("hoist-non-react-statics")),D=h(require("babel-runtime/core-js/get-iterator")),
E=h(require("babel-runtime/helpers/slicedToArray")),G=h(require("babel-runtime/core-js/object/keys")),H=h(require("babel-runtime/helpers/toConsumableArray")),I=h(require("babel-runtime/helpers/objectWithoutProperties"));
function L(a){var b=[];return{i18n:a,i18nHash:null,getSubscribers:function(){return b},subscribe:function(c){b.push(c)},unsubscribe:function(c){b=b.filter(function(a){return a!==c})},update:function(){var c=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},f=c.catalogs,d=c.language;c=c.locales;if(f||d||c)f&&a.load(f),d&&a.activate(d,c),this.i18nHash=y([a.language,a.messages]),b.forEach(function(c){return c()})}}}
var M=function(a){function b(c){n(this,b);var a=r(this,(b.__proto__||l(b)).call(this,c)),d=c.language,g=c.locales,k=c.catalogs;c=c.i18n||A.setupI18n({language:d,locales:g,catalogs:k});a.linguiPublisher=new L(c);a.linguiPublisher.i18n._missing=a.props.missing;return a}t(b,a);q(b,[{key:"componentDidUpdate",value:function(c){var a=this.props,b=a.language,g=a.locales;a=a.catalogs;b===c.language&&g===c.locales&&a===c.catalogs||this.linguiPublisher.update({language:b,catalogs:a,locales:g});this.linguiPublisher.i18n._missing=
this.props.missing}},{key:"getChildContext",value:function(){return{linguiPublisher:this.linguiPublisher,linguiDefaultRender:this.props.defaultRender}}},{key:"render",value:function(){return this.props.children}}]);return b}(u.Component);M.defaultProps={defaultRender:null};M.childContextTypes={linguiPublisher:w.object.isRequired,linguiDefaultRender:w.any};
var N=function(a){function b(){var c,a,d,g;n(this,b);for(var k=arguments.length,m=Array(k),v=0;v<k;v++)m[v]=arguments[v];return g=(a=(d=r(this,(c=b.__proto__||l(b)).call.apply(c,[this].concat(m))),d),d.checkUpdate=function(){d.forceUpdate()},a),r(d,g)}t(b,a);q(b,[{key:"componentDidMount",value:function(){var c=this.getI18n().subscribe;this.props.update&&c&&c(this.checkUpdate)}},{key:"componentWillUnmount",value:function(){var c=this.getI18n().unsubscribe;this.props.update&&c&&c(this.checkUpdate)}},
{key:"getI18n",value:function(){return this.context.linguiPublisher||{}}},{key:"render",value:function(){var c=this.props,a=c.children;c=c.withHash;var b=this.getI18n(),g=b.i18nHash;c=B({i18n:b.i18n},c?{i18nHash:g}:{});return"function"===typeof a?a(c):u.isValidElement(a)?u.cloneElement(a,c):u.createElement(a,c)}}]);return b}(u.Component);N.defaultProps={update:!0,withHash:!0};N.contextTypes={linguiPublisher:w.object};
function O(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return function(b){var c=a.update,f=void 0===c?!0:c;c=a.withHash;var d=void 0===c?!0:c;c=a.withRef;var g=void 0===c?!1:c;c=function(a){function c(){var a,b,d,f;n(this,c);for(var m=arguments.length,k=Array(m),x=0;x<m;x++)k[x]=arguments[x];return f=(b=(d=r(this,(a=c.__proto__||l(c)).call.apply(a,[this].concat(k))),d),d.wrappedInstance=null,d.setWrappedInstance=function(a){g&&(d.wrappedInstance=a)},d.getWrappedInstance=function(){if(!g)throw Error("To access the wrapped instance, you need to specify { withRef: true } in the options argument of the withI18n() call.");
return d.wrappedInstance},b),r(d,f)}t(c,a);q(c,[{key:"render",value:function(){var a=B({},this.props,g?{ref:this.setWrappedInstance}:{});return u.createElement(N,{update:f,withHash:d},function(c){return u.createElement(b,B({},a,{i18n:c.i18n,i18nHash:c.i18nHash}))})}}]);return c}(u.Component);c.contextTypes={linguiPublisher:w.object};return C(c,b)}}var P=/<(\d+)>(.*)<\/\1>|<(\d+)\/>/,Q=/(?:\r\n|\r|\n)/g;
function R(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[],c=a.replace(Q,"").split(P);if(1===c.length)return a;var f=[],d=c.shift();d&&f.push(d);d=!0;var g=!1,k=void 0;try{for(var m=D(S(c)),v;!(d=(v=m.next()).done);d=!0){var F=E(v.value,3),J=F[0],K=F[1],z=F[2],p=b[J];f.push(u.cloneElement(p,{key:J},K?R(K,b):p.props.children));z&&f.push(z)}}catch(x){g=!0,k=x}finally{try{!d&&m.return&&m.return()}finally{if(g)throw k;}}return f}
function S(a){if(!a.length)return[];var b=a.slice(0,4);b=E(b,4);var c=b[1],f=b[2],d=b[3];return[[parseInt(b[0]||f),c||"",d]].concat(S(a.slice(4,a.length)))}
var T=function(a){function b(){n(this,b);return r(this,(b.__proto__||l(b)).apply(this,arguments))}t(b,a);q(b,[{key:"render",value:function(){var a=this.props,b=a.className;a=a.value;var d=this.props.render||this.context.linguiDefaultRender;return null===d||void 0===d?a:"string"===typeof d?u.createElement(d,{className:b},a):u.isValidElement(d)?u.cloneElement(d,{},a):u.createElement(d,{translation:a})}}]);return b}(u.Component);T.contextTypes={linguiDefaultRender:w.any};
var U=function(a){function b(){n(this,b);return r(this,(b.__proto__||l(b)).apply(this,arguments))}t(b,a);q(b,[{key:"componentDidMount",value:function(){}},{key:"getTranslation",value:function(){var a=this.props,b=a.id;b=void 0===b?"":b;var d=a.defaults,g=a.i18n;a=a.formats;var k=B({},this.props.values),m=this.props.components?[].concat(H(this.props.components)):[];k&&G(k).forEach(function(a){var b=k[a];u.isValidElement(b)&&(b=m.push(b)-1,k[a]="\x3c"+b+"/\x3e")});return(a=g&&"function"===typeof g._?
g._(b,k,{defaults:d,formats:a}):b)?R(a,m):null}},{key:"render",value:function(){return u.createElement(T,{render:this.props.render,className:this.props.className,value:this.getTranslation()})}}]);return b}(u.Component),V=O()(U),W=O()(function(a){function b(){n(this,b);return r(this,(b.__proto__||l(b)).apply(this,arguments))}t(b,a);q(b,[{key:"render",value:function(){var a=this.props,b=a.className,d=a.render,g=a.i18n;a=I(a,["className","render","i18n"]);return u.createElement(T,{className:b,render:d,
value:g.select(a)})}}]);return b}(u.Component));
function X(){var a,b,c=0<arguments.length&&void 0!==arguments[0]?arguments[0]:!1,f=c?"SelectOrdinal":"Plural",d=c?"selectOrdinal":"plural";return b=a=function(a){function b(){var a,c,d,g;n(this,b);for(var k=arguments.length,z=Array(k),p=0;p<k;p++)z[p]=arguments[p];return g=(c=(d=r(this,(a=b.__proto__||l(b)).call.apply(a,[this].concat(z))),d),d.displayName=f,c),r(d,g)}t(b,a);q(b,[{key:"render",value:function(){var a=this.props,b=a.className,c=a.render,f=a.i18n,g=a.value,k=a.offset,p=I(a,["className",
"render","i18n","value","offset"]);a=G(p).reduce(function(a,b){var c=b.replace("_","");a[c]=p[b];return a},{value:Number(g),offset:Number(k)});return u.createElement(T,{className:b,render:c,value:f[d](a)})}}]);return b}(u.Component),a.defaultProps={offset:0},b}var Y=O()(X(!1)),aa=O()(X(!0));function Z(a){return function(b){var c=b.value,f=b.i18n,d=b.className,g=b.render;b=a(f.locales||f.language,b.format);return u.createElement(T,{className:d,render:g,value:b(c)})}}var ba=O()(Z(A.date)),ca=O()(Z(A.number));
exports.i18nMark=function(a){return a};exports.withI18n=O;exports.I18nProvider=M;exports.I18n=N;exports.Trans=V;exports.Plural=Y;exports.Select=W;exports.SelectOrdinal=aa;exports.DateFormat=ba;exports.NumberFormat=ca;
'use strict';Object.defineProperty(exports,"__esModule",{value:!0});function g(c){return c&&"object"===typeof c&&"default"in c?c["default"]:c}
var k=g(require("babel-runtime/core-js/object/get-prototype-of")),m=g(require("babel-runtime/helpers/classCallCheck")),p=g(require("babel-runtime/helpers/createClass")),q=g(require("babel-runtime/helpers/possibleConstructorReturn")),r=g(require("babel-runtime/helpers/inherits")),t=require("react"),v=g(require("prop-types")),x=g(require("hash-sum")),z=require("@lingui/core"),A=g(require("babel-runtime/helpers/extends")),B=g(require("hoist-non-react-statics")),C=g(require("babel-runtime/core-js/get-iterator")),
D=g(require("babel-runtime/helpers/slicedToArray")),F=g(require("babel-runtime/core-js/object/keys")),G=g(require("babel-runtime/helpers/toConsumableArray")),H=g(require("babel-runtime/helpers/objectWithoutProperties"));
function K(c){var b=[];return{i18n:c,i18nHash:null,getSubscribers:function(){return b},subscribe:function(a){b.push(a)},unsubscribe:function(a){b=b.filter(function(b){return b!==a})},update:function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=a.catalogs,d=a.language;a=a.locales;if(e||d||a)e&&c.load(e),d&&c.activate(d,a),this.i18nHash=x([c.language,c.messages]),b.forEach(function(a){return a()})}}}
var L=function(c){function b(a){m(this,b);var e=q(this,(b.__proto__||k(b)).call(this,a)),d=a.language,c=a.locales,h=a.catalogs;a=a.i18n||z.setupI18n({language:d,locales:c,catalogs:h});e.linguiPublisher=new K(a);e.linguiPublisher.i18n._missing=e.props.missing;return e}r(b,c);p(b,[{key:"componentDidUpdate",value:function(a){var b=this.props,d=b.language,c=b.locales;b=b.catalogs;d===a.language&&c===a.locales&&b===a.catalogs||this.linguiPublisher.update({language:d,catalogs:b,locales:c});this.linguiPublisher.i18n._missing=
this.props.missing}},{key:"getChildContext",value:function(){return{linguiPublisher:this.linguiPublisher,linguiDefaultRender:this.props.defaultRender}}},{key:"render",value:function(){return this.props.children}}]);return b}(t.Component);L.defaultProps={defaultRender:null};L.childContextTypes={linguiPublisher:v.object.isRequired,linguiDefaultRender:v.any};
var M=function(c){function b(){var a,c,d,f;m(this,b);for(var h=arguments.length,l=Array(h),u=0;u<h;u++)l[u]=arguments[u];return f=(c=(d=q(this,(a=b.__proto__||k(b)).call.apply(a,[this].concat(l))),d),d.checkUpdate=function(){d.forceUpdate()},c),q(d,f)}r(b,c);p(b,[{key:"componentDidMount",value:function(){var a=this.getI18n().subscribe;this.props.update&&a&&a(this.checkUpdate)}},{key:"componentWillUnmount",value:function(){var a=this.getI18n().unsubscribe;this.props.update&&a&&a(this.checkUpdate)}},
{key:"getI18n",value:function(){return this.context.linguiPublisher||{}}},{key:"render",value:function(){var a=this.props,b=a.children;a=a.withHash;var c=this.getI18n(),f=c.i18nHash;a=A({i18n:c.i18n},a?{i18nHash:f}:{});return"function"===typeof b?b(a):t.isValidElement(b)?t.cloneElement(b,a):t.createElement(b,a)}}]);return b}(t.Component);M.defaultProps={update:!0,withHash:!0};M.contextTypes={linguiPublisher:v.object};
function N(){var c=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return function(b){var a=c.update,e=void 0===a?!0:a;a=c.withHash;var d=void 0===a?!0:a;a=c.withRef;var f=void 0===a?!1:a;a=function(a){function c(){var a,b,d,e;m(this,c);for(var l=arguments.length,h=Array(l),w=0;w<l;w++)h[w]=arguments[w];return e=(b=(d=q(this,(a=c.__proto__||k(c)).call.apply(a,[this].concat(h))),d),d.wrappedInstance=null,d.setWrappedInstance=function(a){f&&(d.wrappedInstance=a)},d.getWrappedInstance=function(){if(!f)throw Error("To access the wrapped instance, you need to specify { withRef: true } in the options argument of the withI18n() call.");
return d.wrappedInstance},b),q(d,e)}r(c,a);p(c,[{key:"render",value:function(){var a=A({},this.props,f?{ref:this.setWrappedInstance}:{});return t.createElement(M,{update:e,withHash:d},function(c){return t.createElement(b,A({},a,{i18n:c.i18n,i18nHash:c.i18nHash}))})}}]);return c}(t.Component);a.contextTypes={linguiPublisher:v.object};return B(a,b)}}var O=/<(\d+)>(.*)<\/\1>|<(\d+)\/>/,P=/(?:\r\n|\r|\n)/g;
function Q(c){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[],a=c.replace(P,"").split(O);if(1===a.length)return c;var e=[],d=a.shift();d&&e.push(d);d=!0;var f=!1,h=void 0;try{for(var l=C(R(a)),u;!(d=(u=l.next()).done);d=!0){var E=D(u.value,3),I=E[0],J=E[1],y=E[2],n=b[I];e.push(t.cloneElement(n,{key:I},J?Q(J,b):n.props.children));y&&e.push(y)}}catch(w){f=!0,h=w}finally{try{!d&&l.return&&l.return()}finally{if(f)throw h;}}return e}
function R(c){if(!c.length)return[];var b=c.slice(0,4);b=D(b,4);var a=b[1],e=b[2],d=b[3];return[[parseInt(b[0]||e),a||"",d]].concat(R(c.slice(4,c.length)))}
var S=function(c){function b(){m(this,b);return q(this,(b.__proto__||k(b)).apply(this,arguments))}r(b,c);p(b,[{key:"render",value:function(){var a=this.props,b=a.className;a=a.value;var c=this.props.render||this.context.linguiDefaultRender;return null===c||void 0===c?a:"string"===typeof c?t.createElement(c,{className:b},a):t.isValidElement(c)?t.cloneElement(c,{},a):t.createElement(c,{translation:a})}}]);return b}(t.Component);S.contextTypes={linguiDefaultRender:v.any};
var T=function(c){function b(){m(this,b);return q(this,(b.__proto__||k(b)).apply(this,arguments))}r(b,c);p(b,[{key:"componentDidMount",value:function(){}},{key:"getTranslation",value:function(){var a=this.props,b=a.id;b=void 0===b?"":b;var c=a.defaults,f=a.i18n;a=a.formats;var h=A({},this.props.values),l=this.props.components?[].concat(G(this.props.components)):[];h&&F(h).forEach(function(a){var b=h[a];t.isValidElement(b)&&(b=l.push(b)-1,h[a]="\x3c"+b+"/\x3e")});return(a=f&&"function"===typeof f._?
f._(b,h,{defaults:c,formats:a}):b)?Q(a,l):null}},{key:"render",value:function(){return t.createElement(S,{render:this.props.render,className:this.props.className,value:this.getTranslation()})}}]);return b}(t.Component),U=N()(T),V=N()(function(c){function b(){m(this,b);return q(this,(b.__proto__||k(b)).apply(this,arguments))}r(b,c);p(b,[{key:"render",value:function(){var a=this.props,b=a.className,c=a.render,f=a.i18n;a=H(a,["className","render","i18n"]);return t.createElement(S,{className:b,render:c,
value:f.select(a)})}}]);return b}(t.Component));
function W(){var c,b,a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:!1,e=a?"SelectOrdinal":"Plural",d=a?"selectOrdinal":"plural";return b=c=function(a){function b(){var a,c,d,f;m(this,b);for(var h=arguments.length,y=Array(h),n=0;n<h;n++)y[n]=arguments[n];return f=(c=(d=q(this,(a=b.__proto__||k(b)).call.apply(a,[this].concat(y))),d),d.displayName=e,c),q(d,f)}r(b,a);p(b,[{key:"render",value:function(){var a=this.props,b=a.className,c=a.render,e=a.i18n,f=a.value,h=a.offset,n=H(a,["className",
"render","i18n","value","offset"]);a=F(n).reduce(function(a,b){var c=b.replace("_","");a[c]=n[b];return a},{value:Number(f),offset:Number(h)});return t.createElement(S,{className:b,render:c,value:e[d](a)})}}]);return b}(t.Component),c.defaultProps={offset:0},b}var X=N()(W(!1)),Y=N()(W(!0));function Z(c){return function(b){var a=b.value,e=b.i18n,d=b.className,f=b.render;b=c(e.locales||e.language,b.format);return t.createElement(S,{className:d,render:f,value:b(a)})}}var aa=N()(Z(z.date)),ba=N()(Z(z.number));
exports.i18nMark=function(c){return c};exports.withI18n=N;exports.I18nProvider=L;exports.I18n=M;exports.Trans=U;exports.Plural=X;exports.Select=V;exports.SelectOrdinal=Y;exports.DateFormat=aa;exports.NumberFormat=ba;
{
"name": "@lingui/react",
"version": "2.7.0",
"version": "2.7.1",
"description": "React components for translations",

@@ -43,3 +43,3 @@ "main": "index.js",

"dependencies": {
"@lingui/core": "2.7.0",
"@lingui/core": "2.7.1",
"babel-runtime": "^6.26.0",

@@ -46,0 +46,0 @@ "hash-sum": "^1.0.2",

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