Skip to content

Commit

Permalink
fixes regression of using t.ns for Trans
Browse files Browse the repository at this point in the history
  • Loading branch information
jamuhl committed Jun 16, 2019
1 parent 070624f commit 21ed9bc
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 10.11.1

- fixes a regression in Trans component taking namespace from passed t function [867](https://github.com/i18next/react-i18next/issues/867#issuecomment-502395958)

### 10.11.0

- Restore support passing the defaultNS via I18nextProvider prop [860](https://github.com/i18next/react-i18next/pull/860)
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": "10.11.0",
"version": "10.11.1",
"description": "Internationalization for react done right. Using the i18next i18n ecosystem.",
"main": "dist/commonjs/index.js",
"types": "src/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions react-i18next.js
Original file line number Diff line number Diff line change
Expand Up @@ -692,13 +692,13 @@
return children;
}

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

const reactI18nextOptions = _objectSpread({}, getDefaults(), i18n.options && i18n.options.react);

const useAsParent = parent !== undefined ? parent : reactI18nextOptions.defaultTransParent; // prepare having a namespace

let namespaces = ns || defaultNSFromContext || i18n.options && i18n.options.defaultNS;
let namespaces = ns || t.ns || defaultNSFromContext || i18n.options && i18n.options.defaultNS;
namespaces = typeof namespaces === 'string' ? [namespaces] : namespaces || ['translation'];
const defaultValue = defaults || nodesToString('', children, 0, reactI18nextOptions) || reactI18nextOptions.transEmptyNodeValue;
const hashTransKey = reactI18nextOptions.hashTransKey;
Expand Down
Loading

0 comments on commit 21ed9bc

Please sign in to comment.