react-i18next
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -0,1 +1,4 @@ | ||
### 1.1.0 | ||
- added WrappedComponent property to translate wrapper [PR 15](https://github.com/i18next/react-i18next/pull/15) | ||
### 1.0.1 | ||
@@ -2,0 +5,0 @@ - fixing export of index |
@@ -101,2 +101,4 @@ 'use strict'; | ||
Translate.WrappedComponent = WrappedComponent; | ||
Translate.contextTypes = { | ||
@@ -103,0 +105,0 @@ i18n: _react.PropTypes.object.isRequired |
{ | ||
"name": "react-i18next", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "React integration for i18next", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -11,5 +11,5 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.reactI18next = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
},{"react":"react"}],4:[function(require,module,exports){ | ||
"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(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}function _inherits(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)}function getDisplayName(e){return e.displayName||e.name||"Component"}function translate(e){return function(t){var n=void 0,o=void 0,r=function(r){function a(e,t){_classCallCheck(this,a);var n=_possibleConstructorReturn(this,Object.getPrototypeOf(a).call(this,e,t));return o=t.i18n,n.state={i18nLoadedAt:null},n}return _inherits(a,r),_createClass(a,[{key:"getChildContext",value:function(){return{t:n}}},{key:"componentWillMount",value:function(){this.mounted=!0,o.loadNamespaces(e),n=o.getFixedT(null,e)}},{key:"componentDidMount",value:function(){var e=this;this.onI18nChanged=function(){e.mounted&&e.setState({i18nLoadedAt:new Date})},o.on("languageChanged loaded",this.onI18nChanged)}},{key:"componentWillUnmount",value:function(){this.mounted=!1,this.onI18nChanged&&(o.off("languageChanged",this.onI18nChanged),o.off("loaded",this.onI18nChanged))}},{key:"onI18nChange",value:function(){this.mounted&&this.setState({i18nLoadedAt:new Date})}},{key:"render",value:function(){var e=this.state.i18nLoadedAt;return _react2["default"].createElement(t,_extends({},this.props,{t:n,i18nLoadedAt:e}))}}]),a}(_react.Component);return r.contextTypes={i18n:_react.PropTypes.object.isRequired},r.childContextTypes={t:_react.PropTypes.func.isRequired},r.displayName="Translate["+getDisplayName(t)+"]",r}}Object.defineProperty(exports,"__esModule",{value:!0});var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},_createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),_react=require("react"),_react2=_interopRequireDefault(_react);exports["default"]=translate; | ||
"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(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}function _inherits(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)}function getDisplayName(e){return e.displayName||e.name||"Component"}function translate(e){return function(t){var n=void 0,o=void 0,r=function(r){function a(e,t){_classCallCheck(this,a);var n=_possibleConstructorReturn(this,Object.getPrototypeOf(a).call(this,e,t));return o=t.i18n,n.state={i18nLoadedAt:null},n}return _inherits(a,r),_createClass(a,[{key:"getChildContext",value:function(){return{t:n}}},{key:"componentWillMount",value:function(){this.mounted=!0,o.loadNamespaces(e),n=o.getFixedT(null,e)}},{key:"componentDidMount",value:function(){var e=this;this.onI18nChanged=function(){e.mounted&&e.setState({i18nLoadedAt:new Date})},o.on("languageChanged loaded",this.onI18nChanged)}},{key:"componentWillUnmount",value:function(){this.mounted=!1,this.onI18nChanged&&(o.off("languageChanged",this.onI18nChanged),o.off("loaded",this.onI18nChanged))}},{key:"onI18nChange",value:function(){this.mounted&&this.setState({i18nLoadedAt:new Date})}},{key:"render",value:function(){var e=this.state.i18nLoadedAt;return _react2["default"].createElement(t,_extends({},this.props,{t:n,i18nLoadedAt:e}))}}]),a}(_react.Component);return r.WrappedComponent=t,r.contextTypes={i18n:_react.PropTypes.object.isRequired},r.childContextTypes={t:_react.PropTypes.func.isRequired},r.displayName="Translate["+getDisplayName(t)+"]",r}}Object.defineProperty(exports,"__esModule",{value:!0});var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},_createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),_react=require("react"),_react2=_interopRequireDefault(_react);exports["default"]=translate; | ||
},{"react":"react"}]},{},[2])(2) | ||
}); |
@@ -64,2 +64,4 @@ import React, { Component, PropTypes } from 'react'; | ||
Translate.WrappedComponent = WrappedComponent; | ||
Translate.contextTypes = { | ||
@@ -66,0 +68,0 @@ i18n: PropTypes.object.isRequired |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29990
372