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 5.2.0 to 5.3.0

3

CHANGELOG.md

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

### 5.3.0
- Pass extra parameters to Trans parent component
### 5.2.0

@@ -2,0 +5,0 @@ - adds module export in package.json pointing to es dist files.

21

dist/amd/react-i18next.js

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

var objectWithoutProperties = function (obj, keys) {
var target = {};
for (var i in obj) {
if (keys.indexOf(i) >= 0) continue;
if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
target[i] = obj[i];
}
return target;
};
var possibleConstructorReturn = function (self, call) {

@@ -628,14 +638,15 @@ if (!self) {

count = _props.count,
parent = _props.parent;
parent = _props.parent,
i18nKey = _props.i18nKey,
additionalProps = objectWithoutProperties(_props, ['children', 'count', 'parent', 'i18nKey']);
var defaultValue = nodesToString('', children, 0);
var key = this.props.i18nKey || defaultValue;
var key = i18nKey || defaultValue;
var translation = this.t(key, { interpolation: { prefix: '#$?', suffix: '?$#' }, defaultValue: defaultValue, count: count });
var additionalProps = {};
if (this.i18n.options.react && this.i18n.options.react.exposeNamespace) {
var ns = typeof this.t.ns === 'string' ? this.t.ns : this.t.ns[0];
if (this.props.i18nKey && this.i18n.options.nsSeparator && this.props.i18nKey.indexOf(this.i18n.options.nsSeparator) > -1) {
var parts = this.props.i18nKey.split(this.i18n.options.nsSeparator);
if (i18nKey && this.i18n.options.nsSeparator && i18nKey.indexOf(this.i18n.options.nsSeparator) > -1) {
var parts = i18nKey.split(this.i18n.options.nsSeparator);
ns = parts[0];

@@ -642,0 +653,0 @@ }

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

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

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

function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -142,14 +144,14 @@

count = _props.count,
parent = _props.parent;
parent = _props.parent,
i18nKey = _props.i18nKey,
additionalProps = _objectWithoutProperties(_props, ['children', 'count', 'parent', 'i18nKey']);
var defaultValue = nodesToString('', children, 0);
var key = this.props.i18nKey || defaultValue;
var key = i18nKey || defaultValue;
var translation = this.t(key, { interpolation: { prefix: '#$?', suffix: '?$#' }, defaultValue: defaultValue, count: count });
var additionalProps = {};
if (this.i18n.options.react && this.i18n.options.react.exposeNamespace) {
var ns = typeof this.t.ns === 'string' ? this.t.ns : this.t.ns[0];
if (this.props.i18nKey && this.i18n.options.nsSeparator && this.props.i18nKey.indexOf(this.i18n.options.nsSeparator) > -1) {
var parts = this.props.i18nKey.split(this.i18n.options.nsSeparator);
if (i18nKey && this.i18n.options.nsSeparator && i18nKey.indexOf(this.i18n.options.nsSeparator) > -1) {
var parts = i18nKey.split(this.i18n.options.nsSeparator);
ns = parts[0];

@@ -156,0 +158,0 @@ }

@@ -7,2 +7,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; }; }();

function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -129,14 +131,14 @@

count = _props.count,
parent = _props.parent;
parent = _props.parent,
i18nKey = _props.i18nKey,
additionalProps = _objectWithoutProperties(_props, ['children', 'count', 'parent', 'i18nKey']);
var defaultValue = nodesToString('', children, 0);
var key = this.props.i18nKey || defaultValue;
var key = i18nKey || defaultValue;
var translation = this.t(key, { interpolation: { prefix: '#$?', suffix: '?$#' }, defaultValue: defaultValue, count: count });
var additionalProps = {};
if (this.i18n.options.react && this.i18n.options.react.exposeNamespace) {
var ns = typeof this.t.ns === 'string' ? this.t.ns : this.t.ns[0];
if (this.props.i18nKey && this.i18n.options.nsSeparator && this.props.i18nKey.indexOf(this.i18n.options.nsSeparator) > -1) {
var parts = this.props.i18nKey.split(this.i18n.options.nsSeparator);
if (i18nKey && this.i18n.options.nsSeparator && i18nKey.indexOf(this.i18n.options.nsSeparator) > -1) {
var parts = i18nKey.split(this.i18n.options.nsSeparator);
ns = parts[0];

@@ -143,0 +145,0 @@ }

@@ -158,4 +158,14 @@ (function (global, factory) {

var objectWithoutProperties = function (obj, keys) {
var target = {};
for (var i in obj) {
if (keys.indexOf(i) >= 0) continue;
if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
target[i] = obj[i];
}
return target;
};
var possibleConstructorReturn = function (self, call) {

@@ -632,14 +642,15 @@ if (!self) {

count = _props.count,
parent = _props.parent;
parent = _props.parent,
i18nKey = _props.i18nKey,
additionalProps = objectWithoutProperties(_props, ['children', 'count', 'parent', 'i18nKey']);
var defaultValue = nodesToString('', children, 0);
var key = this.props.i18nKey || defaultValue;
var key = i18nKey || defaultValue;
var translation = this.t(key, { interpolation: { prefix: '#$?', suffix: '?$#' }, defaultValue: defaultValue, count: count });
var additionalProps = {};
if (this.i18n.options.react && this.i18n.options.react.exposeNamespace) {
var ns = typeof this.t.ns === 'string' ? this.t.ns : this.t.ns[0];
if (this.props.i18nKey && this.i18n.options.nsSeparator && this.props.i18nKey.indexOf(this.i18n.options.nsSeparator) > -1) {
var parts = this.props.i18nKey.split(this.i18n.options.nsSeparator);
if (i18nKey && this.i18n.options.nsSeparator && i18nKey.indexOf(this.i18n.options.nsSeparator) > -1) {
var parts = i18nKey.split(this.i18n.options.nsSeparator);
ns = parts[0];

@@ -646,0 +657,0 @@ }

@@ -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 o(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=o.translateFuncName,s=void 0===r?j.translateFuncName:r;return function(r){var a,p=function(e){function n(e,i){g(this,n);var r=w(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,i));r.i18n=i.i18n||e.i18n||o.i18n||C,"string"==typeof(t=t||r.i18n.options.defaultNS)&&(t=[t]);var s=r.i18n&&r.i18n.options.react||{};return r.options=I({},j,s,o),e.initialI18nStore&&(r.i18n.services.resourceStore.data=e.initialI18nStore,r.options.wait=!1),e.initialLanguage&&r.i18n.changeLanguage(e.initialLanguage),r.i18n.options.isInitialSSR&&(r.options.wait=!1),r.state={i18nLoadedAt:null,ready:!1},r.onI18nChanged=r.onI18nChanged.bind(r),r.getWrappedInstance=r.getWrappedInstance.bind(r),r}return x(n,e),b(n,[{key:"getChildContext",value:function(){var t;return t={},S(t,s,this[s]),S(t,"i18n",this.i18n),t}},{key:"componentWillMount",value:function(){this[s]=this.i18n.getFixedT(null,"fallback"===this.options.nsMode?t:t[0])}},{key:"componentDidMount",value:function(){var e=this,n=function(){e.options.bindI18n&&e.i18n&&e.i18n.on(e.options.bindI18n,e.onI18nChanged),e.options.bindStore&&e.i18n.store&&e.i18n.store.on(e.options.bindStore,e.onI18nChanged)};this.mounted=!0,this.i18n.loadNamespaces(t,function(){var t=function(){e.mounted&&!e.state.ready&&e.setState({ready:!0}),e.options.wait&&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)}}),this.options.wait||n()}},{key:"componentWillUnmount",value:function(){var t=this;if(this.mounted=!1,this.onI18nChanged){if(this.options.bindI18n){this.options.bindI18n.split(" ").forEach(function(e){return t.i18n.off(e,t.onI18nChanged)})}if(this.options.bindStore){this.options.bindStore.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 this.options.withRef||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,o=n.ready,a=(t={i18nLoadedAt:i},S(t,s,this[s]),S(t,"i18n",this.i18n),t);return this.options.withRef&&(a.ref="wrappedInstance"),!o&&this.options.wait?null:(this.i18n.options.isInitialSSR&&!T&&(T=!0,setTimeout(function(){delete e.i18n.options.isInitialSSR},100)),f.createElement(r,I({},this.props,a)))}}]),n}(e.Component);return p.WrappedComponent=r,p.contextTypes={i18n:n.object},p.childContextTypes=(a={},S(a,s,n.func.isRequired),S(a,"i18n",n.object),a),p.displayName="Translate("+i(r)+")",p.namespaces=t,v(p,r)}}function r(t){return t&&(t.children||t.props&&t.props.children)}function s(t){return t&&t.children?t.children:t.props&&t.props.children}function a(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(r(e))t=t+"<"+i+">"+a("",s(e),n+1)+"</"+i+">";else if(f.isValidElement(e))t=t+"<"+i+"></"+i+">";else if("object"===(void 0===e?"undefined":m(e))){var o=I({},e),p=o.format;delete o.format;var u=Object.keys(o);p&&1===u.length?t=t+"<"+i+">{{"+u[0]+", "+p+"}}</"+i+">":1===u.length&&(t=t+"<"+i+">{{"+u[0]+"}}</"+i+">")}}),t}function p(t,e,n){function i(t,e){"[object Array]"!==Object.prototype.toString.call(t)&&(t=[t]);var o=e.split(N).reduce(function(t,e,n){return e&&t.push(e),t},[]);return o.reduce(function(e,a,p){var u=!isNaN(a),c=p>0&&!isNaN(o[p-1]);if(c){var l=t[parseInt(o[p-1],10)]||{};f.isValidElement(l)&&!r(l)&&(c=!1)}if(c)return e;if(u){var d=t[parseInt(a,10)]||{},h=f.isValidElement(d);if("string"==typeof d)e.push(d);else if(r(d)){var y=i(s(d),o[p+1]);e.push(f.cloneElement(d,I({},d.props,{key:p}),y))}else if("object"!==(void 0===d?"undefined":m(d))||h)e.push(d);else{var v=n.services.interpolator.interpolate(o[p+1],d,n.language);e.push(v)}}return u||c||e.push(a),e},[])}return i(t,e)}function u(t,e){for(var n=0,i=t.length;n<i;n++)if("object"===m(t[n])){var o=!0,r=!1,s=void 0;try{for(var a,p=Object.entries(t[n])[Symbol.iterator]();!(o=(a=p.next()).done);o=!0){var u=O(a.value,2),c=u[0],l=u[1];e(l,n,c)}}catch(t){r=!0,s=t}finally{try{!o&&p.return&&p.return()}finally{if(r)throw s}}}else e(t[n],n)}function c(t){var e=[];return u(t,function(t){t&&t.namespaces&&t.namespaces.forEach(function(t){-1===e.indexOf(t)&&e.push(t)})}),e}function l(t){var e=t.components,n=t.i18n,i=c(e);return new Promise(function(t){n.loadNamespaces(i,t)})}var f="default"in e?e.default:e;n="default"in n?n.default:n;var d={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},h={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0},y="function"==typeof Object.getOwnPropertySymbols,v=function(t,e,n){if("string"!=typeof e){var i=Object.getOwnPropertyNames(e);y&&(i=i.concat(Object.getOwnPropertySymbols(e)));for(var o=0;o<i.length;++o)if(!(d[i[o]]||h[i[o]]||n&&n[i[o]]))try{t[i[o]]=e[i[o]]}catch(t){}}return t},m="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},g=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},b=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}}(),S=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t},I=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},x=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)},w=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,o=!1,r=void 0;try{for(var s,a=t[Symbol.iterator]();!(i=(s=a.next()).done)&&(n.push(s.value),!e||n.length!==e);i=!0);}catch(t){o=!0,r=t}finally{try{!i&&a.return&&a.return()}finally{if(o)throw r}}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={wait:!1,withRef:!1,bindI18n:"languageChanged loaded",bindStore:"added removed",translateFuncName:"t",nsMode:"default"},C=void 0,T=!1;o.setDefaults=function(t){j=I({},j,t)},o.setI18n=function(t){C=t};var _=function(t){function e(t,n){g(this,e);var i=w(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));return i.i18n=n.i18n,i.t=n.t,i}return x(e,t),b(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,o=i.className,r=i.style,s=this.props.useDangerouslySetInnerHTML||!1,a=this.props.dangerouslySetInnerHTMLPartElement||"span",p=I({},this.props.options,{interpolation:{prefix:"#$?",suffix:"?$#"}}),u=this.t(this.props.i18nKey,p);if(!u||"string"!=typeof u)return f.createElement("noscript",null);var c=[],l=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),o=i.shift().trim(),r=i.join(t.i18n.options.interpolation.formatSeparator).trim();return void 0===n[o]&&t.i18n.services.logger.warn("interpolator: missed to pass in variable "+o+" for interpolating "+u),t.i18n.options.interpolation.format(n[o],r,t.i18n.language)};u.split(n).reduce(function(e,n,i){var o=void 0;if(i%2==0){if(0===n.length)return e;o=s?f.createElement(a,{dangerouslySetInnerHTML:{__html:n}}):n}else o=l(n,t.props);return e.push(o),e},c);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 o&&(d.className=o),r&&(d.style=r),f.createElement.apply(this,[e,d].concat(c))}}]),e}(e.Component);_.propTypes={className:n.string},_.defaultProps={className:""},_.contextTypes={i18n:n.object.isRequired,t:n.func.isRequired};var N=new RegExp("(?:<([^>]*)>(.*?)<\\/\\1>)","gi"),P=function(t){function e(t,n){g(this,e);var i=w(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));return i.i18n=n.i18n,i.t=n.t,i}return x(e,t),b(e,[{key:"componentDidMount",value:function(){}},{key:"render",value:function(){var t=this.props,e=t.children,n=t.count,i=t.parent,o=a("",e,0),r=this.props.i18nKey||o,s=this.t(r,{interpolation:{prefix:"#$?",suffix:"?$#"},defaultValue:o,count:n}),u={};if(this.i18n.options.react&&this.i18n.options.react.exposeNamespace){var c="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){c=this.props.i18nKey.split(this.i18n.options.nsSeparator)[0]}this.t.ns&&(u["data-i18next-options"]=JSON.stringify({ns:c}))}return f.createElement(i,u,p(e,s,this.i18n))}}]),e}(f.Component);P.propTypes={count:n.number,parent:n.string,i18nKey:n.string},P.defaultProps={parent:"div"},P.contextTypes={i18n:n.object.isRequired,t:n.func.isRequired};var E=function(t){function n(t,e){g(this,n);var i=w(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 x(n,t),b(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);E.propTypes={i18n:n.object.isRequired,children:n.element.isRequired},E.childContextTypes={i18n:n.object.isRequired},t.loadNamespaces=l,t.translate=o,t.Interpolate=_,t.I18nextProvider=E,t.Trans=P,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.translateFuncName,a=void 0===o?C.translateFuncName:o;return function(o){var s,p=function(e){function n(e,i){g(this,n);var o=w(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,i));o.i18n=i.i18n||e.i18n||r.i18n||P,"string"==typeof(t=t||o.i18n.options.defaultNS)&&(t=[t]);var a=o.i18n&&o.i18n.options.react||{};return o.options=I({},C,a,r),e.initialI18nStore&&(o.i18n.services.resourceStore.data=e.initialI18nStore,o.options.wait=!1),e.initialLanguage&&o.i18n.changeLanguage(e.initialLanguage),o.i18n.options.isInitialSSR&&(o.options.wait=!1),o.state={i18nLoadedAt:null,ready:!1},o.onI18nChanged=o.onI18nChanged.bind(o),o.getWrappedInstance=o.getWrappedInstance.bind(o),o}return x(n,e),b(n,[{key:"getChildContext",value:function(){var t;return t={},S(t,a,this[a]),S(t,"i18n",this.i18n),t}},{key:"componentWillMount",value:function(){this[a]=this.i18n.getFixedT(null,"fallback"===this.options.nsMode?t:t[0])}},{key:"componentDidMount",value:function(){var e=this,n=function(){e.options.bindI18n&&e.i18n&&e.i18n.on(e.options.bindI18n,e.onI18nChanged),e.options.bindStore&&e.i18n.store&&e.i18n.store.on(e.options.bindStore,e.onI18nChanged)};this.mounted=!0,this.i18n.loadNamespaces(t,function(){var t=function(){e.mounted&&!e.state.ready&&e.setState({ready:!0}),e.options.wait&&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)}}),this.options.wait||n()}},{key:"componentWillUnmount",value:function(){var t=this;if(this.mounted=!1,this.onI18nChanged){if(this.options.bindI18n){this.options.bindI18n.split(" ").forEach(function(e){return t.i18n.off(e,t.onI18nChanged)})}if(this.options.bindStore){this.options.bindStore.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 this.options.withRef||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},S(t,a,this[a]),S(t,"i18n",this.i18n),t);return this.options.withRef&&(s.ref="wrappedInstance"),!r&&this.options.wait?null:(this.i18n.options.isInitialSSR&&!T&&(T=!0,setTimeout(function(){delete e.i18n.options.isInitialSSR},100)),f.createElement(o,I({},this.props,s)))}}]),n}(e.Component);return p.WrappedComponent=o,p.contextTypes={i18n:n.object},p.childContextTypes=(s={},S(s,a,n.func.isRequired),S(s,"i18n",n.object),s),p.displayName="Translate("+i(o)+")",p.namespaces=t,v(p,o)}}function o(t){return t&&(t.children||t.props&&t.props.children)}function a(t){return t&&t.children?t.children:t.props&&t.props.children}function s(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(o(e))t=t+"<"+i+">"+s("",a(e),n+1)+"</"+i+">";else if(f.isValidElement(e))t=t+"<"+i+"></"+i+">";else if("object"===(void 0===e?"undefined":m(e))){var r=I({},e),p=r.format;delete r.format;var u=Object.keys(r);p&&1===u.length?t=t+"<"+i+">{{"+u[0]+", "+p+"}}</"+i+">":1===u.length&&(t=t+"<"+i+">{{"+u[0]+"}}</"+i+">")}}),t}function p(t,e,n){function i(t,e){"[object Array]"!==Object.prototype.toString.call(t)&&(t=[t]);var r=e.split(N).reduce(function(t,e,n){return e&&t.push(e),t},[]);return r.reduce(function(e,s,p){var u=!isNaN(s),c=p>0&&!isNaN(r[p-1]);if(c){var l=t[parseInt(r[p-1],10)]||{};f.isValidElement(l)&&!o(l)&&(c=!1)}if(c)return e;if(u){var d=t[parseInt(s,10)]||{},h=f.isValidElement(d);if("string"==typeof d)e.push(d);else if(o(d)){var y=i(a(d),r[p+1]);e.push(f.cloneElement(d,I({},d.props,{key:p}),y))}else if("object"!==(void 0===d?"undefined":m(d))||h)e.push(d);else{var v=n.services.interpolator.interpolate(r[p+1],d,n.language);e.push(v)}}return u||c||e.push(s),e},[])}return i(t,e)}function u(t,e){for(var n=0,i=t.length;n<i;n++)if("object"===m(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 c(t){var e=[];return u(t,function(t){t&&t.namespaces&&t.namespaces.forEach(function(t){-1===e.indexOf(t)&&e.push(t)})}),e}function l(t){var e=t.components,n=t.i18n,i=c(e);return new Promise(function(t){n.loadNamespaces(i,t)})}var f="default"in e?e.default:e;n="default"in n?n.default:n;var d={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},h={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0},y="function"==typeof Object.getOwnPropertySymbols,v=function(t,e,n){if("string"!=typeof e){var i=Object.getOwnPropertyNames(e);y&&(i=i.concat(Object.getOwnPropertySymbols(e)));for(var r=0;r<i.length;++r)if(!(d[i[r]]||h[i[r]]||n&&n[i[r]]))try{t[i[r]]=e[i[r]]}catch(t){}}return t},m="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},g=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},b=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}}(),S=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t},I=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},x=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){var n={};for(var i in t)e.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);return n},w=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")}}(),C={wait:!1,withRef:!1,bindI18n:"languageChanged loaded",bindStore:"added removed",translateFuncName:"t",nsMode:"default"},P=void 0,T=!1;r.setDefaults=function(t){C=I({},C,t)},r.setI18n=function(t){P=t};var _=function(t){function e(t,n){g(this,e);var i=w(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));return i.i18n=n.i18n,i.t=n.t,i}return x(e,t),b(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=I({},this.props.options,{interpolation:{prefix:"#$?",suffix:"?$#"}}),u=this.t(this.props.i18nKey,p);if(!u||"string"!=typeof u)return f.createElement("noscript",null);var c=[],l=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?f.createElement(s,{dangerouslySetInnerHTML:{__html:n}}):n}else r=l(n,t.props);return e.push(r),e},c);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),f.createElement.apply(this,[e,d].concat(c))}}]),e}(e.Component);_.propTypes={className:n.string},_.defaultProps={className:""},_.contextTypes={i18n:n.object.isRequired,t:n.func.isRequired};var N=new RegExp("(?:<([^>]*)>(.*?)<\\/\\1>)","gi"),E=function(t){function e(t,n){g(this,e);var i=w(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));return i.i18n=n.i18n,i.t=n.t,i}return x(e,t),b(e,[{key:"componentDidMount",value:function(){}},{key:"render",value:function(){var t=this.props,e=t.children,n=t.count,i=t.parent,r=t.i18nKey,o=O(t,["children","count","parent","i18nKey"]),a=s("",e,0),u=r||a,c=this.t(u,{interpolation:{prefix:"#$?",suffix:"?$#"},defaultValue:a,count:n});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(r&&this.i18n.options.nsSeparator&&r.indexOf(this.i18n.options.nsSeparator)>-1){l=r.split(this.i18n.options.nsSeparator)[0]}this.t.ns&&(o["data-i18next-options"]=JSON.stringify({ns:l}))}return f.createElement(i,o,p(e,c,this.i18n))}}]),e}(f.Component);E.propTypes={count:n.number,parent:n.string,i18nKey:n.string},E.defaultProps={parent:"div"},E.contextTypes={i18n:n.object.isRequired,t:n.func.isRequired};var R=function(t){function n(t,e){g(this,n);var i=w(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 x(n,t),b(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);R.propTypes={i18n:n.object.isRequired,children:n.element.isRequired},R.childContextTypes={i18n:n.object.isRequired},t.loadNamespaces=l,t.translate=r,t.Interpolate=_,t.I18nextProvider=R,t.Trans=E,Object.defineProperty(t,"__esModule",{value:!0})});
{
"name": "react-i18next",
"version": "5.2.0",
"version": "5.3.0",
"description": "Internationalization for react done right. Using the i18next i18n ecosystem.",

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

@@ -158,4 +158,14 @@ (function (global, factory) {

var objectWithoutProperties = function (obj, keys) {
var target = {};
for (var i in obj) {
if (keys.indexOf(i) >= 0) continue;
if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
target[i] = obj[i];
}
return target;
};
var possibleConstructorReturn = function (self, call) {

@@ -632,14 +642,15 @@ if (!self) {

count = _props.count,
parent = _props.parent;
parent = _props.parent,
i18nKey = _props.i18nKey,
additionalProps = objectWithoutProperties(_props, ['children', 'count', 'parent', 'i18nKey']);
var defaultValue = nodesToString('', children, 0);
var key = this.props.i18nKey || defaultValue;
var key = i18nKey || defaultValue;
var translation = this.t(key, { interpolation: { prefix: '#$?', suffix: '?$#' }, defaultValue: defaultValue, count: count });
var additionalProps = {};
if (this.i18n.options.react && this.i18n.options.react.exposeNamespace) {
var ns = typeof this.t.ns === 'string' ? this.t.ns : this.t.ns[0];
if (this.props.i18nKey && this.i18n.options.nsSeparator && this.props.i18nKey.indexOf(this.i18n.options.nsSeparator) > -1) {
var parts = this.props.i18nKey.split(this.i18n.options.nsSeparator);
if (i18nKey && this.i18n.options.nsSeparator && i18nKey.indexOf(this.i18n.options.nsSeparator) > -1) {
var parts = i18nKey.split(this.i18n.options.nsSeparator);
ns = parts[0];

@@ -646,0 +657,0 @@ }

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

@@ -112,13 +112,12 @@ import React from 'react';

render() {
const { children, count, parent } = this.props;
const { children, count, parent, i18nKey, ...additionalProps } = this.props;
const defaultValue = nodesToString('', children, 0);
const key = this.props.i18nKey || defaultValue;
const key = i18nKey || defaultValue;
const translation = this.t(key, { interpolation: { prefix: '#$?', suffix: '?$#' }, defaultValue, count });
const additionalProps = {};
if (this.i18n.options.react && this.i18n.options.react.exposeNamespace) {
let ns = typeof this.t.ns === 'string' ? this.t.ns : this.t.ns[0];
if (this.props.i18nKey && this.i18n.options.nsSeparator && this.props.i18nKey.indexOf(this.i18n.options.nsSeparator) > -1) {
const parts = this.props.i18nKey.split(this.i18n.options.nsSeparator);
if (i18nKey && this.i18n.options.nsSeparator && i18nKey.indexOf(this.i18n.options.nsSeparator) > -1) {
const parts = i18nKey.split(this.i18n.options.nsSeparator);
ns = parts[0];

@@ -125,0 +124,0 @@ }

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc