Socket
Socket
Sign inDemoInstall

react-i18next

Package Overview
Dependencies
Maintainers
2
Versions
313
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-i18next - npm Package Compare versions

Comparing version 4.1.1 to 4.1.2

3

CHANGELOG.md

@@ -0,1 +1,4 @@

### 4.1.2
- Remove workaround to set ready if there was no initialized signal [PR263](https://github.com/i18next/react-i18next/pull/263)
### 4.1.1

@@ -2,0 +5,0 @@ - Fix react-i18next to work with TypeScript [PR261](https://github.com/i18next/react-i18next/pull/261)

6

dist/amd/react-i18next.js

@@ -290,8 +290,2 @@ define('reactI18next', ['exports', 'react', 'prop-types'], function (exports, React, PropTypes) { 'use strict';

_this2.i18n.on('initialized', initialized);
// In case of race condition, that 'initialized' never comes - do immediately
// check ready state + if i18n is initialized.
setTimeout(function () {
return !_this2.state.ready && _this2.i18n.isInitialized && ready();
});
}

@@ -298,0 +292,0 @@ });

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

define("reactI18next",["exports","react","prop-types"],function(e,t,n){"use strict";function r(e){return e.displayName||e.name||"Component"}function o(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=o.withRef,a=void 0!==i&&i,s=o.bindI18n,p=void 0===s?"languageChanged loaded":s,c=o.bindStore,l=void 0===c?"added removed":c,d=o.translateFuncName,w=void 0===d?"t":d,O=o.wait,j=void 0!==O&&O;return function(i){var s=function(t){function n(t,r){y(this,n);var i=b(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t,r));return i.i18n=r.i18n||t.i18n,e=e||i.i18n.options.defaultNS,"string"==typeof e&&(e=[e]),!j&&i.i18n.options&&(i.i18n.options.wait||i.i18n.options.react&&i.i18n.options.react.wait)&&(j=!0),i.nsMode=o.nsMode||i.i18n.options&&i.i18n.options.react&&i.i18n.options.react.nsMode||"default",i.state={i18nLoadedAt:null,ready:!1},i.onI18nChanged=i.onI18nChanged.bind(i),i.getWrappedInstance=i.getWrappedInstance.bind(i),i}return g(n,t),h(n,[{key:"getChildContext",value:function(){return m({},w,this[w])}},{key:"componentWillMount",value:function(){this[w]=this.i18n.getFixedT(null,"fallback"===this.nsMode?e:e[0])}},{key:"componentDidMount",value:function(){var t=this,n=function(){p&&t.i18n&&t.i18n.on(p,t.onI18nChanged),l&&t.i18n.store&&t.i18n.store.on(l,t.onI18nChanged)};this.mounted=!0,this.i18n.loadNamespaces(e,function(){var e=function(){t.mounted&&t.setState({ready:!0}),j&&t.mounted&&n()};if(t.i18n.isInitialized)e();else{var r=function n(){setTimeout(function(){t.i18n.off("initialized",n)},1e3),e()};t.i18n.on("initialized",r),setTimeout(function(){return!t.state.ready&&t.i18n.isInitialized&&e()})}}),j||n()}},{key:"componentWillUnmount",value:function(){var e=this;if(this.mounted=!1,this.onI18nChanged){if(p){p.split(" ").forEach(function(t){return e.i18n.off(t,e.onI18nChanged)})}if(l){l.split(" ").forEach(function(t){return e.i18n.store&&e.i18n.store.off(t,e.onI18nChanged)})}}}},{key:"onI18nChanged",value:function(){this.mounted&&this.setState({i18nLoadedAt:new Date})}},{key:"getWrappedInstance",value:function(){return a||console.error("To access the wrapped instance, you need to specify { withRef: true } as the second argument of the translate() call."),this.refs.wrappedInstance}},{key:"render",value:function(){var e,t=this.state,n=t.i18nLoadedAt,r=t.ready,o=(e={i18nLoadedAt:n},m(e,w,this[w]),m(e,"i18n",this.i18n),e);return a&&(o.ref="wrappedInstance"),!r&&j?null:u.createElement(i,v({},this.props,o))}}]),n}(t.Component);return s.WrappedComponent=i,s.contextTypes={i18n:n.object},s.childContextTypes=m({},w,n.func.isRequired),s.displayName="Translate("+r(i)+")",s.namespaces=e,f(s,i)}}function i(e,t){for(var n=0,r=e.length;n<r;n++)if("object"===d(e[n])){var o=!0,i=!1,a=void 0;try{for(var s,u=Object.entries(e[n])[Symbol.iterator]();!(o=(s=u.next()).done);o=!0){var p=w(s.value,2),c=p[0],l=p[1];t(l,n,c)}}catch(e){i=!0,a=e}finally{try{!o&&u.return&&u.return()}finally{if(i)throw a}}}else t(e[n],n)}function a(e){var t=[];return i(e,function(e){e&&e.namespaces&&e.namespaces.forEach(function(e){-1===t.indexOf(e)&&t.push(e)})}),t}function s(e){var t=e.components,n=e.i18n,r=a(t);return new Promise(function(e){n.loadNamespaces(r,e)})}var u="default"in t?t.default:t;n="default"in n?n.default:n;var p={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},c={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0},l="function"==typeof Object.getOwnPropertySymbols,f=function(e,t,n){if("string"!=typeof t){var r=Object.getOwnPropertyNames(t);l&&(r=r.concat(Object.getOwnPropertySymbols(t)));for(var o=0;o<r.length;++o)if(!(p[r[o]]||c[r[o]]||n&&n[r[o]]))try{e[r[o]]=t[r[o]]}catch(e){}}return e},d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},y=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},h=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),m=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},v=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},g=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},b=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},w=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),O=function(e){function t(e,n){y(this,t);var r=b(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return r.i18n=n.i18n,r.t=n.t,r}return g(t,e),h(t,[{key:"render",value:function(){var e=this,t=this.props.parent||"span",n=this.props.regexp||this.i18n.services.interpolator.regexp,r=this.props,o=r.className,i=r.style,a=this.props.useDangerouslySetInnerHTML||!1,s=this.props.dangerouslySetInnerHTMLPartElement||"span",p=v({},this.props.options,{interpolation:{prefix:"#$?",suffix:"?$#"}}),c=this.t(this.props.i18nKey,p);if(!c||"string"!=typeof c)return u.createElement("noscript",null);var l=[],f=function(t,n){if(t.indexOf(e.i18n.options.interpolation.formatSeparator)<0)return void 0===n[t]&&e.i18n.services.logger.warn("interpolator: missed to pass in variable "+t+" for interpolating "+c),n[t];var r=t.split(e.i18n.options.interpolation.formatSeparator),o=r.shift().trim(),i=r.join(e.i18n.options.interpolation.formatSeparator).trim();return void 0===n[o]&&e.i18n.services.logger.warn("interpolator: missed to pass in variable "+o+" for interpolating "+c),e.i18n.options.interpolation.format(n[o],i,e.i18n.language)};c.split(n).reduce(function(t,n,r){var o=void 0;if(r%2==0){if(0===n.length)return t;o=a?u.createElement(s,{dangerouslySetInnerHTML:{__html:n}}):n}else o=f(n,e.props);return t.push(o),t},l);var d={};return o&&(d.className=o),i&&(d.style=i),u.createElement.apply(this,[t,d].concat(l))}}]),t}(t.Component);O.propTypes={className:n.string},O.defaultProps={className:""},O.contextTypes={i18n:n.object.isRequired,t:n.func.isRequired};var j=function(e){function n(e,t){y(this,n);var r=b(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,t));return r.i18n=e.i18n,r}return g(n,e),h(n,[{key:"getChildContext",value:function(){return{i18n:this.i18n}}},{key:"componentWillReceiveProps",value:function(e){if(this.props.i18n!==e.i18n)throw new Error("[react-i18next][I18nextProvider]does not support changing the i18n object.")}},{key:"render",value:function(){var e=this.props.children;return t.Children.only(e)}}]),n}(t.Component);j.propTypes={i18n:n.object.isRequired,children:n.element.isRequired},j.childContextTypes={i18n:n.object.isRequired},e.loadNamespaces=s,e.translate=o,e.Interpolate=O,e.I18nextProvider=j,Object.defineProperty(e,"__esModule",{value:!0})});
define("reactI18next",["exports","react","prop-types"],function(e,t,n){"use strict";function r(e){return e.displayName||e.name||"Component"}function o(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=o.withRef,a=void 0!==i&&i,s=o.bindI18n,p=void 0===s?"languageChanged loaded":s,c=o.bindStore,l=void 0===c?"added removed":c,d=o.translateFuncName,w=void 0===d?"t":d,O=o.wait,j=void 0!==O&&O;return function(i){var s=function(t){function n(t,r){y(this,n);var i=b(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t,r));return i.i18n=r.i18n||t.i18n,e=e||i.i18n.options.defaultNS,"string"==typeof e&&(e=[e]),!j&&i.i18n.options&&(i.i18n.options.wait||i.i18n.options.react&&i.i18n.options.react.wait)&&(j=!0),i.nsMode=o.nsMode||i.i18n.options&&i.i18n.options.react&&i.i18n.options.react.nsMode||"default",i.state={i18nLoadedAt:null,ready:!1},i.onI18nChanged=i.onI18nChanged.bind(i),i.getWrappedInstance=i.getWrappedInstance.bind(i),i}return g(n,t),h(n,[{key:"getChildContext",value:function(){return m({},w,this[w])}},{key:"componentWillMount",value:function(){this[w]=this.i18n.getFixedT(null,"fallback"===this.nsMode?e:e[0])}},{key:"componentDidMount",value:function(){var t=this,n=function(){p&&t.i18n&&t.i18n.on(p,t.onI18nChanged),l&&t.i18n.store&&t.i18n.store.on(l,t.onI18nChanged)};this.mounted=!0,this.i18n.loadNamespaces(e,function(){var e=function(){t.mounted&&t.setState({ready:!0}),j&&t.mounted&&n()};if(t.i18n.isInitialized)e();else{var r=function n(){setTimeout(function(){t.i18n.off("initialized",n)},1e3),e()};t.i18n.on("initialized",r)}}),j||n()}},{key:"componentWillUnmount",value:function(){var e=this;if(this.mounted=!1,this.onI18nChanged){if(p){p.split(" ").forEach(function(t){return e.i18n.off(t,e.onI18nChanged)})}if(l){l.split(" ").forEach(function(t){return e.i18n.store&&e.i18n.store.off(t,e.onI18nChanged)})}}}},{key:"onI18nChanged",value:function(){this.mounted&&this.setState({i18nLoadedAt:new Date})}},{key:"getWrappedInstance",value:function(){return a||console.error("To access the wrapped instance, you need to specify { withRef: true } as the second argument of the translate() call."),this.refs.wrappedInstance}},{key:"render",value:function(){var e,t=this.state,n=t.i18nLoadedAt,r=t.ready,o=(e={i18nLoadedAt:n},m(e,w,this[w]),m(e,"i18n",this.i18n),e);return a&&(o.ref="wrappedInstance"),!r&&j?null:u.createElement(i,v({},this.props,o))}}]),n}(t.Component);return s.WrappedComponent=i,s.contextTypes={i18n:n.object},s.childContextTypes=m({},w,n.func.isRequired),s.displayName="Translate("+r(i)+")",s.namespaces=e,f(s,i)}}function i(e,t){for(var n=0,r=e.length;n<r;n++)if("object"===d(e[n])){var o=!0,i=!1,a=void 0;try{for(var s,u=Object.entries(e[n])[Symbol.iterator]();!(o=(s=u.next()).done);o=!0){var p=w(s.value,2),c=p[0],l=p[1];t(l,n,c)}}catch(e){i=!0,a=e}finally{try{!o&&u.return&&u.return()}finally{if(i)throw a}}}else t(e[n],n)}function a(e){var t=[];return i(e,function(e){e&&e.namespaces&&e.namespaces.forEach(function(e){-1===t.indexOf(e)&&t.push(e)})}),t}function s(e){var t=e.components,n=e.i18n,r=a(t);return new Promise(function(e){n.loadNamespaces(r,e)})}var u="default"in t?t.default:t;n="default"in n?n.default:n;var p={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},c={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0},l="function"==typeof Object.getOwnPropertySymbols,f=function(e,t,n){if("string"!=typeof t){var r=Object.getOwnPropertyNames(t);l&&(r=r.concat(Object.getOwnPropertySymbols(t)));for(var o=0;o<r.length;++o)if(!(p[r[o]]||c[r[o]]||n&&n[r[o]]))try{e[r[o]]=t[r[o]]}catch(e){}}return e},d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},y=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},h=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),m=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},v=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},g=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},b=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},w=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),O=function(e){function t(e,n){y(this,t);var r=b(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return r.i18n=n.i18n,r.t=n.t,r}return g(t,e),h(t,[{key:"render",value:function(){var e=this,t=this.props.parent||"span",n=this.props.regexp||this.i18n.services.interpolator.regexp,r=this.props,o=r.className,i=r.style,a=this.props.useDangerouslySetInnerHTML||!1,s=this.props.dangerouslySetInnerHTMLPartElement||"span",p=v({},this.props.options,{interpolation:{prefix:"#$?",suffix:"?$#"}}),c=this.t(this.props.i18nKey,p);if(!c||"string"!=typeof c)return u.createElement("noscript",null);var l=[],f=function(t,n){if(t.indexOf(e.i18n.options.interpolation.formatSeparator)<0)return void 0===n[t]&&e.i18n.services.logger.warn("interpolator: missed to pass in variable "+t+" for interpolating "+c),n[t];var r=t.split(e.i18n.options.interpolation.formatSeparator),o=r.shift().trim(),i=r.join(e.i18n.options.interpolation.formatSeparator).trim();return void 0===n[o]&&e.i18n.services.logger.warn("interpolator: missed to pass in variable "+o+" for interpolating "+c),e.i18n.options.interpolation.format(n[o],i,e.i18n.language)};c.split(n).reduce(function(t,n,r){var o=void 0;if(r%2==0){if(0===n.length)return t;o=a?u.createElement(s,{dangerouslySetInnerHTML:{__html:n}}):n}else o=f(n,e.props);return t.push(o),t},l);var d={};return o&&(d.className=o),i&&(d.style=i),u.createElement.apply(this,[t,d].concat(l))}}]),t}(t.Component);O.propTypes={className:n.string},O.defaultProps={className:""},O.contextTypes={i18n:n.object.isRequired,t:n.func.isRequired};var j=function(e){function n(e,t){y(this,n);var r=b(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,t));return r.i18n=e.i18n,r}return g(n,e),h(n,[{key:"getChildContext",value:function(){return{i18n:this.i18n}}},{key:"componentWillReceiveProps",value:function(e){if(this.props.i18n!==e.i18n)throw new Error("[react-i18next][I18nextProvider]does not support changing the i18n object.")}},{key:"render",value:function(){var e=this.props.children;return t.Children.only(e)}}]),n}(t.Component);j.propTypes={i18n:n.object.isRequired,children:n.element.isRequired},j.childContextTypes={i18n:n.object.isRequired},e.loadNamespaces=s,e.translate=o,e.Interpolate=O,e.I18nextProvider=j,Object.defineProperty(e,"__esModule",{value:!0})});

@@ -119,8 +119,2 @@ 'use strict';

_this2.i18n.on('initialized', initialized);
// In case of race condition, that 'initialized' never comes - do immediately
// check ready state + if i18n is initialized.
setTimeout(function () {
return !_this2.state.ready && _this2.i18n.isInitialized && ready();
});
}

@@ -127,0 +121,0 @@ });

@@ -101,8 +101,2 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

_this2.i18n.on('initialized', initialized);
// In case of race condition, that 'initialized' never comes - do immediately
// check ready state + if i18n is initialized.
setTimeout(function () {
return !_this2.state.ready && _this2.i18n.isInitialized && ready();
});
}

@@ -109,0 +103,0 @@ });

@@ -294,8 +294,2 @@ (function (global, factory) {

_this2.i18n.on('initialized', initialized);
// In case of race condition, that 'initialized' never comes - do immediately
// check ready state + if i18n is initialized.
setTimeout(function () {
return !_this2.state.ready && _this2.i18n.isInitialized && ready();
});
}

@@ -302,0 +296,0 @@ });

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("prop-types")):"function"==typeof define&&define.amd?define("reactI18next",["exports","react","prop-types"],t):t(e.reactI18next=e.reactI18next||{},e.React,e.PropTypes)}(this,function(e,t,n){"use strict";function r(e){return e.displayName||e.name||"Component"}function o(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=o.withRef,a=void 0!==i&&i,s=o.bindI18n,p=void 0===s?"languageChanged loaded":s,c=o.bindStore,l=void 0===c?"added removed":c,d=o.translateFuncName,w=void 0===d?"t":d,x=o.wait,O=void 0!==x&&x;return function(i){var s=function(t){function n(t,r){y(this,n);var i=g(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t,r));return i.i18n=r.i18n||t.i18n,e=e||i.i18n.options.defaultNS,"string"==typeof e&&(e=[e]),!O&&i.i18n.options&&(i.i18n.options.wait||i.i18n.options.react&&i.i18n.options.react.wait)&&(O=!0),i.nsMode=o.nsMode||i.i18n.options&&i.i18n.options.react&&i.i18n.options.react.nsMode||"default",i.state={i18nLoadedAt:null,ready:!1},i.onI18nChanged=i.onI18nChanged.bind(i),i.getWrappedInstance=i.getWrappedInstance.bind(i),i}return b(n,t),h(n,[{key:"getChildContext",value:function(){return m({},w,this[w])}},{key:"componentWillMount",value:function(){this[w]=this.i18n.getFixedT(null,"fallback"===this.nsMode?e:e[0])}},{key:"componentDidMount",value:function(){var t=this,n=function(){p&&t.i18n&&t.i18n.on(p,t.onI18nChanged),l&&t.i18n.store&&t.i18n.store.on(l,t.onI18nChanged)};this.mounted=!0,this.i18n.loadNamespaces(e,function(){var e=function(){t.mounted&&t.setState({ready:!0}),O&&t.mounted&&n()};if(t.i18n.isInitialized)e();else{var r=function n(){setTimeout(function(){t.i18n.off("initialized",n)},1e3),e()};t.i18n.on("initialized",r),setTimeout(function(){return!t.state.ready&&t.i18n.isInitialized&&e()})}}),O||n()}},{key:"componentWillUnmount",value:function(){var e=this;if(this.mounted=!1,this.onI18nChanged){if(p){p.split(" ").forEach(function(t){return e.i18n.off(t,e.onI18nChanged)})}if(l){l.split(" ").forEach(function(t){return e.i18n.store&&e.i18n.store.off(t,e.onI18nChanged)})}}}},{key:"onI18nChanged",value:function(){this.mounted&&this.setState({i18nLoadedAt:new Date})}},{key:"getWrappedInstance",value:function(){return a||console.error("To access the wrapped instance, you need to specify { withRef: true } as the second argument of the translate() call."),this.refs.wrappedInstance}},{key:"render",value:function(){var e,t=this.state,n=t.i18nLoadedAt,r=t.ready,o=(e={i18nLoadedAt:n},m(e,w,this[w]),m(e,"i18n",this.i18n),e);return a&&(o.ref="wrappedInstance"),!r&&O?null:u.createElement(i,v({},this.props,o))}}]),n}(t.Component);return s.WrappedComponent=i,s.contextTypes={i18n:n.object},s.childContextTypes=m({},w,n.func.isRequired),s.displayName="Translate("+r(i)+")",s.namespaces=e,f(s,i)}}function i(e,t){for(var n=0,r=e.length;n<r;n++)if("object"===d(e[n])){var o=!0,i=!1,a=void 0;try{for(var s,u=Object.entries(e[n])[Symbol.iterator]();!(o=(s=u.next()).done);o=!0){var p=w(s.value,2),c=p[0],l=p[1];t(l,n,c)}}catch(e){i=!0,a=e}finally{try{!o&&u.return&&u.return()}finally{if(i)throw a}}}else t(e[n],n)}function a(e){var t=[];return i(e,function(e){e&&e.namespaces&&e.namespaces.forEach(function(e){-1===t.indexOf(e)&&t.push(e)})}),t}function s(e){var t=e.components,n=e.i18n,r=a(t);return new Promise(function(e){n.loadNamespaces(r,e)})}var u="default"in t?t.default:t;n="default"in n?n.default:n;var p={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},c={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0},l="function"==typeof Object.getOwnPropertySymbols,f=function(e,t,n){if("string"!=typeof t){var r=Object.getOwnPropertyNames(t);l&&(r=r.concat(Object.getOwnPropertySymbols(t)));for(var o=0;o<r.length;++o)if(!(p[r[o]]||c[r[o]]||n&&n[r[o]]))try{e[r[o]]=t[r[o]]}catch(e){}}return e},d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},y=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},h=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),m=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},v=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},b=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},g=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},w=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),x=function(e){function t(e,n){y(this,t);var r=g(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return r.i18n=n.i18n,r.t=n.t,r}return b(t,e),h(t,[{key:"render",value:function(){var e=this,t=this.props.parent||"span",n=this.props.regexp||this.i18n.services.interpolator.regexp,r=this.props,o=r.className,i=r.style,a=this.props.useDangerouslySetInnerHTML||!1,s=this.props.dangerouslySetInnerHTMLPartElement||"span",p=v({},this.props.options,{interpolation:{prefix:"#$?",suffix:"?$#"}}),c=this.t(this.props.i18nKey,p);if(!c||"string"!=typeof c)return u.createElement("noscript",null);var l=[],f=function(t,n){if(t.indexOf(e.i18n.options.interpolation.formatSeparator)<0)return void 0===n[t]&&e.i18n.services.logger.warn("interpolator: missed to pass in variable "+t+" for interpolating "+c),n[t];var r=t.split(e.i18n.options.interpolation.formatSeparator),o=r.shift().trim(),i=r.join(e.i18n.options.interpolation.formatSeparator).trim();return void 0===n[o]&&e.i18n.services.logger.warn("interpolator: missed to pass in variable "+o+" for interpolating "+c),e.i18n.options.interpolation.format(n[o],i,e.i18n.language)};c.split(n).reduce(function(t,n,r){var o=void 0;if(r%2==0){if(0===n.length)return t;o=a?u.createElement(s,{dangerouslySetInnerHTML:{__html:n}}):n}else o=f(n,e.props);return t.push(o),t},l);var d={};return o&&(d.className=o),i&&(d.style=i),u.createElement.apply(this,[t,d].concat(l))}}]),t}(t.Component);x.propTypes={className:n.string},x.defaultProps={className:""},x.contextTypes={i18n:n.object.isRequired,t:n.func.isRequired};var O=function(e){function n(e,t){y(this,n);var r=g(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,t));return r.i18n=e.i18n,r}return b(n,e),h(n,[{key:"getChildContext",value:function(){return{i18n:this.i18n}}},{key:"componentWillReceiveProps",value:function(e){if(this.props.i18n!==e.i18n)throw new Error("[react-i18next][I18nextProvider]does not support changing the i18n object.")}},{key:"render",value:function(){var e=this.props.children;return t.Children.only(e)}}]),n}(t.Component);O.propTypes={i18n:n.object.isRequired,children:n.element.isRequired},O.childContextTypes={i18n:n.object.isRequired},e.loadNamespaces=s,e.translate=o,e.Interpolate=x,e.I18nextProvider=O,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("prop-types")):"function"==typeof define&&define.amd?define("reactI18next",["exports","react","prop-types"],t):t(e.reactI18next=e.reactI18next||{},e.React,e.PropTypes)}(this,function(e,t,n){"use strict";function r(e){return e.displayName||e.name||"Component"}function o(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=o.withRef,a=void 0!==i&&i,s=o.bindI18n,u=void 0===s?"languageChanged loaded":s,c=o.bindStore,l=void 0===c?"added removed":c,d=o.translateFuncName,w=void 0===d?"t":d,x=o.wait,O=void 0!==x&&x;return function(i){var s=function(t){function n(t,r){y(this,n);var i=g(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t,r));return i.i18n=r.i18n||t.i18n,e=e||i.i18n.options.defaultNS,"string"==typeof e&&(e=[e]),!O&&i.i18n.options&&(i.i18n.options.wait||i.i18n.options.react&&i.i18n.options.react.wait)&&(O=!0),i.nsMode=o.nsMode||i.i18n.options&&i.i18n.options.react&&i.i18n.options.react.nsMode||"default",i.state={i18nLoadedAt:null,ready:!1},i.onI18nChanged=i.onI18nChanged.bind(i),i.getWrappedInstance=i.getWrappedInstance.bind(i),i}return b(n,t),h(n,[{key:"getChildContext",value:function(){return m({},w,this[w])}},{key:"componentWillMount",value:function(){this[w]=this.i18n.getFixedT(null,"fallback"===this.nsMode?e:e[0])}},{key:"componentDidMount",value:function(){var t=this,n=function(){u&&t.i18n&&t.i18n.on(u,t.onI18nChanged),l&&t.i18n.store&&t.i18n.store.on(l,t.onI18nChanged)};this.mounted=!0,this.i18n.loadNamespaces(e,function(){var e=function(){t.mounted&&t.setState({ready:!0}),O&&t.mounted&&n()};if(t.i18n.isInitialized)e();else{var r=function n(){setTimeout(function(){t.i18n.off("initialized",n)},1e3),e()};t.i18n.on("initialized",r)}}),O||n()}},{key:"componentWillUnmount",value:function(){var e=this;if(this.mounted=!1,this.onI18nChanged){if(u){u.split(" ").forEach(function(t){return e.i18n.off(t,e.onI18nChanged)})}if(l){l.split(" ").forEach(function(t){return e.i18n.store&&e.i18n.store.off(t,e.onI18nChanged)})}}}},{key:"onI18nChanged",value:function(){this.mounted&&this.setState({i18nLoadedAt:new Date})}},{key:"getWrappedInstance",value:function(){return a||console.error("To access the wrapped instance, you need to specify { withRef: true } as the second argument of the translate() call."),this.refs.wrappedInstance}},{key:"render",value:function(){var e,t=this.state,n=t.i18nLoadedAt,r=t.ready,o=(e={i18nLoadedAt:n},m(e,w,this[w]),m(e,"i18n",this.i18n),e);return a&&(o.ref="wrappedInstance"),!r&&O?null:p.createElement(i,v({},this.props,o))}}]),n}(t.Component);return s.WrappedComponent=i,s.contextTypes={i18n:n.object},s.childContextTypes=m({},w,n.func.isRequired),s.displayName="Translate("+r(i)+")",s.namespaces=e,f(s,i)}}function i(e,t){for(var n=0,r=e.length;n<r;n++)if("object"===d(e[n])){var o=!0,i=!1,a=void 0;try{for(var s,p=Object.entries(e[n])[Symbol.iterator]();!(o=(s=p.next()).done);o=!0){var u=w(s.value,2),c=u[0],l=u[1];t(l,n,c)}}catch(e){i=!0,a=e}finally{try{!o&&p.return&&p.return()}finally{if(i)throw a}}}else t(e[n],n)}function a(e){var t=[];return i(e,function(e){e&&e.namespaces&&e.namespaces.forEach(function(e){-1===t.indexOf(e)&&t.push(e)})}),t}function s(e){var t=e.components,n=e.i18n,r=a(t);return new Promise(function(e){n.loadNamespaces(r,e)})}var p="default"in t?t.default:t;n="default"in n?n.default:n;var u={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},c={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0},l="function"==typeof Object.getOwnPropertySymbols,f=function(e,t,n){if("string"!=typeof t){var r=Object.getOwnPropertyNames(t);l&&(r=r.concat(Object.getOwnPropertySymbols(t)));for(var o=0;o<r.length;++o)if(!(u[r[o]]||c[r[o]]||n&&n[r[o]]))try{e[r[o]]=t[r[o]]}catch(e){}}return e},d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},y=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},h=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),m=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},v=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},b=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},g=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},w=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),x=function(e){function t(e,n){y(this,t);var r=g(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return r.i18n=n.i18n,r.t=n.t,r}return b(t,e),h(t,[{key:"render",value:function(){var e=this,t=this.props.parent||"span",n=this.props.regexp||this.i18n.services.interpolator.regexp,r=this.props,o=r.className,i=r.style,a=this.props.useDangerouslySetInnerHTML||!1,s=this.props.dangerouslySetInnerHTMLPartElement||"span",u=v({},this.props.options,{interpolation:{prefix:"#$?",suffix:"?$#"}}),c=this.t(this.props.i18nKey,u);if(!c||"string"!=typeof c)return p.createElement("noscript",null);var l=[],f=function(t,n){if(t.indexOf(e.i18n.options.interpolation.formatSeparator)<0)return void 0===n[t]&&e.i18n.services.logger.warn("interpolator: missed to pass in variable "+t+" for interpolating "+c),n[t];var r=t.split(e.i18n.options.interpolation.formatSeparator),o=r.shift().trim(),i=r.join(e.i18n.options.interpolation.formatSeparator).trim();return void 0===n[o]&&e.i18n.services.logger.warn("interpolator: missed to pass in variable "+o+" for interpolating "+c),e.i18n.options.interpolation.format(n[o],i,e.i18n.language)};c.split(n).reduce(function(t,n,r){var o=void 0;if(r%2==0){if(0===n.length)return t;o=a?p.createElement(s,{dangerouslySetInnerHTML:{__html:n}}):n}else o=f(n,e.props);return t.push(o),t},l);var d={};return o&&(d.className=o),i&&(d.style=i),p.createElement.apply(this,[t,d].concat(l))}}]),t}(t.Component);x.propTypes={className:n.string},x.defaultProps={className:""},x.contextTypes={i18n:n.object.isRequired,t:n.func.isRequired};var O=function(e){function n(e,t){y(this,n);var r=g(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,t));return r.i18n=e.i18n,r}return b(n,e),h(n,[{key:"getChildContext",value:function(){return{i18n:this.i18n}}},{key:"componentWillReceiveProps",value:function(e){if(this.props.i18n!==e.i18n)throw new Error("[react-i18next][I18nextProvider]does not support changing the i18n object.")}},{key:"render",value:function(){var e=this.props.children;return t.Children.only(e)}}]),n}(t.Component);O.propTypes={i18n:n.object.isRequired,children:n.element.isRequired},O.childContextTypes={i18n:n.object.isRequired},e.loadNamespaces=s,e.translate=o,e.Interpolate=x,e.I18nextProvider=O,Object.defineProperty(e,"__esModule",{value:!0})});
{
"name": "react-i18next",
"version": "4.1.1",
"version": "4.1.2",
"description": "Internationalization for react done right. Using the i18next i18n ecosystem.",

@@ -5,0 +5,0 @@ "main": "dist/commonjs/index.js",

@@ -294,8 +294,2 @@ (function (global, factory) {

_this2.i18n.on('initialized', initialized);
// In case of race condition, that 'initialized' never comes - do immediately
// check ready state + if i18n is initialized.
setTimeout(function () {
return !_this2.state.ready && _this2.i18n.isInitialized && ready();
});
}

@@ -302,0 +296,0 @@ });

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("prop-types")):"function"==typeof define&&define.amd?define("reactI18next",["exports","react","prop-types"],t):t(e.reactI18next=e.reactI18next||{},e.React,e.PropTypes)}(this,function(e,t,n){"use strict";function r(e){return e.displayName||e.name||"Component"}function o(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=o.withRef,a=void 0!==i&&i,s=o.bindI18n,p=void 0===s?"languageChanged loaded":s,c=o.bindStore,l=void 0===c?"added removed":c,d=o.translateFuncName,w=void 0===d?"t":d,x=o.wait,O=void 0!==x&&x;return function(i){var s=function(t){function n(t,r){y(this,n);var i=g(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t,r));return i.i18n=r.i18n||t.i18n,e=e||i.i18n.options.defaultNS,"string"==typeof e&&(e=[e]),!O&&i.i18n.options&&(i.i18n.options.wait||i.i18n.options.react&&i.i18n.options.react.wait)&&(O=!0),i.nsMode=o.nsMode||i.i18n.options&&i.i18n.options.react&&i.i18n.options.react.nsMode||"default",i.state={i18nLoadedAt:null,ready:!1},i.onI18nChanged=i.onI18nChanged.bind(i),i.getWrappedInstance=i.getWrappedInstance.bind(i),i}return b(n,t),h(n,[{key:"getChildContext",value:function(){return m({},w,this[w])}},{key:"componentWillMount",value:function(){this[w]=this.i18n.getFixedT(null,"fallback"===this.nsMode?e:e[0])}},{key:"componentDidMount",value:function(){var t=this,n=function(){p&&t.i18n&&t.i18n.on(p,t.onI18nChanged),l&&t.i18n.store&&t.i18n.store.on(l,t.onI18nChanged)};this.mounted=!0,this.i18n.loadNamespaces(e,function(){var e=function(){t.mounted&&t.setState({ready:!0}),O&&t.mounted&&n()};if(t.i18n.isInitialized)e();else{var r=function n(){setTimeout(function(){t.i18n.off("initialized",n)},1e3),e()};t.i18n.on("initialized",r),setTimeout(function(){return!t.state.ready&&t.i18n.isInitialized&&e()})}}),O||n()}},{key:"componentWillUnmount",value:function(){var e=this;if(this.mounted=!1,this.onI18nChanged){if(p){p.split(" ").forEach(function(t){return e.i18n.off(t,e.onI18nChanged)})}if(l){l.split(" ").forEach(function(t){return e.i18n.store&&e.i18n.store.off(t,e.onI18nChanged)})}}}},{key:"onI18nChanged",value:function(){this.mounted&&this.setState({i18nLoadedAt:new Date})}},{key:"getWrappedInstance",value:function(){return a||console.error("To access the wrapped instance, you need to specify { withRef: true } as the second argument of the translate() call."),this.refs.wrappedInstance}},{key:"render",value:function(){var e,t=this.state,n=t.i18nLoadedAt,r=t.ready,o=(e={i18nLoadedAt:n},m(e,w,this[w]),m(e,"i18n",this.i18n),e);return a&&(o.ref="wrappedInstance"),!r&&O?null:u.createElement(i,v({},this.props,o))}}]),n}(t.Component);return s.WrappedComponent=i,s.contextTypes={i18n:n.object},s.childContextTypes=m({},w,n.func.isRequired),s.displayName="Translate("+r(i)+")",s.namespaces=e,f(s,i)}}function i(e,t){for(var n=0,r=e.length;n<r;n++)if("object"===d(e[n])){var o=!0,i=!1,a=void 0;try{for(var s,u=Object.entries(e[n])[Symbol.iterator]();!(o=(s=u.next()).done);o=!0){var p=w(s.value,2),c=p[0],l=p[1];t(l,n,c)}}catch(e){i=!0,a=e}finally{try{!o&&u.return&&u.return()}finally{if(i)throw a}}}else t(e[n],n)}function a(e){var t=[];return i(e,function(e){e&&e.namespaces&&e.namespaces.forEach(function(e){-1===t.indexOf(e)&&t.push(e)})}),t}function s(e){var t=e.components,n=e.i18n,r=a(t);return new Promise(function(e){n.loadNamespaces(r,e)})}var u="default"in t?t.default:t;n="default"in n?n.default:n;var p={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},c={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0},l="function"==typeof Object.getOwnPropertySymbols,f=function(e,t,n){if("string"!=typeof t){var r=Object.getOwnPropertyNames(t);l&&(r=r.concat(Object.getOwnPropertySymbols(t)));for(var o=0;o<r.length;++o)if(!(p[r[o]]||c[r[o]]||n&&n[r[o]]))try{e[r[o]]=t[r[o]]}catch(e){}}return e},d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},y=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},h=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),m=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},v=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},b=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},g=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},w=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),x=function(e){function t(e,n){y(this,t);var r=g(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return r.i18n=n.i18n,r.t=n.t,r}return b(t,e),h(t,[{key:"render",value:function(){var e=this,t=this.props.parent||"span",n=this.props.regexp||this.i18n.services.interpolator.regexp,r=this.props,o=r.className,i=r.style,a=this.props.useDangerouslySetInnerHTML||!1,s=this.props.dangerouslySetInnerHTMLPartElement||"span",p=v({},this.props.options,{interpolation:{prefix:"#$?",suffix:"?$#"}}),c=this.t(this.props.i18nKey,p);if(!c||"string"!=typeof c)return u.createElement("noscript",null);var l=[],f=function(t,n){if(t.indexOf(e.i18n.options.interpolation.formatSeparator)<0)return void 0===n[t]&&e.i18n.services.logger.warn("interpolator: missed to pass in variable "+t+" for interpolating "+c),n[t];var r=t.split(e.i18n.options.interpolation.formatSeparator),o=r.shift().trim(),i=r.join(e.i18n.options.interpolation.formatSeparator).trim();return void 0===n[o]&&e.i18n.services.logger.warn("interpolator: missed to pass in variable "+o+" for interpolating "+c),e.i18n.options.interpolation.format(n[o],i,e.i18n.language)};c.split(n).reduce(function(t,n,r){var o=void 0;if(r%2==0){if(0===n.length)return t;o=a?u.createElement(s,{dangerouslySetInnerHTML:{__html:n}}):n}else o=f(n,e.props);return t.push(o),t},l);var d={};return o&&(d.className=o),i&&(d.style=i),u.createElement.apply(this,[t,d].concat(l))}}]),t}(t.Component);x.propTypes={className:n.string},x.defaultProps={className:""},x.contextTypes={i18n:n.object.isRequired,t:n.func.isRequired};var O=function(e){function n(e,t){y(this,n);var r=g(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,t));return r.i18n=e.i18n,r}return b(n,e),h(n,[{key:"getChildContext",value:function(){return{i18n:this.i18n}}},{key:"componentWillReceiveProps",value:function(e){if(this.props.i18n!==e.i18n)throw new Error("[react-i18next][I18nextProvider]does not support changing the i18n object.")}},{key:"render",value:function(){var e=this.props.children;return t.Children.only(e)}}]),n}(t.Component);O.propTypes={i18n:n.object.isRequired,children:n.element.isRequired},O.childContextTypes={i18n:n.object.isRequired},e.loadNamespaces=s,e.translate=o,e.Interpolate=x,e.I18nextProvider=O,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("prop-types")):"function"==typeof define&&define.amd?define("reactI18next",["exports","react","prop-types"],t):t(e.reactI18next=e.reactI18next||{},e.React,e.PropTypes)}(this,function(e,t,n){"use strict";function r(e){return e.displayName||e.name||"Component"}function o(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=o.withRef,a=void 0!==i&&i,s=o.bindI18n,u=void 0===s?"languageChanged loaded":s,c=o.bindStore,l=void 0===c?"added removed":c,d=o.translateFuncName,w=void 0===d?"t":d,x=o.wait,O=void 0!==x&&x;return function(i){var s=function(t){function n(t,r){y(this,n);var i=g(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t,r));return i.i18n=r.i18n||t.i18n,e=e||i.i18n.options.defaultNS,"string"==typeof e&&(e=[e]),!O&&i.i18n.options&&(i.i18n.options.wait||i.i18n.options.react&&i.i18n.options.react.wait)&&(O=!0),i.nsMode=o.nsMode||i.i18n.options&&i.i18n.options.react&&i.i18n.options.react.nsMode||"default",i.state={i18nLoadedAt:null,ready:!1},i.onI18nChanged=i.onI18nChanged.bind(i),i.getWrappedInstance=i.getWrappedInstance.bind(i),i}return b(n,t),h(n,[{key:"getChildContext",value:function(){return m({},w,this[w])}},{key:"componentWillMount",value:function(){this[w]=this.i18n.getFixedT(null,"fallback"===this.nsMode?e:e[0])}},{key:"componentDidMount",value:function(){var t=this,n=function(){u&&t.i18n&&t.i18n.on(u,t.onI18nChanged),l&&t.i18n.store&&t.i18n.store.on(l,t.onI18nChanged)};this.mounted=!0,this.i18n.loadNamespaces(e,function(){var e=function(){t.mounted&&t.setState({ready:!0}),O&&t.mounted&&n()};if(t.i18n.isInitialized)e();else{var r=function n(){setTimeout(function(){t.i18n.off("initialized",n)},1e3),e()};t.i18n.on("initialized",r)}}),O||n()}},{key:"componentWillUnmount",value:function(){var e=this;if(this.mounted=!1,this.onI18nChanged){if(u){u.split(" ").forEach(function(t){return e.i18n.off(t,e.onI18nChanged)})}if(l){l.split(" ").forEach(function(t){return e.i18n.store&&e.i18n.store.off(t,e.onI18nChanged)})}}}},{key:"onI18nChanged",value:function(){this.mounted&&this.setState({i18nLoadedAt:new Date})}},{key:"getWrappedInstance",value:function(){return a||console.error("To access the wrapped instance, you need to specify { withRef: true } as the second argument of the translate() call."),this.refs.wrappedInstance}},{key:"render",value:function(){var e,t=this.state,n=t.i18nLoadedAt,r=t.ready,o=(e={i18nLoadedAt:n},m(e,w,this[w]),m(e,"i18n",this.i18n),e);return a&&(o.ref="wrappedInstance"),!r&&O?null:p.createElement(i,v({},this.props,o))}}]),n}(t.Component);return s.WrappedComponent=i,s.contextTypes={i18n:n.object},s.childContextTypes=m({},w,n.func.isRequired),s.displayName="Translate("+r(i)+")",s.namespaces=e,f(s,i)}}function i(e,t){for(var n=0,r=e.length;n<r;n++)if("object"===d(e[n])){var o=!0,i=!1,a=void 0;try{for(var s,p=Object.entries(e[n])[Symbol.iterator]();!(o=(s=p.next()).done);o=!0){var u=w(s.value,2),c=u[0],l=u[1];t(l,n,c)}}catch(e){i=!0,a=e}finally{try{!o&&p.return&&p.return()}finally{if(i)throw a}}}else t(e[n],n)}function a(e){var t=[];return i(e,function(e){e&&e.namespaces&&e.namespaces.forEach(function(e){-1===t.indexOf(e)&&t.push(e)})}),t}function s(e){var t=e.components,n=e.i18n,r=a(t);return new Promise(function(e){n.loadNamespaces(r,e)})}var p="default"in t?t.default:t;n="default"in n?n.default:n;var u={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},c={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0},l="function"==typeof Object.getOwnPropertySymbols,f=function(e,t,n){if("string"!=typeof t){var r=Object.getOwnPropertyNames(t);l&&(r=r.concat(Object.getOwnPropertySymbols(t)));for(var o=0;o<r.length;++o)if(!(u[r[o]]||c[r[o]]||n&&n[r[o]]))try{e[r[o]]=t[r[o]]}catch(e){}}return e},d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},y=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},h=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),m=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},v=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},b=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},g=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},w=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),x=function(e){function t(e,n){y(this,t);var r=g(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return r.i18n=n.i18n,r.t=n.t,r}return b(t,e),h(t,[{key:"render",value:function(){var e=this,t=this.props.parent||"span",n=this.props.regexp||this.i18n.services.interpolator.regexp,r=this.props,o=r.className,i=r.style,a=this.props.useDangerouslySetInnerHTML||!1,s=this.props.dangerouslySetInnerHTMLPartElement||"span",u=v({},this.props.options,{interpolation:{prefix:"#$?",suffix:"?$#"}}),c=this.t(this.props.i18nKey,u);if(!c||"string"!=typeof c)return p.createElement("noscript",null);var l=[],f=function(t,n){if(t.indexOf(e.i18n.options.interpolation.formatSeparator)<0)return void 0===n[t]&&e.i18n.services.logger.warn("interpolator: missed to pass in variable "+t+" for interpolating "+c),n[t];var r=t.split(e.i18n.options.interpolation.formatSeparator),o=r.shift().trim(),i=r.join(e.i18n.options.interpolation.formatSeparator).trim();return void 0===n[o]&&e.i18n.services.logger.warn("interpolator: missed to pass in variable "+o+" for interpolating "+c),e.i18n.options.interpolation.format(n[o],i,e.i18n.language)};c.split(n).reduce(function(t,n,r){var o=void 0;if(r%2==0){if(0===n.length)return t;o=a?p.createElement(s,{dangerouslySetInnerHTML:{__html:n}}):n}else o=f(n,e.props);return t.push(o),t},l);var d={};return o&&(d.className=o),i&&(d.style=i),p.createElement.apply(this,[t,d].concat(l))}}]),t}(t.Component);x.propTypes={className:n.string},x.defaultProps={className:""},x.contextTypes={i18n:n.object.isRequired,t:n.func.isRequired};var O=function(e){function n(e,t){y(this,n);var r=g(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,t));return r.i18n=e.i18n,r}return b(n,e),h(n,[{key:"getChildContext",value:function(){return{i18n:this.i18n}}},{key:"componentWillReceiveProps",value:function(e){if(this.props.i18n!==e.i18n)throw new Error("[react-i18next][I18nextProvider]does not support changing the i18n object.")}},{key:"render",value:function(){var e=this.props.children;return t.Children.only(e)}}]),n}(t.Component);O.propTypes={i18n:n.object.isRequired,children:n.element.isRequired},O.childContextTypes={i18n:n.object.isRequired},e.loadNamespaces=s,e.translate=o,e.Interpolate=x,e.I18nextProvider=O,Object.defineProperty(e,"__esModule",{value:!0})});

@@ -68,6 +68,2 @@ import React, { Component } from 'react';

this.i18n.on('initialized', initialized);
// In case of race condition, that 'initialized' never comes - do immediately
// check ready state + if i18n is initialized.
setTimeout(() => !this.state.ready && this.i18n.isInitialized && ready());
}

@@ -74,0 +70,0 @@ });

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