Skip to content

Commit

Permalink
Merge pull request #52 from loudwinston/universal-rendering
Browse files Browse the repository at this point in the history
Support for universal apps / server-side rendering
  • Loading branch information
jamuhl committed Apr 1, 2016
2 parents c291bca + d7d21f4 commit b3f950b
Show file tree
Hide file tree
Showing 6 changed files with 2,293 additions and 265 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,25 @@ function TranslatableView(props) {
</div>
)
}
```

### Universal Rendering

__loadNamespaces__: Function that will pre-load all namespaces used by your components. Works well with `react-router` `match` function

__props__:

- components: Components that need to have namespaces loaded.
- i18n: the i18n instance to load translations into

```javascript
import { I18nextProvider, loadNamespaces } from 'react-i18next';
import { match } from 'react-router';

match({...matchArguments}, (error, redirectLocation, renderProps) => {
loadNamespaces({ ...renderProps, i18n: i18nInstance })
.then(()=>{
// All i18n namespaces required to render this route are loaded
})
});
```
Loading

0 comments on commit b3f950b

Please sign in to comment.