Skip to content

Commit

Permalink
Adding i18n to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalnarkhede committed Mar 24, 2020
1 parent 2cfd2b5 commit 91b2042
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
- [Register](https://getstream.io/chat/trial/) to get an API key for Stream Chat
- [React Chat Tutorial](https://getstream.io/chat/react-chat/tutorial/)
- [Chat UI Kit](https://getstream.io/chat/ui-kit/)
- [Example Apps](#example-apps)
- [Component Docs](https://getstream.github.io/stream-chat-react/)
- [Internationalisation](#internationalisation)

With these chat components you can support any type of chat use case:

Expand Down Expand Up @@ -116,6 +119,47 @@ Common mistakes that hurt performance are:
- Mistake: Passing an object {} or an array [] that's not using seamless-immutable
- Solution: Use an immutable type (ie a number or a string) or use a seamless immutable version of an object or an array

## Internationalisation

Instance of class `Streami18n` should be provided to Chat component to handle translations.
Stream provides following list of in-built translations for components:

1. English (en)
2. Dutch (nl)
3. Russian (ru)
4. Turkish (tr)
5. French (fr)
6. Italian (it)
7. Hindi (hi)

Default language is English. Simplest way to start using chat components in one of the in-built languages would be following:

Simplest way to start using chat components in one of the in-built languages would be following:

```js static
const i18n = new Streami18n({ language: 'nl' });
<Chat client={chatClient} i18nInstance={i18n}>
...
</Chat>;
```

If you would like to override certain keys in in-built translation:

```js static
const i18n = new Streami18n({
language: 'nl',
translationsForLanguage: {
'Nothing yet...': 'Nog Niet ...',
'{{ firstUser }} and {{ secondUser }} are typing...':
'{{ firstUser }} en {{ secondUser }} zijn aan het typen...',
},
});
```

UI will be automatically updated in this case.

Please read this docs on i18n for more details and further customizations - https://getstream.github.io/stream-chat-react/#section-streami18n

## Contributing

We welcome code changes that improve this library or fix a problem, please make sure to follow all best practices and add tests if applicable before submitting a Pull Request on Github. We are very happy to merge your code in the official repository. Make sure to sign our [Contributor License Agreement (CLA)](https://docs.google.com/forms/d/e/1FAIpQLScFKsKkAJI7mhCr7K9rEIOpqIDThrWxuvxnwUq2XkHyG154vQ/viewform) first. See our license file for more details.

0 comments on commit 91b2042

Please sign in to comment.