Skip to content

Commit

Permalink
rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
jamuhl committed Jan 26, 2018
1 parent 5689e84 commit 66b564c
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 12 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,6 @@
### 7.3.4
- more save access to options in general

### 7.3.3
- more save access to options.react

Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "react-i18next",
"version": "7.3.3",
"version": "7.3.4",
"description": "Internationalization for react done right. Using the i18next i18n ecosystem.",
"main": "dist/commonjs/index.js",
"jsnext:main": "dist/es/index.js",
Expand Down
10 changes: 5 additions & 5 deletions react-i18next.js
Expand Up @@ -442,7 +442,7 @@ var I18n = function (_Component) {
var _this = possibleConstructorReturn(this, (I18n.__proto__ || Object.getPrototypeOf(I18n)).call(this, props, context));

_this.i18n = context.i18n || props.i18n || getI18n();
_this.namespaces = _this.props.ns || _this.i18n.options.defaultNS;
_this.namespaces = _this.props.ns || _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 || {};
Expand All @@ -458,7 +458,7 @@ var I18n = function (_Component) {
}

// provider SSR: data was set in provider and ssr flag was set
if (_this.i18n.options.isInitialSSR) {
if (_this.i18n.options && _this.i18n.options.isInitialSSR) {
_this.options.wait = false;
}

Expand Down Expand Up @@ -570,7 +570,7 @@ var I18n = function (_Component) {
if (!ready && this.options.wait) return null;

// remove ssr flag set by provider - first render was done from now on wait if set to wait
if (this.i18n.options.isInitialSSR && !removedIsInitialSSR) {
if (this.i18n.options && this.i18n.options.isInitialSSR && !removedIsInitialSSR) {
removedIsInitialSSR = true;
setTimeout(function () {
delete _this4.i18n.options.isInitialSSR;
Expand Down Expand Up @@ -610,7 +610,7 @@ function translate(namespaceArg) {
var _this = possibleConstructorReturn(this, (Translate.__proto__ || Object.getPrototypeOf(Translate)).call(this, props, context));

_this.i18n = context.i18n || props.i18n || options.i18n || getI18n();
_this.namespaces = typeof namespaceArg === 'function' ? namespaceArg(props) : namespaceArg || _this.i18n.options.defaultNS;
_this.namespaces = typeof namespaceArg === 'function' ? namespaceArg(props) : namespaceArg || _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 || {};
Expand Down Expand Up @@ -1102,7 +1102,7 @@ var Trans = function (_React$Component) {

if (reactI18nextOptions.exposeNamespace) {
var ns = typeof t.ns === 'string' ? t.ns : t.ns[0];
if (i18nKey && i18n.options.nsSeparator && i18nKey.indexOf(i18n.options.nsSeparator) > -1) {
if (i18nKey && i18n.options && i18n.options.nsSeparator && i18nKey.indexOf(i18n.options.nsSeparator) > -1) {
var parts = i18nKey.split(i18n.options.nsSeparator);
ns = parts[0];
}
Expand Down
2 changes: 1 addition & 1 deletion react-i18next.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/I18n.js
Expand Up @@ -9,7 +9,7 @@ export default class I18n extends Component {
super(props, context);

this.i18n = context.i18n || props.i18n || getI18n();
this.namespaces = this.props.ns || this.i18n.options.defaultNS;
this.namespaces = this.props.ns || (this.i18n.options && this.i18n.options.defaultNS);
if (typeof this.namespaces === 'string') this.namespaces = [this.namespaces];

const i18nOptions = (this.i18n && this.i18n.options && this.i18n.options.react) || {};
Expand All @@ -25,7 +25,7 @@ export default class I18n extends Component {
}

// provider SSR: data was set in provider and ssr flag was set
if (this.i18n.options.isInitialSSR) {
if (this.i18n.options && this.i18n.options.isInitialSSR) {
this.options.wait = false;
}

Expand Down Expand Up @@ -115,7 +115,7 @@ export default class I18n extends Component {
if (!ready && this.options.wait) return null;

// remove ssr flag set by provider - first render was done from now on wait if set to wait
if (this.i18n.options.isInitialSSR && !removedIsInitialSSR) {
if (this.i18n.options && this.i18n.options.isInitialSSR && !removedIsInitialSSR) {
removedIsInitialSSR = true;
setTimeout(() => {
delete this.i18n.options.isInitialSSR;
Expand Down
2 changes: 1 addition & 1 deletion src/Trans.js
Expand Up @@ -110,7 +110,7 @@ export default class Trans extends React.Component {

if (reactI18nextOptions.exposeNamespace) {
let ns = typeof t.ns === 'string' ? t.ns : t.ns[0];
if (i18nKey && i18n.options.nsSeparator && i18nKey.indexOf(i18n.options.nsSeparator) > -1) {
if (i18nKey && i18n.options && i18n.options.nsSeparator && i18nKey.indexOf(i18n.options.nsSeparator) > -1) {
const parts = i18nKey.split(i18n.options.nsSeparator);
ns = parts[0];
}
Expand Down
2 changes: 1 addition & 1 deletion src/translate.js
Expand Up @@ -21,7 +21,7 @@ export default function translate(namespaceArg, options = {}) {
this.namespaces = typeof namespaceArg === 'function' ? (
namespaceArg(props)
) : (
namespaceArg || this.i18n.options.defaultNS
namespaceArg || (this.i18n.options && this.i18n.options.defaultNS)
);
if (typeof this.namespaces === 'string') this.namespaces = [this.namespaces];

Expand Down

0 comments on commit 66b564c

Please sign in to comment.