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.0.0 to 4.1.0

__tests__/backendMock.js

5

CHANGELOG.md

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

### 4.1.0
- eslint cleanup
- a lot more tests
- flag nsMode: 'fallback' -> uses namespaces passed to translate hoc as fallbacks [#254](https://github.com/i18next/react-i18next/issues/254)
### 4.0.0

@@ -2,0 +7,0 @@ - deploys 3.1.1 as possible breaking: fixes issue in fixing t function - pass only first namespace not an array of namespaces (access other namespaces like: this.props.t('namespace:key'))

45

dist/amd/react-i18next.js

@@ -237,4 +237,6 @@ define('reactI18next', ['exports', 'react', 'prop-types'], function (exports, React, PropTypes) { 'use strict';

if (!wait && _this.i18n.options.wait) wait = _this.i18n.options.wait;
if (!wait && _this.i18n.options.wait || _this.i18n.options.react && _this.i18n.options.react.wait) wait = _this.i18n.options.wait || _this.i18n.options.react.wait;
_this.nsMode = options.nsMode || _this.i18n.options.react && _this.i18n.options.react.nsMode || 'default';
_this.state = {

@@ -246,2 +248,3 @@ i18nLoadedAt: null,

_this.onI18nChanged = _this.onI18nChanged.bind(_this);
_this.getWrappedInstance = _this.getWrappedInstance.bind(_this);
return _this;

@@ -258,3 +261,3 @@ }

value: function componentWillMount() {
this[translateFuncName] = this.i18n.getFixedT(null, namespaces[0]);
this[translateFuncName] = this.i18n.getFixedT(null, this.nsMode === 'fallback' ? namespaces : namespaces[0]);
}

@@ -267,4 +270,4 @@ }, {

var bind = function bind() {
bindI18n && _this2.i18n.on(bindI18n, _this2.onI18nChanged);
bindStore && _this2.i18n.store && _this2.i18n.store.on(bindStore, _this2.onI18nChanged);
if (bindI18n && _this2.i18n) _this2.i18n.on(bindI18n, _this2.onI18nChanged);
if (bindStore && _this2.i18n.store) _this2.i18n.store.on(bindStore, _this2.onI18nChanged);
};

@@ -279,13 +282,17 @@

if (_this2.i18n.isInitialized) return ready();
if (_this2.i18n.isInitialized) {
ready();
} else {
var initialized = function initialized() {
// due to emitter removing issue in i18next we need to delay remove
setTimeout(function () {
_this2.i18n.off('initialized', initialized);
}, 1000);
ready();
};
var initialized = function initialized() {
// due to emitter removing issue in i18next we need to delay remove
setTimeout(function () {
_this2.i18n.off('initialized', initialized);
}, 1000);
ready();
};
_this2.i18n.on('initialized', initialized);
_this2.i18n.on('initialized', initialized);
}
});
if (!wait) bind();

@@ -329,2 +336,3 @@ }

/* eslint react/no-string-refs: 1 */
return this.refs.wrappedInstance;

@@ -440,3 +448,7 @@ }

return React__default.createElement.apply(this, [parent, { className: className, style: style }].concat(children));
var additionalProps = {};
if (className) additionalProps.className = className;
if (style) additionalProps.style = style;
return React__default.createElement.apply(this, [parent, additionalProps].concat(children));
}

@@ -448,6 +460,9 @@ }]);

Interpolate.propTypes = {
children: PropTypes.node,
className: PropTypes.string
};
Interpolate.defaultProps = {
className: ''
};
Interpolate.contextTypes = {

@@ -454,0 +469,0 @@ i18n: PropTypes.object.isRequired,

@@ -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,l=void 0===s?"languageChanged loaded":s,p=o.bindStore,c=void 0===p?"added removed":p,d=o.translateFuncName,w=void 0===d?"t":d,O=o.wait,j=void 0!==O&&O;return function(o){var i=function(t){function n(t,r){y(this,n);var o=b(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t,r));return o.i18n=r.i18n||t.i18n,e=e||o.i18n.options.defaultNS,"string"==typeof e&&(e=[e]),!j&&o.i18n.options.wait&&(j=o.i18n.options.wait),o.state={i18nLoadedAt:null,ready:!1},o.onI18nChanged=o.onI18nChanged.bind(o),o}return g(n,t),h(n,[{key:"getChildContext",value:function(){return v({},w,this[w])}},{key:"componentWillMount",value:function(){this[w]=this.i18n.getFixedT(null,e[0])}},{key:"componentDidMount",value:function(){var t=this,n=function(){l&&t.i18n.on(l,t.onI18nChanged),c&&t.i18n.store&&t.i18n.store.on(c,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)return e();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(l){var t=l.split(" ");t.forEach(function(t){return e.i18n.off(t,e.onI18nChanged)})}if(c){var n=c.split(" ");n.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,i=(e={i18nLoadedAt:n},v(e,w,this[w]),v(e,"i18n",this.i18n),e);return a&&(i.ref="wrappedInstance"),!r&&j?null:u.createElement(o,m({},this.props,i))}}]),n}(t.Component);return i.WrappedComponent=o,i.contextTypes={i18n:n.object},i.childContextTypes=v({},w,n.func.isRequired),i.displayName="Translate("+r(o)+")",i.namespaces=e,f(i,o)}}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 l=w(s.value,2),p=l[0],c=l[1];t(c,n,p)}}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){t.indexOf(e)===-1&&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 l={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},p={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0},c="function"==typeof Object.getOwnPropertySymbols,f=function(e,t,n){if("string"!=typeof t){var r=Object.getOwnPropertyNames(t);c&&(r=r.concat(Object.getOwnPropertySymbols(t)));for(var o=0;o<r.length;++o)if(!(l[r[o]]||p[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}}(),v=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},m=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",l=m({},this.props.options,{interpolation:{prefix:"#$?",suffix:"?$#"}}),p=this.t(this.props.i18nKey,l);if(!p||"string"!=typeof p)return u.createElement("noscript",null);var c=[],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 "+p),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 "+p),e.i18n.options.interpolation.format(n[o],i,e.i18n.language)};return p.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},c),u.createElement.apply(this,[t,{className:o,style:i}].concat(c))}}]),t}(t.Component);O.propTypes={children:n.node,className:n.string},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.wait||i.i18n.options.react&&i.i18n.options.react.wait)&&(j=i.i18n.options.wait||i.i18n.options.react.wait),i.nsMode=o.nsMode||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})});

@@ -96,3 +96,7 @@ 'use strict';

return _react2.default.createElement.apply(this, [parent, { className: className, style: style }].concat(children));
var additionalProps = {};
if (className) additionalProps.className = className;
if (style) additionalProps.style = style;
return _react2.default.createElement.apply(this, [parent, additionalProps].concat(children));
}

@@ -105,6 +109,9 @@ }]);

Interpolate.propTypes = {
children: _propTypes2.default.node,
className: _propTypes2.default.string
};
Interpolate.defaultProps = {
className: ''
};
Interpolate.contextTypes = {

@@ -111,0 +118,0 @@ i18n: _propTypes2.default.object.isRequired,

@@ -66,4 +66,6 @@ 'use strict';

if (!wait && _this.i18n.options.wait) wait = _this.i18n.options.wait;
if (!wait && _this.i18n.options.wait || _this.i18n.options.react && _this.i18n.options.react.wait) wait = _this.i18n.options.wait || _this.i18n.options.react.wait;
_this.nsMode = options.nsMode || _this.i18n.options.react && _this.i18n.options.react.nsMode || 'default';
_this.state = {

@@ -75,2 +77,3 @@ i18nLoadedAt: null,

_this.onI18nChanged = _this.onI18nChanged.bind(_this);
_this.getWrappedInstance = _this.getWrappedInstance.bind(_this);
return _this;

@@ -87,3 +90,3 @@ }

value: function componentWillMount() {
this[translateFuncName] = this.i18n.getFixedT(null, namespaces[0]);
this[translateFuncName] = this.i18n.getFixedT(null, this.nsMode === 'fallback' ? namespaces : namespaces[0]);
}

@@ -96,4 +99,4 @@ }, {

var bind = function bind() {
bindI18n && _this2.i18n.on(bindI18n, _this2.onI18nChanged);
bindStore && _this2.i18n.store && _this2.i18n.store.on(bindStore, _this2.onI18nChanged);
if (bindI18n && _this2.i18n) _this2.i18n.on(bindI18n, _this2.onI18nChanged);
if (bindStore && _this2.i18n.store) _this2.i18n.store.on(bindStore, _this2.onI18nChanged);
};

@@ -108,13 +111,17 @@

if (_this2.i18n.isInitialized) return ready();
if (_this2.i18n.isInitialized) {
ready();
} else {
var initialized = function initialized() {
// due to emitter removing issue in i18next we need to delay remove
setTimeout(function () {
_this2.i18n.off('initialized', initialized);
}, 1000);
ready();
};
var initialized = function initialized() {
// due to emitter removing issue in i18next we need to delay remove
setTimeout(function () {
_this2.i18n.off('initialized', initialized);
}, 1000);
ready();
};
_this2.i18n.on('initialized', initialized);
_this2.i18n.on('initialized', initialized);
}
});
if (!wait) bind();

@@ -158,2 +165,3 @@ }

/* eslint react/no-string-refs: 1 */
return this.refs.wrappedInstance;

@@ -160,0 +168,0 @@ }

@@ -83,3 +83,7 @@ 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; };

return React.createElement.apply(this, [parent, { className: className, style: style }].concat(children));
var additionalProps = {};
if (className) additionalProps.className = className;
if (style) additionalProps.style = style;
return React.createElement.apply(this, [parent, additionalProps].concat(children));
}

@@ -92,6 +96,9 @@ }]);

Interpolate.propTypes = {
children: PropTypes.node,
className: PropTypes.string
};
Interpolate.defaultProps = {
className: ''
};
Interpolate.contextTypes = {

@@ -98,0 +105,0 @@ i18n: PropTypes.object.isRequired,

@@ -48,4 +48,6 @@ 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; };

if (!wait && _this.i18n.options.wait) wait = _this.i18n.options.wait;
if (!wait && _this.i18n.options.wait || _this.i18n.options.react && _this.i18n.options.react.wait) wait = _this.i18n.options.wait || _this.i18n.options.react.wait;
_this.nsMode = options.nsMode || _this.i18n.options.react && _this.i18n.options.react.nsMode || 'default';
_this.state = {

@@ -57,2 +59,3 @@ i18nLoadedAt: null,

_this.onI18nChanged = _this.onI18nChanged.bind(_this);
_this.getWrappedInstance = _this.getWrappedInstance.bind(_this);
return _this;

@@ -69,3 +72,3 @@ }

value: function componentWillMount() {
this[translateFuncName] = this.i18n.getFixedT(null, namespaces[0]);
this[translateFuncName] = this.i18n.getFixedT(null, this.nsMode === 'fallback' ? namespaces : namespaces[0]);
}

@@ -78,4 +81,4 @@ }, {

var bind = function bind() {
bindI18n && _this2.i18n.on(bindI18n, _this2.onI18nChanged);
bindStore && _this2.i18n.store && _this2.i18n.store.on(bindStore, _this2.onI18nChanged);
if (bindI18n && _this2.i18n) _this2.i18n.on(bindI18n, _this2.onI18nChanged);
if (bindStore && _this2.i18n.store) _this2.i18n.store.on(bindStore, _this2.onI18nChanged);
};

@@ -90,13 +93,17 @@

if (_this2.i18n.isInitialized) return ready();
if (_this2.i18n.isInitialized) {
ready();
} else {
var initialized = function initialized() {
// due to emitter removing issue in i18next we need to delay remove
setTimeout(function () {
_this2.i18n.off('initialized', initialized);
}, 1000);
ready();
};
var initialized = function initialized() {
// due to emitter removing issue in i18next we need to delay remove
setTimeout(function () {
_this2.i18n.off('initialized', initialized);
}, 1000);
ready();
};
_this2.i18n.on('initialized', initialized);
_this2.i18n.on('initialized', initialized);
}
});
if (!wait) bind();

@@ -140,2 +147,3 @@ }

/* eslint react/no-string-refs: 1 */
return this.refs.wrappedInstance;

@@ -142,0 +150,0 @@ }

@@ -241,4 +241,6 @@ (function (global, factory) {

if (!wait && _this.i18n.options.wait) wait = _this.i18n.options.wait;
if (!wait && _this.i18n.options.wait || _this.i18n.options.react && _this.i18n.options.react.wait) wait = _this.i18n.options.wait || _this.i18n.options.react.wait;
_this.nsMode = options.nsMode || _this.i18n.options.react && _this.i18n.options.react.nsMode || 'default';
_this.state = {

@@ -250,2 +252,3 @@ i18nLoadedAt: null,

_this.onI18nChanged = _this.onI18nChanged.bind(_this);
_this.getWrappedInstance = _this.getWrappedInstance.bind(_this);
return _this;

@@ -262,3 +265,3 @@ }

value: function componentWillMount() {
this[translateFuncName] = this.i18n.getFixedT(null, namespaces[0]);
this[translateFuncName] = this.i18n.getFixedT(null, this.nsMode === 'fallback' ? namespaces : namespaces[0]);
}

@@ -271,4 +274,4 @@ }, {

var bind = function bind() {
bindI18n && _this2.i18n.on(bindI18n, _this2.onI18nChanged);
bindStore && _this2.i18n.store && _this2.i18n.store.on(bindStore, _this2.onI18nChanged);
if (bindI18n && _this2.i18n) _this2.i18n.on(bindI18n, _this2.onI18nChanged);
if (bindStore && _this2.i18n.store) _this2.i18n.store.on(bindStore, _this2.onI18nChanged);
};

@@ -283,13 +286,17 @@

if (_this2.i18n.isInitialized) return ready();
if (_this2.i18n.isInitialized) {
ready();
} else {
var initialized = function initialized() {
// due to emitter removing issue in i18next we need to delay remove
setTimeout(function () {
_this2.i18n.off('initialized', initialized);
}, 1000);
ready();
};
var initialized = function initialized() {
// due to emitter removing issue in i18next we need to delay remove
setTimeout(function () {
_this2.i18n.off('initialized', initialized);
}, 1000);
ready();
};
_this2.i18n.on('initialized', initialized);
_this2.i18n.on('initialized', initialized);
}
});
if (!wait) bind();

@@ -333,2 +340,3 @@ }

/* eslint react/no-string-refs: 1 */
return this.refs.wrappedInstance;

@@ -444,3 +452,7 @@ }

return React__default.createElement.apply(this, [parent, { className: className, style: style }].concat(children));
var additionalProps = {};
if (className) additionalProps.className = className;
if (style) additionalProps.style = style;
return React__default.createElement.apply(this, [parent, additionalProps].concat(children));
}

@@ -452,6 +464,9 @@ }]);

Interpolate.propTypes = {
children: PropTypes.node,
className: PropTypes.string
};
Interpolate.defaultProps = {
className: ''
};
Interpolate.contextTypes = {

@@ -458,0 +473,0 @@ i18n: PropTypes.object.isRequired,

@@ -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(o){var i=function(t){function n(t,r){y(this,n);var o=g(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t,r));return o.i18n=r.i18n||t.i18n,e=e||o.i18n.options.defaultNS,"string"==typeof e&&(e=[e]),!O&&o.i18n.options.wait&&(O=o.i18n.options.wait),o.state={i18nLoadedAt:null,ready:!1},o.onI18nChanged=o.onI18nChanged.bind(o),o}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,e[0])}},{key:"componentDidMount",value:function(){var t=this,n=function(){p&&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)return e();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(p){var t=p.split(" ");t.forEach(function(t){return e.i18n.off(t,e.onI18nChanged)})}if(l){var n=l.split(" ");n.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,i=(e={i18nLoadedAt:n},m(e,w,this[w]),m(e,"i18n",this.i18n),e);return a&&(i.ref="wrappedInstance"),!r&&O?null:u.createElement(o,v({},this.props,i))}}]),n}(t.Component);return i.WrappedComponent=o,i.contextTypes={i18n:n.object},i.childContextTypes=m({},w,n.func.isRequired),i.displayName="Translate("+r(o)+")",i.namespaces=e,f(i,o)}}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){t.indexOf(e)===-1&&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)};return 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),u.createElement.apply(this,[t,{className:o,style:i}].concat(l))}}]),t}(t.Component);x.propTypes={children:n.node,className:n.string},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.wait||i.i18n.options.react&&i.i18n.options.react.wait)&&(O=i.i18n.options.wait||i.i18n.options.react.wait),i.nsMode=o.nsMode||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.0.0",
"version": "4.1.0",
"description": "Internationalization for react done right. Using the i18next i18n ecosystem.",

@@ -30,19 +30,22 @@ "main": "dist/commonjs/index.js",

"babel-core": "6.24.1",
"babel-eslint": "7.2.1",
"babel-eslint": "7.2.3",
"babel-jest": "19.0.0",
"babel-preset-es2015": "6.24.1",
"babel-preset-es2015-rollup": "3.0.0",
"babel-preset-react": "6.16.0",
"babel-preset-stage-0": "6.24.1",
"babel-register": "6.24.1",
"coveralls": "^2.11.12",
"enzyme": "2.8.0",
"enzyme": "2.8.2",
"eslint": "3.19.0",
"eslint-config-airbnb": "14.1.0",
"eslint-config-airbnb": "15.0.1",
"eslint-plugin-import": "2.2.0",
"eslint-plugin-jsx-a11y": "4.0.0",
"eslint-plugin-react": "6.10.3",
"i18next": "7.1.3",
"eslint-plugin-jsx-a11y": "5.0.1",
"eslint-plugin-react": "7.0.1",
"i18next": "8.2.1",
"jest": "19.0.2",
"jest-cli": "19.0.2",
"mkdirp": "0.5.1",
"react-addons-test-utils": "^15.5.1",
"react-dom": "^15.5.4",
"rimraf": "2.6.1",

@@ -54,2 +57,3 @@ "rollup": "0.41.6",

"rollup-plugin-uglify": "1.0.1",
"sinon": "^2.2.0",
"yargs": "7.0.2"

@@ -83,4 +87,7 @@ },

"react"
],
"testMatch": [
"**/?(*.)(spec|test).js?(x)"
]
}
}

@@ -241,4 +241,6 @@ (function (global, factory) {

if (!wait && _this.i18n.options.wait) wait = _this.i18n.options.wait;
if (!wait && _this.i18n.options.wait || _this.i18n.options.react && _this.i18n.options.react.wait) wait = _this.i18n.options.wait || _this.i18n.options.react.wait;
_this.nsMode = options.nsMode || _this.i18n.options.react && _this.i18n.options.react.nsMode || 'default';
_this.state = {

@@ -250,2 +252,3 @@ i18nLoadedAt: null,

_this.onI18nChanged = _this.onI18nChanged.bind(_this);
_this.getWrappedInstance = _this.getWrappedInstance.bind(_this);
return _this;

@@ -262,3 +265,3 @@ }

value: function componentWillMount() {
this[translateFuncName] = this.i18n.getFixedT(null, namespaces[0]);
this[translateFuncName] = this.i18n.getFixedT(null, this.nsMode === 'fallback' ? namespaces : namespaces[0]);
}

@@ -271,4 +274,4 @@ }, {

var bind = function bind() {
bindI18n && _this2.i18n.on(bindI18n, _this2.onI18nChanged);
bindStore && _this2.i18n.store && _this2.i18n.store.on(bindStore, _this2.onI18nChanged);
if (bindI18n && _this2.i18n) _this2.i18n.on(bindI18n, _this2.onI18nChanged);
if (bindStore && _this2.i18n.store) _this2.i18n.store.on(bindStore, _this2.onI18nChanged);
};

@@ -283,13 +286,17 @@

if (_this2.i18n.isInitialized) return ready();
if (_this2.i18n.isInitialized) {
ready();
} else {
var initialized = function initialized() {
// due to emitter removing issue in i18next we need to delay remove
setTimeout(function () {
_this2.i18n.off('initialized', initialized);
}, 1000);
ready();
};
var initialized = function initialized() {
// due to emitter removing issue in i18next we need to delay remove
setTimeout(function () {
_this2.i18n.off('initialized', initialized);
}, 1000);
ready();
};
_this2.i18n.on('initialized', initialized);
_this2.i18n.on('initialized', initialized);
}
});
if (!wait) bind();

@@ -333,2 +340,3 @@ }

/* eslint react/no-string-refs: 1 */
return this.refs.wrappedInstance;

@@ -444,3 +452,7 @@ }

return React__default.createElement.apply(this, [parent, { className: className, style: style }].concat(children));
var additionalProps = {};
if (className) additionalProps.className = className;
if (style) additionalProps.style = style;
return React__default.createElement.apply(this, [parent, additionalProps].concat(children));
}

@@ -452,6 +464,9 @@ }]);

Interpolate.propTypes = {
children: PropTypes.node,
className: PropTypes.string
};
Interpolate.defaultProps = {
className: ''
};
Interpolate.contextTypes = {

@@ -458,0 +473,0 @@ i18n: PropTypes.object.isRequired,

@@ -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(o){var i=function(t){function n(t,r){y(this,n);var o=g(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t,r));return o.i18n=r.i18n||t.i18n,e=e||o.i18n.options.defaultNS,"string"==typeof e&&(e=[e]),!O&&o.i18n.options.wait&&(O=o.i18n.options.wait),o.state={i18nLoadedAt:null,ready:!1},o.onI18nChanged=o.onI18nChanged.bind(o),o}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,e[0])}},{key:"componentDidMount",value:function(){var t=this,n=function(){p&&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)return e();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(p){var t=p.split(" ");t.forEach(function(t){return e.i18n.off(t,e.onI18nChanged)})}if(l){var n=l.split(" ");n.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,i=(e={i18nLoadedAt:n},m(e,w,this[w]),m(e,"i18n",this.i18n),e);return a&&(i.ref="wrappedInstance"),!r&&O?null:u.createElement(o,v({},this.props,i))}}]),n}(t.Component);return i.WrappedComponent=o,i.contextTypes={i18n:n.object},i.childContextTypes=m({},w,n.func.isRequired),i.displayName="Translate("+r(o)+")",i.namespaces=e,f(i,o)}}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){t.indexOf(e)===-1&&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)};return 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),u.createElement.apply(this,[t,{className:o,style:i}].concat(l))}}]),t}(t.Component);x.propTypes={children:n.node,className:n.string},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.wait||i.i18n.options.react&&i.i18n.options.react.wait)&&(O=i.i18n.options.wait||i.i18n.options.react.wait),i.nsMode=o.nsMode||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})});

@@ -8,3 +8,4 @@ # react-i18next

[![Travis CI][travis-ci-image] ][travis-ci-url]
[![Coverage Status](https://coveralls.io/repos/github/i18next/react-i18next/badge.svg?branch=master)](https://coveralls.io/github/i18next/react-i18next?branch=master)
[![Code Climate](https://codeclimate.com/github/codeclimate/codeclimate/badges/gpa.svg)](https://codeclimate.com/github/i18next/react-i18next)
[![Coverage Status](https://coveralls.io/repos/github/i18next/react-i18next/badge.svg)](https://coveralls.io/github/i18next/react-i18next)
[![Quality][quality-badge] ][quality-url]

@@ -99,3 +100,4 @@ [![dependencies][dependencies-image] ][dependencies-url]

translateFuncName: 't', // will change the name of translation prop default 't'
wait: false, // delay rendering until translations are loaded - wait can be set globally on i18next init too
wait: false, // delay rendering until translations are loaded - wait can be set globally on i18next init too ( can be set on i18next.init({ react: { wait: true }};) too)
nsMode: 'default', // can be set to fallback to let passed namespaces treated as fallbacks in order passed - wait can be set globally on i18next init too ( can be set on i18next.init({ react: { nsMode: 'fallback' }};) too)
bindI18n: 'languageChanged loaded', // which events trigger a rerender, can be set to false or string of events

@@ -102,0 +104,0 @@ bindStore: 'added removed' // which events on store trigger a rerender, can be set to false or string of events

@@ -61,3 +61,7 @@ import React, { Component } from 'react';

return React.createElement.apply(this, [parent, { className, style }].concat(children));
const additionalProps = {};
if (className) additionalProps.className = className;
if (style) additionalProps.style = style;
return React.createElement.apply(this, [parent, additionalProps].concat(children));
}

@@ -67,6 +71,9 @@ }

Interpolate.propTypes = {
children: PropTypes.node,
className: PropTypes.string
};
Interpolate.defaultProps = {
className: ''
};
Interpolate.contextTypes = {

@@ -73,0 +80,0 @@ i18n: PropTypes.object.isRequired,

@@ -5,3 +5,3 @@ // Borrowed from https://github.com/Rezonans/redux-async-connect/blob/master/modules/ReduxAsyncConnect.js#L16

if (typeof components[i] === 'object') {
for (let [key, value] of Object.entries(components[i])) {
for (const [key, value] of Object.entries(components[i])) {
iterator(value, i, key);

@@ -20,5 +20,5 @@ }

Component.namespaces.forEach((namespace)=>{
Component.namespaces.forEach((namespace) => {
if (flattened.indexOf(namespace) === -1) {
flattened.push(namespace);
flattened.push(namespace);
}

@@ -34,5 +34,5 @@ });

return new Promise((resolve)=>{
return new Promise((resolve) => {
i18n.loadNamespaces(allNamespaces, resolve);
});
}

@@ -22,4 +22,6 @@ import React, { Component } from 'react';

if (!wait && this.i18n.options.wait) wait = this.i18n.options.wait;
if (!wait && this.i18n.options.wait || (this.i18n.options.react && this.i18n.options.react.wait)) wait = this.i18n.options.wait || this.i18n.options.react.wait;
this.nsMode = options.nsMode || (this.i18n.options.react && this.i18n.options.react.nsMode) || 'default';
this.state = {

@@ -31,2 +33,3 @@ i18nLoadedAt: null,

this.onI18nChanged = this.onI18nChanged.bind(this);
this.getWrappedInstance = this.getWrappedInstance.bind(this);
}

@@ -39,3 +42,3 @@

componentWillMount() {
this[translateFuncName] = this.i18n.getFixedT(null, namespaces[0]);
this[translateFuncName] = this.i18n.getFixedT(null, this.nsMode === 'fallback' ? namespaces : namespaces[0]);
}

@@ -45,5 +48,5 @@

const bind = () => {
bindI18n && this.i18n.on(bindI18n, this.onI18nChanged);
bindStore && this.i18n.store && this.i18n.store.on(bindStore, this.onI18nChanged);
}
if (bindI18n && this.i18n) this.i18n.on(bindI18n, this.onI18nChanged);
if (bindStore && this.i18n.store) this.i18n.store.on(bindStore, this.onI18nChanged);
};

@@ -55,15 +58,19 @@ this.mounted = true;

if (wait && this.mounted) bind();
}
};
if (this.i18n.isInitialized) return ready();
if (this.i18n.isInitialized) {
ready();
} else {
const initialized = () => {
// due to emitter removing issue in i18next we need to delay remove
setTimeout(() => {
this.i18n.off('initialized', initialized);
}, 1000);
ready();
};
const initialized = () => {
// due to emitter removing issue in i18next we need to delay remove
setTimeout(() => {
this.i18n.off('initialized', initialized);
}, 1000);
ready();
this.i18n.on('initialized', initialized);
}
this.i18n.on('initialized', initialized)
});
if (!wait) bind();

@@ -101,2 +108,3 @@ }

/* eslint react/no-string-refs: 1 */
return this.refs.wrappedInstance;

@@ -132,3 +140,3 @@ }

Translate.displayName = 'Translate(' + getDisplayName(WrappedComponent) + ')';
Translate.displayName = `Translate(${getDisplayName(WrappedComponent)})`;

@@ -135,0 +143,0 @@ Translate.namespaces = namespaces;

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