Skip to content

Commit

Permalink
extend hasLoadedNamespace function options to pass optional lng to op…
Browse files Browse the repository at this point in the history
…timize server side usage of react-i18next
  • Loading branch information
adrai committed May 18, 2023
1 parent e7903fd commit d42e3c7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 22.5.0

- extend hasLoadedNamespace function options to pass optional lng to optimize server side usage of react-i18next

## 22.4.15

- fix: function t() passed options alteration [1947](https://github.com/i18next/i18next/issues/1947)
Expand Down
2 changes: 1 addition & 1 deletion i18next.js
Original file line number Diff line number Diff line change
Expand Up @@ -2516,7 +2516,7 @@
this.logger.warn('hasLoadedNamespace: i18n.languages were undefined or empty', this.languages);
return false;
}
var lng = this.resolvedLanguage || this.languages[0];
var lng = options.lng || this.resolvedLanguage || this.languages[0];
var fallbackLng = this.options ? this.options.fallbackLng : false;
var lastLng = this.languages[this.languages.length - 1];
if (lng.toLowerCase() === 'cimode') return true;
Expand Down
2 changes: 1 addition & 1 deletion i18next.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/i18next.js
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ class I18n extends EventEmitter {
return false;
}

const lng = this.resolvedLanguage || this.languages[0];
const lng = options.lng || this.resolvedLanguage || this.languages[0];
const fallbackLng = this.options ? this.options.fallbackLng : false;
const lastLng = this.languages[this.languages.length - 1];

Expand Down

0 comments on commit d42e3c7

Please sign in to comment.