File tree 1 file changed +36
-0
lines changed
1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -152,6 +152,42 @@ Stream provides following list of in-built translations:
152
152
< / Chat>
153
153
```
154
154
155
+ We have exported all the in-built translations in our library. You can import them in your project as following:
156
+
157
+ ``` js
158
+ import {
159
+ enTranslations ,
160
+ nlTranslations ,
161
+ ruTranslations ,
162
+ trTranslations ,
163
+ frTranslations ,
164
+ hiTranslations ,
165
+ itTranslations ,
166
+ esTranslations ,
167
+ } from ' stream-chat-react-native' ; // or 'stream-chat-expo'
168
+ ```
169
+
170
+ If you would like to maintain your own translation files:
171
+
172
+ 1 . Create a json file in your project with whatever name you prefer. Best practice would be to name it after
173
+ the language-translations it contains e.g, If you are creating a translation file for Korean language then ` ko.json `
174
+ 2 . Copy the content of file https://github.com/GetStream/stream-chat-react-native/blob/master/src/i18n/en.json
175
+ 3 . Change the values of the keys as translation of key.
176
+ 4 . Use it in chat client:
177
+
178
+ ``` js
179
+ import koTranslation from ' path/to/ko.json' ;
180
+ import deTranslation from ' path/to/de.json' ;
181
+ const i18n = new Streami18n ();
182
+ i18n .registerTranslation (' ko' , koTranslation);
183
+ i18n .registerTranslation (' de' , deTranslation);
184
+ // You can switch language at any point in lifetime of component, it will automatically reflect in UI.
185
+ i18n .setLanguage (' ko' );
186
+ < Chat client= {chatClient} i18nInstance= {i18n}>
187
+ ...
188
+ < / Chat> ;
189
+ ```
190
+
155
191
- ** Datetime translations**
156
192
157
193
Stream components uses [ momentjs] ( http://momentjs.com/ ) internally to format datetime stamp. e.g., in ChannelPreview, MessageContent components.
You can’t perform that action at this time.
0 commit comments