Socket
Socket
Sign inDemoInstall

react-i18next

Package Overview
Dependencies
Maintainers
2
Versions
313
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-i18next - npm Package Compare versions

Comparing version 1.5.3 to 1.6.0

3

CHANGELOG.md

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

### 1.6.0
- Hoist non react statics [PR 150](https://github.com/i18next/react-i18next/pull/150
### 1.5.3

@@ -2,0 +5,0 @@ - Handle i18next added and removed resource events [PR 150](https://github.com/i18next/react-i18next/pull/150

8

dist/commonjs/translate.js

@@ -17,2 +17,6 @@ 'use strict';

var _hoistNonReactStatics = require('hoist-non-react-statics');
var _hoistNonReactStatics2 = _interopRequireDefault(_hoistNonReactStatics);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -141,8 +145,8 @@

Translate.displayName = 'Translate[' + getDisplayName(WrappedComponent) + ']';
Translate.displayName = 'Translate(' + getDisplayName(WrappedComponent) + ')';
Translate.namespaces = namespaces;
return Translate;
return (0, _hoistNonReactStatics2.default)(Translate, WrappedComponent);
};
}

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

import React, { Component, PropTypes } from 'react';
import hoistStatics from 'hoist-non-react-statics';

@@ -129,8 +130,8 @@ function getDisplayName(component) {

Translate.displayName = 'Translate[' + getDisplayName(WrappedComponent) + ']';
Translate.displayName = 'Translate(' + getDisplayName(WrappedComponent) + ')';
Translate.namespaces = namespaces;
return Translate;
return hoistStatics(Translate, WrappedComponent);
};
}
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
typeof define === 'function' && define.amd ? define('reactI18next', ['exports', 'react'], factory) :
(factory((global.reactI18next = global.reactI18next || {}),global.React));
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
typeof define === 'function' && define.amd ? define('reactI18next', ['exports', 'react'], factory) :
(factory((global.reactI18next = global.reactI18next || {}),global.React));
}(this, function (exports,React) { 'use strict';
var React__default = 'default' in React ? React['default'] : React;
var React__default = 'default' in React ? React['default'] : React;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
};
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
var classCallCheck = function (instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
var index = createCommonjsModule(function (module) {
/**
* Copyright 2015, Yahoo! Inc.
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
'use strict';
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);
}
}
var REACT_STATICS = {
childContextTypes: true,
contextTypes: true,
defaultProps: true,
displayName: true,
getDefaultProps: true,
mixins: true,
propTypes: true,
type: true
};
return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();
var KNOWN_STATICS = {
name: true,
length: true,
prototype: true,
caller: true,
arguments: true,
arity: true
};
var _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
var isGetOwnPropertySymbolsAvailable = typeof Object.getOwnPropertySymbols === 'function';
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
module.exports = function hoistNonReactStatics(targetComponent, sourceComponent, customStatics) {
if (typeof sourceComponent !== 'string') { // don't hoist over string (html) components
var keys = Object.getOwnPropertyNames(sourceComponent);
return target;
};
/* istanbul ignore else */
if (isGetOwnPropertySymbolsAvailable) {
keys = keys.concat(Object.getOwnPropertySymbols(sourceComponent));
}
var inherits = function (subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
}
for (var i = 0; i < keys.length; ++i) {
if (!REACT_STATICS[keys[i]] && !KNOWN_STATICS[keys[i]] && (!customStatics || !customStatics[keys[i]])) {
try {
targetComponent[keys[i]] = sourceComponent[keys[i]];
} catch (error) {
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
enumerable: false,
writable: true,
configurable: true
}
});
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
};
}
}
}
}
var possibleConstructorReturn = function (self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return targetComponent;
};
});
return call && (typeof call === "object" || typeof call === "function") ? call : self;
};
var hoistStatics = (index && typeof index === 'object' && 'default' in index ? index['default'] : index);
var slicedToArray = function () {
function sliceIterator(arr, i) {
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
};
try {
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
var classCallCheck = function (instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"]) _i["return"]();
} finally {
if (_d) throw _e;
}
}
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 _arr;
}
return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();
return function (arr, i) {
if (Array.isArray(arr)) {
return arr;
} else if (Symbol.iterator in Object(arr)) {
return sliceIterator(arr, i);
} else {
throw new TypeError("Invalid attempt to destructure non-iterable instance");
}
};
}();
var _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
function getDisplayName(component) {
return component.displayName || component.name || 'Component';
}
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
function translate(namespaces) {
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var _options$withRef = options.withRef;
var withRef = _options$withRef === undefined ? false : _options$withRef;
var _options$wait = options.wait;
var wait = _options$wait === undefined ? false : _options$wait;
return target;
};
var inherits = function (subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
}
return function Wrapper(WrappedComponent) {
var Translate = function (_Component) {
inherits(Translate, _Component);
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
enumerable: false,
writable: true,
configurable: true
}
});
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
};
function Translate(props, context) {
classCallCheck(this, Translate);
var possibleConstructorReturn = function (self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
var _this = possibleConstructorReturn(this, Object.getPrototypeOf(Translate).call(this, props, context));
return call && (typeof call === "object" || typeof call === "function") ? call : self;
};
_this.i18n = context.i18n;
namespaces = namespaces || _this.i18n.options.defaultNS;
var slicedToArray = function () {
function sliceIterator(arr, i) {
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
_this.state = {
i18nLoadedAt: null,
ready: false
};
try {
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
_this.onI18nChanged = _this.onI18nChanged.bind(_this);
return _this;
}
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"]) _i["return"]();
} finally {
if (_d) throw _e;
}
}
createClass(Translate, [{
key: 'getChildContext',
value: function getChildContext() {
return { t: this.t };
}
}, {
key: 'componentWillMount',
value: function componentWillMount() {
this.t = this.i18n.getFixedT(null, namespaces);
}
}, {
key: 'componentDidMount',
value: function componentDidMount() {
var _this2 = this;
return _arr;
}
this.mounted = true;
this.i18n.loadNamespaces(namespaces, function () {
_this2.setState({ ready: true });
});
this.i18n.on('languageChanged loaded', this.onI18nChanged);
this.i18n.store.on('added removed', this.onI18nChanged);
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
this.mounted = false;
if (this.onI18nChanged) {
this.i18n.off('languageChanged', this.onI18nChanged);
this.i18n.off('loaded', this.onI18nChanged);
this.i18n.store.off('added', this.onI18nChanged);
this.i18n.store.off('removed', this.onI18nChanged);
}
}
}, {
key: 'onI18nChanged',
value: function onI18nChanged() {
if (!this.mounted) return;
return function (arr, i) {
if (Array.isArray(arr)) {
return arr;
} else if (Symbol.iterator in Object(arr)) {
return sliceIterator(arr, i);
} else {
throw new TypeError("Invalid attempt to destructure non-iterable instance");
}
};
}();
this.setState({ i18nLoadedAt: new Date() });
}
}, {
key: 'getWrappedInstance',
value: function getWrappedInstance() {
if (!withRef) {
// eslint-disable-next-line no-console
console.error('To access the wrapped instance, you need to specify ' + '{ withRef: true } as the second argument of the translate() call.');
}
function getDisplayName(component) {
return component.displayName || component.name || 'Component';
}
return this.refs.wrappedInstance;
}
}, {
key: 'render',
value: function render() {
var _state = this.state;
var i18nLoadedAt = _state.i18nLoadedAt;
var ready = _state.ready;
function translate(namespaces) {
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var _options$withRef = options.withRef;
var withRef = _options$withRef === undefined ? false : _options$withRef;
var _options$wait = options.wait;
var wait = _options$wait === undefined ? false : _options$wait;
var extraProps = { i18nLoadedAt: i18nLoadedAt, t: this.t };
if (withRef) {
extraProps.ref = 'wrappedInstance';
}
return function Wrapper(WrappedComponent) {
var Translate = function (_Component) {
inherits(Translate, _Component);
if (!ready && wait) return null;
function Translate(props, context) {
classCallCheck(this, Translate);
return React__default.createElement(WrappedComponent, _extends({}, this.props, extraProps));
}
}]);
return Translate;
}(React.Component);
var _this = possibleConstructorReturn(this, Object.getPrototypeOf(Translate).call(this, props, context));
Translate.WrappedComponent = WrappedComponent;
_this.i18n = context.i18n;
namespaces = namespaces || _this.i18n.options.defaultNS;
Translate.contextTypes = {
i18n: React.PropTypes.object.isRequired
};
_this.state = {
i18nLoadedAt: null,
ready: false
};
Translate.childContextTypes = {
t: React.PropTypes.func.isRequired
};
_this.onI18nChanged = _this.onI18nChanged.bind(_this);
return _this;
}
Translate.displayName = 'Translate[' + getDisplayName(WrappedComponent) + ']';
createClass(Translate, [{
key: 'getChildContext',
value: function getChildContext() {
return { t: this.t };
}
}, {
key: 'componentWillMount',
value: function componentWillMount() {
this.t = this.i18n.getFixedT(null, namespaces);
}
}, {
key: 'componentDidMount',
value: function componentDidMount() {
var _this2 = this;
Translate.namespaces = namespaces;
this.mounted = true;
this.i18n.loadNamespaces(namespaces, function () {
_this2.setState({ ready: true });
});
this.i18n.on('languageChanged loaded', this.onI18nChanged);
this.i18n.store.on('added removed', this.onI18nChanged);
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
this.mounted = false;
if (this.onI18nChanged) {
this.i18n.off('languageChanged', this.onI18nChanged);
this.i18n.off('loaded', this.onI18nChanged);
this.i18n.store.off('added', this.onI18nChanged);
this.i18n.store.off('removed', this.onI18nChanged);
}
}
}, {
key: 'onI18nChanged',
value: function onI18nChanged() {
if (!this.mounted) return;
return Translate;
};
}
this.setState({ i18nLoadedAt: new Date() });
}
}, {
key: 'getWrappedInstance',
value: function getWrappedInstance() {
if (!withRef) {
// eslint-disable-next-line no-console
console.error('To access the wrapped instance, you need to specify ' + '{ withRef: true } as the second argument of the translate() call.');
}
var Interpolate = function (_Component) {
inherits(Interpolate, _Component);
return this.refs.wrappedInstance;
}
}, {
key: 'render',
value: function render() {
var _state = this.state;
var i18nLoadedAt = _state.i18nLoadedAt;
var ready = _state.ready;
function Interpolate(props, context) {
classCallCheck(this, Interpolate);
var extraProps = { i18nLoadedAt: i18nLoadedAt, t: this.t };
var _this = possibleConstructorReturn(this, Object.getPrototypeOf(Interpolate).call(this, props, context));
if (withRef) {
extraProps.ref = 'wrappedInstance';
}
_this.i18n = context.i18n;
_this.t = context.t;
return _this;
}
if (!ready && wait) return null;
createClass(Interpolate, [{
key: 'render',
value: function render() {
var _this2 = this;
return React__default.createElement(WrappedComponent, _extends({}, this.props, extraProps));
}
}]);
return Translate;
}(React.Component);
var parent = this.props.parent || 'span';
var REGEXP = this.props.regexp || this.i18n.services.interpolator.regexp;
Translate.WrappedComponent = WrappedComponent;
var tOpts = _extends({}, this.props.options, { interpolation: { prefix: '#$?', suffix: '?$#' } });
var format = this.t(this.props.i18nKey, tOpts);
Translate.contextTypes = {
i18n: React.PropTypes.object.isRequired
};
if (!format || typeof format !== 'string') return React__default.createElement('noscript', null);
Translate.childContextTypes = {
t: React.PropTypes.func.isRequired
};
var children = [];
Translate.displayName = 'Translate(' + getDisplayName(WrappedComponent) + ')';
format.split(REGEXP).reduce(function (memo, match, index) {
var child;
Translate.namespaces = namespaces;
if (index % 2 === 0) {
if (match.length === 0) return memo;
child = match;
} else {
child = _this2.props[match];
}
return hoistStatics(Translate, WrappedComponent);
};
}
memo.push(child);
return memo;
}, children);
var Interpolate = function (_Component) {
inherits(Interpolate, _Component);
return React__default.createElement.apply(this, [parent, this.props].concat(children));
}
}]);
return Interpolate;
}(React.Component);
function Interpolate(props, context) {
classCallCheck(this, Interpolate);
Interpolate.contextTypes = {
i18n: React.PropTypes.object.isRequired,
t: React.PropTypes.func.isRequired
};
var _this = possibleConstructorReturn(this, Object.getPrototypeOf(Interpolate).call(this, props, context));
var I18nextProvider = function (_Component) {
inherits(I18nextProvider, _Component);
_this.i18n = context.i18n;
_this.t = context.t;
return _this;
}
function I18nextProvider(props, context) {
classCallCheck(this, I18nextProvider);
createClass(Interpolate, [{
key: 'render',
value: function render() {
var _this2 = this;
var _this = possibleConstructorReturn(this, Object.getPrototypeOf(I18nextProvider).call(this, props, context));
var parent = this.props.parent || 'span';
var REGEXP = this.props.regexp || this.i18n.services.interpolator.regexp;
_this.i18n = props.i18n;
return _this;
}
var tOpts = _extends({}, this.props.options, { interpolation: { prefix: '#$?', suffix: '?$#' } });
var format = this.t(this.props.i18nKey, tOpts);
createClass(I18nextProvider, [{
key: 'getChildContext',
value: function getChildContext() {
return { i18n: this.i18n };
}
}, {
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
if (this.props.i18n !== nextProps.i18n) {
console.error('[react-i18next][I18nextProvider]does not support changing the i18n object.');
}
}
}, {
key: 'render',
value: function render() {
var children = this.props.children;
if (!format || typeof format !== 'string') return React__default.createElement('noscript', null);
return React.Children.only(children);
}
}]);
return I18nextProvider;
}(React.Component);
var children = [];
I18nextProvider.propTypes = {
i18n: React.PropTypes.object.isRequired,
children: React.PropTypes.element.isRequired
};
format.split(REGEXP).reduce(function (memo, match, index) {
var child;
I18nextProvider.childContextTypes = {
i18n: React.PropTypes.object.isRequired
};
if (index % 2 === 0) {
if (match.length === 0) return memo;
child = match;
} else {
child = _this2.props[match];
}
// Borrowed from https://github.com/Rezonans/redux-async-connect/blob/master/modules/ReduxAsyncConnect.js#L16
function eachComponents(components, iterator) {
for (var i = 0, l = components.length; i < l; i++) {
// eslint-disable-line id-length
if (_typeof(components[i]) === 'object') {
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
memo.push(child);
return memo;
}, children);
try {
for (var _iterator = Object.entries(components[i])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var _step$value = slicedToArray(_step.value, 2);
return React__default.createElement.apply(this, [parent, this.props].concat(children));
}
}]);
return Interpolate;
}(React.Component);
var key = _step$value[0];
var value = _step$value[1];
Interpolate.contextTypes = {
i18n: React.PropTypes.object.isRequired,
t: React.PropTypes.func.isRequired
};
iterator(value, i, key);
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
} else {
iterator(components[i], i);
}
}
}
var I18nextProvider = function (_Component) {
inherits(I18nextProvider, _Component);
function filterAndFlattenComponents(components) {
var flattened = [];
eachComponents(components, function (Component) {
if (Component && Component.namespaces) {
function I18nextProvider(props, context) {
classCallCheck(this, I18nextProvider);
Component.namespaces.forEach(function (namespace) {
if (flattened.indexOf(namespace) === -1) {
flattened.push(namespace);
}
});
}
});
return flattened;
}
var _this = possibleConstructorReturn(this, Object.getPrototypeOf(I18nextProvider).call(this, props, context));
function loadNamespaces(_ref) {
var components = _ref.components;
var i18n = _ref.i18n;
_this.i18n = props.i18n;
return _this;
}
var allNamespaces = filterAndFlattenComponents(components);
createClass(I18nextProvider, [{
key: 'getChildContext',
value: function getChildContext() {
return { i18n: this.i18n };
}
}, {
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
if (this.props.i18n !== nextProps.i18n) {
console.error('[react-i18next][I18nextProvider]does not support changing the i18n object.');
}
}
}, {
key: 'render',
value: function render() {
var children = this.props.children;
return new Promise(function (resolve) {
i18n.loadNamespaces(allNamespaces, resolve);
});
}
return React.Children.only(children);
}
}]);
return I18nextProvider;
}(React.Component);
exports.loadNamespaces = loadNamespaces;
exports.translate = translate;
exports.Interpolate = Interpolate;
exports.I18nextProvider = I18nextProvider;
I18nextProvider.propTypes = {
i18n: React.PropTypes.object.isRequired,
children: React.PropTypes.element.isRequired
};
Object.defineProperty(exports, '__esModule', { value: true });
I18nextProvider.childContextTypes = {
i18n: React.PropTypes.object.isRequired
};
// Borrowed from https://github.com/Rezonans/redux-async-connect/blob/master/modules/ReduxAsyncConnect.js#L16
function eachComponents(components, iterator) {
for (var i = 0, l = components.length; i < l; i++) {
// eslint-disable-line id-length
if (_typeof(components[i]) === 'object') {
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = Object.entries(components[i])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var _step$value = slicedToArray(_step.value, 2);
var key = _step$value[0];
var value = _step$value[1];
iterator(value, i, key);
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
} else {
iterator(components[i], i);
}
}
}
function filterAndFlattenComponents(components) {
var flattened = [];
eachComponents(components, function (Component) {
if (Component && Component.namespaces) {
Component.namespaces.forEach(function (namespace) {
if (flattened.indexOf(namespace) === -1) {
flattened.push(namespace);
}
});
}
});
return flattened;
}
function loadNamespaces(_ref) {
var components = _ref.components;
var i18n = _ref.i18n;
var allNamespaces = filterAndFlattenComponents(components);
return new Promise(function (resolve) {
i18n.loadNamespaces(allNamespaces, resolve);
});
}
exports.loadNamespaces = loadNamespaces;
exports.translate = translate;
exports.Interpolate = Interpolate;
exports.I18nextProvider = I18nextProvider;
Object.defineProperty(exports, '__esModule', { value: true });
}));

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

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

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

},
"dependencies": {},
"dependencies": {
"hoist-non-react-statics": "1.2.0"
},
"devDependencies": {

@@ -45,2 +47,3 @@ "babel-cli": "6.10.1",

"rollup-plugin-babel": "2.6.1",
"rollup-plugin-commonjs": "3.1.0",
"rollup-plugin-node-resolve": "1.7.1",

@@ -47,0 +50,0 @@ "rollup-plugin-uglify": "1.0.1",

(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
typeof define === 'function' && define.amd ? define('reactI18next', ['exports', 'react'], factory) :
(factory((global.reactI18next = global.reactI18next || {}),global.React));
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
typeof define === 'function' && define.amd ? define('reactI18next', ['exports', 'react'], factory) :
(factory((global.reactI18next = global.reactI18next || {}),global.React));
}(this, function (exports,React) { 'use strict';
var React__default = 'default' in React ? React['default'] : React;
var React__default = 'default' in React ? React['default'] : React;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
};
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
var classCallCheck = function (instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
var index = createCommonjsModule(function (module) {
/**
* Copyright 2015, Yahoo! Inc.
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
'use strict';
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);
}
}
var REACT_STATICS = {
childContextTypes: true,
contextTypes: true,
defaultProps: true,
displayName: true,
getDefaultProps: true,
mixins: true,
propTypes: true,
type: true
};
return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();
var KNOWN_STATICS = {
name: true,
length: true,
prototype: true,
caller: true,
arguments: true,
arity: true
};
var _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
var isGetOwnPropertySymbolsAvailable = typeof Object.getOwnPropertySymbols === 'function';
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
module.exports = function hoistNonReactStatics(targetComponent, sourceComponent, customStatics) {
if (typeof sourceComponent !== 'string') { // don't hoist over string (html) components
var keys = Object.getOwnPropertyNames(sourceComponent);
return target;
};
/* istanbul ignore else */
if (isGetOwnPropertySymbolsAvailable) {
keys = keys.concat(Object.getOwnPropertySymbols(sourceComponent));
}
var inherits = function (subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
}
for (var i = 0; i < keys.length; ++i) {
if (!REACT_STATICS[keys[i]] && !KNOWN_STATICS[keys[i]] && (!customStatics || !customStatics[keys[i]])) {
try {
targetComponent[keys[i]] = sourceComponent[keys[i]];
} catch (error) {
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
enumerable: false,
writable: true,
configurable: true
}
});
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
};
}
}
}
}
var possibleConstructorReturn = function (self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return targetComponent;
};
});
return call && (typeof call === "object" || typeof call === "function") ? call : self;
};
var hoistStatics = (index && typeof index === 'object' && 'default' in index ? index['default'] : index);
var slicedToArray = function () {
function sliceIterator(arr, i) {
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
};
try {
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
var classCallCheck = function (instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"]) _i["return"]();
} finally {
if (_d) throw _e;
}
}
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 _arr;
}
return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();
return function (arr, i) {
if (Array.isArray(arr)) {
return arr;
} else if (Symbol.iterator in Object(arr)) {
return sliceIterator(arr, i);
} else {
throw new TypeError("Invalid attempt to destructure non-iterable instance");
}
};
}();
var _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
function getDisplayName(component) {
return component.displayName || component.name || 'Component';
}
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
function translate(namespaces) {
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var _options$withRef = options.withRef;
var withRef = _options$withRef === undefined ? false : _options$withRef;
var _options$wait = options.wait;
var wait = _options$wait === undefined ? false : _options$wait;
return target;
};
var inherits = function (subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
}
return function Wrapper(WrappedComponent) {
var Translate = function (_Component) {
inherits(Translate, _Component);
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
enumerable: false,
writable: true,
configurable: true
}
});
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
};
function Translate(props, context) {
classCallCheck(this, Translate);
var possibleConstructorReturn = function (self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
var _this = possibleConstructorReturn(this, Object.getPrototypeOf(Translate).call(this, props, context));
return call && (typeof call === "object" || typeof call === "function") ? call : self;
};
_this.i18n = context.i18n;
namespaces = namespaces || _this.i18n.options.defaultNS;
var slicedToArray = function () {
function sliceIterator(arr, i) {
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
_this.state = {
i18nLoadedAt: null,
ready: false
};
try {
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
_this.onI18nChanged = _this.onI18nChanged.bind(_this);
return _this;
}
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"]) _i["return"]();
} finally {
if (_d) throw _e;
}
}
createClass(Translate, [{
key: 'getChildContext',
value: function getChildContext() {
return { t: this.t };
}
}, {
key: 'componentWillMount',
value: function componentWillMount() {
this.t = this.i18n.getFixedT(null, namespaces);
}
}, {
key: 'componentDidMount',
value: function componentDidMount() {
var _this2 = this;
return _arr;
}
this.mounted = true;
this.i18n.loadNamespaces(namespaces, function () {
_this2.setState({ ready: true });
});
this.i18n.on('languageChanged loaded', this.onI18nChanged);
this.i18n.store.on('added removed', this.onI18nChanged);
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
this.mounted = false;
if (this.onI18nChanged) {
this.i18n.off('languageChanged', this.onI18nChanged);
this.i18n.off('loaded', this.onI18nChanged);
this.i18n.store.off('added', this.onI18nChanged);
this.i18n.store.off('removed', this.onI18nChanged);
}
}
}, {
key: 'onI18nChanged',
value: function onI18nChanged() {
if (!this.mounted) return;
return function (arr, i) {
if (Array.isArray(arr)) {
return arr;
} else if (Symbol.iterator in Object(arr)) {
return sliceIterator(arr, i);
} else {
throw new TypeError("Invalid attempt to destructure non-iterable instance");
}
};
}();
this.setState({ i18nLoadedAt: new Date() });
}
}, {
key: 'getWrappedInstance',
value: function getWrappedInstance() {
if (!withRef) {
// eslint-disable-next-line no-console
console.error('To access the wrapped instance, you need to specify ' + '{ withRef: true } as the second argument of the translate() call.');
}
function getDisplayName(component) {
return component.displayName || component.name || 'Component';
}
return this.refs.wrappedInstance;
}
}, {
key: 'render',
value: function render() {
var _state = this.state;
var i18nLoadedAt = _state.i18nLoadedAt;
var ready = _state.ready;
function translate(namespaces) {
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var _options$withRef = options.withRef;
var withRef = _options$withRef === undefined ? false : _options$withRef;
var _options$wait = options.wait;
var wait = _options$wait === undefined ? false : _options$wait;
var extraProps = { i18nLoadedAt: i18nLoadedAt, t: this.t };
if (withRef) {
extraProps.ref = 'wrappedInstance';
}
return function Wrapper(WrappedComponent) {
var Translate = function (_Component) {
inherits(Translate, _Component);
if (!ready && wait) return null;
function Translate(props, context) {
classCallCheck(this, Translate);
return React__default.createElement(WrappedComponent, _extends({}, this.props, extraProps));
}
}]);
return Translate;
}(React.Component);
var _this = possibleConstructorReturn(this, Object.getPrototypeOf(Translate).call(this, props, context));
Translate.WrappedComponent = WrappedComponent;
_this.i18n = context.i18n;
namespaces = namespaces || _this.i18n.options.defaultNS;
Translate.contextTypes = {
i18n: React.PropTypes.object.isRequired
};
_this.state = {
i18nLoadedAt: null,
ready: false
};
Translate.childContextTypes = {
t: React.PropTypes.func.isRequired
};
_this.onI18nChanged = _this.onI18nChanged.bind(_this);
return _this;
}
Translate.displayName = 'Translate[' + getDisplayName(WrappedComponent) + ']';
createClass(Translate, [{
key: 'getChildContext',
value: function getChildContext() {
return { t: this.t };
}
}, {
key: 'componentWillMount',
value: function componentWillMount() {
this.t = this.i18n.getFixedT(null, namespaces);
}
}, {
key: 'componentDidMount',
value: function componentDidMount() {
var _this2 = this;
Translate.namespaces = namespaces;
this.mounted = true;
this.i18n.loadNamespaces(namespaces, function () {
_this2.setState({ ready: true });
});
this.i18n.on('languageChanged loaded', this.onI18nChanged);
this.i18n.store.on('added removed', this.onI18nChanged);
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
this.mounted = false;
if (this.onI18nChanged) {
this.i18n.off('languageChanged', this.onI18nChanged);
this.i18n.off('loaded', this.onI18nChanged);
this.i18n.store.off('added', this.onI18nChanged);
this.i18n.store.off('removed', this.onI18nChanged);
}
}
}, {
key: 'onI18nChanged',
value: function onI18nChanged() {
if (!this.mounted) return;
return Translate;
};
}
this.setState({ i18nLoadedAt: new Date() });
}
}, {
key: 'getWrappedInstance',
value: function getWrappedInstance() {
if (!withRef) {
// eslint-disable-next-line no-console
console.error('To access the wrapped instance, you need to specify ' + '{ withRef: true } as the second argument of the translate() call.');
}
var Interpolate = function (_Component) {
inherits(Interpolate, _Component);
return this.refs.wrappedInstance;
}
}, {
key: 'render',
value: function render() {
var _state = this.state;
var i18nLoadedAt = _state.i18nLoadedAt;
var ready = _state.ready;
function Interpolate(props, context) {
classCallCheck(this, Interpolate);
var extraProps = { i18nLoadedAt: i18nLoadedAt, t: this.t };
var _this = possibleConstructorReturn(this, Object.getPrototypeOf(Interpolate).call(this, props, context));
if (withRef) {
extraProps.ref = 'wrappedInstance';
}
_this.i18n = context.i18n;
_this.t = context.t;
return _this;
}
if (!ready && wait) return null;
createClass(Interpolate, [{
key: 'render',
value: function render() {
var _this2 = this;
return React__default.createElement(WrappedComponent, _extends({}, this.props, extraProps));
}
}]);
return Translate;
}(React.Component);
var parent = this.props.parent || 'span';
var REGEXP = this.props.regexp || this.i18n.services.interpolator.regexp;
Translate.WrappedComponent = WrappedComponent;
var tOpts = _extends({}, this.props.options, { interpolation: { prefix: '#$?', suffix: '?$#' } });
var format = this.t(this.props.i18nKey, tOpts);
Translate.contextTypes = {
i18n: React.PropTypes.object.isRequired
};
if (!format || typeof format !== 'string') return React__default.createElement('noscript', null);
Translate.childContextTypes = {
t: React.PropTypes.func.isRequired
};
var children = [];
Translate.displayName = 'Translate(' + getDisplayName(WrappedComponent) + ')';
format.split(REGEXP).reduce(function (memo, match, index) {
var child;
Translate.namespaces = namespaces;
if (index % 2 === 0) {
if (match.length === 0) return memo;
child = match;
} else {
child = _this2.props[match];
}
return hoistStatics(Translate, WrappedComponent);
};
}
memo.push(child);
return memo;
}, children);
var Interpolate = function (_Component) {
inherits(Interpolate, _Component);
return React__default.createElement.apply(this, [parent, this.props].concat(children));
}
}]);
return Interpolate;
}(React.Component);
function Interpolate(props, context) {
classCallCheck(this, Interpolate);
Interpolate.contextTypes = {
i18n: React.PropTypes.object.isRequired,
t: React.PropTypes.func.isRequired
};
var _this = possibleConstructorReturn(this, Object.getPrototypeOf(Interpolate).call(this, props, context));
var I18nextProvider = function (_Component) {
inherits(I18nextProvider, _Component);
_this.i18n = context.i18n;
_this.t = context.t;
return _this;
}
function I18nextProvider(props, context) {
classCallCheck(this, I18nextProvider);
createClass(Interpolate, [{
key: 'render',
value: function render() {
var _this2 = this;
var _this = possibleConstructorReturn(this, Object.getPrototypeOf(I18nextProvider).call(this, props, context));
var parent = this.props.parent || 'span';
var REGEXP = this.props.regexp || this.i18n.services.interpolator.regexp;
_this.i18n = props.i18n;
return _this;
}
var tOpts = _extends({}, this.props.options, { interpolation: { prefix: '#$?', suffix: '?$#' } });
var format = this.t(this.props.i18nKey, tOpts);
createClass(I18nextProvider, [{
key: 'getChildContext',
value: function getChildContext() {
return { i18n: this.i18n };
}
}, {
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
if (this.props.i18n !== nextProps.i18n) {
console.error('[react-i18next][I18nextProvider]does not support changing the i18n object.');
}
}
}, {
key: 'render',
value: function render() {
var children = this.props.children;
if (!format || typeof format !== 'string') return React__default.createElement('noscript', null);
return React.Children.only(children);
}
}]);
return I18nextProvider;
}(React.Component);
var children = [];
I18nextProvider.propTypes = {
i18n: React.PropTypes.object.isRequired,
children: React.PropTypes.element.isRequired
};
format.split(REGEXP).reduce(function (memo, match, index) {
var child;
I18nextProvider.childContextTypes = {
i18n: React.PropTypes.object.isRequired
};
if (index % 2 === 0) {
if (match.length === 0) return memo;
child = match;
} else {
child = _this2.props[match];
}
// Borrowed from https://github.com/Rezonans/redux-async-connect/blob/master/modules/ReduxAsyncConnect.js#L16
function eachComponents(components, iterator) {
for (var i = 0, l = components.length; i < l; i++) {
// eslint-disable-line id-length
if (_typeof(components[i]) === 'object') {
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
memo.push(child);
return memo;
}, children);
try {
for (var _iterator = Object.entries(components[i])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var _step$value = slicedToArray(_step.value, 2);
return React__default.createElement.apply(this, [parent, this.props].concat(children));
}
}]);
return Interpolate;
}(React.Component);
var key = _step$value[0];
var value = _step$value[1];
Interpolate.contextTypes = {
i18n: React.PropTypes.object.isRequired,
t: React.PropTypes.func.isRequired
};
iterator(value, i, key);
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
} else {
iterator(components[i], i);
}
}
}
var I18nextProvider = function (_Component) {
inherits(I18nextProvider, _Component);
function filterAndFlattenComponents(components) {
var flattened = [];
eachComponents(components, function (Component) {
if (Component && Component.namespaces) {
function I18nextProvider(props, context) {
classCallCheck(this, I18nextProvider);
Component.namespaces.forEach(function (namespace) {
if (flattened.indexOf(namespace) === -1) {
flattened.push(namespace);
}
});
}
});
return flattened;
}
var _this = possibleConstructorReturn(this, Object.getPrototypeOf(I18nextProvider).call(this, props, context));
function loadNamespaces(_ref) {
var components = _ref.components;
var i18n = _ref.i18n;
_this.i18n = props.i18n;
return _this;
}
var allNamespaces = filterAndFlattenComponents(components);
createClass(I18nextProvider, [{
key: 'getChildContext',
value: function getChildContext() {
return { i18n: this.i18n };
}
}, {
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
if (this.props.i18n !== nextProps.i18n) {
console.error('[react-i18next][I18nextProvider]does not support changing the i18n object.');
}
}
}, {
key: 'render',
value: function render() {
var children = this.props.children;
return new Promise(function (resolve) {
i18n.loadNamespaces(allNamespaces, resolve);
});
}
return React.Children.only(children);
}
}]);
return I18nextProvider;
}(React.Component);
exports.loadNamespaces = loadNamespaces;
exports.translate = translate;
exports.Interpolate = Interpolate;
exports.I18nextProvider = I18nextProvider;
I18nextProvider.propTypes = {
i18n: React.PropTypes.object.isRequired,
children: React.PropTypes.element.isRequired
};
Object.defineProperty(exports, '__esModule', { value: true });
I18nextProvider.childContextTypes = {
i18n: React.PropTypes.object.isRequired
};
// Borrowed from https://github.com/Rezonans/redux-async-connect/blob/master/modules/ReduxAsyncConnect.js#L16
function eachComponents(components, iterator) {
for (var i = 0, l = components.length; i < l; i++) {
// eslint-disable-line id-length
if (_typeof(components[i]) === 'object') {
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = Object.entries(components[i])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var _step$value = slicedToArray(_step.value, 2);
var key = _step$value[0];
var value = _step$value[1];
iterator(value, i, key);
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
} else {
iterator(components[i], i);
}
}
}
function filterAndFlattenComponents(components) {
var flattened = [];
eachComponents(components, function (Component) {
if (Component && Component.namespaces) {
Component.namespaces.forEach(function (namespace) {
if (flattened.indexOf(namespace) === -1) {
flattened.push(namespace);
}
});
}
});
return flattened;
}
function loadNamespaces(_ref) {
var components = _ref.components;
var i18n = _ref.i18n;
var allNamespaces = filterAndFlattenComponents(components);
return new Promise(function (resolve) {
i18n.loadNamespaces(allNamespaces, resolve);
});
}
exports.loadNamespaces = loadNamespaces;
exports.translate = translate;
exports.Interpolate = Interpolate;
exports.I18nextProvider = I18nextProvider;
Object.defineProperty(exports, '__esModule', { value: true });
}));

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

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

@@ -27,3 +28,4 @@ import { argv } from 'yargs';

babel(babelOptions),
nodeResolve({ jsnext: true })
nodeResolve({ jsnext: true }),
commonjs()
].concat(compress ? uglify() : []),

@@ -30,0 +32,0 @@ moduleName: 'reactI18next',

import React, { Component, PropTypes } from 'react';
import hoistStatics from 'hoist-non-react-statics';

@@ -98,8 +99,8 @@ function getDisplayName(component) {

Translate.displayName = 'Translate[' + getDisplayName(WrappedComponent) + ']';
Translate.displayName = 'Translate(' + getDisplayName(WrappedComponent) + ')';
Translate.namespaces = namespaces;
return Translate;
return hoistStatics(Translate, WrappedComponent);
};
}
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