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 3.1.0 to 3.1.1

3

CHANGELOG.md

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

### 3.1.1
- fixes issue in fixing t function - pass only first namespace not an array of namespaces
### 3.1.0

@@ -2,0 +5,0 @@ - fixes wrong warning of missing prop on interpolate with format

3

dist/amd/react-i18next.js

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

namespaces = namespaces || _this.i18n.options.defaultNS;
if (typeof namespaces === 'string') namespaces = [namespaces];

@@ -256,3 +257,3 @@ if (!wait && _this.i18n.options.wait) wait = _this.i18n.options.wait;

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

@@ -259,0 +260,0 @@ }, {

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

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

@@ -64,2 +64,3 @@ 'use strict';

namespaces = namespaces || _this.i18n.options.defaultNS;
if (typeof namespaces === 'string') namespaces = [namespaces];

@@ -85,3 +86,3 @@ if (!wait && _this.i18n.options.wait) wait = _this.i18n.options.wait;

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

@@ -88,0 +89,0 @@ }, {

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

namespaces = namespaces || _this.i18n.options.defaultNS;
if (typeof namespaces === 'string') namespaces = [namespaces];

@@ -67,3 +68,3 @@ if (!wait && _this.i18n.options.wait) wait = _this.i18n.options.wait;

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

@@ -70,0 +71,0 @@ }, {

@@ -239,2 +239,3 @@ (function (global, factory) {

namespaces = namespaces || _this.i18n.options.defaultNS;
if (typeof namespaces === 'string') namespaces = [namespaces];

@@ -260,3 +261,3 @@ if (!wait && _this.i18n.options.wait) wait = _this.i18n.options.wait;

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

@@ -263,0 +264,0 @@ }, {

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

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

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

@@ -239,2 +239,3 @@ (function (global, factory) {

namespaces = namespaces || _this.i18n.options.defaultNS;
if (typeof namespaces === 'string') namespaces = [namespaces];

@@ -260,3 +261,3 @@ if (!wait && _this.i18n.options.wait) wait = _this.i18n.options.wait;

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

@@ -263,0 +264,0 @@ }, {

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

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

@@ -49,3 +49,15 @@ # react-i18next

--------------
**NEWS: localization as a service - locize.com**
Needing a translation management? Want to edit your translations with an InContext Editor? Use the orginal provided to you by the maintainers of i18next!
![locize](http://i18next.com/img/locize_recap_medium_low.gif)
With using [locize](http://locize.com/) you directly support the future of i18next and react-i18next.
--------------
## Documentation
### I18nextProvider

@@ -52,0 +64,0 @@

@@ -20,2 +20,3 @@ import React, { Component } from 'react';

namespaces = namespaces || this.i18n.options.defaultNS;
if (typeof namespaces === 'string') namespaces = [namespaces];

@@ -37,3 +38,3 @@ if (!wait && this.i18n.options.wait) wait = this.i18n.options.wait;

componentWillMount() {
this[translateFuncName] = this.i18n.getFixedT(null, namespaces);
this[translateFuncName] = this.i18n.getFixedT(null, namespaces[0]);
}

@@ -40,0 +41,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