Skip to content

Commit

Permalink
try to fix another edge case issue i18next#1570 introduces by fixing i…
Browse files Browse the repository at this point in the history
  • Loading branch information
adrai authored and plindse committed Mar 9, 2021
1 parent fe5d90e commit 7196edc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
- Improve updateMissing default plural behavior [1558](https://github.com/i18next/i18next/pull/1558)
- typescript: type definitions improvements for backend [1560](https://github.com/i18next/i18next/pull/1560)

### 19.8.10

- try to fix another edge case issue [1570](https://github.com/i18next/i18next/issues/1570) introduces by fixing [1552](https://github.com/i18next/i18next/issues/1552)

### 19.8.9

- warn if i18next gets initialized multiple times
Expand Down
2 changes: 1 addition & 1 deletion i18next.js
Original file line number Diff line number Diff line change
Expand Up @@ -2061,7 +2061,7 @@
callback(err, t);
};

if (_this2.languages && _this2.options.compatibilityAPI !== 'v1') return finish(null, _this2.t.bind(_this2));
if (_this2.languages && _this2.options.compatibilityAPI !== 'v1' && !_this2.isInitialized) return finish(null, _this2.t.bind(_this2));

_this2.changeLanguage(_this2.options.lng, finish);
};
Expand Down
2 changes: 1 addition & 1 deletion src/i18next.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class I18n extends EventEmitter {
callback(err, t);
};
// fix for use cases when calling changeLanguage before finished to initialized (i.e. https://github.com/i18next/i18next/issues/1552)
if (this.languages && this.options.compatibilityAPI !== 'v1') return finish(null, this.t.bind(this));
if (this.languages && this.options.compatibilityAPI !== 'v1' && !this.isInitialized) return finish(null, this.t.bind(this));
this.changeLanguage(this.options.lng, finish);
};

Expand Down

0 comments on commit 7196edc

Please sign in to comment.