diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9389b4972..185b07c91 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,71 +1,94 @@
-### upcoming
+### 7.9.0
+
+- Support defaultNS from I18nextProvider props [PR478](https://github.com/i18next/react-i18next/pull/478)
- Don't polyfill Object.entries globally [476](https://github.com/i18next/react-i18next/pull/476)
### 7.8.1
+
- i18n in context is optional as it can be passed via props too [474](https://github.com/i18next/react-i18next/pull/474)
### 7.8.0
+
- avoid rerenders triggered by bound i18next events while I18n or translate hoc are not ready yet (omitBoundRerender: true --- is default) [456](https://github.com/i18next/react-i18next/issues/456)
### 7.7.0
+
- Allow Trans component to be used with props only for icu use case (next step babel makro) [439](https://github.com/i18next/react-i18next/issues/439)
### 7.6.1
+
- Allow to pass a function as parent for component [PR424](https://github.com/i18next/react-i18next/pull/424)
### 7.6.0
+
- adds tOptions to Trans component to support ICU
- removes componentWillMount lifecycle method from I18n.js render props as it will get deprecated on react 16.3 [404](https://github.com/i18next/react-i18next/issues/404)
### 7.5.1
+
- Fix reference to props in constructor [PR411](https://github.com/i18next/react-i18next/pull/411)
### 7.5.0
+
- passes down tReady from translate hoc for cases you prefer showing a placeholder instead of default return null in case of wait: true and not yet loaded translations [PR400](https://github.com/i18next/react-i18next/pull/400)
- I18n render prop calls with ready as third param
### 7.4.0
+
- enables setting prop `ns` on Trans component to override namespace passed by render prop or hoc
- allows trans component with no children just returning the string getting from translations
### 7.3.6
+
- reorder selection of i18n in I18n render prop
### 7.3.5
+
- reorder selection of i18n in I18n render prop
### 7.3.4
+
- more save access to options in general
### 7.3.3
+
- more save access to options.react
### 7.3.2
+
- replace Interpolate PureComponent with Component to assert it gets rerendered on lng change
### 7.3.1
+
- remove react-dom from peer dependencies as module is used in react-native too
### 7.3.0
+
- Allow translate HOC to take a function for getting namespaces [372](https://github.com/i18next/react-i18next/pull/372)
### 7.2.0
+
- Add usePureComponent option [PR357](https://github.com/i18next/react-i18next/pull/357)
- Render empty string on empty string as Trans child [PR364](https://github.com/i18next/react-i18next/pull/364)
### 7.1.1
+
- fixes: bring back Trans component t fc from context
### 7.1.0
+
- optional take i18n.t in Trans component if non t function passed in via props or context
### 7.0.2
+
- fixes rendering in Trans component in case of no parent
### 7.0.1
+
- working Trans component without the need of setting options.react
### 7.0.0
+
- **[BREAKING]** As with react 16 you can return multiple elements from render - based on that we do not need to return a wrapper any longer from Trans component.
Starting with v7.0.0 Trans component per default won't add a parent div around content passed as children. It will just return it's children.
@@ -75,49 +98,62 @@ You still got the option to set a parent if you prefer content being wrapped.
If you prefer wrapping for all your Trans components (or for backwards compatibility) you can set option `react.defaultTransParent` to an element on i18next init.
### 6.2.0
+
- adds hashTransKey function for custom key generation in case of not passing a key to Trans component and not like having the source value as key
### 6.1.0
+
- pre-check namespaces to avoid unnecessary initial `null` render [PR336](https://github.com/i18next/react-i18next/pull/336)
### 6.0.6
+
- remove PureComponent from Trans
### 6.0.5
+
- fixes support passing i18n and t to Trans as props [PR315](https://github.com/i18next/react-i18next/pull/315)
### 6.0.4
+
- fixes translate hoc build
### 6.0.3
+
- stop using PureComponent and use Component again...seems we get an issue with react-router v4 if using PureComponents
- recreate t function on i18next updates so PureComponents relying on t get an update triggered
### 6.0.2
+
- rebuild needed cause of uppercasing for components name was not reflected in last build
### 6.0.1
+
- remove react from dependencies - not sure how that came into the package.json
### 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
+
- fixes AST implementation for preact
### 5.4.0
+
- replaces regex used to parse nodes from string to an ast implementation solving [#298](https://github.com/i18next/react-i18next/issues/298)
### 5.3.0
+
- Pass extra parameters to Trans parent component
### 5.2.0
-- adds module export in package.json pointing to es dist files.
+- adds module export in package.json pointing to es dist files.
### 5.1.0
+
- you now can set i18n instance on translate hoc once using setI18n:
```
@@ -128,7 +164,8 @@ translate.setI18n(i18n);
```
### 5.0.0
-- **[BREAKING]** we no longer accept wait to be specified on i18next init options like ``{ wait: true }`` -> all overrides for the translate hoc now have to be in child `react` like `{ react: { wait: true } }`
+
+- **[BREAKING]** we no longer accept wait to be specified on i18next init options like `{ wait: true }` -> all overrides for the translate hoc now have to be in child `react` like `{ react: { wait: true } }`
- you now can override all the default options for translate hoc by setting them on i18next.init (excluding `translateFuncName` as we need that upfront to define childContextTypes)
```
@@ -159,158 +196,204 @@ translate.setDefaults({
});
```
-
### 4.8.0
+
- make trans component work with preact and preact-compat
- add preact example
### 4.7.0
+
- Trans component parent element configurable [PR278](https://github.com/i18next/react-i18next/pull/278)
### 4.6.4
+
- optimize generated defaultValue for components not having children
### 4.6.3
+
- move react, prop-types, ... to peerDependency again
### 4.6.2
+
- optimize trans component output
### 4.6.1
+
- fixes issue in changeLanguage on set via translate hoc ssr
### 4.6.0
+
- allow passing initialI18nStore and initialLanguage to I18nextProvider via props to support simpler ssr
- adds a serverside rendering sample based on razzle
### 4.5.0
+
- pass i18n instance to context inside translate hoc to simplify usage in nextjs
- options.react.exposeNamespace will expose namespace on data-i18next-options for consuming in editors
### 4.4.0
+
- introduces Trans component which enables you to translate nested components incl. interpolation by resulting in one translatable string. [learn more](https://react.i18next.com/components/trans-component.html)
### 4.3.0
+
- allow passing down initialI18nStore and initialLanguage to translate hoc to support ssr scenario better see example/nextjs
### 4.2.0
+
- allow passing i18next instance in translate hoc options makes integration in nextjs easier
### 4.1.2
+
- Remove workaround to set ready if there was no initialized signal [PR263](https://github.com/i18next/react-i18next/pull/263)
### 4.1.1
+
- Fix react-i18next to work with TypeScript [PR261](https://github.com/i18next/react-i18next/pull/261)
### 4.1.0
+
- eslint cleanup
- a lot more tests
- flag nsMode: 'fallback' -> uses namespaces passed to translate hoc as fallbacks [#254](https://github.com/i18next/react-i18next/issues/254)
### 4.0.0
+
- deploys 3.1.1 as possible breaking: fixes issue in fixing t function - pass only first namespace not an array of namespaces (access other namespaces like: this.props.t('namespace:key'))
### 3.1.2
+
- reverts last change
### 3.1.1
+
- fixes issue in fixing t function - pass only first namespace not an array of namespaces
### 3.1.0
+
- fixes wrong warning of missing prop on interpolate with format
- the wait flag on translate hoc can now be set globally on i18next options `i18next.init({ wait: true })`
### 3.0.0
+
- [BREAKING] assert you install prop-types as a peerDependency based on changes in react >= 15.5.x
- update react to 15.5.x use prop-types module to remove react warnings [PR248](https://github.com/i18next/react-i18next/pull/248)
- update all dependencies
- move react, prop-types to peerDependencies
### 2.2.3
+
- try not access store if undefined for hmr
### 2.2.1
+
- fixes validation for missing prop in interpolate component
### 2.2.0
+
- support formatting inside interpolate component
### 2.1.0
+
- tanslate hoc: expose the i18n instance via props
### 2.0.0
+
- translate hoc wait option asserts now that i18next is initialized before rendering (waits for lng detection)
- [BREAKING] needs i18next >= 4.2.0
### 1.11.0
+
- pass style prop to interpolate component
- define i18next as a peerDependency
### 1.10.1
+
- Suppresses required context type warning if passing i18n as a prop [PR205](https://github.com/i18next/react-i18next/pull/205)
### 1.10.0
+
- allow passing i18next instance via props to translate hoc [PR203](https://github.com/i18next/react-i18next/pull/203)
### 1.9.0
+
- adds options bindI18n, bindStore can be set to false or string of events to bind for triggering updates
### 1.8.0
+
- allows to set a className on interpolate component
- update all dependencies and devDependencies
### 1.7.0
+
- add option to change t function name to something else [PR196](https://github.com/i18next/react-i18next/pull/196)
- Added an option of using the with a raw HTML [PR195](https://github.com/i18next/react-i18next/pull/195)
### 1.6.3
+
- only trigger loaded namespaces if mounted
### 1.6.2
+
- update for react 15.2, eliminates Unknown Prop Warning
### 1.6.1
+
- Added conditional warning on unmatched variable during interpolation [PR 160](https://github.com/i18next/react-i18next/pull/160
### 1.6.0
+
- Hoist non react statics [PR 150](https://github.com/i18next/react-i18next/pull/150
### 1.5.3
+
- Handle i18next added and removed resource events [PR 150](https://github.com/i18next/react-i18next/pull/150
### 1.5.2
+
- move ns loading to did mount
### 1.5.1
+
- possible fix for HRM issues
### 1.5.0
+
- adds wait option, which delays initial rendering until translations are loaded
### 1.4.2
+
- possible fix for HRM issues
### 1.4.1
+
- change global name
### 1.4.0
+
- adds getWrappedInstance() to translate wrapper
### 1.3.0
+
- Support for universal apps / server-side rendering [PR 52](https://github.com/i18next/react-i18next/pull/52)
### 1.2.2
+
- fixes bower json - bower publish only
### 1.2.0
+
- change build to rollup
### 1.1.0
+
- added WrappedComponent property to translate wrapper [PR 15](https://github.com/i18next/react-i18next/pull/15)
### 1.0.1
+
- fixing export of index
### 1.0.0
+
- change package.json main to `/lib/index.js`
- move build from gulp to npm run script
diff --git a/package.json b/package.json
index 3dcc72262..c5511b6df 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "react-i18next",
- "version": "7.8.1",
+ "version": "7.9.0",
"description": "Internationalization for react done right. Using the i18next i18n ecosystem.",
"main": "dist/commonjs/index.js",
"jsnext:main": "dist/es/index.js",
diff --git a/react-i18next.js b/react-i18next.js
index eb61ac155..173428d8c 100644
--- a/react-i18next.js
+++ b/react-i18next.js
@@ -613,7 +613,7 @@ function translate(namespaceArg) {
var _this = possibleConstructorReturn(this, (Translate.__proto__ || Object.getPrototypeOf(Translate)).call(this, props, context));
_this.i18n = props.i18n || options.i18n || context.i18n || getI18n();
- _this.namespaces = typeof namespaceArg === 'function' ? namespaceArg(props) : namespaceArg || _this.i18n.options && _this.i18n.options.defaultNS;
+ _this.namespaces = typeof namespaceArg === 'function' ? namespaceArg(props) : namespaceArg || context.defaultNS || _this.i18n.options && _this.i18n.options.defaultNS;
if (typeof _this.namespaces === 'string') _this.namespaces = [_this.namespaces];
var i18nOptions = _this.i18n && _this.i18n.options && _this.i18n.options.react || {};
@@ -671,7 +671,8 @@ function translate(namespaceArg) {
Translate.WrappedComponent = WrappedComponent;
Translate.contextTypes = {
- i18n: PropTypes.object
+ i18n: PropTypes.object,
+ defaultNS: PropTypes.string
};
Translate.displayName = 'Translate(' + getDisplayName(WrappedComponent) + ')';
@@ -1158,6 +1159,7 @@ var I18nextProvider = function (_Component) {
var _this = possibleConstructorReturn(this, (I18nextProvider.__proto__ || Object.getPrototypeOf(I18nextProvider)).call(this, props, context));
_this.i18n = props.i18n;
+ _this.defaultNS = props.defaultNS;
if (props.initialI18nStore) {
_this.i18n.services.resourceStore.data = props.initialI18nStore;
_this.i18n.options.isInitialSSR = true; // if set will be deleted on first render in translate hoc
@@ -1171,7 +1173,10 @@ var I18nextProvider = function (_Component) {
createClass(I18nextProvider, [{
key: 'getChildContext',
value: function getChildContext() {
- return { i18n: this.i18n };
+ return {
+ i18n: this.i18n,
+ defaultNS: this.defaultNS
+ };
}
}, {
key: 'componentWillReceiveProps',
@@ -1193,15 +1198,20 @@ var I18nextProvider = function (_Component) {
I18nextProvider.propTypes = {
i18n: PropTypes.object.isRequired,
- children: PropTypes.element.isRequired
+ children: PropTypes.element.isRequired,
+ defaultNS: PropTypes.string
};
I18nextProvider.childContextTypes = {
- i18n: PropTypes.object.isRequired
+ i18n: PropTypes.object.isRequired,
+ defaultNS: PropTypes.string
+};
+
+I18nextProvider.defaultProps = {
+ defaultNS: undefined
};
-// shim object entries
-if (!Object.entries) Object.entries = function (obj) {
+var objectEntries = Object.entries || function (obj) {
var ownProps = Object.keys(obj),
i = ownProps.length,
resArray = new Array(i); // preallocate the Array
@@ -1220,7 +1230,7 @@ function eachComponents(components, iterator) {
var _iteratorError = undefined;
try {
- for (var _iterator = Object.entries(components[i])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
+ for (var _iterator = objectEntries(components[i])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var _step$value = slicedToArray(_step.value, 2),
key = _step$value[0],
value = _step$value[1];
diff --git a/react-i18next.min.js b/react-i18next.min.js
index 00efa57ae..7f0e43720 100644
--- a/react-i18next.min.js
+++ b/react-i18next.min.js
@@ -1 +1 @@
-!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("prop-types")):"function"==typeof define&&define.amd?define(["exports","react","prop-types"],t):t(e.reactI18next={},e.React,e.PropTypes)}(this,function(e,t,n){"use strict";function i(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function r(e,t){if(i(e,t))return!0;if("object"!==(void 0===e?"undefined":C(e))||null===e||"object"!==(void 0===t?"undefined":C(t))||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(var o=0;o1&&void 0!==arguments[1]?arguments[1]:{};return function(o){var s=function(t){function n(t,r){E(this,n);var o=W(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t,r));o.i18n=t.i18n||i.i18n||r.i18n||c(),o.namespaces="function"==typeof e?e(t):e||o.i18n.options&&o.i18n.options.defaultNS,"string"==typeof o.namespaces&&(o.namespaces=[o.namespaces]);var s=o.i18n&&o.i18n.options&&o.i18n.options.react||{};return o.options=N({},a(),s,i),o.getWrappedInstance=o.getWrappedInstance.bind(o),o}return A(n,t),R(n,[{key:"shouldComponentUpdate",value:function(e){return!this.options.usePureComponent||!r(this.props,e)}},{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,t={};return this.options.withRef&&(t.ref=function(t){e.wrappedInstance=t}),O.createElement(B,N({ns:this.namespaces},this.options,this.props,{i18n:this.i18n}),function(n,i){var r=i.ready,a=L(i,["ready"]);return O.createElement(o,N({tReady:r},e.props,t,a))})}}]),n}(t.Component);return s.WrappedComponent=o,s.contextTypes={i18n:n.object},s.displayName="Translate("+p(o)+")",s.namespaces=e,_(s,o)}}function l(e,t,n,i,r){var o=t.indexOf("<",i),a=t.slice(i,-1===o?void 0:o);/^\s*$/.test(a)&&(a=" "),(!r&&o>-1&&n+e.length>=0||" "!==a)&&e.push({type:"text",content:a})}function f(e){var t=[];for(var n in e)t.push(n+'="'+e[n]+'"');return t.length?" "+t.join(" "):""}function h(e,t){switch(t.type){case"text":return e+t.content;case"tag":return e+="<"+t.name+(t.attrs?f(t.attrs):"")+(t.voidElement?"/>":">"),t.voidElement?e:e+t.children.reduce(h,"")+""+t.name+">"}}function d(e){return e&&(e.children||e.props&&e.props.children)}function y(e){return e&&e.children?e.children:e.props&&e.props.children}function v(e,t,n){return t?("[object Array]"!==Object.prototype.toString.call(t)&&(t=[t]),t.forEach(function(t,n){var i=""+n;if("string"==typeof t)e=""+e+t;else if(d(t))e=e+"<"+i+">"+v("",y(t),n+1)+""+i+">";else if(O.isValidElement(t))e=e+"<"+i+">"+i+">";else if("object"===(void 0===t?"undefined":C(t))){var r=N({},t),o=r.format;delete r.format;var a=Object.keys(r);o&&1===a.length?e=e+"<"+i+">{{"+a[0]+", "+o+"}}"+i+">":1===a.length?e=e+"<"+i+">{{"+a[0]+"}}"+i+">":console&&console.warn&&console.warn("react-i18next: the passed in object contained more than one variable - the object should look like {{ value, format }} where format is optional.",t)}else console&&console.warn&&console.warn("react-i18next: the passed in value is invalid - seems you passed in a variable like {number} - please pass in variables for interpolation as full objects like {{number}}.",t)}),e):""}function m(e,t,n){function i(e,t){return"[object Array]"!==Object.prototype.toString.call(e)&&(e=[e]),"[object Array]"!==Object.prototype.toString.call(t)&&(t=[t]),t.reduce(function(t,r,o){if("tag"===r.type){var a=e[parseInt(r.name,10)]||{},s=O.isValidElement(a);if("string"==typeof a)t.push(a);else if(d(a)){var c=i(y(a),r.children);a.dummy&&(a.children=c),t.push(O.cloneElement(a,N({},a.props,{key:o}),c))}else if("object"!==(void 0===a?"undefined":C(a))||s)t.push(a);else{var p=n.services.interpolator.interpolate(r.children[0].content,a,n.language);t.push(p)}}else"text"===r.type&&t.push(r.content);return t},[])}return""===t?[]:e?y(i([{dummy:!0,children:e}],Q.parse("<0>"+t+"0>"))[0]):[t]}function g(e,t){for(var n=0,i=e.length;n=0||Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n},W=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},q=function(){function e(e,t){var n=[],i=!0,r=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(i=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);i=!0);}catch(e){r=!0,o=e}finally{try{!i&&s.return&&s.return()}finally{if(r)throw o}}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")}}(),D=Object.prototype.hasOwnProperty,K={wait:!1,withRef:!1,bindI18n:"languageChanged loaded",bindStore:"added removed",translateFuncName:"t",nsMode:"default",usePureComponent:!1,omitBoundRerender:!0},M=void 0,$={type:"3rdParty",init:function(e){o(e.options.react),s(e)}},z=!1,B=function(e){function t(e,n){E(this,t);var i=W(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));i.i18n=e.i18n||n.i18n||c(),i.namespaces=e.ns||i.i18n.options&&i.i18n.options.defaultNS,"string"==typeof i.namespaces&&(i.namespaces=[i.namespaces]);var r=i.i18n&&i.i18n.options&&i.i18n.options.react||{};i.options=N({},a(),r,e),e.initialI18nStore&&(i.i18n.services.resourceStore.data=e.initialI18nStore,i.options.wait=!1),e.initialLanguage&&i.i18n.changeLanguage(e.initialLanguage),i.i18n.options&&i.i18n.options.isInitialSSR&&(i.options.wait=!1);var o=i.i18n.languages&&i.i18n.languages[0],s=!!o&&i.namespaces.every(function(e){return i.i18n.hasResourceBundle(o,e)});return i.state={i18nLoadedAt:null,ready:s},i.t=i.getI18nTranslate(),i.onI18nChanged=i.onI18nChanged.bind(i),i.getI18nTranslate=i.getI18nTranslate.bind(i),i}return A(t,e),R(t,[{key:"getChildContext",value:function(){return{t:this.t,i18n:this.i18n}}},{key:"componentDidMount",value:function(){var e=this,t=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(this.namespaces,function(){var n=function(){e.mounted&&!e.state.ready&&e.setState({ready:!0}),e.options.wait&&e.mounted&&t()};if(e.i18n.isInitialized)n();else{e.i18n.on("initialized",function t(){setTimeout(function(){e.i18n.off("initialized",t)},1e3),n()})}}),this.options.wait||t()}},{key:"componentWillUnmount",value:function(){var e=this;this.mounted=!1,this.onI18nChanged&&(this.options.bindI18n&&this.options.bindI18n.split(" ").forEach(function(t){return e.i18n.off(t,e.onI18nChanged)}),this.options.bindStore&&this.options.bindStore.split(" ").forEach(function(t){return e.i18n.store&&e.i18n.store.off(t,e.onI18nChanged)}))}},{key:"onI18nChanged",value:function(){this.mounted&&(!this.state.ready&&this.options.omitBoundRerender||(this.t=this.getI18nTranslate(),this.setState({i18nLoadedAt:new Date})))}},{key:"getI18nTranslate",value:function(){return this.i18n.getFixedT(null,"fallback"===this.options.nsMode?this.namespaces:this.namespaces[0])}},{key:"render",value:function(){var e=this,t=this.props.children,n=this.state.ready;return!n&&this.options.wait?null:(this.i18n.options&&this.i18n.options.isInitialSSR&&!z&&(z=!0,setTimeout(function(){delete e.i18n.options.isInitialSSR},100)),t(this.t,{i18n:this.i18n,t:this.t,ready:n}))}}]),t}(t.Component);B.contextTypes={i18n:n.object},B.childContextTypes={t:n.func.isRequired,i18n:n.object},u.setDefaults=o,u.setI18n=s;var H=function(e){function t(e,n){E(this,t);var i=W(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return i.i18n=e.i18n||n.i18n,i.t=e.t||n.t,i}return A(t,e),R(t,[{key:"render",value:function(){var e=this,t=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",c=N({},this.props.options,{interpolation:{prefix:"#$?",suffix:"?$#"}}),p=this.t(this.props.i18nKey,c);if(!p||"string"!=typeof p)return O.createElement("noscript",null);var u=[],l=function(t,n){if(t.indexOf(e.i18n.options.interpolation.formatSeparator)<0)return void 0===n[t]&&e.i18n.services.logger.warn("interpolator: missed to pass in variable "+t+" for interpolating "+p),n[t];var i=t.split(e.i18n.options.interpolation.formatSeparator),r=i.shift().trim(),o=i.join(e.i18n.options.interpolation.formatSeparator).trim();return void 0===n[r]&&e.i18n.services.logger.warn("interpolator: missed to pass in variable "+r+" for interpolating "+p),e.i18n.options.interpolation.format(n[r],o,e.i18n.language)};p.split(n).reduce(function(t,n,i){var r=void 0;if(i%2==0){if(0===n.length)return t;r=a?O.createElement(s,{dangerouslySetInnerHTML:{__html:n}}):n}else r=l(n,e.props);return t.push(r),t},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];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),O.createElement.apply(this,[t,f].concat(u))}}]),t}(t.Component);H.propTypes={className:n.string},H.defaultProps={className:""},H.contextTypes={i18n:n.object.isRequired,t:n.func.isRequired};var V={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},F=/([\w-]+)|=|(['"])([.\s\S]*?)\2/g,J=function(e){var t,n=0,i=!0,r={type:"tag",name:"",voidElement:!1,attrs:{},children:[]};return e.replace(F,function(o){if("="===o)return i=!0,void n++;i?0===n?((V[o]||"/"===e.charAt(e.length-2))&&(r.voidElement=!0),r.name=o):(r.attrs[t]=o.replace(/^['"]|['"]$/g,""),t=void 0):(t&&(r.attrs[t]=t),t=o),n++,i=!1}),r},U=/(?:|<(?:"[^"]*"['"]*|'[^']*'['"]*|[^'">])+>)/g,G=Object.create?Object.create(null):{},Q={parse:function(e,t){t||(t={}),t.components||(t.components=G);var n,i=[],r=-1,o=[],a=!1;return e.replace(U,function(s,c){if(a){if(s!==""+n.name+">")return;a=!1}var p,u="/"!==s.charAt(1),f=0===s.indexOf("\x3c!--"),h=c+s.length,d=e.charAt(h);u&&!f&&(r++,"tag"===(n=J(s)).type&&t.components[n.name]&&(n.type="component",a=!0),n.voidElement||a||!d||"<"===d||l(n.children,e,r,h,t.ignoreWhitespace),0===r&&i.push(n),(p=o[r-1])&&p.children.push(n),o[r]=n),(f||!u||n.voidElement)&&(f||r--,!a&&"<"!==d&&d&&l(p=-1===r?i:o[r].children,e,r,h,t.ignoreWhitespace))}),!i.length&&e.length&&l(i,e,0,0,t.ignoreWhitespace),i},stringify:function(e){return e.reduce(function(e,t){return e+h("",t)},"")}},X=function(e){function t(){return E(this,t),W(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return A(t,e),R(t,[{key:"render",value:function(){var e=N({i18n:this.context.i18n,t:this.context.t},this.props),t=e.children,n=e.count,i=e.parent,r=e.i18nKey,o=e.tOptions,a=e.values,s=e.defaults,c=e.components,p=e.ns,u=e.i18n,l=e.t,f=L(e,["children","count","parent","i18nKey","tOptions","values","defaults","components","ns","i18n","t"]),h=l||u.t.bind(u),d=u.options&&u.options.react||{},y=void 0!==i?i:d.defaultTransParent,g=s||v("",t,0),b=d.hashTransKey,j=r||(b?b(g):g),S=j?h(j,N({},o,a,a?{}:{interpolation:{prefix:"#$?",suffix:"?$#"}},{defaultValue:g,count:n,ns:p})):g;if(d.exposeNamespace){var w="string"==typeof h.ns?h.ns:h.ns[0];r&&u.options&&u.options.nsSeparator&&r.indexOf(u.options.nsSeparator)>-1&&(w=r.split(u.options.nsSeparator)[0]),h.ns&&(f["data-i18next-options"]=JSON.stringify({ns:w}))}return y?O.createElement(y,f,m(c||t,S,u)):m(c||t,S,u)}}]),t}(O.Component);X.propTypes={count:n.number,parent:n.oneOfType([n.node,n.func]),i18nKey:n.string,i18n:n.object,t:n.func},X.contextTypes={i18n:n.object,t:n.func};var Y=function(e){function n(e,t){E(this,n);var i=W(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,t));return i.i18n=e.i18n,e.initialI18nStore&&(i.i18n.services.resourceStore.data=e.initialI18nStore,i.i18n.options.isInitialSSR=!0),e.initialLanguage&&i.i18n.changeLanguage(e.initialLanguage),i}return A(n,e),R(n,[{key:"getChildContext",value:function(){return{i18n:this.i18n}}},{key:"componentWillReceiveProps",value:function(e){if(this.props.i18n!==e.i18n)throw new Error("[react-i18next][I18nextProvider]does not support changing the i18n object.")}},{key:"render",value:function(){var e=this.props.children;return t.Children.only(e)}}]),n}(t.Component);Y.propTypes={i18n:n.object.isRequired,children:n.element.isRequired},Y.childContextTypes={i18n:n.object.isRequired},Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),n=t.length,i=new Array(n);n--;)i[n]=[t[n],e[t[n]]];return i}),e.translate=u,e.I18n=B,e.Interpolate=H,e.Trans=X,e.I18nextProvider=Y,e.loadNamespaces=function(e){var t=e.components,n=e.i18n,i=b(t);return new Promise(function(e){n.loadNamespaces(i,e)})},e.reactI18nextModule=$,e.setDefaults=o,e.getDefaults=a,e.setI18n=s,e.getI18n=c,Object.defineProperty(e,"__esModule",{value:!0})});
+!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("prop-types")):"function"==typeof define&&define.amd?define(["exports","react","prop-types"],t):t(e.reactI18next={},e.React,e.PropTypes)}(this,function(e,t,n){"use strict";function i(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function r(e,t){if(i(e,t))return!0;if("object"!==(void 0===e?"undefined":C(e))||null===e||"object"!==(void 0===t?"undefined":C(t))||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(var o=0;o1&&void 0!==arguments[1]?arguments[1]:{};return function(o){var s=function(t){function n(t,r){N(this,n);var o=W(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t,r));o.i18n=t.i18n||i.i18n||r.i18n||p(),o.namespaces="function"==typeof e?e(t):e||r.defaultNS||o.i18n.options&&o.i18n.options.defaultNS,"string"==typeof o.namespaces&&(o.namespaces=[o.namespaces]);var s=o.i18n&&o.i18n.options&&o.i18n.options.react||{};return o.options=R({},a(),s,i),o.getWrappedInstance=o.getWrappedInstance.bind(o),o}return A(n,t),E(n,[{key:"shouldComponentUpdate",value:function(e){return!this.options.usePureComponent||!r(this.props,e)}},{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,t={};return this.options.withRef&&(t.ref=function(t){e.wrappedInstance=t}),S.createElement(B,R({ns:this.namespaces},this.options,this.props,{i18n:this.i18n}),function(n,i){var r=i.ready,a=L(i,["ready"]);return S.createElement(o,R({tReady:r},e.props,t,a))})}}]),n}(t.Component);return s.WrappedComponent=o,s.contextTypes={i18n:n.object,defaultNS:n.string},s.displayName="Translate("+u(o)+")",s.namespaces=e,_(s,o)}}function l(e,t,n,i,r){var o=t.indexOf("<",i),a=t.slice(i,-1===o?void 0:o);/^\s*$/.test(a)&&(a=" "),(!r&&o>-1&&n+e.length>=0||" "!==a)&&e.push({type:"text",content:a})}function f(e){var t=[];for(var n in e)t.push(n+'="'+e[n]+'"');return t.length?" "+t.join(" "):""}function d(e,t){switch(t.type){case"text":return e+t.content;case"tag":return e+="<"+t.name+(t.attrs?f(t.attrs):"")+(t.voidElement?"/>":">"),t.voidElement?e:e+t.children.reduce(d,"")+""+t.name+">"}}function h(e){return e&&(e.children||e.props&&e.props.children)}function y(e){return e&&e.children?e.children:e.props&&e.props.children}function v(e,t,n){return t?("[object Array]"!==Object.prototype.toString.call(t)&&(t=[t]),t.forEach(function(t,n){var i=""+n;if("string"==typeof t)e=""+e+t;else if(h(t))e=e+"<"+i+">"+v("",y(t),n+1)+""+i+">";else if(S.isValidElement(t))e=e+"<"+i+">"+i+">";else if("object"===(void 0===t?"undefined":C(t))){var r=R({},t),o=r.format;delete r.format;var a=Object.keys(r);o&&1===a.length?e=e+"<"+i+">{{"+a[0]+", "+o+"}}"+i+">":1===a.length?e=e+"<"+i+">{{"+a[0]+"}}"+i+">":console&&console.warn&&console.warn("react-i18next: the passed in object contained more than one variable - the object should look like {{ value, format }} where format is optional.",t)}else console&&console.warn&&console.warn("react-i18next: the passed in value is invalid - seems you passed in a variable like {number} - please pass in variables for interpolation as full objects like {{number}}.",t)}),e):""}function m(e,t,n){function i(e,t){return"[object Array]"!==Object.prototype.toString.call(e)&&(e=[e]),"[object Array]"!==Object.prototype.toString.call(t)&&(t=[t]),t.reduce(function(t,r,o){if("tag"===r.type){var a=e[parseInt(r.name,10)]||{},s=S.isValidElement(a);if("string"==typeof a)t.push(a);else if(h(a)){var p=i(y(a),r.children);a.dummy&&(a.children=p),t.push(S.cloneElement(a,R({},a.props,{key:o}),p))}else if("object"!==(void 0===a?"undefined":C(a))||s)t.push(a);else{var u=n.services.interpolator.interpolate(r.children[0].content,a,n.language);t.push(u)}}else"text"===r.type&&t.push(r.content);return t},[])}return""===t?[]:e?y(i([{dummy:!0,children:e}],Q.parse("<0>"+t+"0>"))[0]):[t]}function g(e,t){for(var n=0,i=e.length;n=0||Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n},W=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},q=function(){function e(e,t){var n=[],i=!0,r=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(i=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);i=!0);}catch(e){r=!0,o=e}finally{try{!i&&s.return&&s.return()}finally{if(r)throw o}}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")}}(),D=Object.prototype.hasOwnProperty,K={wait:!1,withRef:!1,bindI18n:"languageChanged loaded",bindStore:"added removed",translateFuncName:"t",nsMode:"default",usePureComponent:!1,omitBoundRerender:!0},M=void 0,$={type:"3rdParty",init:function(e){o(e.options.react),s(e)}},z=!1,B=function(e){function t(e,n){N(this,t);var i=W(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));i.i18n=e.i18n||n.i18n||p(),i.namespaces=e.ns||i.i18n.options&&i.i18n.options.defaultNS,"string"==typeof i.namespaces&&(i.namespaces=[i.namespaces]);var r=i.i18n&&i.i18n.options&&i.i18n.options.react||{};i.options=R({},a(),r,e),e.initialI18nStore&&(i.i18n.services.resourceStore.data=e.initialI18nStore,i.options.wait=!1),e.initialLanguage&&i.i18n.changeLanguage(e.initialLanguage),i.i18n.options&&i.i18n.options.isInitialSSR&&(i.options.wait=!1);var o=i.i18n.languages&&i.i18n.languages[0],s=!!o&&i.namespaces.every(function(e){return i.i18n.hasResourceBundle(o,e)});return i.state={i18nLoadedAt:null,ready:s},i.t=i.getI18nTranslate(),i.onI18nChanged=i.onI18nChanged.bind(i),i.getI18nTranslate=i.getI18nTranslate.bind(i),i}return A(t,e),E(t,[{key:"getChildContext",value:function(){return{t:this.t,i18n:this.i18n}}},{key:"componentDidMount",value:function(){var e=this,t=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(this.namespaces,function(){var n=function(){e.mounted&&!e.state.ready&&e.setState({ready:!0}),e.options.wait&&e.mounted&&t()};if(e.i18n.isInitialized)n();else{e.i18n.on("initialized",function t(){setTimeout(function(){e.i18n.off("initialized",t)},1e3),n()})}}),this.options.wait||t()}},{key:"componentWillUnmount",value:function(){var e=this;this.mounted=!1,this.onI18nChanged&&(this.options.bindI18n&&this.options.bindI18n.split(" ").forEach(function(t){return e.i18n.off(t,e.onI18nChanged)}),this.options.bindStore&&this.options.bindStore.split(" ").forEach(function(t){return e.i18n.store&&e.i18n.store.off(t,e.onI18nChanged)}))}},{key:"onI18nChanged",value:function(){this.mounted&&(!this.state.ready&&this.options.omitBoundRerender||(this.t=this.getI18nTranslate(),this.setState({i18nLoadedAt:new Date})))}},{key:"getI18nTranslate",value:function(){return this.i18n.getFixedT(null,"fallback"===this.options.nsMode?this.namespaces:this.namespaces[0])}},{key:"render",value:function(){var e=this,t=this.props.children,n=this.state.ready;return!n&&this.options.wait?null:(this.i18n.options&&this.i18n.options.isInitialSSR&&!z&&(z=!0,setTimeout(function(){delete e.i18n.options.isInitialSSR},100)),t(this.t,{i18n:this.i18n,t:this.t,ready:n}))}}]),t}(t.Component);B.contextTypes={i18n:n.object},B.childContextTypes={t:n.func.isRequired,i18n:n.object},c.setDefaults=o,c.setI18n=s;var H=function(e){function t(e,n){N(this,t);var i=W(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return i.i18n=e.i18n||n.i18n,i.t=e.t||n.t,i}return A(t,e),E(t,[{key:"render",value:function(){var e=this,t=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=R({},this.props.options,{interpolation:{prefix:"#$?",suffix:"?$#"}}),u=this.t(this.props.i18nKey,p);if(!u||"string"!=typeof u)return S.createElement("noscript",null);var c=[],l=function(t,n){if(t.indexOf(e.i18n.options.interpolation.formatSeparator)<0)return void 0===n[t]&&e.i18n.services.logger.warn("interpolator: missed to pass in variable "+t+" for interpolating "+u),n[t];var i=t.split(e.i18n.options.interpolation.formatSeparator),r=i.shift().trim(),o=i.join(e.i18n.options.interpolation.formatSeparator).trim();return void 0===n[r]&&e.i18n.services.logger.warn("interpolator: missed to pass in variable "+r+" for interpolating "+u),e.i18n.options.interpolation.format(n[r],o,e.i18n.language)};u.split(n).reduce(function(t,n,i){var r=void 0;if(i%2==0){if(0===n.length)return t;r=a?S.createElement(s,{dangerouslySetInnerHTML:{__html:n}}):n}else r=l(n,e.props);return t.push(r),t},c);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];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),S.createElement.apply(this,[t,f].concat(c))}}]),t}(t.Component);H.propTypes={className:n.string},H.defaultProps={className:""},H.contextTypes={i18n:n.object.isRequired,t:n.func.isRequired};var V={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},F=/([\w-]+)|=|(['"])([.\s\S]*?)\2/g,J=function(e){var t,n=0,i=!0,r={type:"tag",name:"",voidElement:!1,attrs:{},children:[]};return e.replace(F,function(o){if("="===o)return i=!0,void n++;i?0===n?((V[o]||"/"===e.charAt(e.length-2))&&(r.voidElement=!0),r.name=o):(r.attrs[t]=o.replace(/^['"]|['"]$/g,""),t=void 0):(t&&(r.attrs[t]=t),t=o),n++,i=!1}),r},U=/(?:|<(?:"[^"]*"['"]*|'[^']*'['"]*|[^'">])+>)/g,G=Object.create?Object.create(null):{},Q={parse:function(e,t){t||(t={}),t.components||(t.components=G);var n,i=[],r=-1,o=[],a=!1;return e.replace(U,function(s,p){if(a){if(s!==""+n.name+">")return;a=!1}var u,c="/"!==s.charAt(1),f=0===s.indexOf("\x3c!--"),d=p+s.length,h=e.charAt(d);c&&!f&&(r++,"tag"===(n=J(s)).type&&t.components[n.name]&&(n.type="component",a=!0),n.voidElement||a||!h||"<"===h||l(n.children,e,r,d,t.ignoreWhitespace),0===r&&i.push(n),(u=o[r-1])&&u.children.push(n),o[r]=n),(f||!c||n.voidElement)&&(f||r--,!a&&"<"!==h&&h&&l(u=-1===r?i:o[r].children,e,r,d,t.ignoreWhitespace))}),!i.length&&e.length&&l(i,e,0,0,t.ignoreWhitespace),i},stringify:function(e){return e.reduce(function(e,t){return e+d("",t)},"")}},X=function(e){function t(){return N(this,t),W(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return A(t,e),E(t,[{key:"render",value:function(){var e=R({i18n:this.context.i18n,t:this.context.t},this.props),t=e.children,n=e.count,i=e.parent,r=e.i18nKey,o=e.tOptions,a=e.values,s=e.defaults,p=e.components,u=e.ns,c=e.i18n,l=e.t,f=L(e,["children","count","parent","i18nKey","tOptions","values","defaults","components","ns","i18n","t"]),d=l||c.t.bind(c),h=c.options&&c.options.react||{},y=void 0!==i?i:h.defaultTransParent,g=s||v("",t,0),b=h.hashTransKey,O=r||(b?b(g):g),j=O?d(O,R({},o,a,a?{}:{interpolation:{prefix:"#$?",suffix:"?$#"}},{defaultValue:g,count:n,ns:u})):g;if(h.exposeNamespace){var w="string"==typeof d.ns?d.ns:d.ns[0];r&&c.options&&c.options.nsSeparator&&r.indexOf(c.options.nsSeparator)>-1&&(w=r.split(c.options.nsSeparator)[0]),d.ns&&(f["data-i18next-options"]=JSON.stringify({ns:w}))}return y?S.createElement(y,f,m(p||t,j,c)):m(p||t,j,c)}}]),t}(S.Component);X.propTypes={count:n.number,parent:n.oneOfType([n.node,n.func]),i18nKey:n.string,i18n:n.object,t:n.func},X.contextTypes={i18n:n.object,t:n.func};var Y=function(e){function n(e,t){N(this,n);var i=W(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,t));return i.i18n=e.i18n,i.defaultNS=e.defaultNS,e.initialI18nStore&&(i.i18n.services.resourceStore.data=e.initialI18nStore,i.i18n.options.isInitialSSR=!0),e.initialLanguage&&i.i18n.changeLanguage(e.initialLanguage),i}return A(n,e),E(n,[{key:"getChildContext",value:function(){return{i18n:this.i18n,defaultNS:this.defaultNS}}},{key:"componentWillReceiveProps",value:function(e){if(this.props.i18n!==e.i18n)throw new Error("[react-i18next][I18nextProvider]does not support changing the i18n object.")}},{key:"render",value:function(){var e=this.props.children;return t.Children.only(e)}}]),n}(t.Component);Y.propTypes={i18n:n.object.isRequired,children:n.element.isRequired,defaultNS:n.string},Y.childContextTypes={i18n:n.object.isRequired,defaultNS:n.string},Y.defaultProps={defaultNS:void 0};var Z=Object.entries||function(e){for(var t=Object.keys(e),n=t.length,i=new Array(n);n--;)i[n]=[t[n],e[t[n]]];return i};e.translate=c,e.I18n=B,e.Interpolate=H,e.Trans=X,e.I18nextProvider=Y,e.loadNamespaces=function(e){var t=e.components,n=e.i18n,i=b(t);return new Promise(function(e){n.loadNamespaces(i,e)})},e.reactI18nextModule=$,e.setDefaults=o,e.getDefaults=a,e.setI18n=s,e.getI18n=p,Object.defineProperty(e,"__esModule",{value:!0})});