-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add missing I18nextProvider interface to typings (#721)
* Add missing I18nextProvider interface to typings * remove old props * change ClassComponent to FunctionComponent * add usage test
- Loading branch information
1 parent
032f900
commit 6065af7
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import i18n from 'i18next'; | ||
import * as React from 'react'; | ||
import { I18nextProvider, initReactI18next } from 'react-i18next'; | ||
|
||
i18n.use(initReactI18next).init({ | ||
fallbackLng: 'en', | ||
|
||
// have a common namespace used around the full app | ||
ns: ['translations'], | ||
defaultNS: 'translations', | ||
|
||
debug: true, | ||
|
||
interpolation: { | ||
escapeValue: false, // not needed for react!! | ||
}, | ||
|
||
react: { | ||
wait: true, | ||
}, | ||
}); | ||
|
||
function test() { | ||
return ( | ||
<React.Suspense fallback={<p>Loading</p>}> | ||
<I18nextProvider i18n={i18n}> | ||
<h1>Foo</h1> | ||
</I18nextProvider> | ||
</React.Suspense> | ||
); | ||
} |