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

react-i18next

Package Overview
Dependencies
Maintainers
2
Versions
316
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.6.4 to 4.7.0

3

CHANGELOG.md

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

### 4.7.0
- Trans component parent element configurable [PR278](https://github.com/i18next/react-i18next/pull/278)
### 4.6.4

@@ -2,0 +5,0 @@ - optimize generated defaultValue for components not having children

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

children = _props.children,
count = _props.count;
count = _props.count,
parent = _props.parent;

@@ -626,3 +627,3 @@

return React__default.createElement('div', additionalProps, renderNodes(children, translation, this.i18n));
return React__default.createElement(parent, additionalProps, renderNodes(children, translation, this.i18n));
}

@@ -633,2 +634,12 @@ }]);

Trans.propTypes = {
count: PropTypes.number,
parent: PropTypes.string,
i18nKey: PropTypes.string
};
Trans.defaultProps = {
parent: 'div'
};
Trans.contextTypes = {

@@ -635,0 +646,0 @@ i18n: PropTypes.object.isRequired,

2

dist/amd/react-i18next.min.js

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

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

@@ -132,3 +132,4 @@ 'use strict';

children = _props.children,
count = _props.count;
count = _props.count,
parent = _props.parent;

@@ -150,3 +151,3 @@

return _react2.default.createElement('div', additionalProps, renderNodes(children, translation, this.i18n));
return _react2.default.createElement(parent, additionalProps, renderNodes(children, translation, this.i18n));
}

@@ -161,2 +162,12 @@ }]);

Trans.propTypes = {
count: _propTypes2.default.number,
parent: _propTypes2.default.string,
i18nKey: _propTypes2.default.string
};
Trans.defaultProps = {
parent: 'div'
};
Trans.contextTypes = {

@@ -163,0 +174,0 @@ i18n: _propTypes2.default.object.isRequired,

@@ -119,3 +119,4 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

children = _props.children,
count = _props.count;
count = _props.count,
parent = _props.parent;

@@ -137,3 +138,3 @@

return React.createElement('div', additionalProps, renderNodes(children, translation, this.i18n));
return React.createElement(parent, additionalProps, renderNodes(children, translation, this.i18n));
}

@@ -148,2 +149,12 @@ }]);

Trans.propTypes = {
count: PropTypes.number,
parent: PropTypes.string,
i18nKey: PropTypes.string
};
Trans.defaultProps = {
parent: 'div'
};
Trans.contextTypes = {

@@ -150,0 +161,0 @@ i18n: PropTypes.object.isRequired,

@@ -612,3 +612,4 @@ (function (global, factory) {

children = _props.children,
count = _props.count;
count = _props.count,
parent = _props.parent;

@@ -630,3 +631,3 @@

return React__default.createElement('div', additionalProps, renderNodes(children, translation, this.i18n));
return React__default.createElement(parent, additionalProps, renderNodes(children, translation, this.i18n));
}

@@ -637,2 +638,12 @@ }]);

Trans.propTypes = {
count: PropTypes.number,
parent: PropTypes.string,
i18nKey: PropTypes.string
};
Trans.defaultProps = {
parent: 'div'
};
Trans.contextTypes = {

@@ -639,0 +650,0 @@ i18n: PropTypes.object.isRequired,

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("prop-types")):"function"==typeof define&&define.amd?define("reactI18next",["exports","react","prop-types"],e):e(t.reactI18next=t.reactI18next||{},t.React,t.PropTypes)}(this,function(t,e,n){"use strict";function i(t){return t.displayName||t.name||"Component"}function r(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=r.withRef,a=void 0!==o&&o,s=r.bindI18n,p=void 0===s?"languageChanged loaded":s,u=r.bindStore,l=void 0===u?"added removed":u,f=r.translateFuncName,d=void 0===f?"t":f,y=r.wait,O=void 0!==y&&y;return function(o){var s,u=function(e){function n(e,i){v(this,n);var o=x(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,i));return o.i18n=i.i18n||e.i18n||r.i18n,t=t||o.i18n.options.defaultNS,"string"==typeof t&&(t=[t]),!O&&o.i18n.options&&(o.i18n.options.wait||o.i18n.options.react&&o.i18n.options.react.wait)&&(O=!0),o.nsMode=r.nsMode||o.i18n.options&&o.i18n.options.react&&o.i18n.options.react.nsMode||"default",e.initialI18nStore&&(o.i18n.services.resourceStore.data=e.initialI18nStore,O=!1),e.initialLanguage&&o.i18n.changeLanguage(e.initialLanguage),o.i18n.options.isInitialSSR&&(O=!1),o.state={i18nLoadedAt:null,ready:!1},o.onI18nChanged=o.onI18nChanged.bind(o),o.getWrappedInstance=o.getWrappedInstance.bind(o),o}return S(n,e),g(n,[{key:"getChildContext",value:function(){var t;return t={},m(t,d,this[d]),m(t,"i18n",this.i18n),t}},{key:"componentWillMount",value:function(){this[d]=this.i18n.getFixedT(null,"fallback"===this.nsMode?t:t[0])}},{key:"componentDidMount",value:function(){var e=this,n=function(){p&&e.i18n&&e.i18n.on(p,e.onI18nChanged),l&&e.i18n.store&&e.i18n.store.on(l,e.onI18nChanged)};this.mounted=!0,this.i18n.loadNamespaces(t,function(){var t=function(){e.mounted&&!e.state.ready&&e.setState({ready:!0}),O&&e.mounted&&n()};if(e.i18n.isInitialized)t();else{var i=function n(){setTimeout(function(){e.i18n.off("initialized",n)},1e3),t()};e.i18n.on("initialized",i)}}),O||n()}},{key:"componentWillUnmount",value:function(){var t=this;if(this.mounted=!1,this.onI18nChanged){if(p){p.split(" ").forEach(function(e){return t.i18n.off(e,t.onI18nChanged)})}if(l){l.split(" ").forEach(function(e){return t.i18n.store&&t.i18n.store.off(e,t.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 t,e=this,n=this.state,i=n.i18nLoadedAt,r=n.ready,s=(t={i18nLoadedAt:i},m(t,d,this[d]),m(t,"i18n",this.i18n),t);return a&&(s.ref="wrappedInstance"),!r&&O?null:(this.i18n.options.isInitialSSR&&!j&&(j=!0,setTimeout(function(){delete e.i18n.options.isInitialSSR},100)),c.createElement(o,b({},this.props,s)))}}]),n}(e.Component);return u.WrappedComponent=o,u.contextTypes={i18n:n.object},u.childContextTypes=(s={},m(s,d,n.func.isRequired),m(s,"i18n",n.object),s),u.displayName="Translate("+i(o)+")",u.namespaces=t,h(u,o)}}function o(t,e,n){return"[object Array]"!==Object.prototype.toString.call(e)&&(e=[e]),e.forEach(function(e,n){var i=""+n;if("string"==typeof e)t=""+t+e;else if(e.props&&e.props.children)t=t+"<"+i+">"+o("",e.props.children,n+1)+"</"+i+">";else if(c.isValidElement(e))t=t+"<"+i+"></"+i+">";else if("object"===(void 0===e?"undefined":y(e))){var r=b({},e),a=r.format;delete r.format;var s=Object.keys(r);a&&1===s.length?t=t+"<"+i+">{{"+s[0]+", "+a+"}}</"+i+">":1===s.length&&(t=t+"<"+i+">{{"+s[0]+"}}</"+i+">")}}),t}function a(t,e,n){function i(t,e){"[object Array]"!==Object.prototype.toString.call(t)&&(t=[t]);var r=e.split(w).reduce(function(t,e,n){return e&&t.push(e),t},[]);return r.reduce(function(e,o,a){var s=!isNaN(o),p=a>0&&!isNaN(r[a-1]);if(p){var u=t[parseInt(r[a-1],10)]||{};u.props&&!u.props.children&&(p=!1)}if(p)return e;if(s){var l=t[parseInt(o,10)]||{},f=c.isValidElement(l);if("string"==typeof l)e.push(l);else if(l.props&&l.props.children){var d=i(l.props&&l.props.children,r[a+1]);e.push(c.cloneElement(l,b({},l.props,{key:a}),d))}else if("object"!==(void 0===l?"undefined":y(l))||f)e.push(l);else{var h=n.services.interpolator.interpolate(r[a+1],l,n.language);e.push(h)}}return s||p||e.push(o),e},[])}return i(t,e)}function s(t,e){for(var n=0,i=t.length;n<i;n++)if("object"===y(t[n])){var r=!0,o=!1,a=void 0;try{for(var s,p=Object.entries(t[n])[Symbol.iterator]();!(r=(s=p.next()).done);r=!0){var u=O(s.value,2),c=u[0],l=u[1];e(l,n,c)}}catch(t){o=!0,a=t}finally{try{!r&&p.return&&p.return()}finally{if(o)throw a}}}else e(t[n],n)}function p(t){var e=[];return s(t,function(t){t&&t.namespaces&&t.namespaces.forEach(function(t){-1===e.indexOf(t)&&e.push(t)})}),e}function u(t){var e=t.components,n=t.i18n,i=p(e);return new Promise(function(t){n.loadNamespaces(i,t)})}var c="default"in e?e.default:e;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},f={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0},d="function"==typeof Object.getOwnPropertySymbols,h=function(t,e,n){if("string"!=typeof e){var i=Object.getOwnPropertyNames(e);d&&(i=i.concat(Object.getOwnPropertySymbols(e)));for(var r=0;r<i.length;++r)if(!(l[i[r]]||f[i[r]]||n&&n[i[r]]))try{t[i[r]]=e[i[r]]}catch(t){}}return t},y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},g=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),m=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t},b=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},S=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},x=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},O=function(){function t(t,e){var n=[],i=!0,r=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(i=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);i=!0);}catch(t){r=!0,o=t}finally{try{!i&&s.return&&s.return()}finally{if(r)throw o}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),j=!1,I=function(t){function e(t,n){v(this,e);var i=x(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));return i.i18n=n.i18n,i.t=n.t,i}return S(e,t),g(e,[{key:"render",value:function(){var t=this,e=this.props.parent||"span",n=this.props.regexp||this.i18n.services.interpolator.regexp,i=this.props,r=i.className,o=i.style,a=this.props.useDangerouslySetInnerHTML||!1,s=this.props.dangerouslySetInnerHTMLPartElement||"span",p=b({},this.props.options,{interpolation:{prefix:"#$?",suffix:"?$#"}}),u=this.t(this.props.i18nKey,p);if(!u||"string"!=typeof u)return c.createElement("noscript",null);var l=[],f=function(e,n){if(e.indexOf(t.i18n.options.interpolation.formatSeparator)<0)return void 0===n[e]&&t.i18n.services.logger.warn("interpolator: missed to pass in variable "+e+" for interpolating "+u),n[e];var i=e.split(t.i18n.options.interpolation.formatSeparator),r=i.shift().trim(),o=i.join(t.i18n.options.interpolation.formatSeparator).trim();return void 0===n[r]&&t.i18n.services.logger.warn("interpolator: missed to pass in variable "+r+" for interpolating "+u),t.i18n.options.interpolation.format(n[r],o,t.i18n.language)};u.split(n).reduce(function(e,n,i){var r=void 0;if(i%2==0){if(0===n.length)return e;r=a?c.createElement(s,{dangerouslySetInnerHTML:{__html:n}}):n}else r=f(n,t.props);return e.push(r),e},l);var d={};if(this.i18n.options.react&&this.i18n.options.react.exposeNamespace){var h="string"==typeof this.t.ns?this.t.ns:this.t.ns[0];if(this.props.i18nKey&&this.i18n.options.nsSeparator&&this.props.i18nKey.indexOf(this.i18n.options.nsSeparator)>-1){h=this.props.i18nKey.split(this.i18n.options.nsSeparator)[0]}this.t.ns&&(d["data-i18next-options"]=JSON.stringify({ns:h}))}return r&&(d.className=r),o&&(d.style=o),c.createElement.apply(this,[e,d].concat(l))}}]),e}(e.Component);I.propTypes={className:n.string},I.defaultProps={className:""},I.contextTypes={i18n:n.object.isRequired,t:n.func.isRequired};var w=new RegExp("(?:<([^>]*)>(.*?)<\\/\\1>)","gi"),C=function(t){function e(t,n){v(this,e);var i=x(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));return i.i18n=n.i18n,i.t=n.t,i}return S(e,t),g(e,[{key:"componentDidMount",value:function(){}},{key:"render",value:function(){var t=this.props,e=t.children,n=t.count,i=o("",e,0),r=this.props.i18nKey||i,s=this.t(r,{interpolation:{prefix:"#$?",suffix:"?$#"},defaultValue:i,count:n}),p={};if(this.i18n.options.react&&this.i18n.options.react.exposeNamespace){var u="string"==typeof this.t.ns?this.t.ns:this.t.ns[0];if(this.props.i18nKey&&this.i18n.options.nsSeparator&&this.props.i18nKey.indexOf(this.i18n.options.nsSeparator)>-1){u=this.props.i18nKey.split(this.i18n.options.nsSeparator)[0]}this.t.ns&&(p["data-i18next-options"]=JSON.stringify({ns:u}))}return c.createElement("div",p,a(e,s,this.i18n))}}]),e}(c.Component);C.contextTypes={i18n:n.object.isRequired,t:n.func.isRequired};var _=function(t){function n(t,e){v(this,n);var i=x(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t,e));return i.i18n=t.i18n,t.initialI18nStore&&(i.i18n.services.resourceStore.data=t.initialI18nStore,i.i18n.options.isInitialSSR=!0),t.initialLanguage&&i.i18n.changeLanguage(t.initialLanguage),i}return S(n,t),g(n,[{key:"getChildContext",value:function(){return{i18n:this.i18n}}},{key:"componentWillReceiveProps",value:function(t){if(this.props.i18n!==t.i18n)throw new Error("[react-i18next][I18nextProvider]does not support changing the i18n object.")}},{key:"render",value:function(){var t=this.props.children;return e.Children.only(t)}}]),n}(e.Component);_.propTypes={i18n:n.object.isRequired,children:n.element.isRequired},_.childContextTypes={i18n:n.object.isRequired},t.loadNamespaces=u,t.translate=r,t.Interpolate=I,t.I18nextProvider=_,t.Trans=C,Object.defineProperty(t,"__esModule",{value:!0})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("prop-types")):"function"==typeof define&&define.amd?define("reactI18next",["exports","react","prop-types"],e):e(t.reactI18next=t.reactI18next||{},t.React,t.PropTypes)}(this,function(t,e,n){"use strict";function i(t){return t.displayName||t.name||"Component"}function r(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=r.withRef,a=void 0!==o&&o,s=r.bindI18n,p=void 0===s?"languageChanged loaded":s,u=r.bindStore,l=void 0===u?"added removed":u,f=r.translateFuncName,d=void 0===f?"t":f,y=r.wait,O=void 0!==y&&y;return function(o){var s,u=function(e){function n(e,i){v(this,n);var o=x(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,i));return o.i18n=i.i18n||e.i18n||r.i18n,t=t||o.i18n.options.defaultNS,"string"==typeof t&&(t=[t]),!O&&o.i18n.options&&(o.i18n.options.wait||o.i18n.options.react&&o.i18n.options.react.wait)&&(O=!0),o.nsMode=r.nsMode||o.i18n.options&&o.i18n.options.react&&o.i18n.options.react.nsMode||"default",e.initialI18nStore&&(o.i18n.services.resourceStore.data=e.initialI18nStore,O=!1),e.initialLanguage&&o.i18n.changeLanguage(e.initialLanguage),o.i18n.options.isInitialSSR&&(O=!1),o.state={i18nLoadedAt:null,ready:!1},o.onI18nChanged=o.onI18nChanged.bind(o),o.getWrappedInstance=o.getWrappedInstance.bind(o),o}return S(n,e),g(n,[{key:"getChildContext",value:function(){var t;return t={},m(t,d,this[d]),m(t,"i18n",this.i18n),t}},{key:"componentWillMount",value:function(){this[d]=this.i18n.getFixedT(null,"fallback"===this.nsMode?t:t[0])}},{key:"componentDidMount",value:function(){var e=this,n=function(){p&&e.i18n&&e.i18n.on(p,e.onI18nChanged),l&&e.i18n.store&&e.i18n.store.on(l,e.onI18nChanged)};this.mounted=!0,this.i18n.loadNamespaces(t,function(){var t=function(){e.mounted&&!e.state.ready&&e.setState({ready:!0}),O&&e.mounted&&n()};if(e.i18n.isInitialized)t();else{var i=function n(){setTimeout(function(){e.i18n.off("initialized",n)},1e3),t()};e.i18n.on("initialized",i)}}),O||n()}},{key:"componentWillUnmount",value:function(){var t=this;if(this.mounted=!1,this.onI18nChanged){if(p){p.split(" ").forEach(function(e){return t.i18n.off(e,t.onI18nChanged)})}if(l){l.split(" ").forEach(function(e){return t.i18n.store&&t.i18n.store.off(e,t.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 t,e=this,n=this.state,i=n.i18nLoadedAt,r=n.ready,s=(t={i18nLoadedAt:i},m(t,d,this[d]),m(t,"i18n",this.i18n),t);return a&&(s.ref="wrappedInstance"),!r&&O?null:(this.i18n.options.isInitialSSR&&!j&&(j=!0,setTimeout(function(){delete e.i18n.options.isInitialSSR},100)),c.createElement(o,b({},this.props,s)))}}]),n}(e.Component);return u.WrappedComponent=o,u.contextTypes={i18n:n.object},u.childContextTypes=(s={},m(s,d,n.func.isRequired),m(s,"i18n",n.object),s),u.displayName="Translate("+i(o)+")",u.namespaces=t,h(u,o)}}function o(t,e,n){return"[object Array]"!==Object.prototype.toString.call(e)&&(e=[e]),e.forEach(function(e,n){var i=""+n;if("string"==typeof e)t=""+t+e;else if(e.props&&e.props.children)t=t+"<"+i+">"+o("",e.props.children,n+1)+"</"+i+">";else if(c.isValidElement(e))t=t+"<"+i+"></"+i+">";else if("object"===(void 0===e?"undefined":y(e))){var r=b({},e),a=r.format;delete r.format;var s=Object.keys(r);a&&1===s.length?t=t+"<"+i+">{{"+s[0]+", "+a+"}}</"+i+">":1===s.length&&(t=t+"<"+i+">{{"+s[0]+"}}</"+i+">")}}),t}function a(t,e,n){function i(t,e){"[object Array]"!==Object.prototype.toString.call(t)&&(t=[t]);var r=e.split(w).reduce(function(t,e,n){return e&&t.push(e),t},[]);return r.reduce(function(e,o,a){var s=!isNaN(o),p=a>0&&!isNaN(r[a-1]);if(p){var u=t[parseInt(r[a-1],10)]||{};u.props&&!u.props.children&&(p=!1)}if(p)return e;if(s){var l=t[parseInt(o,10)]||{},f=c.isValidElement(l);if("string"==typeof l)e.push(l);else if(l.props&&l.props.children){var d=i(l.props&&l.props.children,r[a+1]);e.push(c.cloneElement(l,b({},l.props,{key:a}),d))}else if("object"!==(void 0===l?"undefined":y(l))||f)e.push(l);else{var h=n.services.interpolator.interpolate(r[a+1],l,n.language);e.push(h)}}return s||p||e.push(o),e},[])}return i(t,e)}function s(t,e){for(var n=0,i=t.length;n<i;n++)if("object"===y(t[n])){var r=!0,o=!1,a=void 0;try{for(var s,p=Object.entries(t[n])[Symbol.iterator]();!(r=(s=p.next()).done);r=!0){var u=O(s.value,2),c=u[0],l=u[1];e(l,n,c)}}catch(t){o=!0,a=t}finally{try{!r&&p.return&&p.return()}finally{if(o)throw a}}}else e(t[n],n)}function p(t){var e=[];return s(t,function(t){t&&t.namespaces&&t.namespaces.forEach(function(t){-1===e.indexOf(t)&&e.push(t)})}),e}function u(t){var e=t.components,n=t.i18n,i=p(e);return new Promise(function(t){n.loadNamespaces(i,t)})}var c="default"in e?e.default:e;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},f={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0},d="function"==typeof Object.getOwnPropertySymbols,h=function(t,e,n){if("string"!=typeof e){var i=Object.getOwnPropertyNames(e);d&&(i=i.concat(Object.getOwnPropertySymbols(e)));for(var r=0;r<i.length;++r)if(!(l[i[r]]||f[i[r]]||n&&n[i[r]]))try{t[i[r]]=e[i[r]]}catch(t){}}return t},y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},g=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),m=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t},b=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},S=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},x=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},O=function(){function t(t,e){var n=[],i=!0,r=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(i=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);i=!0);}catch(t){r=!0,o=t}finally{try{!i&&s.return&&s.return()}finally{if(r)throw o}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),j=!1,I=function(t){function e(t,n){v(this,e);var i=x(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));return i.i18n=n.i18n,i.t=n.t,i}return S(e,t),g(e,[{key:"render",value:function(){var t=this,e=this.props.parent||"span",n=this.props.regexp||this.i18n.services.interpolator.regexp,i=this.props,r=i.className,o=i.style,a=this.props.useDangerouslySetInnerHTML||!1,s=this.props.dangerouslySetInnerHTMLPartElement||"span",p=b({},this.props.options,{interpolation:{prefix:"#$?",suffix:"?$#"}}),u=this.t(this.props.i18nKey,p);if(!u||"string"!=typeof u)return c.createElement("noscript",null);var l=[],f=function(e,n){if(e.indexOf(t.i18n.options.interpolation.formatSeparator)<0)return void 0===n[e]&&t.i18n.services.logger.warn("interpolator: missed to pass in variable "+e+" for interpolating "+u),n[e];var i=e.split(t.i18n.options.interpolation.formatSeparator),r=i.shift().trim(),o=i.join(t.i18n.options.interpolation.formatSeparator).trim();return void 0===n[r]&&t.i18n.services.logger.warn("interpolator: missed to pass in variable "+r+" for interpolating "+u),t.i18n.options.interpolation.format(n[r],o,t.i18n.language)};u.split(n).reduce(function(e,n,i){var r=void 0;if(i%2==0){if(0===n.length)return e;r=a?c.createElement(s,{dangerouslySetInnerHTML:{__html:n}}):n}else r=f(n,t.props);return e.push(r),e},l);var d={};if(this.i18n.options.react&&this.i18n.options.react.exposeNamespace){var h="string"==typeof this.t.ns?this.t.ns:this.t.ns[0];if(this.props.i18nKey&&this.i18n.options.nsSeparator&&this.props.i18nKey.indexOf(this.i18n.options.nsSeparator)>-1){h=this.props.i18nKey.split(this.i18n.options.nsSeparator)[0]}this.t.ns&&(d["data-i18next-options"]=JSON.stringify({ns:h}))}return r&&(d.className=r),o&&(d.style=o),c.createElement.apply(this,[e,d].concat(l))}}]),e}(e.Component);I.propTypes={className:n.string},I.defaultProps={className:""},I.contextTypes={i18n:n.object.isRequired,t:n.func.isRequired};var w=new RegExp("(?:<([^>]*)>(.*?)<\\/\\1>)","gi"),C=function(t){function e(t,n){v(this,e);var i=x(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));return i.i18n=n.i18n,i.t=n.t,i}return S(e,t),g(e,[{key:"componentDidMount",value:function(){}},{key:"render",value:function(){var t=this.props,e=t.children,n=t.count,i=t.parent,r=o("",e,0),s=this.props.i18nKey||r,p=this.t(s,{interpolation:{prefix:"#$?",suffix:"?$#"},defaultValue:r,count:n}),u={};if(this.i18n.options.react&&this.i18n.options.react.exposeNamespace){var l="string"==typeof this.t.ns?this.t.ns:this.t.ns[0];if(this.props.i18nKey&&this.i18n.options.nsSeparator&&this.props.i18nKey.indexOf(this.i18n.options.nsSeparator)>-1){l=this.props.i18nKey.split(this.i18n.options.nsSeparator)[0]}this.t.ns&&(u["data-i18next-options"]=JSON.stringify({ns:l}))}return c.createElement(i,u,a(e,p,this.i18n))}}]),e}(c.Component);C.propTypes={count:n.number,parent:n.string,i18nKey:n.string},C.defaultProps={parent:"div"},C.contextTypes={i18n:n.object.isRequired,t:n.func.isRequired};var T=function(t){function n(t,e){v(this,n);var i=x(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t,e));return i.i18n=t.i18n,t.initialI18nStore&&(i.i18n.services.resourceStore.data=t.initialI18nStore,i.i18n.options.isInitialSSR=!0),t.initialLanguage&&i.i18n.changeLanguage(t.initialLanguage),i}return S(n,t),g(n,[{key:"getChildContext",value:function(){return{i18n:this.i18n}}},{key:"componentWillReceiveProps",value:function(t){if(this.props.i18n!==t.i18n)throw new Error("[react-i18next][I18nextProvider]does not support changing the i18n object.")}},{key:"render",value:function(){var t=this.props.children;return e.Children.only(t)}}]),n}(e.Component);T.propTypes={i18n:n.object.isRequired,children:n.element.isRequired},T.childContextTypes={i18n:n.object.isRequired},t.loadNamespaces=u,t.translate=r,t.Interpolate=I,t.I18nextProvider=T,t.Trans=C,Object.defineProperty(t,"__esModule",{value:!0})});
{
"name": "react-i18next",
"version": "4.6.4",
"version": "4.7.0",
"description": "Internationalization for react done right. Using the i18next i18n ecosystem.",

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

@@ -612,3 +612,4 @@ (function (global, factory) {

children = _props.children,
count = _props.count;
count = _props.count,
parent = _props.parent;

@@ -630,3 +631,3 @@

return React__default.createElement('div', additionalProps, renderNodes(children, translation, this.i18n));
return React__default.createElement(parent, additionalProps, renderNodes(children, translation, this.i18n));
}

@@ -637,2 +638,12 @@ }]);

Trans.propTypes = {
count: PropTypes.number,
parent: PropTypes.string,
i18nKey: PropTypes.string
};
Trans.defaultProps = {
parent: 'div'
};
Trans.contextTypes = {

@@ -639,0 +650,0 @@ i18n: PropTypes.object.isRequired,

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

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

@@ -7,3 +7,3 @@ # react-i18next

[![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?t=1)](https://coveralls.io/github/i18next/react-i18next)
[![Coverage Status](https://coveralls.io/repos/github/i18next/react-i18next/badge.svg?t=2)](https://coveralls.io/github/i18next/react-i18next)
[![Quality][quality-badge] ][quality-url]

@@ -10,0 +10,0 @@ [![dependencies][dependencies-image] ][dependencies-url]

@@ -104,3 +104,3 @@ import React from 'react';

render() {
const { children, count } = this.props;
const { children, count, parent } = this.props;

@@ -122,3 +122,3 @@ const defaultValue = nodesToString('', children, 0);

return React.createElement(
'div',
parent,
additionalProps,

@@ -130,2 +130,12 @@ renderNodes(children, translation, this.i18n)

Trans.propTypes = {
count: PropTypes.number,
parent: PropTypes.string,
i18nKey: PropTypes.string
};
Trans.defaultProps = {
parent: 'div',
};
Trans.contextTypes = {

@@ -132,0 +142,0 @@ i18n: PropTypes.object.isRequired,

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