stream-chat-react-native-core 5.4.2 → 5.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/README.md +2 -2
  2. package/lib/commonjs/components/Chat/hooks/useAppSettings.js +1 -1
  3. package/lib/commonjs/components/Chat/hooks/useAppSettings.js.map +1 -1
  4. package/lib/commonjs/i18n/tr.json +19 -19
  5. package/lib/commonjs/version.json +1 -1
  6. package/lib/module/components/Chat/hooks/useAppSettings.js +1 -1
  7. package/lib/module/components/Chat/hooks/useAppSettings.js.map +1 -1
  8. package/lib/module/i18n/tr.json +19 -19
  9. package/lib/module/version.json +1 -1
  10. package/lib/typescript/i18n/tr.json +19 -19
  11. package/package.json +1 -1
  12. package/src/components/Chat/hooks/__tests__/useAppSettings.test.tsx +1 -0
  13. package/src/components/Chat/hooks/useAppSettings.ts +1 -1
  14. package/src/i18n/tr.json +19 -19
  15. package/src/version.json +1 -1
  16. package/lib/commonjs/components/Channel/Channel.md +0 -39
  17. package/lib/commonjs/components/ChannelList/ChannelList.md +0 -18
  18. package/lib/commonjs/components/ChannelList/ChannelListMessenger.md +0 -19
  19. package/lib/commonjs/components/Message/Message.md +0 -22
  20. package/lib/commonjs/components/Message/MessageSimple/MessageText.md +0 -4
  21. package/lib/commonjs/components/Message/MessageSimple/utils/renderText.md +0 -11
  22. package/lib/commonjs/components/docs/AttachmentProps.md +0 -1
  23. package/lib/commonjs/components/docs/ListProps.md +0 -14
  24. package/lib/commonjs/components/docs/MessageProps.md +0 -1
  25. package/lib/commonjs/components/docs/PreviewProps.md +0 -7
  26. package/lib/commonjs/contexts/channelContext/ChannelContext.md +0 -37
  27. package/lib/commonjs/contexts/channelsContext/ChannelsContext.md +0 -38
  28. package/lib/commonjs/contexts/chatContext/ChatContext.md +0 -37
  29. package/lib/commonjs/contexts/imageGalleryContext/ImageGalleryContext.md +0 -38
  30. package/lib/commonjs/contexts/keyboardContext/KeyboardContext.md +0 -5
  31. package/lib/commonjs/contexts/keyboardContext/withKeyboardContext.md +0 -18
  32. package/lib/commonjs/contexts/messageContext/MessageContext.md +0 -43
  33. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.md +0 -40
  34. package/lib/commonjs/contexts/messagesContext/MessagesContext.md +0 -35
  35. package/lib/commonjs/contexts/messagesContext/withMessagesContext.md +0 -26
  36. package/lib/commonjs/contexts/overlayContext/OverlayContext.md +0 -34
  37. package/lib/commonjs/contexts/overlayContext/OverlayProvider.md +0 -0
  38. package/lib/commonjs/contexts/overlayContext/withOverlayContext.md +0 -1
  39. package/lib/commonjs/contexts/paginatedMessageListContext/PaginatedMessageListContext.md +0 -34
  40. package/lib/commonjs/contexts/suggestionsContext/SuggestionsContext.md +0 -28
  41. package/lib/commonjs/contexts/suggestionsContext/withSuggestionsContext.md +0 -1
  42. package/lib/commonjs/contexts/threadContext/ThreadContext.md +0 -34
  43. package/lib/commonjs/contexts/typingContext/TypingContext.md +0 -33
  44. package/lib/commonjs/utils/Streami18n.md +0 -390
  45. package/lib/module/components/Channel/Channel.md +0 -39
  46. package/lib/module/components/ChannelList/ChannelList.md +0 -18
  47. package/lib/module/components/ChannelList/ChannelListMessenger.md +0 -19
  48. package/lib/module/components/Message/Message.md +0 -22
  49. package/lib/module/components/Message/MessageSimple/MessageText.md +0 -4
  50. package/lib/module/components/Message/MessageSimple/utils/renderText.md +0 -11
  51. package/lib/module/components/docs/AttachmentProps.md +0 -1
  52. package/lib/module/components/docs/ListProps.md +0 -14
  53. package/lib/module/components/docs/MessageProps.md +0 -1
  54. package/lib/module/components/docs/PreviewProps.md +0 -7
  55. package/lib/module/contexts/channelContext/ChannelContext.md +0 -37
  56. package/lib/module/contexts/channelsContext/ChannelsContext.md +0 -38
  57. package/lib/module/contexts/chatContext/ChatContext.md +0 -37
  58. package/lib/module/contexts/imageGalleryContext/ImageGalleryContext.md +0 -38
  59. package/lib/module/contexts/keyboardContext/KeyboardContext.md +0 -5
  60. package/lib/module/contexts/keyboardContext/withKeyboardContext.md +0 -18
  61. package/lib/module/contexts/messageContext/MessageContext.md +0 -43
  62. package/lib/module/contexts/messageInputContext/MessageInputContext.md +0 -40
  63. package/lib/module/contexts/messagesContext/MessagesContext.md +0 -35
  64. package/lib/module/contexts/messagesContext/withMessagesContext.md +0 -26
  65. package/lib/module/contexts/overlayContext/OverlayContext.md +0 -34
  66. package/lib/module/contexts/overlayContext/OverlayProvider.md +0 -0
  67. package/lib/module/contexts/overlayContext/withOverlayContext.md +0 -1
  68. package/lib/module/contexts/paginatedMessageListContext/PaginatedMessageListContext.md +0 -34
  69. package/lib/module/contexts/suggestionsContext/SuggestionsContext.md +0 -28
  70. package/lib/module/contexts/suggestionsContext/withSuggestionsContext.md +0 -1
  71. package/lib/module/contexts/threadContext/ThreadContext.md +0 -34
  72. package/lib/module/contexts/typingContext/TypingContext.md +0 -33
  73. package/lib/module/utils/Streami18n.md +0 -390
  74. package/src/components/Channel/Channel.md +0 -39
  75. package/src/components/ChannelList/ChannelList.md +0 -18
  76. package/src/components/ChannelList/ChannelListMessenger.md +0 -19
  77. package/src/components/Message/Message.md +0 -22
  78. package/src/components/Message/MessageSimple/MessageText.md +0 -4
  79. package/src/components/Message/MessageSimple/utils/renderText.md +0 -11
  80. package/src/components/docs/AttachmentProps.md +0 -1
  81. package/src/components/docs/ListProps.md +0 -14
  82. package/src/components/docs/MessageProps.md +0 -1
  83. package/src/components/docs/PreviewProps.md +0 -7
  84. package/src/contexts/channelContext/ChannelContext.md +0 -37
  85. package/src/contexts/channelsContext/ChannelsContext.md +0 -38
  86. package/src/contexts/chatContext/ChatContext.md +0 -37
  87. package/src/contexts/imageGalleryContext/ImageGalleryContext.md +0 -38
  88. package/src/contexts/keyboardContext/KeyboardContext.md +0 -5
  89. package/src/contexts/keyboardContext/withKeyboardContext.md +0 -18
  90. package/src/contexts/messageContext/MessageContext.md +0 -43
  91. package/src/contexts/messageInputContext/MessageInputContext.md +0 -40
  92. package/src/contexts/messagesContext/MessagesContext.md +0 -35
  93. package/src/contexts/messagesContext/withMessagesContext.md +0 -26
  94. package/src/contexts/overlayContext/OverlayContext.md +0 -34
  95. package/src/contexts/overlayContext/OverlayProvider.md +0 -0
  96. package/src/contexts/overlayContext/withOverlayContext.md +0 -1
  97. package/src/contexts/paginatedMessageListContext/PaginatedMessageListContext.md +0 -34
  98. package/src/contexts/suggestionsContext/SuggestionsContext.md +0 -28
  99. package/src/contexts/suggestionsContext/withSuggestionsContext.md +0 -1
  100. package/src/contexts/threadContext/ThreadContext.md +0 -34
  101. package/src/contexts/typingContext/TypingContext.md +0 -33
  102. package/src/utils/Streami18n.md +0 -390
@@ -1,390 +0,0 @@
1
- Wrapper around [i18next](https://www.i18next.com/) class for Stream related translations.
2
-
3
- ### API
4
-
5
- - **constructor**(options)
6
-
7
- Constructor accepts following options:
8
-
9
- - **language** (String) default: 'en'
10
-
11
- Language code e.g., en, tr
12
-
13
- - **disableDateTimeTranslations** (boolean) default: false
14
-
15
- Disable translations for datetimes
16
-
17
- - **debug** (boolean) default: false
18
-
19
- Enable debug mode in internal i18n class
20
-
21
- - **logger** (function) default: () => {}
22
-
23
- Logger function to log warnings/errors from this class
24
-
25
- - **dayjsLocaleConfigForLanguage** (object) default: 'enConfig'
26
-
27
- [Config object](https://github.com/iamkun/dayjs/tree/dev/src/locale) for internal dayjs object, corresponding to language (param)
28
-
29
- - **DateTimeParser** (function)
30
-
31
- Moment or Dayjs instance/function.
32
-
33
- - **geti18Instance**
34
-
35
- Returns an instance of [i18next](https://www.i18next.com/) used internally.
36
-
37
- - **getAvailableLanguages**
38
-
39
- Returns all the languages (code) registered with Streami18n
40
-
41
- - **getTranslations**
42
-
43
- Returns all the translations registered with Streami18n
44
-
45
- - **getTranslators**
46
-
47
- Returns an object containing t (i18next translator) and momentjs instance (configured with set language)
48
-
49
- ```js static
50
- const streami18n = new Streami18n({ language: 'nl' });
51
- const { t, tDateTimeParser } = await streami18n.getTranslators();
52
- ```
53
-
54
- - **registerTranslation**
55
-
56
- _params_
57
-
58
- - language | string
59
- - translator | object
60
- - customDayjsLocale | object (optional)
61
-
62
- ```js static
63
- streami18n.registerTranslation(
64
- 'mr',
65
- {
66
- 'Nothing yet...': 'काहीही नाही ...',
67
- '{{ firstUser }} and {{ secondUser }} are typing...':
68
- '{{ firstUser }} आणि {{ secondUser }} टीपी करत आहेत ',
69
- },
70
- {
71
- months: [...],
72
- monthsShort: [...],
73
- calendar: {
74
- sameDay: '...'
75
- }
76
- }
77
- );
78
- ```
79
-
80
- - **setLanguage**
81
-
82
- Set a different language
83
-
84
- ```js static
85
- streami18n.setLanguage('tr');
86
- ```
87
-
88
- Instance of this class should be provided to Chat component to handle translations.
89
- Stream provides following list of in-built translations:
90
-
91
- 1. English (en)
92
- 2. Dutch (nl)
93
- 3. Russian (ru)
94
- 4. Turkish (tr)
95
- 5. French (fr)
96
- 6. Italian (it)
97
- 7. Hindi (hi)
98
-
99
- ### Docs
100
-
101
- - **Text translations**
102
-
103
- Simplest way to start using chat components in one of the in-built languages would be following:
104
-
105
- ```js static
106
- const i18n = new Streami18n({ language: 'nl' });
107
- <Chat client={chatClient} i18nInstance={i18n}>
108
- ...
109
- </Chat>;
110
- ```
111
-
112
- If you would like to override certain keys in in-built translation.
113
- UI will be automatically updated in this case.
114
-
115
- ```js static
116
- const i18n = new Streami18n({
117
- language: 'nl',
118
- translationsForLanguage: {
119
- 'Nothing yet...': 'Nog Niet ...',
120
- '{{ firstUser }} and {{ secondUser }} are typing...':
121
- '{{ firstUser }} en {{ secondUser }} zijn aan het typen...',
122
- },
123
- });
124
- ```
125
-
126
- If you would like to register additional languages, use registerTranslation. You can add as many languages as you want:
127
-
128
- ```js static
129
- i18n.registerTranslation('zh', {
130
- 'Nothing yet...': 'Nog Niet ...',
131
- '{{ firstUser }} and {{ secondUser }} are typing...':
132
- '{{ firstUser }} en {{ secondUser }} zijn aan het typen...',
133
- });
134
-
135
- <Chat client={chatClient} i18nInstance={i18n}>
136
- ...
137
- </Chat>;
138
- ```
139
-
140
- You can use the same function to add whole new language as well.
141
-
142
- ```js static
143
- const i18n = new Streami18n();
144
-
145
- i18n.registerTranslation('mr', {
146
- 'Nothing yet...': 'काहीही नाही ...',
147
- '{{ firstUser }} and {{ secondUser }} are typing...':
148
- '{{ firstUser }} आणि {{ secondUser }} टीपी करत आहेत ',
149
- });
150
-
151
- // Make sure to call setLanguage to reflect new language in UI.
152
- i18n.setLanguage('it');
153
-
154
- <Chat client={chatClient} i18nInstance={i18n}>
155
- ...
156
- </Chat>;
157
- ```
158
-
159
- We have exported all the in-built translations in our library. You can import them in your project as following:
160
-
161
- ```js static
162
- import {
163
- enTranslations,
164
- nlTranslations,
165
- ruTranslations,
166
- trTranslations,
167
- frTranslations,
168
- hiTranslations,
169
- itTranslations,
170
- esTranslations,
171
- } from 'stream-chat-react-native'; // or 'stream-chat-expo'
172
- ```
173
-
174
- If you would like to maintain your own translation files:
175
-
176
- 1. Create a json file in your project with whatever name you prefer. Best practice would be to name it after
177
- the language-translations it contains e.g, If you are creating a translation file for Korean language then `ko.json`
178
- 2. Copy the content of file https://github.com/GetStream/stream-chat-react/blob/master/src/i18n/en.json
179
- 3. Change the values of the keys as translation of key.
180
- 4. Use it in chat client:
181
-
182
- ```js static
183
- import koTranslation from 'path/to/ko.json';
184
- import deTranslation from 'path/to/de.json';
185
- const i18n = new Streami18n();
186
- i18n.registerTranslation('ko', koTranslation);
187
- i18n.registerTranslation('de', deTranslation);
188
- // You can switch language at any point in lifetime of component, it will automatically reflect in UI.
189
- i18n.setLanguage('ko');
190
- <Chat client={chatClient} i18nInstance={i18n}>
191
- ...
192
- </Chat>;
193
- ```
194
-
195
- ## Datetime translations
196
-
197
- Stream react chat components uses [dayjs](https://day.js.org/en/) internally by default to format datetime stamp.
198
- e.g., in ChannelPreview, MessageContent components.
199
- Dayjs has locale support as well - https://day.js.org/docs/en/i18n/i18n
200
- Dayjs is a lightweight alternative to Momentjs with the same modern API.
201
-
202
- Dayjs provides locale config for plenty of languages, you can check the whole list of locale configs at following url
203
- https://github.com/iamkun/dayjs/tree/dev/src/locale
204
-
205
- You can either provide the dayjs locale config while registering
206
- language with Streami18n (either via constructor or registerTranslation()) OR you can provide your own Dayjs or Moment instance
207
- to Streami18n constructor, which will be then used internally (using the language locale) in components.
208
-
209
- ### Via language registration
210
-
211
- e.g.,
212
-
213
- ```js static
214
- const i18n = new Streami18n({
215
- language: 'nl',
216
- dayjsLocaleConfigForLanguage: {
217
- months: [...],
218
- monthsShort: [...],
219
- calendar: {
220
- sameDay: ...'
221
- }
222
- }
223
- });
224
- ```
225
-
226
- Similarly, you can add locale config for dayjs while registering translation via `registerTranslation` function.
227
-
228
- e.g.,
229
-
230
- ```js static
231
- const i18n = new Streami18n();
232
-
233
- i18n.registerTranslation(
234
- 'mr',
235
- {
236
- 'Nothing yet...': 'काहीही नाही ...',
237
- '{{ firstUser }} and {{ secondUser }} are typing...': '{{ firstUser }} आणि {{ secondUser }} टीपी करत आहेत ',
238
- },
239
- {
240
- months: [...],
241
- monthsShort: [...],
242
- calendar: {
243
- sameDay: ...'
244
- }
245
- }
246
- );
247
- ```
248
-
249
- ### Provide your own Moment object
250
-
251
- ```js static
252
- import 'moment/locale/nl';
253
- import 'moment/locale/it';
254
- // or if you want to include all locales
255
- import 'moment/min/locales';
256
-
257
- import Moment from moment
258
-
259
- const i18n = new Streami18n({
260
- language: 'nl',
261
- DateTimeParser: Moment
262
- })
263
- ```
264
-
265
- ### Provide your own Dayjs object
266
-
267
- ```js static
268
- import Dayjs from 'dayjs';
269
-
270
- import 'dayjs/locale/nl';
271
- import 'dayjs/locale/it';
272
-
273
- const i18n = new Streami18n({
274
- language: 'nl',
275
- DateTimeParser: Dayjs,
276
- });
277
- ```
278
-
279
- If you would like to stick with english language for datetimes in Stream components, you can set `disableDateTimeTranslations` to true.
280
-
281
- **NOTE** Please note here that locales in `dayjs/locale/it` (and all other language locale files), does not load calendar related
282
- config like 'today at', 'tomorrow at' etc. You will need to manually configure calendar locale using [updateLocale](https://day.js.org/docs/en/plugin/update-locale).
283
-
284
- **TIPS**
285
-
286
- 1. If you would like to stick with english language for datetimes in Stream components,
287
- you can set `disableDateTimeTranslations` to true.
288
-
289
- ```js static
290
- const i18n = new Streami18n({
291
- language: 'nl',
292
- disableDateTimeTranslations: false,
293
- });
294
- ```
295
-
296
- 2. If you want to disable all the warnings, you can override logger option:
297
-
298
- ```js static
299
- const i18n = new Streami18n({
300
- language: 'nl',
301
- logger: () => null,
302
- });
303
- ```
304
-
305
- The default `en` locale config from dayjs is as follow:
306
-
307
- ```json static
308
- {
309
- "months": [
310
- "January",
311
- "February",
312
- "March",
313
- "April",
314
- "May",
315
- "June",
316
- "July",
317
- "August",
318
- "September",
319
- "October",
320
- "November",
321
- "December"
322
- ],
323
- "monthsShort": [
324
- "Jan",
325
- "Feb",
326
- "Mar",
327
- "Apr",
328
- "May",
329
- "Jun",
330
- "Jul",
331
- "Aug",
332
- "Sep",
333
- "Oct",
334
- "Nov",
335
- "Dec"
336
- ],
337
- "week": {
338
- "dow": 0,
339
- "doy": 6
340
- },
341
- "weekdays": [
342
- "Sunday",
343
- "Monday",
344
- "Tuesday",
345
- "Wednesday",
346
- "Thursday",
347
- "Friday",
348
- "Saturday"
349
- ],
350
- "weekdaysMin": ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
351
- "weekdaysShort": ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
352
- "calendar": {
353
- "sameDay": "[Today at] LT",
354
- "nextDay": "[Tomorrow at] LT",
355
- "nextWeek": "dddd [at] LT",
356
- "lastDay": "[Yesterday at] LT",
357
- "lastWeek": "[Last] dddd [at] LT",
358
- "sameElse": "L"
359
- },
360
- "formats": {
361
- "LTS": "h:mm:ss A",
362
- "LT": "h:mm A",
363
- "L": "MM/DD/YYYY",
364
- "LL": "MMMM D, YYYY",
365
- "LLL": "MMMM D, YYYY h:mm A",
366
- "LLLL": "dddd, MMMM D, YYYY h:mm A"
367
- },
368
- "invalidDate": "Invalid date",
369
- "ordinal": "%d.",
370
- "dayOfMonthOrdinalParse": /\\d{1,2}(th|st|nd|rd)/,
371
- "relativeTime": {
372
- "future": "in %s",
373
- "past": "%s ago",
374
- "s": "a few seconds",
375
- "ss": "%d seconds",
376
- "m": "a minute",
377
- "mm": "%d minutes",
378
- "h": "an hour",
379
- "hh": "%d hours",
380
- "d": "a day",
381
- "dd": "%d days",
382
- "M": "a month",
383
- "MM": "%d months",
384
- "y": "a year",
385
- "yy": "%d years"
386
- },
387
- "meridiemParse": /[ap]\\.?m?\\.?/i,
388
- "abbr": "en"
389
- }
390
- ```