Skip to content

Commit

Permalink
Merge options by Trans component
Browse files Browse the repository at this point in the history
  • Loading branch information
yashigani committed Apr 5, 2019
1 parent bb1348d commit e8a40ac
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/Trans.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useContext } from 'react';
import HTML from 'html-parse-stringify2';
import { getI18n, getHasUsedI18nextProvider, I18nContext } from './context';
import { getI18n, getHasUsedI18nextProvider, I18nContext, getDefaults } from './context';
import { warn, warnOnce } from './utils';

function hasChildren(node) {
Expand Down Expand Up @@ -204,7 +204,8 @@ export function Trans({

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

const reactI18nextOptions = (i18n.options && i18n.options.react) || {};
const options = (i18n.options && i18n.options.react) || {};
const reactI18nextOptions = { ...getDefaults(), ...options };
const useAsParent = parent !== undefined ? parent : reactI18nextOptions.defaultTransParent;

const defaultValue =
Expand Down
2 changes: 0 additions & 2 deletions src/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ export const initReactI18next = {
type: '3rdParty',

init(instance) {
setDefaults(instance.options.react);
instance.options.react = getDefaults();
setI18n(instance);
},
};
Expand Down

0 comments on commit e8a40ac

Please # to comment.