Skip to content

Commit

Permalink
rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
jamuhl committed Mar 8, 2018
1 parent 7d35821 commit fec5f5f
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-i18next",
"version": "7.4.0",
"version": "7.5.0",
"description": "Internationalization for react done right. Using the i18next i18n ecosystem.",
"main": "dist/commonjs/index.js",
"jsnext:main": "dist/es/index.js",
Expand Down
16 changes: 12 additions & 4 deletions react-i18next.js
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ var I18n = function (_Component) {
if (!this.mounted) return;

this.t = this.getI18nTranslate();
this.setState({ i18nLoadedAt: new Date() });
this.setState({ i18nLoadedAt: new Date() }); // rerender
}
}, {
key: 'getI18nTranslate',
Expand All @@ -577,7 +577,11 @@ var I18n = function (_Component) {
}, 100);
}

return children(this.t, { i18n: this.i18n, t: this.t });
return children(this.t, {
i18n: this.i18n,
t: this.t,
ready: ready
});
}
}]);
return I18n;
Expand Down Expand Up @@ -653,8 +657,12 @@ function translate(namespaceArg) {
};
}

return React__default.createElement(I18n, _extends({ ns: this.namespaces }, this.options, this.props, { i18n: this.i18n }), function (t, context) {
return React__default.createElement(WrappedComponent, _extends({}, _this2.props, extraProps, context));
return React__default.createElement(I18n, _extends({ ns: this.namespaces }, this.options, this.props, { i18n: this.i18n }), function (t, _ref) {
var ready = _ref.ready,
context = objectWithoutProperties(_ref, ['ready']);
return React__default.createElement(WrappedComponent, _extends({
tReady: ready
}, _this2.props, extraProps, context));
});
}
}]);
Expand Down
2 changes: 1 addition & 1 deletion react-i18next.min.js

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion src/I18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ export default class I18n extends Component {
const language = this.i18n.languages && this.i18n.languages[0];
const ready = !!language && this.namespaces.every(ns => this.i18n.hasResourceBundle(language, ns));

this.state = { ready };
this.state = {
i18nLoadedAt: null,
ready
};

this.onI18nChanged = this.onI18nChanged.bind(this);
this.getI18nTranslate = this.getI18nTranslate.bind(this);
Expand Down Expand Up @@ -98,6 +101,7 @@ export default class I18n extends Component {
if (!this.mounted) return;

this.t = this.getI18nTranslate();
this.setState({ i18nLoadedAt: new Date() }); // rerender
}

getI18nTranslate() {
Expand Down

0 comments on commit fec5f5f

Please sign in to comment.