Adding to i18n mocks

This commit is contained in:
Jeff Avallone
2018-02-15 17:35:12 -05:00
parent 79191c0fd7
commit 7a8a9836aa
5 changed files with 23 additions and 4 deletions
+20
View File
@@ -0,0 +1,20 @@
import React from 'react';
import i18n from 'i18next';
import { I18nextProvider } from 'react-i18next';
const translate = txt => `translate(${ txt })`;
i18n.init({
fallbackLng: 'en',
fallbackNS: 'missing',
debug: false,
resources: {}
});
const I18nWrapper = ({ children }) => ( // eslint-disable-line react/prop-types
<I18nextProvider i18n={ i18n }>
{ React.cloneElement(React.Children.only(children), { t: translate }) }
</I18nextProvider>
);
export { translate, i18n, I18nWrapper };
-2
View File
@@ -1,2 +0,0 @@
const translate = txt => `translate(${ txt })`;
export default translate;