Skip to content

Commit

Permalink
fix crash in gatsby
Browse files Browse the repository at this point in the history
  • Loading branch information
adrai committed Jan 7, 2023
1 parent 98b118b commit 187f7bf
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 12.1.2

- fix crash in gatsby [1594](https://github.com/i18next/react-i18next/issues/1594)

### 12.1.1

- fix for node resolution [1589](https://github.com/i18next/react-i18next/issues/1589)
Expand Down
4 changes: 2 additions & 2 deletions react-i18next.js
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@

var i18n = i18nFromProps || i18nFromContext || getI18n();

var t = tFromProps || i18n.t.bind(i18n) || function (k) {
var t = tFromProps || i18n && i18n.t.bind(i18n) || function (k) {
return k;
};

Expand All @@ -822,7 +822,7 @@
values: values,
defaults: defaults,
components: components,
ns: ns || t.ns || defaultNSFromContext || i18n.options && i18n.options.defaultNS,
ns: ns || t.ns || defaultNSFromContext || i18n && i18n.options && i18n.options.defaultNS,
i18n: i18n,
t: tFromProps,
shouldUnescape: shouldUnescape
Expand Down
2 changes: 1 addition & 1 deletion react-i18next.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/Trans.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function Trans({
const { i18n: i18nFromContext, defaultNS: defaultNSFromContext } = useContext(I18nContext) || {};
const i18n = i18nFromProps || i18nFromContext || getI18n();

const t = tFromProps || i18n.t.bind(i18n) || ((k) => k);
const t = tFromProps || (i18n && i18n.t.bind(i18n)) || ((k) => k);

return TransWithoutContext({
children,
Expand All @@ -36,7 +36,7 @@ export function Trans({
defaults,
components,
// prepare having a namespace
ns: ns || t.ns || defaultNSFromContext || (i18n.options && i18n.options.defaultNS),
ns: ns || t.ns || defaultNSFromContext || (i18n && i18n.options && i18n.options.defaultNS),
i18n,
t: tFromProps,
shouldUnescape,
Expand Down

0 comments on commit 187f7bf

Please sign in to comment.