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.4.1 to 6.0.0

.npmignore

5

CHANGELOG.md

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

### 6.0.0
- **[BREAKING]** removes options to set translateFuncName in translate hoc (was not supported in Trans and Interpolate component anyway)
- setting i18n instance and defaults can now be done by i18next.use(reactI18nextModule) making I18nextProvider obsolete
- As an alternative to the translate hoc you now can use the I18n component supporting a render props (for details about render props https://www.youtube.com/watch?v=BcVAq3YFiuc)
### 5.4.1

@@ -2,0 +7,0 @@ - fixes AST implementation for preact

379

dist/amd/react-i18next.js

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

var defineProperty = function (obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
};

@@ -228,131 +215,205 @@ var _extends = Object.assign || function (target) {

function getDisplayName(component) {
return component.displayName || component.name || 'Component';
function setDefaults(options) {
defaultOptions = _extends({}, defaultOptions, options);
}
function getDefaults() {
return defaultOptions;
}
function setI18n(instance) {
i18n = instance;
}
function getI18n() {
return i18n;
}
var reactI18nextModule = {
type: '3rdParty',
init: function init(instance) {
setDefaults(instance.options.react);
setI18n(instance);
}
};
var removedIsInitialSSR = false;
function translate(namespaces) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var _options$translateFun = options.translateFuncName,
translateFuncName = _options$translateFun === undefined ? defaultOptions.translateFuncName : _options$translateFun;
var I18n = function (_PureComponent) {
inherits(I18n, _PureComponent);
function I18n(props, context) {
classCallCheck(this, I18n);
return function Wrapper(WrappedComponent) {
var _Translate$childConte;
var _this = possibleConstructorReturn(this, (I18n.__proto__ || Object.getPrototypeOf(I18n)).call(this, props, context));
var Translate = function (_Component) {
inherits(Translate, _Component);
_this.i18n = context.i18n || props.i18n || getI18n();
_this.namespaces = _this.props.ns || _this.i18n.options.defaultNS;
if (typeof _this.namespaces === 'string') _this.namespaces = [_this.namespaces];
function Translate(props, context) {
classCallCheck(this, Translate);
var i18nOptions = _this.i18n && _this.i18n.options.react || {};
_this.options = _extends({}, getDefaults(), i18nOptions, props);
var _this = possibleConstructorReturn(this, (Translate.__proto__ || Object.getPrototypeOf(Translate)).call(this, props, context));
// nextjs SSR: getting data from next.js or other ssr stack
if (props.initialI18nStore) {
_this.i18n.services.resourceStore.data = props.initialI18nStore;
_this.options.wait = false; // we got all passed down already
}
if (props.initialLanguage) {
_this.i18n.changeLanguage(props.initialLanguage);
}
_this.i18n = context.i18n || props.i18n || options.i18n || i18n;
namespaces = namespaces || _this.i18n.options.defaultNS;
if (typeof namespaces === 'string') namespaces = [namespaces];
// provider SSR: data was set in provider and ssr flag was set
if (_this.i18n.options.isInitialSSR) {
_this.options.wait = false;
}
var i18nOptions = _this.i18n && _this.i18n.options.react || {};
_this.options = _extends({}, defaultOptions, i18nOptions, options);
_this.state = {
i18nLoadedAt: null,
ready: false
};
// nextjs SSR: getting data from next.js or other ssr stack
if (props.initialI18nStore) {
_this.i18n.services.resourceStore.data = props.initialI18nStore;
_this.options.wait = false; // we got all passed down already
}
if (props.initialLanguage) {
_this.i18n.changeLanguage(props.initialLanguage);
}
_this.onI18nChanged = _this.onI18nChanged.bind(_this);
return _this;
}
// provider SSR: data was set in provider and ssr flag was set
if (_this.i18n.options.isInitialSSR) {
_this.options.wait = false;
}
createClass(I18n, [{
key: 'getChildContext',
value: function getChildContext() {
return {
t: this.t,
i18n: this.i18n
};
}
}, {
key: 'componentWillMount',
value: function componentWillMount() {
this.t = this.i18n.getFixedT(null, this.options.nsMode === 'fallback' ? this.namespaces : this.namespaces[0]);
}
}, {
key: 'componentDidMount',
value: function componentDidMount() {
var _this2 = this;
_this.state = {
i18nLoadedAt: null,
ready: false
var bind = function bind() {
if (_this2.options.bindI18n && _this2.i18n) _this2.i18n.on(_this2.options.bindI18n, _this2.onI18nChanged);
if (_this2.options.bindStore && _this2.i18n.store) _this2.i18n.store.on(_this2.options.bindStore, _this2.onI18nChanged);
};
this.mounted = true;
this.i18n.loadNamespaces(this.namespaces, function () {
var ready = function ready() {
if (_this2.mounted && !_this2.state.ready) _this2.setState({ ready: true });
if (_this2.options.wait && _this2.mounted) bind();
};
_this.onI18nChanged = _this.onI18nChanged.bind(_this);
_this.getWrappedInstance = _this.getWrappedInstance.bind(_this);
return _this;
}
if (_this2.i18n.isInitialized) {
ready();
} else {
var initialized = function initialized() {
// due to emitter removing issue in i18next we need to delay remove
setTimeout(function () {
_this2.i18n.off('initialized', initialized);
}, 1000);
ready();
};
createClass(Translate, [{
key: 'getChildContext',
value: function getChildContext() {
var _ref;
_this2.i18n.on('initialized', initialized);
}
});
return _ref = {}, defineProperty(_ref, translateFuncName, this[translateFuncName]), defineProperty(_ref, 'i18n', this.i18n), _ref;
if (!this.options.wait) bind();
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
var _this3 = this;
this.mounted = false;
if (this.onI18nChanged) {
if (this.options.bindI18n) {
var p = this.options.bindI18n.split(' ');
p.forEach(function (f) {
return _this3.i18n.off(f, _this3.onI18nChanged);
});
}
}, {
key: 'componentWillMount',
value: function componentWillMount() {
this[translateFuncName] = this.i18n.getFixedT(null, this.options.nsMode === 'fallback' ? namespaces : namespaces[0]);
if (this.options.bindStore) {
var _p = this.options.bindStore.split(' ');
_p.forEach(function (f) {
return _this3.i18n.store && _this3.i18n.store.off(f, _this3.onI18nChanged);
});
}
}, {
key: 'componentDidMount',
value: function componentDidMount() {
var _this2 = this;
}
}
}, {
key: 'onI18nChanged',
value: function onI18nChanged() {
if (!this.mounted) return;
var bind = function bind() {
if (_this2.options.bindI18n && _this2.i18n) _this2.i18n.on(_this2.options.bindI18n, _this2.onI18nChanged);
if (_this2.options.bindStore && _this2.i18n.store) _this2.i18n.store.on(_this2.options.bindStore, _this2.onI18nChanged);
};
this.setState({ i18nLoadedAt: new Date() });
}
}, {
key: 'render',
value: function render() {
var _this4 = this;
this.mounted = true;
this.i18n.loadNamespaces(namespaces, function () {
var ready = function ready() {
if (_this2.mounted && !_this2.state.ready) _this2.setState({ ready: true });
if (_this2.options.wait && _this2.mounted) bind();
};
var children = this.props.children;
var ready = this.state.ready;
if (_this2.i18n.isInitialized) {
ready();
} else {
var initialized = function initialized() {
// due to emitter removing issue in i18next we need to delay remove
setTimeout(function () {
_this2.i18n.off('initialized', initialized);
}, 1000);
ready();
};
_this2.i18n.on('initialized', initialized);
}
});
if (!ready && this.options.wait) return null;
if (!this.options.wait) bind();
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
var _this3 = this;
// remove ssr flag set by provider - first render was done from now on wait if set to wait
if (this.i18n.options.isInitialSSR && !removedIsInitialSSR) {
removedIsInitialSSR = true;
setTimeout(function () {
delete _this4.i18n.options.isInitialSSR;
}, 100);
}
this.mounted = false;
if (this.onI18nChanged) {
if (this.options.bindI18n) {
var p = this.options.bindI18n.split(' ');
p.forEach(function (f) {
return _this3.i18n.off(f, _this3.onI18nChanged);
});
}
if (this.options.bindStore) {
var _p = this.options.bindStore.split(' ');
_p.forEach(function (f) {
return _this3.i18n.store && _this3.i18n.store.off(f, _this3.onI18nChanged);
});
}
}
}
}, {
key: 'onI18nChanged',
value: function onI18nChanged() {
if (!this.mounted) return;
return children(this.t, { i18n: this.i18n, t: this.t });
}
}]);
return I18n;
}(React.PureComponent);
this.setState({ i18nLoadedAt: new Date() });
}
}, {
I18n.contextTypes = {
i18n: PropTypes.object
};
I18n.childContextTypes = {
t: PropTypes.func.isRequired,
i18n: PropTypes.object
};
function getDisplayName(component) {
return component.displayName || component.name || 'Component';
}
function translate(namespaces) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return function Wrapper(WrappedComponent) {
var Translate = function (_PureComponent) {
inherits(Translate, _PureComponent);
function Translate(props, context) {
classCallCheck(this, Translate);
var _this = possibleConstructorReturn(this, (Translate.__proto__ || Object.getPrototypeOf(Translate)).call(this, props, context));
_this.i18n = context.i18n || props.i18n || options.i18n || getI18n();
namespaces = namespaces || _this.i18n.options.defaultNS;
if (typeof namespaces === 'string') namespaces = [namespaces];
var i18nOptions = _this.i18n && _this.i18n.options.react || {};
_this.options = _extends({}, getDefaults(), i18nOptions, options);
_this.getWrappedInstance = _this.getWrappedInstance.bind(_this);
return _this;
}
createClass(Translate, [{
key: 'getWrappedInstance',

@@ -366,3 +427,3 @@ value: function getWrappedInstance() {

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

@@ -372,32 +433,19 @@ }, {

value: function render() {
var _extraProps,
_this4 = this;
var _this2 = this;
var _state = this.state,
i18nLoadedAt = _state.i18nLoadedAt,
ready = _state.ready;
var extraProps = {};
var extraProps = (_extraProps = {
i18nLoadedAt: i18nLoadedAt
}, defineProperty(_extraProps, translateFuncName, this[translateFuncName]), defineProperty(_extraProps, 'i18n', this.i18n), _extraProps);
if (this.options.withRef) {
extraProps.ref = 'wrappedInstance';
extraProps.ref = function (c) {
_this2.wrappedInstance = c;
};
}
if (!ready && this.options.wait) return null;
// remove ssr flag set by provider - first render was done from now on wait if set to wait
if (this.i18n.options.isInitialSSR && !removedIsInitialSSR) {
removedIsInitialSSR = true;
setTimeout(function () {
delete _this4.i18n.options.isInitialSSR;
}, 100);
}
return React__default.createElement(WrappedComponent, _extends({}, this.props, extraProps));
return React__default.createElement(I18n, _extends({ ns: namespaces }, this.options, this.props, { i18n: this.i18n }), function (t, context) {
return React__default.createElement(WrappedComponent, _extends({}, _this2.props, extraProps, context));
});
}
}]);
return Translate;
}(React.Component);
}(React.PureComponent);

@@ -410,4 +458,2 @@ Translate.WrappedComponent = WrappedComponent;

Translate.childContextTypes = (_Translate$childConte = {}, defineProperty(_Translate$childConte, translateFuncName, PropTypes.func.isRequired), defineProperty(_Translate$childConte, 'i18n', PropTypes.object), _Translate$childConte);
Translate.displayName = 'Translate(' + getDisplayName(WrappedComponent) + ')';

@@ -421,12 +467,8 @@

translate.setDefaults = function setDefaults(options) {
defaultOptions = _extends({}, defaultOptions, options);
};
translate.setDefaults = setDefaults;
translate.setI18n = function setI18n(instance) {
i18n = instance;
};
translate.setI18n = setI18n;
var Interpolate = function (_Component) {
inherits(Interpolate, _Component);
var Interpolate = function (_PureComponent) {
inherits(Interpolate, _PureComponent);

@@ -438,4 +480,4 @@ function Interpolate(props, context) {

_this.i18n = context.i18n;
_this.t = context.t;
_this.i18n = props.i18n || context.i18n;
_this.t = props.t || context.t;
return _this;

@@ -517,3 +559,3 @@ }

return Interpolate;
}(React.Component);
}(React.PureComponent);

@@ -821,4 +863,4 @@ Interpolate.propTypes = {

var Trans = function (_React$Component) {
inherits(Trans, _React$Component);
var Trans = function (_React$PureComponent) {
inherits(Trans, _React$PureComponent);

@@ -830,4 +872,4 @@ function Trans(props, context) {

_this.i18n = context.i18n;
_this.t = context.t;
_this.i18n = props.i18n || context.i18n;
_this.t = props.t || context.t;
return _this;

@@ -837,5 +879,2 @@ }

createClass(Trans, [{
key: 'componentDidMount',
value: function componentDidMount() {}
}, {
key: 'render',

@@ -868,3 +907,3 @@ value: function render() {

return Trans;
}(React__default.Component);
}(React__default.PureComponent);

@@ -886,4 +925,4 @@ Trans.propTypes = {

var I18nextProvider = function (_Component) {
inherits(I18nextProvider, _Component);
var I18nextProvider = function (_PureComponent) {
inherits(I18nextProvider, _PureComponent);

@@ -927,3 +966,3 @@ function I18nextProvider(props, context) {

return I18nextProvider;
}(React.Component);
}(React.PureComponent);

@@ -978,6 +1017,6 @@ I18nextProvider.propTypes = {

var flattened = [];
eachComponents(components, function (Component$$1) {
if (Component$$1 && Component$$1.namespaces) {
eachComponents(components, function (Component) {
if (Component && Component.namespaces) {
Component$$1.namespaces.forEach(function (namespace) {
Component.namespaces.forEach(function (namespace) {
if (flattened.indexOf(namespace) === -1) {

@@ -1003,7 +1042,13 @@ flattened.push(namespace);

exports.loadNamespaces = loadNamespaces;
exports.translate = translate;
exports.I18n = I18n;
exports.Interpolate = Interpolate;
exports.Trans = Trans;
exports.I18nextProvider = I18nextProvider;
exports.Trans = Trans;
exports.loadNamespaces = loadNamespaces;
exports.reactI18nextModule = reactI18nextModule;
exports.setDefaults = setDefaults;
exports.getDefaults = getDefaults;
exports.setI18n = setI18n;
exports.getI18n = getI18n;

@@ -1010,0 +1055,0 @@ Object.defineProperty(exports, '__esModule', { value: true });

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

define("reactI18next",["exports","react","prop-types"],function(t,e,n){"use strict";function i(t){return t.displayName||t.name||"Component"}function r(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=r.translateFuncName,a=void 0===o?P.translateFuncName:o;return function(o){var s,p=function(e){function n(e,i){O(this,n);var o=E(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,i));o.i18n=i.i18n||e.i18n||r.i18n||T,"string"==typeof(t=t||o.i18n.options.defaultNS)&&(t=[t]);var a=o.i18n&&o.i18n.options.react||{};return o.options=x({},P,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 I(n,e),j(n,[{key:"getChildContext",value:function(){var t;return t={},w(t,a,this[a]),w(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},w(t,a,this[a]),w(t,"i18n",this.i18n),t);return this.options.withRef&&(s.ref="wrappedInstance"),!r&&this.options.wait?null:(this.i18n.options.isInitialSSR&&!k&&(k=!0,setTimeout(function(){delete e.i18n.options.isInitialSSR},100)),y.createElement(o,x({},this.props,s)))}}]),n}(e.Component);return p.WrappedComponent=o,p.contextTypes={i18n:n.object},p.childContextTypes=(s={},w(s,a,n.func.isRequired),w(s,"i18n",n.object),s),p.displayName="Translate("+i(o)+")",p.namespaces=t,b(p,o)}}function o(t,e,n,i,r){var o=e.indexOf("<",i),a=e.slice(i,-1===o?void 0:o);/^\s*$/.test(a)&&(a=" "),(!r&&o>-1&&n+t.length>=0||" "!==a)&&t.push({type:"text",content:a})}function a(t){var e=[];for(var n in t)e.push(n+'="'+t[n]+'"');return e.length?" "+e.join(" "):""}function s(t,e){switch(e.type){case"text":return t+e.content;case"tag":return t+="<"+e.name+(e.attrs?a(e.attrs):"")+(e.voidElement?"/>":">"),e.voidElement?t:t+e.children.reduce(s,"")+"</"+e.name+">"}}function p(t){return t&&(t.children||t.props&&t.props.children)}function c(t){return t&&t.children?t.children:t.props&&t.props.children}function u(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(p(e))t=t+"<"+i+">"+u("",c(e),n+1)+"</"+i+">";else if(y.isValidElement(e))t=t+"<"+i+"></"+i+">";else if("object"===(void 0===e?"undefined":S(e))){var r=x({},e),o=r.format;delete r.format;var a=Object.keys(r);o&&1===a.length?t=t+"<"+i+">{{"+a[0]+", "+o+"}}</"+i+">":1===a.length&&(t=t+"<"+i+">{{"+a[0]+"}}</"+i+">")}}),t}function l(t,e,n){function i(t,e){return"[object Array]"!==Object.prototype.toString.call(t)&&(t=[t]),"[object Array]"!==Object.prototype.toString.call(e)&&(e=[e]),e.reduce(function(e,r,o){if("tag"===r.type){var a=t[parseInt(r.name,10)]||{},s=y.isValidElement(a);if("string"==typeof a)e.push(a);else if(p(a)){var u=i(c(a),r.children);a.dummy&&(a.children=u),e.push(y.cloneElement(a,x({},a.props,{key:o}),u))}else if("object"!==(void 0===a?"undefined":S(a))||s)e.push(a);else{var l=n.services.interpolator.interpolate(r.children[0].content,a,n.language);e.push(l)}}else"text"===r.type&&e.push(r.content);return e},[])}return c(i([{dummy:!0,children:t}],D.parse("<0>"+e+"</0>"))[0])}function f(t,e){for(var n=0,i=t.length;n<i;n++)if("object"===S(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 c=_(s.value,2),u=c[0],l=c[1];e(l,n,u)}}catch(t){o=!0,a=t}finally{try{!r&&p.return&&p.return()}finally{if(o)throw a}}}else e(t[n],n)}function h(t){var e=[];return f(t,function(t){t&&t.namespaces&&t.namespaces.forEach(function(t){-1===e.indexOf(t)&&e.push(t)})}),e}function d(t){var e=t.components,n=t.i18n,i=h(e);return new Promise(function(t){n.loadNamespaces(i,t)})}var y="default"in e?e.default:e;n="default"in n?n.default:n;var m={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},v={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0},g="function"==typeof Object.getOwnPropertySymbols,b=function(t,e,n){if("string"!=typeof e){var i=Object.getOwnPropertyNames(e);g&&(i=i.concat(Object.getOwnPropertySymbols(e)));for(var r=0;r<i.length;++r)if(!(m[i[r]]||v[i[r]]||n&&n[i[r]]))try{t[i[r]]=e[i[r]]}catch(t){}}return t},S="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},O=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},j=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}}(),w=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t},x=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},I=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)},C=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},E=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},_=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")}}(),P={wait:!1,withRef:!1,bindI18n:"languageChanged loaded",bindStore:"added removed",translateFuncName:"t",nsMode:"default"},T=void 0,k=!1;r.setDefaults=function(t){P=x({},P,t)},r.setI18n=function(t){T=t};var N=function(t){function e(t,n){O(this,e);var i=E(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));return i.i18n=n.i18n,i.t=n.t,i}return I(e,t),j(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=x({},this.props.options,{interpolation:{prefix:"#$?",suffix:"?$#"}}),c=this.t(this.props.i18nKey,p);if(!c||"string"!=typeof c)return y.createElement("noscript",null);var u=[],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 "+c),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 "+c),t.i18n.options.interpolation.format(n[r],o,t.i18n.language)};c.split(n).reduce(function(e,n,i){var r=void 0;if(i%2==0){if(0===n.length)return e;r=a?y.createElement(s,{dangerouslySetInnerHTML:{__html:n}}):n}else r=l(n,t.props);return e.push(r),e},u);var f={};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&&(f["data-i18next-options"]=JSON.stringify({ns:h}))}return r&&(f.className=r),o&&(f.style=o),y.createElement.apply(this,[e,f].concat(u))}}]),e}(e.Component);N.propTypes={className:n.string},N.defaultProps={className:""},N.contextTypes={i18n:n.object.isRequired,t:n.func.isRequired};var R={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,menuitem:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},L=/([\w-]+)|=|(['"])([.\s\S]*?)\2/g,A=function(t){var e,n=0,i=!0,r={type:"tag",name:"",voidElement:!1,attrs:{},children:[]};return t.replace(L,function(o){if("="===o)return i=!0,void n++;i?0===n?((R[o]||"/"===t.charAt(t.length-2))&&(r.voidElement=!0),r.name=o):(r.attrs[e]=o.replace(/^['"]|['"]$/g,""),e=void 0):(e&&(r.attrs[e]=e),e=o),n++,i=!1}),r},W=/(?:<!--[\S\s]*?-->|<(?:"[^"]*"['"]*|'[^']*'['"]*|[^'">])+>)/g,M=Object.create?Object.create(null):{},q=function(t,e){e||(e={}),e.components||(e.components=M);var n,i=[],r=-1,a=[],s={},p=!1;return t.replace(W,function(c,u){if(p){if(c!=="</"+n.name+">")return;p=!1}var l,f="/"!==c.charAt(1),h=0===c.indexOf("\x3c!--"),d=u+c.length,y=t.charAt(d);f&&!h&&(r++,n=A(c),"tag"===n.type&&e.components[n.name]&&(n.type="component",p=!0),n.voidElement||p||!y||"<"===y||o(n.children,t,r,d,e.ignoreWhitespace),s[n.tagName]=n,0===r&&i.push(n),l=a[r-1],l&&l.children.push(n),a[r]=n),(h||!f||n.voidElement)&&(h||r--,!p&&"<"!==y&&y&&(l=-1===r?i:a[r].children,o(l,t,r,d,e.ignoreWhitespace)))}),!i.length&&t.length&&o(i,t,0,0,e.ignoreWhitespace),i},K=function(t){return t.reduce(function(t,e){return t+s("",e)},"")},D={parse:q,stringify:K},$=function(t){function e(t,n){O(this,e);var i=E(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));return i.i18n=n.i18n,i.t=n.t,i}return I(e,t),j(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=C(t,["children","count","parent","i18nKey"]),a=u("",e,0),s=r||a,p=this.t(s,{interpolation:{prefix:"#$?",suffix:"?$#"},defaultValue:a,count:n});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(r&&this.i18n.options.nsSeparator&&r.indexOf(this.i18n.options.nsSeparator)>-1){c=r.split(this.i18n.options.nsSeparator)[0]}this.t.ns&&(o["data-i18next-options"]=JSON.stringify({ns:c}))}return y.createElement(i,o,l(e,p,this.i18n))}}]),e}(y.Component);$.propTypes={count:n.number,parent:n.string,i18nKey:n.string},$.defaultProps={parent:"div"},$.contextTypes={i18n:n.object.isRequired,t:n.func.isRequired};var F=function(t){function n(t,e){O(this,n);var i=E(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 I(n,t),j(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);F.propTypes={i18n:n.object.isRequired,children:n.element.isRequired},F.childContextTypes={i18n:n.object.isRequired},t.loadNamespaces=d,t.translate=r,t.Interpolate=N,t.I18nextProvider=F,t.Trans=$,Object.defineProperty(t,"__esModule",{value:!0})});
define("reactI18next",["exports","react","prop-types"],function(t,e,n){"use strict";function i(t){N=_({},N,t)}function r(){return N}function o(t){R=t}function s(){return R}function a(t){return t.displayName||t.name||"Component"}function p(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(o){var p=function(e){function n(e,o){w(this,n);var a=T(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,o));a.i18n=o.i18n||e.i18n||i.i18n||s(),"string"==typeof(t=t||a.i18n.options.defaultNS)&&(t=[t]);var p=a.i18n&&a.i18n.options.react||{};return a.options=_({},r(),p,i),a.getWrappedInstance=a.getWrappedInstance.bind(a),a}return C(n,e),P(n,[{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.wrappedInstance}},{key:"render",value:function(){var e=this,n={};return this.options.withRef&&(n.ref=function(t){e.wrappedInstance=t}),b.createElement(W,_({ns:t},this.options,this.props,{i18n:this.i18n}),function(t,i){return b.createElement(o,_({},e.props,n,i))})}}]),n}(e.PureComponent);return p.WrappedComponent=o,p.contextTypes={i18n:n.object},p.displayName="Translate("+a(o)+")",p.namespaces=t,j(p,o)}}function c(t,e,n,i,r){var o=e.indexOf("<",i),s=e.slice(i,-1===o?void 0:o);/^\s*$/.test(s)&&(s=" "),(!r&&o>-1&&n+t.length>=0||" "!==s)&&t.push({type:"text",content:s})}function u(t){var e=[];for(var n in t)e.push(n+'="'+t[n]+'"');return e.length?" "+e.join(" "):""}function l(t,e){switch(e.type){case"text":return t+e.content;case"tag":return t+="<"+e.name+(e.attrs?u(e.attrs):"")+(e.voidElement?"/>":">"),e.voidElement?t:t+e.children.reduce(l,"")+"</"+e.name+">"}}function f(t){return t&&(t.children||t.props&&t.props.children)}function h(t){return t&&t.children?t.children:t.props&&t.props.children}function d(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(f(e))t=t+"<"+i+">"+d("",h(e),n+1)+"</"+i+">";else if(b.isValidElement(e))t=t+"<"+i+"></"+i+">";else if("object"===(void 0===e?"undefined":I(e))){var r=_({},e),o=r.format;delete r.format;var s=Object.keys(r);o&&1===s.length?t=t+"<"+i+">{{"+s[0]+", "+o+"}}</"+i+">":1===s.length&&(t=t+"<"+i+">{{"+s[0]+"}}</"+i+">")}}),t}function y(t,e,n){function i(t,e){return"[object Array]"!==Object.prototype.toString.call(t)&&(t=[t]),"[object Array]"!==Object.prototype.toString.call(e)&&(e=[e]),e.reduce(function(e,r,o){if("tag"===r.type){var s=t[parseInt(r.name,10)]||{},a=b.isValidElement(s);if("string"==typeof s)e.push(s);else if(f(s)){var p=i(h(s),r.children);s.dummy&&(s.children=p),e.push(b.cloneElement(s,_({},s.props,{key:o}),p))}else if("object"!==(void 0===s?"undefined":I(s))||a)e.push(s);else{var c=n.services.interpolator.interpolate(r.children[0].content,s,n.language);e.push(c)}}else"text"===r.type&&e.push(r.content);return e},[])}return h(i([{dummy:!0,children:t}],H.parse("<0>"+e+"</0>"))[0])}function m(t,e){for(var n=0,i=t.length;n<i;n++)if("object"===I(t[n])){var r=!0,o=!1,s=void 0;try{for(var a,p=Object.entries(t[n])[Symbol.iterator]();!(r=(a=p.next()).done);r=!0){var c=k(a.value,2),u=c[0],l=c[1];e(l,n,u)}}catch(t){o=!0,s=t}finally{try{!r&&p.return&&p.return()}finally{if(o)throw s}}}else e(t[n],n)}function g(t){var e=[];return m(t,function(t){t&&t.namespaces&&t.namespaces.forEach(function(t){-1===e.indexOf(t)&&e.push(t)})}),e}function v(t){var e=t.components,n=t.i18n,i=g(e);return new Promise(function(t){n.loadNamespaces(i,t)})}var b="default"in e?e.default:e;n="default"in n?n.default:n;var S={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},O={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0},x="function"==typeof Object.getOwnPropertySymbols,j=function(t,e,n){if("string"!=typeof e){var i=Object.getOwnPropertyNames(e);x&&(i=i.concat(Object.getOwnPropertySymbols(e)));for(var r=0;r<i.length;++r)if(!(S[i[r]]||O[i[r]]||n&&n[i[r]]))try{t[i[r]]=e[i[r]]}catch(t){}}return t},I="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},w=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},P=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}}(),_=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},C=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)},E=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},T=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},k=function(){function t(t,e){var n=[],i=!0,r=!1,o=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){r=!0,o=t}finally{try{!i&&a.return&&a.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")}}(),N={wait:!1,withRef:!1,bindI18n:"languageChanged loaded",bindStore:"added removed",translateFuncName:"t",nsMode:"default"},R=void 0,L={type:"3rdParty",init:function(t){i(t.options.react),o(t)}},A=!1,W=function(t){function e(t,n){w(this,e);var i=T(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));i.i18n=n.i18n||t.i18n||s(),i.namespaces=i.props.ns||i.i18n.options.defaultNS,"string"==typeof i.namespaces&&(i.namespaces=[i.namespaces]);var o=i.i18n&&i.i18n.options.react||{};return i.options=_({},r(),o,t),t.initialI18nStore&&(i.i18n.services.resourceStore.data=t.initialI18nStore,i.options.wait=!1),t.initialLanguage&&i.i18n.changeLanguage(t.initialLanguage),i.i18n.options.isInitialSSR&&(i.options.wait=!1),i.state={i18nLoadedAt:null,ready:!1},i.onI18nChanged=i.onI18nChanged.bind(i),i}return C(e,t),P(e,[{key:"getChildContext",value:function(){return{t:this.t,i18n:this.i18n}}},{key:"componentWillMount",value:function(){this.t=this.i18n.getFixedT(null,"fallback"===this.options.nsMode?this.namespaces:this.namespaces[0])}},{key:"componentDidMount",value:function(){var t=this,e=function(){t.options.bindI18n&&t.i18n&&t.i18n.on(t.options.bindI18n,t.onI18nChanged),t.options.bindStore&&t.i18n.store&&t.i18n.store.on(t.options.bindStore,t.onI18nChanged)};this.mounted=!0,this.i18n.loadNamespaces(this.namespaces,function(){var n=function(){t.mounted&&!t.state.ready&&t.setState({ready:!0}),t.options.wait&&t.mounted&&e()};if(t.i18n.isInitialized)n();else{var i=function e(){setTimeout(function(){t.i18n.off("initialized",e)},1e3),n()};t.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(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:"render",value:function(){var t=this,e=this.props.children;return!this.state.ready&&this.options.wait?null:(this.i18n.options.isInitialSSR&&!A&&(A=!0,setTimeout(function(){delete t.i18n.options.isInitialSSR},100)),e(this.t,{i18n:this.i18n,t:this.t}))}}]),e}(e.PureComponent);W.contextTypes={i18n:n.object},W.childContextTypes={t:n.func.isRequired,i18n:n.object},p.setDefaults=i,p.setI18n=o;var M=function(t){function e(t,n){w(this,e);var i=T(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));return i.i18n=t.i18n||n.i18n,i.t=t.t||n.t,i}return C(e,t),P(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,s=this.props.useDangerouslySetInnerHTML||!1,a=this.props.dangerouslySetInnerHTMLPartElement||"span",p=_({},this.props.options,{interpolation:{prefix:"#$?",suffix:"?$#"}}),c=this.t(this.props.i18nKey,p);if(!c||"string"!=typeof c)return b.createElement("noscript",null);var u=[],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 "+c),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 "+c),t.i18n.options.interpolation.format(n[r],o,t.i18n.language)};c.split(n).reduce(function(e,n,i){var r=void 0;if(i%2==0){if(0===n.length)return e;r=s?b.createElement(a,{dangerouslySetInnerHTML:{__html:n}}):n}else r=l(n,t.props);return e.push(r),e},u);var f={};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&&(f["data-i18next-options"]=JSON.stringify({ns:h}))}return r&&(f.className=r),o&&(f.style=o),b.createElement.apply(this,[e,f].concat(u))}}]),e}(e.PureComponent);M.propTypes={className:n.string},M.defaultProps={className:""},M.contextTypes={i18n:n.object.isRequired,t:n.func.isRequired};var q={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,menuitem:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},D=function(t){var e,n=0,i=!0,r={type:"tag",name:"",voidElement:!1,attrs:{},children:[]};return t.replace(/([\w-]+)|=|(['"])([.\s\S]*?)\2/g,function(o){if("="===o)return i=!0,void n++;i?0===n?((q[o]||"/"===t.charAt(t.length-2))&&(r.voidElement=!0),r.name=o):(r.attrs[e]=o.replace(/^['"]|['"]$/g,""),e=void 0):(e&&(r.attrs[e]=e),e=o),n++,i=!1}),r},K=Object.create?Object.create(null):{},$=function(t,e){e||(e={}),e.components||(e.components=K);var n,i=[],r=-1,o=[],s={},a=!1;return t.replace(/(?:<!--[\S\s]*?-->|<(?:"[^"]*"['"]*|'[^']*'['"]*|[^'">])+>)/g,function(p,u){if(a){if(p!=="</"+n.name+">")return;a=!1}var l,f="/"!==p.charAt(1),h=0===p.indexOf("\x3c!--"),d=u+p.length,y=t.charAt(d);f&&!h&&(r++,n=D(p),"tag"===n.type&&e.components[n.name]&&(n.type="component",a=!0),n.voidElement||a||!y||"<"===y||c(n.children,t,r,d,e.ignoreWhitespace),s[n.tagName]=n,0===r&&i.push(n),l=o[r-1],l&&l.children.push(n),o[r]=n),(h||!f||n.voidElement)&&(h||r--,!a&&"<"!==y&&y&&(l=-1===r?i:o[r].children,c(l,t,r,d,e.ignoreWhitespace)))}),!i.length&&t.length&&c(i,t,0,0,e.ignoreWhitespace),i},z=function(t){return t.reduce(function(t,e){return t+l("",e)},"")},H={parse:$,stringify:z},V=function(t){function e(t,n){w(this,e);var i=T(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));return i.i18n=t.i18n||n.i18n,i.t=t.t||n.t,i}return C(e,t),P(e,[{key:"render",value:function(){var t=this.props,e=t.children,n=t.count,i=t.parent,r=t.i18nKey,o=E(t,["children","count","parent","i18nKey"]),s=d("",e,0),a=r||s,p=this.t(a,{interpolation:{prefix:"#$?",suffix:"?$#"},defaultValue:s,count:n});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(r&&this.i18n.options.nsSeparator&&r.indexOf(this.i18n.options.nsSeparator)>-1){c=r.split(this.i18n.options.nsSeparator)[0]}this.t.ns&&(o["data-i18next-options"]=JSON.stringify({ns:c}))}return b.createElement(i,o,y(e,p,this.i18n))}}]),e}(b.PureComponent);V.propTypes={count:n.number,parent:n.string,i18nKey:n.string},V.defaultProps={parent:"div"},V.contextTypes={i18n:n.object.isRequired,t:n.func.isRequired};var F=function(t){function n(t,e){w(this,n);var i=T(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 C(n,t),P(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.PureComponent);F.propTypes={i18n:n.object.isRequired,children:n.element.isRequired},F.childContextTypes={i18n:n.object.isRequired},t.translate=p,t.I18n=W,t.Interpolate=M,t.Trans=V,t.I18nextProvider=F,t.loadNamespaces=v,t.reactI18nextModule=L,t.setDefaults=i,t.getDefaults=r,t.setI18n=o,t.getI18n=s,Object.defineProperty(t,"__esModule",{value:!0})});

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

var I18nextProvider = function (_Component) {
_inherits(I18nextProvider, _Component);
var I18nextProvider = function (_PureComponent) {
_inherits(I18nextProvider, _PureComponent);

@@ -65,3 +65,3 @@ function I18nextProvider(props, context) {

return I18nextProvider;
}(_react.Component);
}(_react.PureComponent);

@@ -68,0 +68,0 @@ I18nextProvider.propTypes = {

@@ -6,30 +6,90 @@ 'use strict';

});
exports.Trans = exports.I18nextProvider = exports.Interpolate = exports.translate = exports.loadNamespaces = undefined;
var _translate = require('./translate');
var _translate2 = _interopRequireDefault(_translate);
Object.defineProperty(exports, 'translate', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_translate).default;
}
});
var _interpolate = require('./interpolate');
var _I18n = require('./I18n');
var _interpolate2 = _interopRequireDefault(_interpolate);
Object.defineProperty(exports, 'I18n', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_I18n).default;
}
});
var _trans = require('./trans');
var _Interpolate = require('./Interpolate');
var _trans2 = _interopRequireDefault(_trans);
Object.defineProperty(exports, 'Interpolate', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Interpolate).default;
}
});
var _Trans = require('./Trans');
Object.defineProperty(exports, 'Trans', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Trans).default;
}
});
var _I18nextProvider = require('./I18nextProvider');
var _I18nextProvider2 = _interopRequireDefault(_I18nextProvider);
Object.defineProperty(exports, 'I18nextProvider', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_I18nextProvider).default;
}
});
var _loadNamespaces = require('./loadNamespaces');
var _loadNamespaces2 = _interopRequireDefault(_loadNamespaces);
Object.defineProperty(exports, 'loadNamespaces', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_loadNamespaces).default;
}
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _context = require('./context');
exports.loadNamespaces = _loadNamespaces2.default;
exports.translate = _translate2.default;
exports.Interpolate = _interpolate2.default;
exports.I18nextProvider = _I18nextProvider2.default;
exports.Trans = _trans2.default;
Object.defineProperty(exports, 'reactI18nextModule', {
enumerable: true,
get: function get() {
return _context.reactI18nextModule;
}
});
Object.defineProperty(exports, 'setDefaults', {
enumerable: true,
get: function get() {
return _context.setDefaults;
}
});
Object.defineProperty(exports, 'getDefaults', {
enumerable: true,
get: function get() {
return _context.getDefaults;
}
});
Object.defineProperty(exports, 'setI18n', {
enumerable: true,
get: function get() {
return _context.setI18n;
}
});
Object.defineProperty(exports, 'getI18n', {
enumerable: true,
get: function get() {
return _context.getI18n;
}
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -25,6 +25,10 @@ 'use strict';

var _context = require('./context');
var _I18n = require('./I18n');
var _I18n2 = _interopRequireDefault(_I18n);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -36,13 +40,2 @@

var defaultOptions = {
wait: false,
withRef: false,
bindI18n: 'languageChanged loaded',
bindStore: 'added removed',
translateFuncName: 't',
nsMode: 'default'
};
var i18n = void 0;
function getDisplayName(component) {

@@ -52,16 +45,10 @@ return component.displayName || component.name || 'Component';

var removedIsInitialSSR = false;
function translate(namespaces) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var _options$translateFun = options.translateFuncName,
translateFuncName = _options$translateFun === undefined ? defaultOptions.translateFuncName : _options$translateFun;
return function Wrapper(WrappedComponent) {
var _Translate$childConte;
var Translate = function (_PureComponent) {
_inherits(Translate, _PureComponent);
var Translate = function (_Component) {
_inherits(Translate, _Component);
function Translate(props, context) {

@@ -72,3 +59,3 @@ _classCallCheck(this, Translate);

_this.i18n = context.i18n || props.i18n || options.i18n || i18n;
_this.i18n = context.i18n || props.i18n || options.i18n || (0, _context.getI18n)();
namespaces = namespaces || _this.i18n.options.defaultNS;

@@ -78,24 +65,4 @@ if (typeof namespaces === 'string') namespaces = [namespaces];

var i18nOptions = _this.i18n && _this.i18n.options.react || {};
_this.options = _extends({}, defaultOptions, i18nOptions, options);
_this.options = _extends({}, (0, _context.getDefaults)(), i18nOptions, options);
// nextjs SSR: getting data from next.js or other ssr stack
if (props.initialI18nStore) {
_this.i18n.services.resourceStore.data = props.initialI18nStore;
_this.options.wait = false; // we got all passed down already
}
if (props.initialLanguage) {
_this.i18n.changeLanguage(props.initialLanguage);
}
// provider SSR: data was set in provider and ssr flag was set
if (_this.i18n.options.isInitialSSR) {
_this.options.wait = false;
}
_this.state = {
i18nLoadedAt: null,
ready: false
};
_this.onI18nChanged = _this.onI18nChanged.bind(_this);
_this.getWrappedInstance = _this.getWrappedInstance.bind(_this);

@@ -106,76 +73,2 @@ return _this;

_createClass(Translate, [{
key: 'getChildContext',
value: function getChildContext() {
var _ref;
return _ref = {}, _defineProperty(_ref, translateFuncName, this[translateFuncName]), _defineProperty(_ref, 'i18n', this.i18n), _ref;
}
}, {
key: 'componentWillMount',
value: function componentWillMount() {
this[translateFuncName] = this.i18n.getFixedT(null, this.options.nsMode === 'fallback' ? namespaces : namespaces[0]);
}
}, {
key: 'componentDidMount',
value: function componentDidMount() {
var _this2 = this;
var bind = function bind() {
if (_this2.options.bindI18n && _this2.i18n) _this2.i18n.on(_this2.options.bindI18n, _this2.onI18nChanged);
if (_this2.options.bindStore && _this2.i18n.store) _this2.i18n.store.on(_this2.options.bindStore, _this2.onI18nChanged);
};
this.mounted = true;
this.i18n.loadNamespaces(namespaces, function () {
var ready = function ready() {
if (_this2.mounted && !_this2.state.ready) _this2.setState({ ready: true });
if (_this2.options.wait && _this2.mounted) bind();
};
if (_this2.i18n.isInitialized) {
ready();
} else {
var initialized = function initialized() {
// due to emitter removing issue in i18next we need to delay remove
setTimeout(function () {
_this2.i18n.off('initialized', initialized);
}, 1000);
ready();
};
_this2.i18n.on('initialized', initialized);
}
});
if (!this.options.wait) bind();
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
var _this3 = this;
this.mounted = false;
if (this.onI18nChanged) {
if (this.options.bindI18n) {
var p = this.options.bindI18n.split(' ');
p.forEach(function (f) {
return _this3.i18n.off(f, _this3.onI18nChanged);
});
}
if (this.options.bindStore) {
var _p = this.options.bindStore.split(' ');
_p.forEach(function (f) {
return _this3.i18n.store && _this3.i18n.store.off(f, _this3.onI18nChanged);
});
}
}
}
}, {
key: 'onI18nChanged',
value: function onI18nChanged() {
if (!this.mounted) return;
this.setState({ i18nLoadedAt: new Date() });
}
}, {
key: 'getWrappedInstance',

@@ -189,3 +82,3 @@ value: function getWrappedInstance() {

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

@@ -195,28 +88,15 @@ }, {

value: function render() {
var _extraProps,
_this4 = this;
var _this2 = this;
var _state = this.state,
i18nLoadedAt = _state.i18nLoadedAt,
ready = _state.ready;
var extraProps = {};
var extraProps = (_extraProps = {
i18nLoadedAt: i18nLoadedAt
}, _defineProperty(_extraProps, translateFuncName, this[translateFuncName]), _defineProperty(_extraProps, 'i18n', this.i18n), _extraProps);
if (this.options.withRef) {
extraProps.ref = 'wrappedInstance';
extraProps.ref = function (c) {
_this2.wrappedInstance = c;
};
}
if (!ready && this.options.wait) return null;
// remove ssr flag set by provider - first render was done from now on wait if set to wait
if (this.i18n.options.isInitialSSR && !removedIsInitialSSR) {
removedIsInitialSSR = true;
setTimeout(function () {
delete _this4.i18n.options.isInitialSSR;
}, 100);
}
return _react2.default.createElement(WrappedComponent, _extends({}, this.props, extraProps));
return _react2.default.createElement(_I18n2.default, _extends({ ns: namespaces }, this.options, this.props, { i18n: this.i18n }), function (t, context) {
return _react2.default.createElement(WrappedComponent, _extends({}, _this2.props, extraProps, context));
});
}

@@ -226,3 +106,3 @@ }]);

return Translate;
}(_react.Component);
}(_react.PureComponent);

@@ -235,4 +115,2 @@ Translate.WrappedComponent = WrappedComponent;

Translate.childContextTypes = (_Translate$childConte = {}, _defineProperty(_Translate$childConte, translateFuncName, _propTypes2.default.func.isRequired), _defineProperty(_Translate$childConte, 'i18n', _propTypes2.default.object), _Translate$childConte);
Translate.displayName = 'Translate(' + getDisplayName(WrappedComponent) + ')';

@@ -246,8 +124,4 @@

translate.setDefaults = function setDefaults(options) {
defaultOptions = _extends({}, defaultOptions, options);
};
translate.setDefaults = _context.setDefaults;
translate.setI18n = function setI18n(instance) {
i18n = instance;
};
translate.setI18n = _context.setI18n;

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

import { Component, Children } from 'react';
import { PureComponent, Children } from 'react';
import PropTypes from 'prop-types';
var I18nextProvider = function (_Component) {
_inherits(I18nextProvider, _Component);
var I18nextProvider = function (_PureComponent) {
_inherits(I18nextProvider, _PureComponent);

@@ -54,3 +54,3 @@ function I18nextProvider(props, context) {

return I18nextProvider;
}(Component);
}(PureComponent);

@@ -57,0 +57,0 @@ I18nextProvider.propTypes = {

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

import translate from './translate';
import Interpolate from './interpolate';
import Trans from './trans';
import I18nextProvider from './I18nextProvider';
import loadNamespaces from './loadNamespaces';
export { loadNamespaces, translate, Interpolate, I18nextProvider, Trans };
export { default as translate } from './translate';
export { default as I18n } from './I18n';
export { default as Interpolate } from './Interpolate';
export { default as Trans } from './Trans';
export { default as I18nextProvider } from './I18nextProvider';
export { default as loadNamespaces } from './loadNamespaces';
export { reactI18nextModule, setDefaults, getDefaults, setI18n, getI18n } from './context';

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

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -14,17 +12,8 @@

import React, { Component } from 'react';
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import hoistStatics from 'hoist-non-react-statics';
import { getDefaults, setDefaults, getI18n, setI18n } from './context';
import I18n from './I18n';
var defaultOptions = {
wait: false,
withRef: false,
bindI18n: 'languageChanged loaded',
bindStore: 'added removed',
translateFuncName: 't',
nsMode: 'default'
};
var i18n = void 0;
function getDisplayName(component) {

@@ -34,16 +23,10 @@ return component.displayName || component.name || 'Component';

var removedIsInitialSSR = false;
export default function translate(namespaces) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var _options$translateFun = options.translateFuncName,
translateFuncName = _options$translateFun === undefined ? defaultOptions.translateFuncName : _options$translateFun;
return function Wrapper(WrappedComponent) {
var _Translate$childConte;
var Translate = function (_PureComponent) {
_inherits(Translate, _PureComponent);
var Translate = function (_Component) {
_inherits(Translate, _Component);
function Translate(props, context) {

@@ -54,3 +37,3 @@ _classCallCheck(this, Translate);

_this.i18n = context.i18n || props.i18n || options.i18n || i18n;
_this.i18n = context.i18n || props.i18n || options.i18n || getI18n();
namespaces = namespaces || _this.i18n.options.defaultNS;

@@ -60,24 +43,4 @@ if (typeof namespaces === 'string') namespaces = [namespaces];

var i18nOptions = _this.i18n && _this.i18n.options.react || {};
_this.options = _extends({}, defaultOptions, i18nOptions, options);
_this.options = _extends({}, getDefaults(), i18nOptions, options);
// nextjs SSR: getting data from next.js or other ssr stack
if (props.initialI18nStore) {
_this.i18n.services.resourceStore.data = props.initialI18nStore;
_this.options.wait = false; // we got all passed down already
}
if (props.initialLanguage) {
_this.i18n.changeLanguage(props.initialLanguage);
}
// provider SSR: data was set in provider and ssr flag was set
if (_this.i18n.options.isInitialSSR) {
_this.options.wait = false;
}
_this.state = {
i18nLoadedAt: null,
ready: false
};
_this.onI18nChanged = _this.onI18nChanged.bind(_this);
_this.getWrappedInstance = _this.getWrappedInstance.bind(_this);

@@ -88,76 +51,2 @@ return _this;

_createClass(Translate, [{
key: 'getChildContext',
value: function getChildContext() {
var _ref;
return _ref = {}, _defineProperty(_ref, translateFuncName, this[translateFuncName]), _defineProperty(_ref, 'i18n', this.i18n), _ref;
}
}, {
key: 'componentWillMount',
value: function componentWillMount() {
this[translateFuncName] = this.i18n.getFixedT(null, this.options.nsMode === 'fallback' ? namespaces : namespaces[0]);
}
}, {
key: 'componentDidMount',
value: function componentDidMount() {
var _this2 = this;
var bind = function bind() {
if (_this2.options.bindI18n && _this2.i18n) _this2.i18n.on(_this2.options.bindI18n, _this2.onI18nChanged);
if (_this2.options.bindStore && _this2.i18n.store) _this2.i18n.store.on(_this2.options.bindStore, _this2.onI18nChanged);
};
this.mounted = true;
this.i18n.loadNamespaces(namespaces, function () {
var ready = function ready() {
if (_this2.mounted && !_this2.state.ready) _this2.setState({ ready: true });
if (_this2.options.wait && _this2.mounted) bind();
};
if (_this2.i18n.isInitialized) {
ready();
} else {
var initialized = function initialized() {
// due to emitter removing issue in i18next we need to delay remove
setTimeout(function () {
_this2.i18n.off('initialized', initialized);
}, 1000);
ready();
};
_this2.i18n.on('initialized', initialized);
}
});
if (!this.options.wait) bind();
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
var _this3 = this;
this.mounted = false;
if (this.onI18nChanged) {
if (this.options.bindI18n) {
var p = this.options.bindI18n.split(' ');
p.forEach(function (f) {
return _this3.i18n.off(f, _this3.onI18nChanged);
});
}
if (this.options.bindStore) {
var _p = this.options.bindStore.split(' ');
_p.forEach(function (f) {
return _this3.i18n.store && _this3.i18n.store.off(f, _this3.onI18nChanged);
});
}
}
}
}, {
key: 'onI18nChanged',
value: function onI18nChanged() {
if (!this.mounted) return;
this.setState({ i18nLoadedAt: new Date() });
}
}, {
key: 'getWrappedInstance',

@@ -171,3 +60,3 @@ value: function getWrappedInstance() {

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

@@ -177,28 +66,15 @@ }, {

value: function render() {
var _extraProps,
_this4 = this;
var _this2 = this;
var _state = this.state,
i18nLoadedAt = _state.i18nLoadedAt,
ready = _state.ready;
var extraProps = {};
var extraProps = (_extraProps = {
i18nLoadedAt: i18nLoadedAt
}, _defineProperty(_extraProps, translateFuncName, this[translateFuncName]), _defineProperty(_extraProps, 'i18n', this.i18n), _extraProps);
if (this.options.withRef) {
extraProps.ref = 'wrappedInstance';
extraProps.ref = function (c) {
_this2.wrappedInstance = c;
};
}
if (!ready && this.options.wait) return null;
// remove ssr flag set by provider - first render was done from now on wait if set to wait
if (this.i18n.options.isInitialSSR && !removedIsInitialSSR) {
removedIsInitialSSR = true;
setTimeout(function () {
delete _this4.i18n.options.isInitialSSR;
}, 100);
}
return React.createElement(WrappedComponent, _extends({}, this.props, extraProps));
return React.createElement(I18n, _extends({ ns: namespaces }, this.options, this.props, { i18n: this.i18n }), function (t, context) {
return React.createElement(WrappedComponent, _extends({}, _this2.props, extraProps, context));
});
}

@@ -208,3 +84,3 @@ }]);

return Translate;
}(Component);
}(PureComponent);

@@ -217,4 +93,2 @@ Translate.WrappedComponent = WrappedComponent;

Translate.childContextTypes = (_Translate$childConte = {}, _defineProperty(_Translate$childConte, translateFuncName, PropTypes.func.isRequired), _defineProperty(_Translate$childConte, 'i18n', PropTypes.object), _Translate$childConte);
Translate.displayName = 'Translate(' + getDisplayName(WrappedComponent) + ')';

@@ -228,8 +102,4 @@

translate.setDefaults = function setDefaults(options) {
defaultOptions = _extends({}, defaultOptions, options);
};
translate.setDefaults = setDefaults;
translate.setI18n = function setI18n(instance) {
i18n = instance;
};
translate.setI18n = setI18n;

@@ -103,16 +103,3 @@ (function (global, factory) {

var defineProperty = function (obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
};

@@ -232,131 +219,205 @@ var _extends = Object.assign || function (target) {

function getDisplayName(component) {
return component.displayName || component.name || 'Component';
function setDefaults(options) {
defaultOptions = _extends({}, defaultOptions, options);
}
function getDefaults() {
return defaultOptions;
}
function setI18n(instance) {
i18n = instance;
}
function getI18n() {
return i18n;
}
var reactI18nextModule = {
type: '3rdParty',
init: function init(instance) {
setDefaults(instance.options.react);
setI18n(instance);
}
};
var removedIsInitialSSR = false;
function translate(namespaces) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var _options$translateFun = options.translateFuncName,
translateFuncName = _options$translateFun === undefined ? defaultOptions.translateFuncName : _options$translateFun;
var I18n = function (_PureComponent) {
inherits(I18n, _PureComponent);
function I18n(props, context) {
classCallCheck(this, I18n);
return function Wrapper(WrappedComponent) {
var _Translate$childConte;
var _this = possibleConstructorReturn(this, (I18n.__proto__ || Object.getPrototypeOf(I18n)).call(this, props, context));
var Translate = function (_Component) {
inherits(Translate, _Component);
_this.i18n = context.i18n || props.i18n || getI18n();
_this.namespaces = _this.props.ns || _this.i18n.options.defaultNS;
if (typeof _this.namespaces === 'string') _this.namespaces = [_this.namespaces];
function Translate(props, context) {
classCallCheck(this, Translate);
var i18nOptions = _this.i18n && _this.i18n.options.react || {};
_this.options = _extends({}, getDefaults(), i18nOptions, props);
var _this = possibleConstructorReturn(this, (Translate.__proto__ || Object.getPrototypeOf(Translate)).call(this, props, context));
// nextjs SSR: getting data from next.js or other ssr stack
if (props.initialI18nStore) {
_this.i18n.services.resourceStore.data = props.initialI18nStore;
_this.options.wait = false; // we got all passed down already
}
if (props.initialLanguage) {
_this.i18n.changeLanguage(props.initialLanguage);
}
_this.i18n = context.i18n || props.i18n || options.i18n || i18n;
namespaces = namespaces || _this.i18n.options.defaultNS;
if (typeof namespaces === 'string') namespaces = [namespaces];
// provider SSR: data was set in provider and ssr flag was set
if (_this.i18n.options.isInitialSSR) {
_this.options.wait = false;
}
var i18nOptions = _this.i18n && _this.i18n.options.react || {};
_this.options = _extends({}, defaultOptions, i18nOptions, options);
_this.state = {
i18nLoadedAt: null,
ready: false
};
// nextjs SSR: getting data from next.js or other ssr stack
if (props.initialI18nStore) {
_this.i18n.services.resourceStore.data = props.initialI18nStore;
_this.options.wait = false; // we got all passed down already
}
if (props.initialLanguage) {
_this.i18n.changeLanguage(props.initialLanguage);
}
_this.onI18nChanged = _this.onI18nChanged.bind(_this);
return _this;
}
// provider SSR: data was set in provider and ssr flag was set
if (_this.i18n.options.isInitialSSR) {
_this.options.wait = false;
}
createClass(I18n, [{
key: 'getChildContext',
value: function getChildContext() {
return {
t: this.t,
i18n: this.i18n
};
}
}, {
key: 'componentWillMount',
value: function componentWillMount() {
this.t = this.i18n.getFixedT(null, this.options.nsMode === 'fallback' ? this.namespaces : this.namespaces[0]);
}
}, {
key: 'componentDidMount',
value: function componentDidMount() {
var _this2 = this;
_this.state = {
i18nLoadedAt: null,
ready: false
var bind = function bind() {
if (_this2.options.bindI18n && _this2.i18n) _this2.i18n.on(_this2.options.bindI18n, _this2.onI18nChanged);
if (_this2.options.bindStore && _this2.i18n.store) _this2.i18n.store.on(_this2.options.bindStore, _this2.onI18nChanged);
};
this.mounted = true;
this.i18n.loadNamespaces(this.namespaces, function () {
var ready = function ready() {
if (_this2.mounted && !_this2.state.ready) _this2.setState({ ready: true });
if (_this2.options.wait && _this2.mounted) bind();
};
_this.onI18nChanged = _this.onI18nChanged.bind(_this);
_this.getWrappedInstance = _this.getWrappedInstance.bind(_this);
return _this;
}
if (_this2.i18n.isInitialized) {
ready();
} else {
var initialized = function initialized() {
// due to emitter removing issue in i18next we need to delay remove
setTimeout(function () {
_this2.i18n.off('initialized', initialized);
}, 1000);
ready();
};
createClass(Translate, [{
key: 'getChildContext',
value: function getChildContext() {
var _ref;
_this2.i18n.on('initialized', initialized);
}
});
return _ref = {}, defineProperty(_ref, translateFuncName, this[translateFuncName]), defineProperty(_ref, 'i18n', this.i18n), _ref;
if (!this.options.wait) bind();
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
var _this3 = this;
this.mounted = false;
if (this.onI18nChanged) {
if (this.options.bindI18n) {
var p = this.options.bindI18n.split(' ');
p.forEach(function (f) {
return _this3.i18n.off(f, _this3.onI18nChanged);
});
}
}, {
key: 'componentWillMount',
value: function componentWillMount() {
this[translateFuncName] = this.i18n.getFixedT(null, this.options.nsMode === 'fallback' ? namespaces : namespaces[0]);
if (this.options.bindStore) {
var _p = this.options.bindStore.split(' ');
_p.forEach(function (f) {
return _this3.i18n.store && _this3.i18n.store.off(f, _this3.onI18nChanged);
});
}
}, {
key: 'componentDidMount',
value: function componentDidMount() {
var _this2 = this;
}
}
}, {
key: 'onI18nChanged',
value: function onI18nChanged() {
if (!this.mounted) return;
var bind = function bind() {
if (_this2.options.bindI18n && _this2.i18n) _this2.i18n.on(_this2.options.bindI18n, _this2.onI18nChanged);
if (_this2.options.bindStore && _this2.i18n.store) _this2.i18n.store.on(_this2.options.bindStore, _this2.onI18nChanged);
};
this.setState({ i18nLoadedAt: new Date() });
}
}, {
key: 'render',
value: function render() {
var _this4 = this;
this.mounted = true;
this.i18n.loadNamespaces(namespaces, function () {
var ready = function ready() {
if (_this2.mounted && !_this2.state.ready) _this2.setState({ ready: true });
if (_this2.options.wait && _this2.mounted) bind();
};
var children = this.props.children;
var ready = this.state.ready;
if (_this2.i18n.isInitialized) {
ready();
} else {
var initialized = function initialized() {
// due to emitter removing issue in i18next we need to delay remove
setTimeout(function () {
_this2.i18n.off('initialized', initialized);
}, 1000);
ready();
};
_this2.i18n.on('initialized', initialized);
}
});
if (!ready && this.options.wait) return null;
if (!this.options.wait) bind();
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
var _this3 = this;
// remove ssr flag set by provider - first render was done from now on wait if set to wait
if (this.i18n.options.isInitialSSR && !removedIsInitialSSR) {
removedIsInitialSSR = true;
setTimeout(function () {
delete _this4.i18n.options.isInitialSSR;
}, 100);
}
this.mounted = false;
if (this.onI18nChanged) {
if (this.options.bindI18n) {
var p = this.options.bindI18n.split(' ');
p.forEach(function (f) {
return _this3.i18n.off(f, _this3.onI18nChanged);
});
}
if (this.options.bindStore) {
var _p = this.options.bindStore.split(' ');
_p.forEach(function (f) {
return _this3.i18n.store && _this3.i18n.store.off(f, _this3.onI18nChanged);
});
}
}
}
}, {
key: 'onI18nChanged',
value: function onI18nChanged() {
if (!this.mounted) return;
return children(this.t, { i18n: this.i18n, t: this.t });
}
}]);
return I18n;
}(React.PureComponent);
this.setState({ i18nLoadedAt: new Date() });
}
}, {
I18n.contextTypes = {
i18n: PropTypes.object
};
I18n.childContextTypes = {
t: PropTypes.func.isRequired,
i18n: PropTypes.object
};
function getDisplayName(component) {
return component.displayName || component.name || 'Component';
}
function translate(namespaces) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return function Wrapper(WrappedComponent) {
var Translate = function (_PureComponent) {
inherits(Translate, _PureComponent);
function Translate(props, context) {
classCallCheck(this, Translate);
var _this = possibleConstructorReturn(this, (Translate.__proto__ || Object.getPrototypeOf(Translate)).call(this, props, context));
_this.i18n = context.i18n || props.i18n || options.i18n || getI18n();
namespaces = namespaces || _this.i18n.options.defaultNS;
if (typeof namespaces === 'string') namespaces = [namespaces];
var i18nOptions = _this.i18n && _this.i18n.options.react || {};
_this.options = _extends({}, getDefaults(), i18nOptions, options);
_this.getWrappedInstance = _this.getWrappedInstance.bind(_this);
return _this;
}
createClass(Translate, [{
key: 'getWrappedInstance',

@@ -370,3 +431,3 @@ value: function getWrappedInstance() {

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

@@ -376,32 +437,19 @@ }, {

value: function render() {
var _extraProps,
_this4 = this;
var _this2 = this;
var _state = this.state,
i18nLoadedAt = _state.i18nLoadedAt,
ready = _state.ready;
var extraProps = {};
var extraProps = (_extraProps = {
i18nLoadedAt: i18nLoadedAt
}, defineProperty(_extraProps, translateFuncName, this[translateFuncName]), defineProperty(_extraProps, 'i18n', this.i18n), _extraProps);
if (this.options.withRef) {
extraProps.ref = 'wrappedInstance';
extraProps.ref = function (c) {
_this2.wrappedInstance = c;
};
}
if (!ready && this.options.wait) return null;
// remove ssr flag set by provider - first render was done from now on wait if set to wait
if (this.i18n.options.isInitialSSR && !removedIsInitialSSR) {
removedIsInitialSSR = true;
setTimeout(function () {
delete _this4.i18n.options.isInitialSSR;
}, 100);
}
return React__default.createElement(WrappedComponent, _extends({}, this.props, extraProps));
return React__default.createElement(I18n, _extends({ ns: namespaces }, this.options, this.props, { i18n: this.i18n }), function (t, context) {
return React__default.createElement(WrappedComponent, _extends({}, _this2.props, extraProps, context));
});
}
}]);
return Translate;
}(React.Component);
}(React.PureComponent);

@@ -414,4 +462,2 @@ Translate.WrappedComponent = WrappedComponent;

Translate.childContextTypes = (_Translate$childConte = {}, defineProperty(_Translate$childConte, translateFuncName, PropTypes.func.isRequired), defineProperty(_Translate$childConte, 'i18n', PropTypes.object), _Translate$childConte);
Translate.displayName = 'Translate(' + getDisplayName(WrappedComponent) + ')';

@@ -425,12 +471,8 @@

translate.setDefaults = function setDefaults(options) {
defaultOptions = _extends({}, defaultOptions, options);
};
translate.setDefaults = setDefaults;
translate.setI18n = function setI18n(instance) {
i18n = instance;
};
translate.setI18n = setI18n;
var Interpolate = function (_Component) {
inherits(Interpolate, _Component);
var Interpolate = function (_PureComponent) {
inherits(Interpolate, _PureComponent);

@@ -442,4 +484,4 @@ function Interpolate(props, context) {

_this.i18n = context.i18n;
_this.t = context.t;
_this.i18n = props.i18n || context.i18n;
_this.t = props.t || context.t;
return _this;

@@ -521,3 +563,3 @@ }

return Interpolate;
}(React.Component);
}(React.PureComponent);

@@ -825,4 +867,4 @@ Interpolate.propTypes = {

var Trans = function (_React$Component) {
inherits(Trans, _React$Component);
var Trans = function (_React$PureComponent) {
inherits(Trans, _React$PureComponent);

@@ -834,4 +876,4 @@ function Trans(props, context) {

_this.i18n = context.i18n;
_this.t = context.t;
_this.i18n = props.i18n || context.i18n;
_this.t = props.t || context.t;
return _this;

@@ -841,5 +883,2 @@ }

createClass(Trans, [{
key: 'componentDidMount',
value: function componentDidMount() {}
}, {
key: 'render',

@@ -872,3 +911,3 @@ value: function render() {

return Trans;
}(React__default.Component);
}(React__default.PureComponent);

@@ -890,4 +929,4 @@ Trans.propTypes = {

var I18nextProvider = function (_Component) {
inherits(I18nextProvider, _Component);
var I18nextProvider = function (_PureComponent) {
inherits(I18nextProvider, _PureComponent);

@@ -931,3 +970,3 @@ function I18nextProvider(props, context) {

return I18nextProvider;
}(React.Component);
}(React.PureComponent);

@@ -982,6 +1021,6 @@ I18nextProvider.propTypes = {

var flattened = [];
eachComponents(components, function (Component$$1) {
if (Component$$1 && Component$$1.namespaces) {
eachComponents(components, function (Component) {
if (Component && Component.namespaces) {
Component$$1.namespaces.forEach(function (namespace) {
Component.namespaces.forEach(function (namespace) {
if (flattened.indexOf(namespace) === -1) {

@@ -1007,7 +1046,13 @@ flattened.push(namespace);

exports.loadNamespaces = loadNamespaces;
exports.translate = translate;
exports.I18n = I18n;
exports.Interpolate = Interpolate;
exports.Trans = Trans;
exports.I18nextProvider = I18nextProvider;
exports.Trans = Trans;
exports.loadNamespaces = loadNamespaces;
exports.reactI18nextModule = reactI18nextModule;
exports.setDefaults = setDefaults;
exports.getDefaults = getDefaults;
exports.setI18n = setI18n;
exports.getI18n = getI18n;

@@ -1014,0 +1059,0 @@ Object.defineProperty(exports, '__esModule', { value: true });

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("prop-types")):"function"==typeof define&&define.amd?define("reactI18next",["exports","react","prop-types"],e):e(t.reactI18next=t.reactI18next||{},t.React,t.PropTypes)}(this,function(t,e,n){"use strict";function i(t){return t.displayName||t.name||"Component"}function r(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=r.translateFuncName,a=void 0===o?T.translateFuncName:o;return function(o){var s,p=function(e){function n(e,i){x(this,n);var o=E(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,i));o.i18n=i.i18n||e.i18n||r.i18n||_,"string"==typeof(t=t||o.i18n.options.defaultNS)&&(t=[t]);var a=o.i18n&&o.i18n.options.react||{};return o.options=w({},T,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 I(n,e),O(n,[{key:"getChildContext",value:function(){var t;return t={},j(t,a,this[a]),j(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},j(t,a,this[a]),j(t,"i18n",this.i18n),t);return this.options.withRef&&(s.ref="wrappedInstance"),!r&&this.options.wait?null:(this.i18n.options.isInitialSSR&&!k&&(k=!0,setTimeout(function(){delete e.i18n.options.isInitialSSR},100)),y.createElement(o,w({},this.props,s)))}}]),n}(e.Component);return p.WrappedComponent=o,p.contextTypes={i18n:n.object},p.childContextTypes=(s={},j(s,a,n.func.isRequired),j(s,"i18n",n.object),s),p.displayName="Translate("+i(o)+")",p.namespaces=t,b(p,o)}}function o(t,e,n,i,r){var o=e.indexOf("<",i),a=e.slice(i,-1===o?void 0:o);/^\s*$/.test(a)&&(a=" "),(!r&&o>-1&&n+t.length>=0||" "!==a)&&t.push({type:"text",content:a})}function a(t){var e=[];for(var n in t)e.push(n+'="'+t[n]+'"');return e.length?" "+e.join(" "):""}function s(t,e){switch(e.type){case"text":return t+e.content;case"tag":return t+="<"+e.name+(e.attrs?a(e.attrs):"")+(e.voidElement?"/>":">"),e.voidElement?t:t+e.children.reduce(s,"")+"</"+e.name+">"}}function p(t){return t&&(t.children||t.props&&t.props.children)}function c(t){return t&&t.children?t.children:t.props&&t.props.children}function u(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(p(e))t=t+"<"+i+">"+u("",c(e),n+1)+"</"+i+">";else if(y.isValidElement(e))t=t+"<"+i+"></"+i+">";else if("object"===(void 0===e?"undefined":S(e))){var r=w({},e),o=r.format;delete r.format;var a=Object.keys(r);o&&1===a.length?t=t+"<"+i+">{{"+a[0]+", "+o+"}}</"+i+">":1===a.length&&(t=t+"<"+i+">{{"+a[0]+"}}</"+i+">")}}),t}function l(t,e,n){function i(t,e){return"[object Array]"!==Object.prototype.toString.call(t)&&(t=[t]),"[object Array]"!==Object.prototype.toString.call(e)&&(e=[e]),e.reduce(function(e,r,o){if("tag"===r.type){var a=t[parseInt(r.name,10)]||{},s=y.isValidElement(a);if("string"==typeof a)e.push(a);else if(p(a)){var u=i(c(a),r.children);a.dummy&&(a.children=u),e.push(y.cloneElement(a,w({},a.props,{key:o}),u))}else if("object"!==(void 0===a?"undefined":S(a))||s)e.push(a);else{var l=n.services.interpolator.interpolate(r.children[0].content,a,n.language);e.push(l)}}else"text"===r.type&&e.push(r.content);return e},[])}return c(i([{dummy:!0,children:t}],D.parse("<0>"+e+"</0>"))[0])}function f(t,e){for(var n=0,i=t.length;n<i;n++)if("object"===S(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 c=P(s.value,2),u=c[0],l=c[1];e(l,n,u)}}catch(t){o=!0,a=t}finally{try{!r&&p.return&&p.return()}finally{if(o)throw a}}}else e(t[n],n)}function d(t){var e=[];return f(t,function(t){t&&t.namespaces&&t.namespaces.forEach(function(t){-1===e.indexOf(t)&&e.push(t)})}),e}function h(t){var e=t.components,n=t.i18n,i=d(e);return new Promise(function(t){n.loadNamespaces(i,t)})}var y="default"in e?e.default:e;n="default"in n?n.default:n;var m={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},v={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0},g="function"==typeof Object.getOwnPropertySymbols,b=function(t,e,n){if("string"!=typeof e){var i=Object.getOwnPropertyNames(e);g&&(i=i.concat(Object.getOwnPropertySymbols(e)));for(var r=0;r<i.length;++r)if(!(m[i[r]]||v[i[r]]||n&&n[i[r]]))try{t[i[r]]=e[i[r]]}catch(t){}}return t},S="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},x=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},O=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}}(),j=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t},w=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},I=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)},C=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},E=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},P=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")}}(),T={wait:!1,withRef:!1,bindI18n:"languageChanged loaded",bindStore:"added removed",translateFuncName:"t",nsMode:"default"},_=void 0,k=!1;r.setDefaults=function(t){T=w({},T,t)},r.setI18n=function(t){_=t};var N=function(t){function e(t,n){x(this,e);var i=E(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));return i.i18n=n.i18n,i.t=n.t,i}return I(e,t),O(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=w({},this.props.options,{interpolation:{prefix:"#$?",suffix:"?$#"}}),c=this.t(this.props.i18nKey,p);if(!c||"string"!=typeof c)return y.createElement("noscript",null);var u=[],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 "+c),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 "+c),t.i18n.options.interpolation.format(n[r],o,t.i18n.language)};c.split(n).reduce(function(e,n,i){var r=void 0;if(i%2==0){if(0===n.length)return e;r=a?y.createElement(s,{dangerouslySetInnerHTML:{__html:n}}):n}else r=l(n,t.props);return e.push(r),e},u);var f={};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&&(f["data-i18next-options"]=JSON.stringify({ns:d}))}return r&&(f.className=r),o&&(f.style=o),y.createElement.apply(this,[e,f].concat(u))}}]),e}(e.Component);N.propTypes={className:n.string},N.defaultProps={className:""},N.contextTypes={i18n:n.object.isRequired,t:n.func.isRequired};var R={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,menuitem:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},L=/([\w-]+)|=|(['"])([.\s\S]*?)\2/g,A=function(t){var e,n=0,i=!0,r={type:"tag",name:"",voidElement:!1,attrs:{},children:[]};return t.replace(L,function(o){if("="===o)return i=!0,void n++;i?0===n?((R[o]||"/"===t.charAt(t.length-2))&&(r.voidElement=!0),r.name=o):(r.attrs[e]=o.replace(/^['"]|['"]$/g,""),e=void 0):(e&&(r.attrs[e]=e),e=o),n++,i=!1}),r},q=/(?:<!--[\S\s]*?-->|<(?:"[^"]*"['"]*|'[^']*'['"]*|[^'">])+>)/g,W=Object.create?Object.create(null):{},M=function(t,e){e||(e={}),e.components||(e.components=W);var n,i=[],r=-1,a=[],s={},p=!1;return t.replace(q,function(c,u){if(p){if(c!=="</"+n.name+">")return;p=!1}var l,f="/"!==c.charAt(1),d=0===c.indexOf("\x3c!--"),h=u+c.length,y=t.charAt(h);f&&!d&&(r++,n=A(c),"tag"===n.type&&e.components[n.name]&&(n.type="component",p=!0),n.voidElement||p||!y||"<"===y||o(n.children,t,r,h,e.ignoreWhitespace),s[n.tagName]=n,0===r&&i.push(n),l=a[r-1],l&&l.children.push(n),a[r]=n),(d||!f||n.voidElement)&&(d||r--,!p&&"<"!==y&&y&&(l=-1===r?i:a[r].children,o(l,t,r,h,e.ignoreWhitespace)))}),!i.length&&t.length&&o(i,t,0,0,e.ignoreWhitespace),i},K=function(t){return t.reduce(function(t,e){return t+s("",e)},"")},D={parse:M,stringify:K},$=function(t){function e(t,n){x(this,e);var i=E(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));return i.i18n=n.i18n,i.t=n.t,i}return I(e,t),O(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=C(t,["children","count","parent","i18nKey"]),a=u("",e,0),s=r||a,p=this.t(s,{interpolation:{prefix:"#$?",suffix:"?$#"},defaultValue:a,count:n});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(r&&this.i18n.options.nsSeparator&&r.indexOf(this.i18n.options.nsSeparator)>-1){c=r.split(this.i18n.options.nsSeparator)[0]}this.t.ns&&(o["data-i18next-options"]=JSON.stringify({ns:c}))}return y.createElement(i,o,l(e,p,this.i18n))}}]),e}(y.Component);$.propTypes={count:n.number,parent:n.string,i18nKey:n.string},$.defaultProps={parent:"div"},$.contextTypes={i18n:n.object.isRequired,t:n.func.isRequired};var F=function(t){function n(t,e){x(this,n);var i=E(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 I(n,t),O(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);F.propTypes={i18n:n.object.isRequired,children:n.element.isRequired},F.childContextTypes={i18n:n.object.isRequired},t.loadNamespaces=h,t.translate=r,t.Interpolate=N,t.I18nextProvider=F,t.Trans=$,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){N=_({},N,t)}function r(){return N}function o(t){R=t}function s(){return R}function a(t){return t.displayName||t.name||"Component"}function p(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(o){var p=function(e){function n(e,o){w(this,n);var a=T(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,o));a.i18n=o.i18n||e.i18n||i.i18n||s(),"string"==typeof(t=t||a.i18n.options.defaultNS)&&(t=[t]);var p=a.i18n&&a.i18n.options.react||{};return a.options=_({},r(),p,i),a.getWrappedInstance=a.getWrappedInstance.bind(a),a}return C(n,e),P(n,[{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.wrappedInstance}},{key:"render",value:function(){var e=this,n={};return this.options.withRef&&(n.ref=function(t){e.wrappedInstance=t}),b.createElement(A,_({ns:t},this.options,this.props,{i18n:this.i18n}),function(t,i){return b.createElement(o,_({},e.props,n,i))})}}]),n}(e.PureComponent);return p.WrappedComponent=o,p.contextTypes={i18n:n.object},p.displayName="Translate("+a(o)+")",p.namespaces=t,I(p,o)}}function c(t,e,n,i,r){var o=e.indexOf("<",i),s=e.slice(i,-1===o?void 0:o);/^\s*$/.test(s)&&(s=" "),(!r&&o>-1&&n+t.length>=0||" "!==s)&&t.push({type:"text",content:s})}function u(t){var e=[];for(var n in t)e.push(n+'="'+t[n]+'"');return e.length?" "+e.join(" "):""}function l(t,e){switch(e.type){case"text":return t+e.content;case"tag":return t+="<"+e.name+(e.attrs?u(e.attrs):"")+(e.voidElement?"/>":">"),e.voidElement?t:t+e.children.reduce(l,"")+"</"+e.name+">"}}function f(t){return t&&(t.children||t.props&&t.props.children)}function h(t){return t&&t.children?t.children:t.props&&t.props.children}function d(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(f(e))t=t+"<"+i+">"+d("",h(e),n+1)+"</"+i+">";else if(b.isValidElement(e))t=t+"<"+i+"></"+i+">";else if("object"===(void 0===e?"undefined":j(e))){var r=_({},e),o=r.format;delete r.format;var s=Object.keys(r);o&&1===s.length?t=t+"<"+i+">{{"+s[0]+", "+o+"}}</"+i+">":1===s.length&&(t=t+"<"+i+">{{"+s[0]+"}}</"+i+">")}}),t}function y(t,e,n){function i(t,e){return"[object Array]"!==Object.prototype.toString.call(t)&&(t=[t]),"[object Array]"!==Object.prototype.toString.call(e)&&(e=[e]),e.reduce(function(e,r,o){if("tag"===r.type){var s=t[parseInt(r.name,10)]||{},a=b.isValidElement(s);if("string"==typeof s)e.push(s);else if(f(s)){var p=i(h(s),r.children);s.dummy&&(s.children=p),e.push(b.cloneElement(s,_({},s.props,{key:o}),p))}else if("object"!==(void 0===s?"undefined":j(s))||a)e.push(s);else{var c=n.services.interpolator.interpolate(r.children[0].content,s,n.language);e.push(c)}}else"text"===r.type&&e.push(r.content);return e},[])}return h(i([{dummy:!0,children:t}],H.parse("<0>"+e+"</0>"))[0])}function m(t,e){for(var n=0,i=t.length;n<i;n++)if("object"===j(t[n])){var r=!0,o=!1,s=void 0;try{for(var a,p=Object.entries(t[n])[Symbol.iterator]();!(r=(a=p.next()).done);r=!0){var c=k(a.value,2),u=c[0],l=c[1];e(l,n,u)}}catch(t){o=!0,s=t}finally{try{!r&&p.return&&p.return()}finally{if(o)throw s}}}else e(t[n],n)}function g(t){var e=[];return m(t,function(t){t&&t.namespaces&&t.namespaces.forEach(function(t){-1===e.indexOf(t)&&e.push(t)})}),e}function v(t){var e=t.components,n=t.i18n,i=g(e);return new Promise(function(t){n.loadNamespaces(i,t)})}var b="default"in e?e.default:e;n="default"in n?n.default:n;var S={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},x={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0},O="function"==typeof Object.getOwnPropertySymbols,I=function(t,e,n){if("string"!=typeof e){var i=Object.getOwnPropertyNames(e);O&&(i=i.concat(Object.getOwnPropertySymbols(e)));for(var r=0;r<i.length;++r)if(!(S[i[r]]||x[i[r]]||n&&n[i[r]]))try{t[i[r]]=e[i[r]]}catch(t){}}return t},j="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},w=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},P=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}}(),_=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},C=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)},E=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},T=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},k=function(){function t(t,e){var n=[],i=!0,r=!1,o=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){r=!0,o=t}finally{try{!i&&a.return&&a.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")}}(),N={wait:!1,withRef:!1,bindI18n:"languageChanged loaded",bindStore:"added removed",translateFuncName:"t",nsMode:"default"},R=void 0,L={type:"3rdParty",init:function(t){i(t.options.react),o(t)}},q=!1,A=function(t){function e(t,n){w(this,e);var i=T(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));i.i18n=n.i18n||t.i18n||s(),i.namespaces=i.props.ns||i.i18n.options.defaultNS,"string"==typeof i.namespaces&&(i.namespaces=[i.namespaces]);var o=i.i18n&&i.i18n.options.react||{};return i.options=_({},r(),o,t),t.initialI18nStore&&(i.i18n.services.resourceStore.data=t.initialI18nStore,i.options.wait=!1),t.initialLanguage&&i.i18n.changeLanguage(t.initialLanguage),i.i18n.options.isInitialSSR&&(i.options.wait=!1),i.state={i18nLoadedAt:null,ready:!1},i.onI18nChanged=i.onI18nChanged.bind(i),i}return C(e,t),P(e,[{key:"getChildContext",value:function(){return{t:this.t,i18n:this.i18n}}},{key:"componentWillMount",value:function(){this.t=this.i18n.getFixedT(null,"fallback"===this.options.nsMode?this.namespaces:this.namespaces[0])}},{key:"componentDidMount",value:function(){var t=this,e=function(){t.options.bindI18n&&t.i18n&&t.i18n.on(t.options.bindI18n,t.onI18nChanged),t.options.bindStore&&t.i18n.store&&t.i18n.store.on(t.options.bindStore,t.onI18nChanged)};this.mounted=!0,this.i18n.loadNamespaces(this.namespaces,function(){var n=function(){t.mounted&&!t.state.ready&&t.setState({ready:!0}),t.options.wait&&t.mounted&&e()};if(t.i18n.isInitialized)n();else{var i=function e(){setTimeout(function(){t.i18n.off("initialized",e)},1e3),n()};t.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(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:"render",value:function(){var t=this,e=this.props.children;return!this.state.ready&&this.options.wait?null:(this.i18n.options.isInitialSSR&&!q&&(q=!0,setTimeout(function(){delete t.i18n.options.isInitialSSR},100)),e(this.t,{i18n:this.i18n,t:this.t}))}}]),e}(e.PureComponent);A.contextTypes={i18n:n.object},A.childContextTypes={t:n.func.isRequired,i18n:n.object},p.setDefaults=i,p.setI18n=o;var W=function(t){function e(t,n){w(this,e);var i=T(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));return i.i18n=t.i18n||n.i18n,i.t=t.t||n.t,i}return C(e,t),P(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,s=this.props.useDangerouslySetInnerHTML||!1,a=this.props.dangerouslySetInnerHTMLPartElement||"span",p=_({},this.props.options,{interpolation:{prefix:"#$?",suffix:"?$#"}}),c=this.t(this.props.i18nKey,p);if(!c||"string"!=typeof c)return b.createElement("noscript",null);var u=[],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 "+c),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 "+c),t.i18n.options.interpolation.format(n[r],o,t.i18n.language)};c.split(n).reduce(function(e,n,i){var r=void 0;if(i%2==0){if(0===n.length)return e;r=s?b.createElement(a,{dangerouslySetInnerHTML:{__html:n}}):n}else r=l(n,t.props);return e.push(r),e},u);var f={};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&&(f["data-i18next-options"]=JSON.stringify({ns:h}))}return r&&(f.className=r),o&&(f.style=o),b.createElement.apply(this,[e,f].concat(u))}}]),e}(e.PureComponent);W.propTypes={className:n.string},W.defaultProps={className:""},W.contextTypes={i18n:n.object.isRequired,t:n.func.isRequired};var M={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,menuitem:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},D=function(t){var e,n=0,i=!0,r={type:"tag",name:"",voidElement:!1,attrs:{},children:[]};return t.replace(/([\w-]+)|=|(['"])([.\s\S]*?)\2/g,function(o){if("="===o)return i=!0,void n++;i?0===n?((M[o]||"/"===t.charAt(t.length-2))&&(r.voidElement=!0),r.name=o):(r.attrs[e]=o.replace(/^['"]|['"]$/g,""),e=void 0):(e&&(r.attrs[e]=e),e=o),n++,i=!1}),r},K=Object.create?Object.create(null):{},$=function(t,e){e||(e={}),e.components||(e.components=K);var n,i=[],r=-1,o=[],s={},a=!1;return t.replace(/(?:<!--[\S\s]*?-->|<(?:"[^"]*"['"]*|'[^']*'['"]*|[^'">])+>)/g,function(p,u){if(a){if(p!=="</"+n.name+">")return;a=!1}var l,f="/"!==p.charAt(1),h=0===p.indexOf("\x3c!--"),d=u+p.length,y=t.charAt(d);f&&!h&&(r++,n=D(p),"tag"===n.type&&e.components[n.name]&&(n.type="component",a=!0),n.voidElement||a||!y||"<"===y||c(n.children,t,r,d,e.ignoreWhitespace),s[n.tagName]=n,0===r&&i.push(n),l=o[r-1],l&&l.children.push(n),o[r]=n),(h||!f||n.voidElement)&&(h||r--,!a&&"<"!==y&&y&&(l=-1===r?i:o[r].children,c(l,t,r,d,e.ignoreWhitespace)))}),!i.length&&t.length&&c(i,t,0,0,e.ignoreWhitespace),i},z=function(t){return t.reduce(function(t,e){return t+l("",e)},"")},H={parse:$,stringify:z},V=function(t){function e(t,n){w(this,e);var i=T(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));return i.i18n=t.i18n||n.i18n,i.t=t.t||n.t,i}return C(e,t),P(e,[{key:"render",value:function(){var t=this.props,e=t.children,n=t.count,i=t.parent,r=t.i18nKey,o=E(t,["children","count","parent","i18nKey"]),s=d("",e,0),a=r||s,p=this.t(a,{interpolation:{prefix:"#$?",suffix:"?$#"},defaultValue:s,count:n});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(r&&this.i18n.options.nsSeparator&&r.indexOf(this.i18n.options.nsSeparator)>-1){c=r.split(this.i18n.options.nsSeparator)[0]}this.t.ns&&(o["data-i18next-options"]=JSON.stringify({ns:c}))}return b.createElement(i,o,y(e,p,this.i18n))}}]),e}(b.PureComponent);V.propTypes={count:n.number,parent:n.string,i18nKey:n.string},V.defaultProps={parent:"div"},V.contextTypes={i18n:n.object.isRequired,t:n.func.isRequired};var F=function(t){function n(t,e){w(this,n);var i=T(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 C(n,t),P(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.PureComponent);F.propTypes={i18n:n.object.isRequired,children:n.element.isRequired},F.childContextTypes={i18n:n.object.isRequired},t.translate=p,t.I18n=A,t.Interpolate=W,t.Trans=V,t.I18nextProvider=F,t.loadNamespaces=v,t.reactI18nextModule=L,t.setDefaults=i,t.getDefaults=r,t.setI18n=o,t.getI18n=s,Object.defineProperty(t,"__esModule",{value:!0})});
{
"name": "react-i18next",
"version": "5.4.1",
"version": "6.0.0",
"description": "Internationalization for react done right. Using the i18next i18n ecosystem.",

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

@@ -103,16 +103,3 @@ (function (global, factory) {

var defineProperty = function (obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
};

@@ -232,131 +219,205 @@ var _extends = Object.assign || function (target) {

function getDisplayName(component) {
return component.displayName || component.name || 'Component';
function setDefaults(options) {
defaultOptions = _extends({}, defaultOptions, options);
}
function getDefaults() {
return defaultOptions;
}
function setI18n(instance) {
i18n = instance;
}
function getI18n() {
return i18n;
}
var reactI18nextModule = {
type: '3rdParty',
init: function init(instance) {
setDefaults(instance.options.react);
setI18n(instance);
}
};
var removedIsInitialSSR = false;
function translate(namespaces) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var _options$translateFun = options.translateFuncName,
translateFuncName = _options$translateFun === undefined ? defaultOptions.translateFuncName : _options$translateFun;
var I18n = function (_PureComponent) {
inherits(I18n, _PureComponent);
function I18n(props, context) {
classCallCheck(this, I18n);
return function Wrapper(WrappedComponent) {
var _Translate$childConte;
var _this = possibleConstructorReturn(this, (I18n.__proto__ || Object.getPrototypeOf(I18n)).call(this, props, context));
var Translate = function (_Component) {
inherits(Translate, _Component);
_this.i18n = context.i18n || props.i18n || getI18n();
_this.namespaces = _this.props.ns || _this.i18n.options.defaultNS;
if (typeof _this.namespaces === 'string') _this.namespaces = [_this.namespaces];
function Translate(props, context) {
classCallCheck(this, Translate);
var i18nOptions = _this.i18n && _this.i18n.options.react || {};
_this.options = _extends({}, getDefaults(), i18nOptions, props);
var _this = possibleConstructorReturn(this, (Translate.__proto__ || Object.getPrototypeOf(Translate)).call(this, props, context));
// nextjs SSR: getting data from next.js or other ssr stack
if (props.initialI18nStore) {
_this.i18n.services.resourceStore.data = props.initialI18nStore;
_this.options.wait = false; // we got all passed down already
}
if (props.initialLanguage) {
_this.i18n.changeLanguage(props.initialLanguage);
}
_this.i18n = context.i18n || props.i18n || options.i18n || i18n;
namespaces = namespaces || _this.i18n.options.defaultNS;
if (typeof namespaces === 'string') namespaces = [namespaces];
// provider SSR: data was set in provider and ssr flag was set
if (_this.i18n.options.isInitialSSR) {
_this.options.wait = false;
}
var i18nOptions = _this.i18n && _this.i18n.options.react || {};
_this.options = _extends({}, defaultOptions, i18nOptions, options);
_this.state = {
i18nLoadedAt: null,
ready: false
};
// nextjs SSR: getting data from next.js or other ssr stack
if (props.initialI18nStore) {
_this.i18n.services.resourceStore.data = props.initialI18nStore;
_this.options.wait = false; // we got all passed down already
}
if (props.initialLanguage) {
_this.i18n.changeLanguage(props.initialLanguage);
}
_this.onI18nChanged = _this.onI18nChanged.bind(_this);
return _this;
}
// provider SSR: data was set in provider and ssr flag was set
if (_this.i18n.options.isInitialSSR) {
_this.options.wait = false;
}
createClass(I18n, [{
key: 'getChildContext',
value: function getChildContext() {
return {
t: this.t,
i18n: this.i18n
};
}
}, {
key: 'componentWillMount',
value: function componentWillMount() {
this.t = this.i18n.getFixedT(null, this.options.nsMode === 'fallback' ? this.namespaces : this.namespaces[0]);
}
}, {
key: 'componentDidMount',
value: function componentDidMount() {
var _this2 = this;
_this.state = {
i18nLoadedAt: null,
ready: false
var bind = function bind() {
if (_this2.options.bindI18n && _this2.i18n) _this2.i18n.on(_this2.options.bindI18n, _this2.onI18nChanged);
if (_this2.options.bindStore && _this2.i18n.store) _this2.i18n.store.on(_this2.options.bindStore, _this2.onI18nChanged);
};
this.mounted = true;
this.i18n.loadNamespaces(this.namespaces, function () {
var ready = function ready() {
if (_this2.mounted && !_this2.state.ready) _this2.setState({ ready: true });
if (_this2.options.wait && _this2.mounted) bind();
};
_this.onI18nChanged = _this.onI18nChanged.bind(_this);
_this.getWrappedInstance = _this.getWrappedInstance.bind(_this);
return _this;
}
if (_this2.i18n.isInitialized) {
ready();
} else {
var initialized = function initialized() {
// due to emitter removing issue in i18next we need to delay remove
setTimeout(function () {
_this2.i18n.off('initialized', initialized);
}, 1000);
ready();
};
createClass(Translate, [{
key: 'getChildContext',
value: function getChildContext() {
var _ref;
_this2.i18n.on('initialized', initialized);
}
});
return _ref = {}, defineProperty(_ref, translateFuncName, this[translateFuncName]), defineProperty(_ref, 'i18n', this.i18n), _ref;
if (!this.options.wait) bind();
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
var _this3 = this;
this.mounted = false;
if (this.onI18nChanged) {
if (this.options.bindI18n) {
var p = this.options.bindI18n.split(' ');
p.forEach(function (f) {
return _this3.i18n.off(f, _this3.onI18nChanged);
});
}
}, {
key: 'componentWillMount',
value: function componentWillMount() {
this[translateFuncName] = this.i18n.getFixedT(null, this.options.nsMode === 'fallback' ? namespaces : namespaces[0]);
if (this.options.bindStore) {
var _p = this.options.bindStore.split(' ');
_p.forEach(function (f) {
return _this3.i18n.store && _this3.i18n.store.off(f, _this3.onI18nChanged);
});
}
}, {
key: 'componentDidMount',
value: function componentDidMount() {
var _this2 = this;
}
}
}, {
key: 'onI18nChanged',
value: function onI18nChanged() {
if (!this.mounted) return;
var bind = function bind() {
if (_this2.options.bindI18n && _this2.i18n) _this2.i18n.on(_this2.options.bindI18n, _this2.onI18nChanged);
if (_this2.options.bindStore && _this2.i18n.store) _this2.i18n.store.on(_this2.options.bindStore, _this2.onI18nChanged);
};
this.setState({ i18nLoadedAt: new Date() });
}
}, {
key: 'render',
value: function render() {
var _this4 = this;
this.mounted = true;
this.i18n.loadNamespaces(namespaces, function () {
var ready = function ready() {
if (_this2.mounted && !_this2.state.ready) _this2.setState({ ready: true });
if (_this2.options.wait && _this2.mounted) bind();
};
var children = this.props.children;
var ready = this.state.ready;
if (_this2.i18n.isInitialized) {
ready();
} else {
var initialized = function initialized() {
// due to emitter removing issue in i18next we need to delay remove
setTimeout(function () {
_this2.i18n.off('initialized', initialized);
}, 1000);
ready();
};
_this2.i18n.on('initialized', initialized);
}
});
if (!ready && this.options.wait) return null;
if (!this.options.wait) bind();
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
var _this3 = this;
// remove ssr flag set by provider - first render was done from now on wait if set to wait
if (this.i18n.options.isInitialSSR && !removedIsInitialSSR) {
removedIsInitialSSR = true;
setTimeout(function () {
delete _this4.i18n.options.isInitialSSR;
}, 100);
}
this.mounted = false;
if (this.onI18nChanged) {
if (this.options.bindI18n) {
var p = this.options.bindI18n.split(' ');
p.forEach(function (f) {
return _this3.i18n.off(f, _this3.onI18nChanged);
});
}
if (this.options.bindStore) {
var _p = this.options.bindStore.split(' ');
_p.forEach(function (f) {
return _this3.i18n.store && _this3.i18n.store.off(f, _this3.onI18nChanged);
});
}
}
}
}, {
key: 'onI18nChanged',
value: function onI18nChanged() {
if (!this.mounted) return;
return children(this.t, { i18n: this.i18n, t: this.t });
}
}]);
return I18n;
}(React.PureComponent);
this.setState({ i18nLoadedAt: new Date() });
}
}, {
I18n.contextTypes = {
i18n: PropTypes.object
};
I18n.childContextTypes = {
t: PropTypes.func.isRequired,
i18n: PropTypes.object
};
function getDisplayName(component) {
return component.displayName || component.name || 'Component';
}
function translate(namespaces) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return function Wrapper(WrappedComponent) {
var Translate = function (_PureComponent) {
inherits(Translate, _PureComponent);
function Translate(props, context) {
classCallCheck(this, Translate);
var _this = possibleConstructorReturn(this, (Translate.__proto__ || Object.getPrototypeOf(Translate)).call(this, props, context));
_this.i18n = context.i18n || props.i18n || options.i18n || getI18n();
namespaces = namespaces || _this.i18n.options.defaultNS;
if (typeof namespaces === 'string') namespaces = [namespaces];
var i18nOptions = _this.i18n && _this.i18n.options.react || {};
_this.options = _extends({}, getDefaults(), i18nOptions, options);
_this.getWrappedInstance = _this.getWrappedInstance.bind(_this);
return _this;
}
createClass(Translate, [{
key: 'getWrappedInstance',

@@ -370,3 +431,3 @@ value: function getWrappedInstance() {

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

@@ -376,32 +437,19 @@ }, {

value: function render() {
var _extraProps,
_this4 = this;
var _this2 = this;
var _state = this.state,
i18nLoadedAt = _state.i18nLoadedAt,
ready = _state.ready;
var extraProps = {};
var extraProps = (_extraProps = {
i18nLoadedAt: i18nLoadedAt
}, defineProperty(_extraProps, translateFuncName, this[translateFuncName]), defineProperty(_extraProps, 'i18n', this.i18n), _extraProps);
if (this.options.withRef) {
extraProps.ref = 'wrappedInstance';
extraProps.ref = function (c) {
_this2.wrappedInstance = c;
};
}
if (!ready && this.options.wait) return null;
// remove ssr flag set by provider - first render was done from now on wait if set to wait
if (this.i18n.options.isInitialSSR && !removedIsInitialSSR) {
removedIsInitialSSR = true;
setTimeout(function () {
delete _this4.i18n.options.isInitialSSR;
}, 100);
}
return React__default.createElement(WrappedComponent, _extends({}, this.props, extraProps));
return React__default.createElement(I18n, _extends({ ns: namespaces }, this.options, this.props, { i18n: this.i18n }), function (t, context) {
return React__default.createElement(WrappedComponent, _extends({}, _this2.props, extraProps, context));
});
}
}]);
return Translate;
}(React.Component);
}(React.PureComponent);

@@ -414,4 +462,2 @@ Translate.WrappedComponent = WrappedComponent;

Translate.childContextTypes = (_Translate$childConte = {}, defineProperty(_Translate$childConte, translateFuncName, PropTypes.func.isRequired), defineProperty(_Translate$childConte, 'i18n', PropTypes.object), _Translate$childConte);
Translate.displayName = 'Translate(' + getDisplayName(WrappedComponent) + ')';

@@ -425,12 +471,8 @@

translate.setDefaults = function setDefaults(options) {
defaultOptions = _extends({}, defaultOptions, options);
};
translate.setDefaults = setDefaults;
translate.setI18n = function setI18n(instance) {
i18n = instance;
};
translate.setI18n = setI18n;
var Interpolate = function (_Component) {
inherits(Interpolate, _Component);
var Interpolate = function (_PureComponent) {
inherits(Interpolate, _PureComponent);

@@ -442,4 +484,4 @@ function Interpolate(props, context) {

_this.i18n = context.i18n;
_this.t = context.t;
_this.i18n = props.i18n || context.i18n;
_this.t = props.t || context.t;
return _this;

@@ -521,3 +563,3 @@ }

return Interpolate;
}(React.Component);
}(React.PureComponent);

@@ -825,4 +867,4 @@ Interpolate.propTypes = {

var Trans = function (_React$Component) {
inherits(Trans, _React$Component);
var Trans = function (_React$PureComponent) {
inherits(Trans, _React$PureComponent);

@@ -834,4 +876,4 @@ function Trans(props, context) {

_this.i18n = context.i18n;
_this.t = context.t;
_this.i18n = props.i18n || context.i18n;
_this.t = props.t || context.t;
return _this;

@@ -841,5 +883,2 @@ }

createClass(Trans, [{
key: 'componentDidMount',
value: function componentDidMount() {}
}, {
key: 'render',

@@ -872,3 +911,3 @@ value: function render() {

return Trans;
}(React__default.Component);
}(React__default.PureComponent);

@@ -890,4 +929,4 @@ Trans.propTypes = {

var I18nextProvider = function (_Component) {
inherits(I18nextProvider, _Component);
var I18nextProvider = function (_PureComponent) {
inherits(I18nextProvider, _PureComponent);

@@ -931,3 +970,3 @@ function I18nextProvider(props, context) {

return I18nextProvider;
}(React.Component);
}(React.PureComponent);

@@ -982,6 +1021,6 @@ I18nextProvider.propTypes = {

var flattened = [];
eachComponents(components, function (Component$$1) {
if (Component$$1 && Component$$1.namespaces) {
eachComponents(components, function (Component) {
if (Component && Component.namespaces) {
Component$$1.namespaces.forEach(function (namespace) {
Component.namespaces.forEach(function (namespace) {
if (flattened.indexOf(namespace) === -1) {

@@ -1007,7 +1046,13 @@ flattened.push(namespace);

exports.loadNamespaces = loadNamespaces;
exports.translate = translate;
exports.I18n = I18n;
exports.Interpolate = Interpolate;
exports.Trans = Trans;
exports.I18nextProvider = I18nextProvider;
exports.Trans = Trans;
exports.loadNamespaces = loadNamespaces;
exports.reactI18nextModule = reactI18nextModule;
exports.setDefaults = setDefaults;
exports.getDefaults = getDefaults;
exports.setI18n = setI18n;
exports.getI18n = getI18n;

@@ -1014,0 +1059,0 @@ Object.defineProperty(exports, '__esModule', { value: true });

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("prop-types")):"function"==typeof define&&define.amd?define("reactI18next",["exports","react","prop-types"],e):e(t.reactI18next=t.reactI18next||{},t.React,t.PropTypes)}(this,function(t,e,n){"use strict";function i(t){return t.displayName||t.name||"Component"}function r(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=r.translateFuncName,a=void 0===o?T.translateFuncName:o;return function(o){var s,p=function(e){function n(e,i){x(this,n);var o=E(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,i));o.i18n=i.i18n||e.i18n||r.i18n||_,"string"==typeof(t=t||o.i18n.options.defaultNS)&&(t=[t]);var a=o.i18n&&o.i18n.options.react||{};return o.options=w({},T,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 I(n,e),O(n,[{key:"getChildContext",value:function(){var t;return t={},j(t,a,this[a]),j(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},j(t,a,this[a]),j(t,"i18n",this.i18n),t);return this.options.withRef&&(s.ref="wrappedInstance"),!r&&this.options.wait?null:(this.i18n.options.isInitialSSR&&!k&&(k=!0,setTimeout(function(){delete e.i18n.options.isInitialSSR},100)),y.createElement(o,w({},this.props,s)))}}]),n}(e.Component);return p.WrappedComponent=o,p.contextTypes={i18n:n.object},p.childContextTypes=(s={},j(s,a,n.func.isRequired),j(s,"i18n",n.object),s),p.displayName="Translate("+i(o)+")",p.namespaces=t,b(p,o)}}function o(t,e,n,i,r){var o=e.indexOf("<",i),a=e.slice(i,-1===o?void 0:o);/^\s*$/.test(a)&&(a=" "),(!r&&o>-1&&n+t.length>=0||" "!==a)&&t.push({type:"text",content:a})}function a(t){var e=[];for(var n in t)e.push(n+'="'+t[n]+'"');return e.length?" "+e.join(" "):""}function s(t,e){switch(e.type){case"text":return t+e.content;case"tag":return t+="<"+e.name+(e.attrs?a(e.attrs):"")+(e.voidElement?"/>":">"),e.voidElement?t:t+e.children.reduce(s,"")+"</"+e.name+">"}}function p(t){return t&&(t.children||t.props&&t.props.children)}function c(t){return t&&t.children?t.children:t.props&&t.props.children}function u(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(p(e))t=t+"<"+i+">"+u("",c(e),n+1)+"</"+i+">";else if(y.isValidElement(e))t=t+"<"+i+"></"+i+">";else if("object"===(void 0===e?"undefined":S(e))){var r=w({},e),o=r.format;delete r.format;var a=Object.keys(r);o&&1===a.length?t=t+"<"+i+">{{"+a[0]+", "+o+"}}</"+i+">":1===a.length&&(t=t+"<"+i+">{{"+a[0]+"}}</"+i+">")}}),t}function l(t,e,n){function i(t,e){return"[object Array]"!==Object.prototype.toString.call(t)&&(t=[t]),"[object Array]"!==Object.prototype.toString.call(e)&&(e=[e]),e.reduce(function(e,r,o){if("tag"===r.type){var a=t[parseInt(r.name,10)]||{},s=y.isValidElement(a);if("string"==typeof a)e.push(a);else if(p(a)){var u=i(c(a),r.children);a.dummy&&(a.children=u),e.push(y.cloneElement(a,w({},a.props,{key:o}),u))}else if("object"!==(void 0===a?"undefined":S(a))||s)e.push(a);else{var l=n.services.interpolator.interpolate(r.children[0].content,a,n.language);e.push(l)}}else"text"===r.type&&e.push(r.content);return e},[])}return c(i([{dummy:!0,children:t}],D.parse("<0>"+e+"</0>"))[0])}function f(t,e){for(var n=0,i=t.length;n<i;n++)if("object"===S(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 c=P(s.value,2),u=c[0],l=c[1];e(l,n,u)}}catch(t){o=!0,a=t}finally{try{!r&&p.return&&p.return()}finally{if(o)throw a}}}else e(t[n],n)}function d(t){var e=[];return f(t,function(t){t&&t.namespaces&&t.namespaces.forEach(function(t){-1===e.indexOf(t)&&e.push(t)})}),e}function h(t){var e=t.components,n=t.i18n,i=d(e);return new Promise(function(t){n.loadNamespaces(i,t)})}var y="default"in e?e.default:e;n="default"in n?n.default:n;var m={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},v={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0},g="function"==typeof Object.getOwnPropertySymbols,b=function(t,e,n){if("string"!=typeof e){var i=Object.getOwnPropertyNames(e);g&&(i=i.concat(Object.getOwnPropertySymbols(e)));for(var r=0;r<i.length;++r)if(!(m[i[r]]||v[i[r]]||n&&n[i[r]]))try{t[i[r]]=e[i[r]]}catch(t){}}return t},S="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},x=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},O=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}}(),j=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t},w=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},I=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)},C=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},E=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},P=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")}}(),T={wait:!1,withRef:!1,bindI18n:"languageChanged loaded",bindStore:"added removed",translateFuncName:"t",nsMode:"default"},_=void 0,k=!1;r.setDefaults=function(t){T=w({},T,t)},r.setI18n=function(t){_=t};var N=function(t){function e(t,n){x(this,e);var i=E(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));return i.i18n=n.i18n,i.t=n.t,i}return I(e,t),O(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=w({},this.props.options,{interpolation:{prefix:"#$?",suffix:"?$#"}}),c=this.t(this.props.i18nKey,p);if(!c||"string"!=typeof c)return y.createElement("noscript",null);var u=[],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 "+c),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 "+c),t.i18n.options.interpolation.format(n[r],o,t.i18n.language)};c.split(n).reduce(function(e,n,i){var r=void 0;if(i%2==0){if(0===n.length)return e;r=a?y.createElement(s,{dangerouslySetInnerHTML:{__html:n}}):n}else r=l(n,t.props);return e.push(r),e},u);var f={};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&&(f["data-i18next-options"]=JSON.stringify({ns:d}))}return r&&(f.className=r),o&&(f.style=o),y.createElement.apply(this,[e,f].concat(u))}}]),e}(e.Component);N.propTypes={className:n.string},N.defaultProps={className:""},N.contextTypes={i18n:n.object.isRequired,t:n.func.isRequired};var R={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,menuitem:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},L=/([\w-]+)|=|(['"])([.\s\S]*?)\2/g,A=function(t){var e,n=0,i=!0,r={type:"tag",name:"",voidElement:!1,attrs:{},children:[]};return t.replace(L,function(o){if("="===o)return i=!0,void n++;i?0===n?((R[o]||"/"===t.charAt(t.length-2))&&(r.voidElement=!0),r.name=o):(r.attrs[e]=o.replace(/^['"]|['"]$/g,""),e=void 0):(e&&(r.attrs[e]=e),e=o),n++,i=!1}),r},q=/(?:<!--[\S\s]*?-->|<(?:"[^"]*"['"]*|'[^']*'['"]*|[^'">])+>)/g,W=Object.create?Object.create(null):{},M=function(t,e){e||(e={}),e.components||(e.components=W);var n,i=[],r=-1,a=[],s={},p=!1;return t.replace(q,function(c,u){if(p){if(c!=="</"+n.name+">")return;p=!1}var l,f="/"!==c.charAt(1),d=0===c.indexOf("\x3c!--"),h=u+c.length,y=t.charAt(h);f&&!d&&(r++,n=A(c),"tag"===n.type&&e.components[n.name]&&(n.type="component",p=!0),n.voidElement||p||!y||"<"===y||o(n.children,t,r,h,e.ignoreWhitespace),s[n.tagName]=n,0===r&&i.push(n),l=a[r-1],l&&l.children.push(n),a[r]=n),(d||!f||n.voidElement)&&(d||r--,!p&&"<"!==y&&y&&(l=-1===r?i:a[r].children,o(l,t,r,h,e.ignoreWhitespace)))}),!i.length&&t.length&&o(i,t,0,0,e.ignoreWhitespace),i},K=function(t){return t.reduce(function(t,e){return t+s("",e)},"")},D={parse:M,stringify:K},$=function(t){function e(t,n){x(this,e);var i=E(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));return i.i18n=n.i18n,i.t=n.t,i}return I(e,t),O(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=C(t,["children","count","parent","i18nKey"]),a=u("",e,0),s=r||a,p=this.t(s,{interpolation:{prefix:"#$?",suffix:"?$#"},defaultValue:a,count:n});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(r&&this.i18n.options.nsSeparator&&r.indexOf(this.i18n.options.nsSeparator)>-1){c=r.split(this.i18n.options.nsSeparator)[0]}this.t.ns&&(o["data-i18next-options"]=JSON.stringify({ns:c}))}return y.createElement(i,o,l(e,p,this.i18n))}}]),e}(y.Component);$.propTypes={count:n.number,parent:n.string,i18nKey:n.string},$.defaultProps={parent:"div"},$.contextTypes={i18n:n.object.isRequired,t:n.func.isRequired};var F=function(t){function n(t,e){x(this,n);var i=E(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 I(n,t),O(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);F.propTypes={i18n:n.object.isRequired,children:n.element.isRequired},F.childContextTypes={i18n:n.object.isRequired},t.loadNamespaces=h,t.translate=r,t.Interpolate=N,t.I18nextProvider=F,t.Trans=$,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){N=_({},N,t)}function r(){return N}function o(t){R=t}function s(){return R}function a(t){return t.displayName||t.name||"Component"}function p(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(o){var p=function(e){function n(e,o){w(this,n);var a=T(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,o));a.i18n=o.i18n||e.i18n||i.i18n||s(),"string"==typeof(t=t||a.i18n.options.defaultNS)&&(t=[t]);var p=a.i18n&&a.i18n.options.react||{};return a.options=_({},r(),p,i),a.getWrappedInstance=a.getWrappedInstance.bind(a),a}return C(n,e),P(n,[{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.wrappedInstance}},{key:"render",value:function(){var e=this,n={};return this.options.withRef&&(n.ref=function(t){e.wrappedInstance=t}),b.createElement(A,_({ns:t},this.options,this.props,{i18n:this.i18n}),function(t,i){return b.createElement(o,_({},e.props,n,i))})}}]),n}(e.PureComponent);return p.WrappedComponent=o,p.contextTypes={i18n:n.object},p.displayName="Translate("+a(o)+")",p.namespaces=t,I(p,o)}}function c(t,e,n,i,r){var o=e.indexOf("<",i),s=e.slice(i,-1===o?void 0:o);/^\s*$/.test(s)&&(s=" "),(!r&&o>-1&&n+t.length>=0||" "!==s)&&t.push({type:"text",content:s})}function u(t){var e=[];for(var n in t)e.push(n+'="'+t[n]+'"');return e.length?" "+e.join(" "):""}function l(t,e){switch(e.type){case"text":return t+e.content;case"tag":return t+="<"+e.name+(e.attrs?u(e.attrs):"")+(e.voidElement?"/>":">"),e.voidElement?t:t+e.children.reduce(l,"")+"</"+e.name+">"}}function f(t){return t&&(t.children||t.props&&t.props.children)}function h(t){return t&&t.children?t.children:t.props&&t.props.children}function d(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(f(e))t=t+"<"+i+">"+d("",h(e),n+1)+"</"+i+">";else if(b.isValidElement(e))t=t+"<"+i+"></"+i+">";else if("object"===(void 0===e?"undefined":j(e))){var r=_({},e),o=r.format;delete r.format;var s=Object.keys(r);o&&1===s.length?t=t+"<"+i+">{{"+s[0]+", "+o+"}}</"+i+">":1===s.length&&(t=t+"<"+i+">{{"+s[0]+"}}</"+i+">")}}),t}function y(t,e,n){function i(t,e){return"[object Array]"!==Object.prototype.toString.call(t)&&(t=[t]),"[object Array]"!==Object.prototype.toString.call(e)&&(e=[e]),e.reduce(function(e,r,o){if("tag"===r.type){var s=t[parseInt(r.name,10)]||{},a=b.isValidElement(s);if("string"==typeof s)e.push(s);else if(f(s)){var p=i(h(s),r.children);s.dummy&&(s.children=p),e.push(b.cloneElement(s,_({},s.props,{key:o}),p))}else if("object"!==(void 0===s?"undefined":j(s))||a)e.push(s);else{var c=n.services.interpolator.interpolate(r.children[0].content,s,n.language);e.push(c)}}else"text"===r.type&&e.push(r.content);return e},[])}return h(i([{dummy:!0,children:t}],H.parse("<0>"+e+"</0>"))[0])}function m(t,e){for(var n=0,i=t.length;n<i;n++)if("object"===j(t[n])){var r=!0,o=!1,s=void 0;try{for(var a,p=Object.entries(t[n])[Symbol.iterator]();!(r=(a=p.next()).done);r=!0){var c=k(a.value,2),u=c[0],l=c[1];e(l,n,u)}}catch(t){o=!0,s=t}finally{try{!r&&p.return&&p.return()}finally{if(o)throw s}}}else e(t[n],n)}function g(t){var e=[];return m(t,function(t){t&&t.namespaces&&t.namespaces.forEach(function(t){-1===e.indexOf(t)&&e.push(t)})}),e}function v(t){var e=t.components,n=t.i18n,i=g(e);return new Promise(function(t){n.loadNamespaces(i,t)})}var b="default"in e?e.default:e;n="default"in n?n.default:n;var S={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},x={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0},O="function"==typeof Object.getOwnPropertySymbols,I=function(t,e,n){if("string"!=typeof e){var i=Object.getOwnPropertyNames(e);O&&(i=i.concat(Object.getOwnPropertySymbols(e)));for(var r=0;r<i.length;++r)if(!(S[i[r]]||x[i[r]]||n&&n[i[r]]))try{t[i[r]]=e[i[r]]}catch(t){}}return t},j="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},w=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},P=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}}(),_=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},C=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)},E=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},T=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},k=function(){function t(t,e){var n=[],i=!0,r=!1,o=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){r=!0,o=t}finally{try{!i&&a.return&&a.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")}}(),N={wait:!1,withRef:!1,bindI18n:"languageChanged loaded",bindStore:"added removed",translateFuncName:"t",nsMode:"default"},R=void 0,L={type:"3rdParty",init:function(t){i(t.options.react),o(t)}},q=!1,A=function(t){function e(t,n){w(this,e);var i=T(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));i.i18n=n.i18n||t.i18n||s(),i.namespaces=i.props.ns||i.i18n.options.defaultNS,"string"==typeof i.namespaces&&(i.namespaces=[i.namespaces]);var o=i.i18n&&i.i18n.options.react||{};return i.options=_({},r(),o,t),t.initialI18nStore&&(i.i18n.services.resourceStore.data=t.initialI18nStore,i.options.wait=!1),t.initialLanguage&&i.i18n.changeLanguage(t.initialLanguage),i.i18n.options.isInitialSSR&&(i.options.wait=!1),i.state={i18nLoadedAt:null,ready:!1},i.onI18nChanged=i.onI18nChanged.bind(i),i}return C(e,t),P(e,[{key:"getChildContext",value:function(){return{t:this.t,i18n:this.i18n}}},{key:"componentWillMount",value:function(){this.t=this.i18n.getFixedT(null,"fallback"===this.options.nsMode?this.namespaces:this.namespaces[0])}},{key:"componentDidMount",value:function(){var t=this,e=function(){t.options.bindI18n&&t.i18n&&t.i18n.on(t.options.bindI18n,t.onI18nChanged),t.options.bindStore&&t.i18n.store&&t.i18n.store.on(t.options.bindStore,t.onI18nChanged)};this.mounted=!0,this.i18n.loadNamespaces(this.namespaces,function(){var n=function(){t.mounted&&!t.state.ready&&t.setState({ready:!0}),t.options.wait&&t.mounted&&e()};if(t.i18n.isInitialized)n();else{var i=function e(){setTimeout(function(){t.i18n.off("initialized",e)},1e3),n()};t.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(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:"render",value:function(){var t=this,e=this.props.children;return!this.state.ready&&this.options.wait?null:(this.i18n.options.isInitialSSR&&!q&&(q=!0,setTimeout(function(){delete t.i18n.options.isInitialSSR},100)),e(this.t,{i18n:this.i18n,t:this.t}))}}]),e}(e.PureComponent);A.contextTypes={i18n:n.object},A.childContextTypes={t:n.func.isRequired,i18n:n.object},p.setDefaults=i,p.setI18n=o;var W=function(t){function e(t,n){w(this,e);var i=T(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));return i.i18n=t.i18n||n.i18n,i.t=t.t||n.t,i}return C(e,t),P(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,s=this.props.useDangerouslySetInnerHTML||!1,a=this.props.dangerouslySetInnerHTMLPartElement||"span",p=_({},this.props.options,{interpolation:{prefix:"#$?",suffix:"?$#"}}),c=this.t(this.props.i18nKey,p);if(!c||"string"!=typeof c)return b.createElement("noscript",null);var u=[],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 "+c),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 "+c),t.i18n.options.interpolation.format(n[r],o,t.i18n.language)};c.split(n).reduce(function(e,n,i){var r=void 0;if(i%2==0){if(0===n.length)return e;r=s?b.createElement(a,{dangerouslySetInnerHTML:{__html:n}}):n}else r=l(n,t.props);return e.push(r),e},u);var f={};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&&(f["data-i18next-options"]=JSON.stringify({ns:h}))}return r&&(f.className=r),o&&(f.style=o),b.createElement.apply(this,[e,f].concat(u))}}]),e}(e.PureComponent);W.propTypes={className:n.string},W.defaultProps={className:""},W.contextTypes={i18n:n.object.isRequired,t:n.func.isRequired};var M={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,menuitem:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},D=function(t){var e,n=0,i=!0,r={type:"tag",name:"",voidElement:!1,attrs:{},children:[]};return t.replace(/([\w-]+)|=|(['"])([.\s\S]*?)\2/g,function(o){if("="===o)return i=!0,void n++;i?0===n?((M[o]||"/"===t.charAt(t.length-2))&&(r.voidElement=!0),r.name=o):(r.attrs[e]=o.replace(/^['"]|['"]$/g,""),e=void 0):(e&&(r.attrs[e]=e),e=o),n++,i=!1}),r},K=Object.create?Object.create(null):{},$=function(t,e){e||(e={}),e.components||(e.components=K);var n,i=[],r=-1,o=[],s={},a=!1;return t.replace(/(?:<!--[\S\s]*?-->|<(?:"[^"]*"['"]*|'[^']*'['"]*|[^'">])+>)/g,function(p,u){if(a){if(p!=="</"+n.name+">")return;a=!1}var l,f="/"!==p.charAt(1),h=0===p.indexOf("\x3c!--"),d=u+p.length,y=t.charAt(d);f&&!h&&(r++,n=D(p),"tag"===n.type&&e.components[n.name]&&(n.type="component",a=!0),n.voidElement||a||!y||"<"===y||c(n.children,t,r,d,e.ignoreWhitespace),s[n.tagName]=n,0===r&&i.push(n),l=o[r-1],l&&l.children.push(n),o[r]=n),(h||!f||n.voidElement)&&(h||r--,!a&&"<"!==y&&y&&(l=-1===r?i:o[r].children,c(l,t,r,d,e.ignoreWhitespace)))}),!i.length&&t.length&&c(i,t,0,0,e.ignoreWhitespace),i},z=function(t){return t.reduce(function(t,e){return t+l("",e)},"")},H={parse:$,stringify:z},V=function(t){function e(t,n){w(this,e);var i=T(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));return i.i18n=t.i18n||n.i18n,i.t=t.t||n.t,i}return C(e,t),P(e,[{key:"render",value:function(){var t=this.props,e=t.children,n=t.count,i=t.parent,r=t.i18nKey,o=E(t,["children","count","parent","i18nKey"]),s=d("",e,0),a=r||s,p=this.t(a,{interpolation:{prefix:"#$?",suffix:"?$#"},defaultValue:s,count:n});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(r&&this.i18n.options.nsSeparator&&r.indexOf(this.i18n.options.nsSeparator)>-1){c=r.split(this.i18n.options.nsSeparator)[0]}this.t.ns&&(o["data-i18next-options"]=JSON.stringify({ns:c}))}return b.createElement(i,o,y(e,p,this.i18n))}}]),e}(b.PureComponent);V.propTypes={count:n.number,parent:n.string,i18nKey:n.string},V.defaultProps={parent:"div"},V.contextTypes={i18n:n.object.isRequired,t:n.func.isRequired};var F=function(t){function n(t,e){w(this,n);var i=T(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 C(n,t),P(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.PureComponent);F.propTypes={i18n:n.object.isRequired,children:n.element.isRequired},F.childContextTypes={i18n:n.object.isRequired},t.translate=p,t.I18n=A,t.Interpolate=W,t.Trans=V,t.I18nextProvider=F,t.loadNamespaces=v,t.reactI18nextModule=L,t.setDefaults=i,t.getDefaults=r,t.setI18n=o,t.getI18n=s,Object.defineProperty(t,"__esModule",{value:!0})});

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

import { Component, Children } from 'react';
import { PureComponent, Children } from 'react';
import PropTypes from 'prop-types';
class I18nextProvider extends Component {
class I18nextProvider extends PureComponent {
constructor(props, context) {

@@ -6,0 +6,0 @@ super(props, context);

@@ -1,13 +0,7 @@

import translate from './translate';
import Interpolate from './interpolate';
import Trans from './trans';
import I18nextProvider from './I18nextProvider';
import loadNamespaces from './loadNamespaces';
export {
loadNamespaces,
translate,
Interpolate,
I18nextProvider,
Trans
};
export { default as translate } from './translate';
export { default as I18n } from './I18n';
export { default as Interpolate } from './Interpolate';
export { default as Trans } from './Trans';
export { default as I18nextProvider } from './I18nextProvider';
export { default as loadNamespaces } from './loadNamespaces';
export { reactI18nextModule, setDefaults, getDefaults, setI18n, getI18n } from './context';

@@ -1,16 +0,7 @@

import React, { Component } from 'react';
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import hoistStatics from 'hoist-non-react-statics';
import { getDefaults, setDefaults, getI18n, setI18n } from './context';
import I18n from './I18n';
let defaultOptions = {
wait: false,
withRef: false,
bindI18n: 'languageChanged loaded',
bindStore: 'added removed',
translateFuncName: 't',
nsMode: 'default'
};
let i18n;
function getDisplayName(component) {

@@ -20,14 +11,11 @@ return component.displayName || component.name || 'Component';

let removedIsInitialSSR = false;
export default function translate(namespaces, options = {}) {
const { translateFuncName = defaultOptions.translateFuncName } = options;
return function Wrapper(WrappedComponent) {
class Translate extends Component {
class Translate extends PureComponent {
constructor(props, context) {
super(props, context);
this.i18n = context.i18n || props.i18n || options.i18n || i18n;
this.i18n = context.i18n || props.i18n || options.i18n || getI18n();
namespaces = namespaces || this.i18n.options.defaultNS;

@@ -37,89 +25,7 @@ if (typeof namespaces === 'string') namespaces = [namespaces];

const i18nOptions = (this.i18n && this.i18n.options.react) || {};
this.options = { ...defaultOptions, ...i18nOptions, ...options };
this.options = { ...getDefaults(), ...i18nOptions, ...options };
// nextjs SSR: getting data from next.js or other ssr stack
if (props.initialI18nStore) {
this.i18n.services.resourceStore.data = props.initialI18nStore;
this.options.wait = false; // we got all passed down already
}
if (props.initialLanguage) {
this.i18n.changeLanguage(props.initialLanguage);
}
// provider SSR: data was set in provider and ssr flag was set
if (this.i18n.options.isInitialSSR) {
this.options.wait = false;
}
this.state = {
i18nLoadedAt: null,
ready: false
};
this.onI18nChanged = this.onI18nChanged.bind(this);
this.getWrappedInstance = this.getWrappedInstance.bind(this);
}
getChildContext() {
return {
[translateFuncName]: this[translateFuncName],
i18n: this.i18n
};
}
componentWillMount() {
this[translateFuncName] = this.i18n.getFixedT(null, this.options.nsMode === 'fallback' ? namespaces : namespaces[0]);
}
componentDidMount() {
const bind = () => {
if (this.options.bindI18n && this.i18n) this.i18n.on(this.options.bindI18n, this.onI18nChanged);
if (this.options.bindStore && this.i18n.store) this.i18n.store.on(this.options.bindStore, this.onI18nChanged);
};
this.mounted = true;
this.i18n.loadNamespaces(namespaces, () => {
const ready = () => {
if (this.mounted && !this.state.ready) this.setState({ ready: true });
if (this.options.wait && this.mounted) bind();
};
if (this.i18n.isInitialized) {
ready();
} else {
const initialized = () => {
// due to emitter removing issue in i18next we need to delay remove
setTimeout(() => {
this.i18n.off('initialized', initialized);
}, 1000);
ready();
};
this.i18n.on('initialized', initialized);
}
});
if (!this.options.wait) bind();
}
componentWillUnmount() {
this.mounted = false;
if (this.onI18nChanged) {
if (this.options.bindI18n) {
const p = this.options.bindI18n.split(' ');
p.forEach(f => this.i18n.off(f, this.onI18nChanged));
}
if (this.options.bindStore) {
const p = this.options.bindStore.split(' ');
p.forEach(f => this.i18n.store && this.i18n.store.off(f, this.onI18nChanged));
}
}
}
onI18nChanged() {
if (!this.mounted) return;
this.setState({ i18nLoadedAt: new Date() });
}
getWrappedInstance() {

@@ -135,30 +41,20 @@ if (!this.options.withRef) {

/* eslint react/no-string-refs: 1 */
return this.refs.wrappedInstance;
return this.wrappedInstance;
}
render() {
const { i18nLoadedAt, ready } = this.state;
const extraProps = {
i18nLoadedAt,
[translateFuncName]: this[translateFuncName],
i18n: this.i18n
};
if (this.options.withRef) {
extraProps.ref = 'wrappedInstance';
extraProps.ref = (c) => { this.wrappedInstance = c; };
}
if (!ready && this.options.wait) return null;
// remove ssr flag set by provider - first render was done from now on wait if set to wait
if (this.i18n.options.isInitialSSR && !removedIsInitialSSR) {
removedIsInitialSSR = true;
setTimeout(() => {
delete this.i18n.options.isInitialSSR;
}, 100);
}
return React.createElement(
WrappedComponent,
{ ...this.props, ...extraProps }
I18n,
{ ns: namespaces, ...this.options, ...this.props, ...{ i18n: this.i18n } },
(t, context) => React.createElement(
WrappedComponent,
{ ...this.props, ...extraProps, ...context }
)
);

@@ -174,7 +70,2 @@ }

Translate.childContextTypes = {
[translateFuncName]: PropTypes.func.isRequired,
i18n: PropTypes.object
};
Translate.displayName = `Translate(${getDisplayName(WrappedComponent)})`;

@@ -188,8 +79,4 @@

translate.setDefaults = function setDefaults(options) {
defaultOptions = { ...defaultOptions, ...options };
};
translate.setDefaults = setDefaults;
translate.setI18n = function setI18n(instance) {
i18n = instance;
};
translate.setI18n = setI18n;
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