stream-chat-react-native-core 5.32.0-beta.1 → 5.32.0-beta.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 (228) hide show
  1. package/lib/commonjs/components/Channel/Channel.js +7 -1
  2. package/lib/commonjs/components/Channel/Channel.js.map +1 -1
  3. package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js +2 -0
  4. package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
  5. package/lib/commonjs/components/ChannelPreview/ChannelPreviewStatus.js +18 -3
  6. package/lib/commonjs/components/ChannelPreview/ChannelPreviewStatus.js.map +1 -1
  7. package/lib/commonjs/components/ChannelPreview/hooks/useLatestMessagePreview.js +4 -17
  8. package/lib/commonjs/components/ChannelPreview/hooks/useLatestMessagePreview.js.map +1 -1
  9. package/lib/commonjs/components/Chat/Chat.js.map +1 -1
  10. package/lib/commonjs/components/ImageGallery/components/ImageGalleryHeader.js +9 -6
  11. package/lib/commonjs/components/ImageGallery/components/ImageGalleryHeader.js.map +1 -1
  12. package/lib/commonjs/components/Message/MessageSimple/MessageEditedTimestamp.js +4 -5
  13. package/lib/commonjs/components/Message/MessageSimple/MessageEditedTimestamp.js.map +1 -1
  14. package/lib/commonjs/components/Message/MessageSimple/MessageFooter.js +8 -8
  15. package/lib/commonjs/components/Message/MessageSimple/MessageFooter.js.map +1 -1
  16. package/lib/commonjs/components/Message/MessageSimple/MessageTimestamp.js +21 -18
  17. package/lib/commonjs/components/Message/MessageSimple/MessageTimestamp.js.map +1 -1
  18. package/lib/commonjs/components/MessageList/InlineDateSeparator.js +14 -12
  19. package/lib/commonjs/components/MessageList/InlineDateSeparator.js.map +1 -1
  20. package/lib/commonjs/components/MessageList/MessageList.js +4 -28
  21. package/lib/commonjs/components/MessageList/MessageList.js.map +1 -1
  22. package/lib/commonjs/components/MessageList/MessageSystem.js +14 -8
  23. package/lib/commonjs/components/MessageList/MessageSystem.js.map +1 -1
  24. package/lib/commonjs/components/MessageList/StickyHeader.js +36 -0
  25. package/lib/commonjs/components/MessageList/StickyHeader.js.map +1 -0
  26. package/lib/commonjs/components/index.js +11 -0
  27. package/lib/commonjs/components/index.js.map +1 -1
  28. package/lib/commonjs/contexts/channelContext/ChannelContext.js.map +1 -1
  29. package/lib/commonjs/contexts/messagesContext/MessagesContext.js.map +1 -1
  30. package/lib/commonjs/hooks/useStreami18n.js +1 -1
  31. package/lib/commonjs/i18n/en.json +88 -81
  32. package/lib/commonjs/i18n/es.json +88 -81
  33. package/lib/commonjs/i18n/fr.json +88 -81
  34. package/lib/commonjs/i18n/he.json +88 -81
  35. package/lib/commonjs/i18n/hi.json +88 -81
  36. package/lib/commonjs/i18n/it.json +88 -81
  37. package/lib/commonjs/i18n/ja.json +88 -81
  38. package/lib/commonjs/i18n/ko.json +88 -81
  39. package/lib/commonjs/i18n/nl.json +88 -81
  40. package/lib/commonjs/i18n/pt-br.json +90 -0
  41. package/lib/commonjs/i18n/ru.json +88 -81
  42. package/lib/commonjs/i18n/tr.json +88 -81
  43. package/lib/commonjs/index.js +2 -1
  44. package/lib/commonjs/index.js.map +1 -1
  45. package/lib/{module/utils → commonjs/utils/i18n}/Streami18n.js +62 -69
  46. package/lib/commonjs/utils/i18n/Streami18n.js.map +1 -0
  47. package/lib/commonjs/utils/i18n/calendarFormats.js +104 -0
  48. package/lib/commonjs/utils/i18n/calendarFormats.js.map +1 -0
  49. package/lib/commonjs/utils/i18n/getDateString.js +47 -0
  50. package/lib/commonjs/utils/i18n/getDateString.js.map +1 -0
  51. package/lib/commonjs/utils/i18n/predefinedFormatters.js +40 -0
  52. package/lib/commonjs/utils/i18n/predefinedFormatters.js.map +1 -0
  53. package/lib/commonjs/version.json +1 -1
  54. package/lib/module/components/Channel/Channel.js +7 -1
  55. package/lib/module/components/Channel/Channel.js.map +1 -1
  56. package/lib/module/components/Channel/hooks/useCreateMessagesContext.js +2 -0
  57. package/lib/module/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
  58. package/lib/module/components/ChannelPreview/ChannelPreviewStatus.js +18 -3
  59. package/lib/module/components/ChannelPreview/ChannelPreviewStatus.js.map +1 -1
  60. package/lib/module/components/ChannelPreview/hooks/useLatestMessagePreview.js +4 -17
  61. package/lib/module/components/ChannelPreview/hooks/useLatestMessagePreview.js.map +1 -1
  62. package/lib/module/components/Chat/Chat.js.map +1 -1
  63. package/lib/module/components/ImageGallery/components/ImageGalleryHeader.js +9 -6
  64. package/lib/module/components/ImageGallery/components/ImageGalleryHeader.js.map +1 -1
  65. package/lib/module/components/Message/MessageSimple/MessageEditedTimestamp.js +4 -5
  66. package/lib/module/components/Message/MessageSimple/MessageEditedTimestamp.js.map +1 -1
  67. package/lib/module/components/Message/MessageSimple/MessageFooter.js +8 -8
  68. package/lib/module/components/Message/MessageSimple/MessageFooter.js.map +1 -1
  69. package/lib/module/components/Message/MessageSimple/MessageTimestamp.js +21 -18
  70. package/lib/module/components/Message/MessageSimple/MessageTimestamp.js.map +1 -1
  71. package/lib/module/components/MessageList/InlineDateSeparator.js +14 -12
  72. package/lib/module/components/MessageList/InlineDateSeparator.js.map +1 -1
  73. package/lib/module/components/MessageList/MessageList.js +4 -28
  74. package/lib/module/components/MessageList/MessageList.js.map +1 -1
  75. package/lib/module/components/MessageList/MessageSystem.js +14 -8
  76. package/lib/module/components/MessageList/MessageSystem.js.map +1 -1
  77. package/lib/module/components/MessageList/StickyHeader.js +36 -0
  78. package/lib/module/components/MessageList/StickyHeader.js.map +1 -0
  79. package/lib/module/components/index.js +11 -0
  80. package/lib/module/components/index.js.map +1 -1
  81. package/lib/module/contexts/channelContext/ChannelContext.js.map +1 -1
  82. package/lib/module/contexts/messagesContext/MessagesContext.js.map +1 -1
  83. package/lib/module/hooks/useStreami18n.js +1 -1
  84. package/lib/module/i18n/en.json +88 -81
  85. package/lib/module/i18n/es.json +88 -81
  86. package/lib/module/i18n/fr.json +88 -81
  87. package/lib/module/i18n/he.json +88 -81
  88. package/lib/module/i18n/hi.json +88 -81
  89. package/lib/module/i18n/it.json +88 -81
  90. package/lib/module/i18n/ja.json +88 -81
  91. package/lib/module/i18n/ko.json +88 -81
  92. package/lib/module/i18n/nl.json +88 -81
  93. package/lib/module/i18n/pt-br.json +90 -0
  94. package/lib/module/i18n/ru.json +88 -81
  95. package/lib/module/i18n/tr.json +88 -81
  96. package/lib/module/index.js +2 -1
  97. package/lib/module/index.js.map +1 -1
  98. package/lib/{commonjs/utils → module/utils/i18n}/Streami18n.js +62 -69
  99. package/lib/module/utils/i18n/Streami18n.js.map +1 -0
  100. package/lib/module/utils/i18n/calendarFormats.js +104 -0
  101. package/lib/module/utils/i18n/calendarFormats.js.map +1 -0
  102. package/lib/module/utils/i18n/getDateString.js +47 -0
  103. package/lib/module/utils/i18n/getDateString.js.map +1 -0
  104. package/lib/module/utils/i18n/predefinedFormatters.js +40 -0
  105. package/lib/module/utils/i18n/predefinedFormatters.js.map +1 -0
  106. package/lib/module/version.json +1 -1
  107. package/lib/typescript/components/Channel/Channel.d.ts +1 -1
  108. package/lib/typescript/components/Channel/Channel.d.ts.map +1 -1
  109. package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts +1 -1
  110. package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts.map +1 -1
  111. package/lib/typescript/components/ChannelPreview/ChannelPreviewStatus.d.ts.map +1 -1
  112. package/lib/typescript/components/ChannelPreview/hooks/useLatestMessagePreview.d.ts +1 -1
  113. package/lib/typescript/components/ChannelPreview/hooks/useLatestMessagePreview.d.ts.map +1 -1
  114. package/lib/typescript/components/Chat/Chat.d.ts +1 -1
  115. package/lib/typescript/components/Chat/Chat.d.ts.map +1 -1
  116. package/lib/typescript/components/ImageGallery/components/ImageGalleryHeader.d.ts.map +1 -1
  117. package/lib/typescript/components/Message/MessageSimple/MessageEditedTimestamp.d.ts +2 -2
  118. package/lib/typescript/components/Message/MessageSimple/MessageEditedTimestamp.d.ts.map +1 -1
  119. package/lib/typescript/components/Message/MessageSimple/MessageFooter.d.ts.map +1 -1
  120. package/lib/typescript/components/Message/MessageSimple/MessageTimestamp.d.ts +2 -13
  121. package/lib/typescript/components/Message/MessageSimple/MessageTimestamp.d.ts.map +1 -1
  122. package/lib/typescript/components/Message/hooks/useMessageActionHandlers.d.ts +1 -1
  123. package/lib/typescript/components/Message/hooks/useMessageActions.d.ts +1 -1
  124. package/lib/typescript/components/MessageList/DateHeader.d.ts +1 -1
  125. package/lib/typescript/components/MessageList/DateHeader.d.ts.map +1 -1
  126. package/lib/typescript/components/MessageList/InlineDateSeparator.d.ts +7 -1
  127. package/lib/typescript/components/MessageList/InlineDateSeparator.d.ts.map +1 -1
  128. package/lib/typescript/components/MessageList/MessageList.d.ts +1 -2
  129. package/lib/typescript/components/MessageList/MessageList.d.ts.map +1 -1
  130. package/lib/typescript/components/MessageList/MessageSystem.d.ts +3 -0
  131. package/lib/typescript/components/MessageList/MessageSystem.d.ts.map +1 -1
  132. package/lib/typescript/components/MessageList/StickyHeader.d.ts +18 -0
  133. package/lib/typescript/components/MessageList/StickyHeader.d.ts.map +1 -0
  134. package/lib/typescript/components/index.d.ts +1 -0
  135. package/lib/typescript/components/index.d.ts.map +1 -1
  136. package/lib/typescript/contexts/channelContext/ChannelContext.d.ts +2 -3
  137. package/lib/typescript/contexts/channelContext/ChannelContext.d.ts.map +1 -1
  138. package/lib/typescript/contexts/messageContext/MessageContext.d.ts +1 -1
  139. package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +1 -1
  140. package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts +6 -0
  141. package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts.map +1 -1
  142. package/lib/typescript/contexts/overlayContext/OverlayContext.d.ts +1 -1
  143. package/lib/typescript/contexts/overlayContext/OverlayContext.d.ts.map +1 -1
  144. package/lib/typescript/hooks/useStreami18n.d.ts +1 -1
  145. package/lib/typescript/hooks/useStreami18n.d.ts.map +1 -1
  146. package/lib/typescript/i18n/en.json +88 -81
  147. package/lib/typescript/i18n/es.json +88 -81
  148. package/lib/typescript/i18n/fr.json +88 -81
  149. package/lib/typescript/i18n/he.json +88 -81
  150. package/lib/typescript/i18n/hi.json +88 -81
  151. package/lib/typescript/i18n/it.json +88 -81
  152. package/lib/typescript/i18n/ja.json +88 -81
  153. package/lib/typescript/i18n/ko.json +88 -81
  154. package/lib/typescript/i18n/nl.json +88 -81
  155. package/lib/typescript/i18n/pt-br.json +90 -0
  156. package/lib/typescript/i18n/ru.json +88 -81
  157. package/lib/typescript/i18n/tr.json +88 -81
  158. package/lib/typescript/index.d.ts +3 -1
  159. package/lib/typescript/index.d.ts.map +1 -1
  160. package/lib/typescript/utils/{Streami18n.d.ts → i18n/Streami18n.d.ts} +16 -10
  161. package/lib/typescript/utils/i18n/Streami18n.d.ts.map +1 -0
  162. package/lib/typescript/utils/i18n/calendarFormats.d.ts +14 -0
  163. package/lib/typescript/utils/i18n/calendarFormats.d.ts.map +1 -0
  164. package/lib/typescript/utils/i18n/getDateString.d.ts +16 -0
  165. package/lib/typescript/utils/i18n/getDateString.d.ts.map +1 -0
  166. package/lib/typescript/utils/i18n/predefinedFormatters.d.ts +13 -0
  167. package/lib/typescript/utils/i18n/predefinedFormatters.d.ts.map +1 -0
  168. package/package.json +10 -10
  169. package/src/components/Attachment/__tests__/Giphy.test.js +1 -1
  170. package/src/components/Channel/Channel.tsx +6 -1
  171. package/src/components/Channel/hooks/useCreateMessagesContext.ts +2 -0
  172. package/src/components/ChannelPreview/ChannelPreviewStatus.tsx +16 -2
  173. package/src/components/ChannelPreview/hooks/useLatestMessagePreview.ts +7 -28
  174. package/src/components/Chat/Chat.tsx +1 -1
  175. package/src/components/Chat/__tests__/Chat.test.js +1 -1
  176. package/src/components/ImageGallery/components/ImageGalleryHeader.tsx +13 -3
  177. package/src/components/Message/MessageSimple/MessageEditedTimestamp.tsx +10 -5
  178. package/src/components/Message/MessageSimple/MessageFooter.tsx +10 -7
  179. package/src/components/Message/MessageSimple/MessageTimestamp.tsx +20 -29
  180. package/src/components/Message/MessageSimple/__tests__/MessageStatus.test.js +1 -1
  181. package/src/components/MessageList/DateHeader.tsx +1 -1
  182. package/src/components/MessageList/InlineDateSeparator.tsx +20 -15
  183. package/src/components/MessageList/MessageList.tsx +4 -31
  184. package/src/components/MessageList/MessageSystem.tsx +20 -8
  185. package/src/components/MessageList/StickyHeader.tsx +42 -0
  186. package/src/components/MessageList/__tests__/MessageSystem.test.js +8 -3
  187. package/src/components/MessageList/__tests__/ScrollToBottomButton.test.js +1 -1
  188. package/src/components/MessageList/__tests__/TypingIndicator.test.js +1 -1
  189. package/src/components/Thread/__tests__/Thread.test.js +1 -1
  190. package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap +1 -1
  191. package/src/components/index.ts +1 -0
  192. package/src/contexts/channelContext/ChannelContext.tsx +2 -1
  193. package/src/contexts/messagesContext/MessagesContext.tsx +6 -0
  194. package/src/contexts/overlayContext/OverlayContext.tsx +1 -1
  195. package/src/hooks/useStreami18n.ts +1 -1
  196. package/src/i18n/en.json +8 -1
  197. package/src/i18n/es.json +73 -66
  198. package/src/i18n/fr.json +73 -66
  199. package/src/i18n/he.json +73 -66
  200. package/src/i18n/hi.json +73 -66
  201. package/src/i18n/it.json +73 -66
  202. package/src/i18n/ja.json +73 -66
  203. package/src/i18n/ko.json +75 -68
  204. package/src/i18n/nl.json +73 -66
  205. package/src/i18n/pt-br.json +90 -0
  206. package/src/i18n/ru.json +73 -66
  207. package/src/i18n/tr.json +73 -66
  208. package/src/index.ts +4 -1
  209. package/src/utils/__tests__/Streami18n.test.js +23 -1
  210. package/src/utils/{Streami18n.ts → i18n/Streami18n.ts} +60 -71
  211. package/src/utils/i18n/calendarFormats.ts +110 -0
  212. package/src/utils/i18n/getDateString.ts +76 -0
  213. package/src/utils/i18n/predefinedFormatters.ts +63 -0
  214. package/src/version.json +1 -1
  215. package/lib/commonjs/i18n/pt-BR.json +0 -83
  216. package/lib/commonjs/utils/Streami18n.js.map +0 -1
  217. package/lib/commonjs/utils/getDateString.js +0 -31
  218. package/lib/commonjs/utils/getDateString.js.map +0 -1
  219. package/lib/module/i18n/pt-BR.json +0 -83
  220. package/lib/module/utils/Streami18n.js.map +0 -1
  221. package/lib/module/utils/getDateString.js +0 -31
  222. package/lib/module/utils/getDateString.js.map +0 -1
  223. package/lib/typescript/i18n/pt-BR.json +0 -83
  224. package/lib/typescript/utils/Streami18n.d.ts.map +0 -1
  225. package/lib/typescript/utils/getDateString.d.ts +0 -30
  226. package/lib/typescript/utils/getDateString.d.ts.map +0 -1
  227. package/src/i18n/pt-BR.json +0 -83
  228. package/src/utils/getDateString.ts +0 -67
package/src/i18n/tr.json CHANGED
@@ -1,83 +1,90 @@
1
1
  {
2
- "1 Reply": "",
2
+ "1 Reply": "1 Cevap",
3
3
  "1 Thread Reply": "1 Konu Yanıtı",
4
- "Allow access to your Gallery": "",
5
- "Allow camera access in device settings": "",
6
- "Also send to channel": "",
7
- "Are you sure you want to permanently delete this message?": "",
8
- "Are you sure?": "",
9
- "Block User": "",
10
- "Cancel": "",
11
- "Cannot Flag Message": "",
12
- "Consider how your comment might make others feel and be sure to follow our Community Guidelines": "",
13
- "Copy Message": "",
14
- "Delete": "",
15
- "Delete Message": "",
16
- "Device camera is used to take photos or videos.": "",
17
- "Do you want to send a copy of this message to a moderator for further investigation?": "",
18
- "Edit Message": "",
19
- "Edited": "",
4
+ "Allow access to your Gallery": "Galerinize erişime izin verin",
5
+ "Allow camera access in device settings": "Cihaz ayarlarında kamera erişimine izin ver",
6
+ "Also send to channel": "Kanala da gönder",
7
+ "Are you sure you want to permanently delete this message?": "Bu mesajı kalıcı olarak silmek istediğinizden emin misiniz?",
8
+ "Are you sure?": "Emin misiniz?",
9
+ "Block User": "Kullanıcıyı engelle",
10
+ "Cancel": "İptal",
11
+ "Cannot Flag Message": "Raporlama Başarısız",
12
+ "Consider how your comment might make others feel and be sure to follow our Community Guidelines": "Yorumunuzun diğerlerini nasıl hissettirebileceğini düşünün ve topluluk kurallarımızı takip ettiğinizden emin olun",
13
+ "Copy Message": "Mesajı Kopyala",
14
+ "Delete": "Sil",
15
+ "Delete Message": "Mesajı Sil",
16
+ "Device camera is used to take photos or videos.": "Cihaz kamerası fotoğraf veya video çekmek için kullanılır.",
17
+ "Do you want to send a copy of this message to a moderator for further investigation?": "Detaylı inceleme için bu mesajın kopyasını moderatöre göndermek istiyor musunuz?",
18
+ "Edit Message": "Mesajı Düzenle",
19
+ "Edited": "Düzenlendi",
20
20
  "Editing Message": "Mesaj Düzenleniyor",
21
- "Emoji matching": "",
22
- "Empty message...": "",
23
- "Error loading": "",
24
- "Error loading channel list...": "",
25
- "Error loading messages for this channel...": "",
26
- "Error while loading, please reload/refresh": "",
27
- "File is too large: {{ size }}, maximum upload size is {{ limit }}": "",
28
- "File type not supported": "",
29
- "Flag": "",
30
- "Flag Message": "",
31
- "Flag action failed either due to a network issue or the message is already flagged": "",
32
- "Hold to start recording.": "",
33
- "How about sending your first message to a friend?": "",
34
- "Instant Commands": "",
35
- "Let's start chatting!": "",
36
- "Links are disabled": "",
37
- "Loading channels...": "",
38
- "Loading messages...": "",
39
- "Loading...": "",
40
- "Message Reactions": "",
21
+ "Emoji matching": "Emoji eşleştirme",
22
+ "Empty message...": "Boş mesaj...",
23
+ "Error loading": "Yükleme hatası",
24
+ "Error loading channel list...": "Kanal listesi yüklenirken hata oluştu...",
25
+ "Error loading messages for this channel...": "Bu kanal için mesajlar yüklenirken hata oluştu...",
26
+ "Error while loading, please reload/refresh": "Yüklenirken hata oluştu, lütfen tekrar deneyiniz",
27
+ "File is too large: {{ size }}, maximum upload size is {{ limit }}": "Dosya çok büyük: {{ size }}, maksimum yükleme boyutu {{ limit }}",
28
+ "File type not supported": "Dosya türü desteklenmiyor",
29
+ "Flag": "Raporla",
30
+ "Flag Message": "Mesajı Raporla",
31
+ "Flag action failed either due to a network issue or the message is already flagged": "Mesajın daha önce raporlanmış olması veya bir ağ bağlantısı sorunu nedeniyle raporlama işlemi başarısız oldu.",
32
+ "Hold to start recording.": "Kayıt yapmak için basılı tutun.",
33
+ "How about sending your first message to a friend?": "İlk mesajınızı bir arkadaşınıza göndermeye ne dersiniz?",
34
+ "Instant Commands": "Anlık Komutlar",
35
+ "Let's start chatting!": "Haydi sohbete başlayalım!",
36
+ "Links are disabled": "Bağlantılar devre dışı",
37
+ "Loading channels...": "Kanallar yükleniyor...",
38
+ "Loading messages...": "Mesajlar yükleniyor...",
39
+ "Loading...": "Yükleniyor...",
40
+ "Message Reactions": "Mesaj Tepkileri",
41
41
  "Message deleted": "Mesaj silindi",
42
- "Message flagged": "",
43
- "Mute User": "",
44
- "No chats here yet…": "",
45
- "Not supported": "",
46
- "Nothing yet...": "",
47
- "Ok": "",
42
+ "Message flagged": "Mesaj işaretlendi",
43
+ "Mute User": "Kullanıcıyı sessize al",
44
+ "No chats here yet…": "Henüz burada sohbet yok…",
45
+ "Not supported": "Desteklenmiyor",
46
+ "Nothing yet...": "Henüz değil...",
47
+ "Ok": "Tamam",
48
48
  "Only visible to you": "Sadece siz görebilirsiniz",
49
- "Open Settings": "",
49
+ "Open Settings": "Ayarları aç",
50
50
  "Photo": "Fotoğraf",
51
- "Photos and Videos": "",
52
- "Pin to Conversation": "",
51
+ "Photos and Videos": "Fotoğraflar ve Videolar",
52
+ "Pin to Conversation": "Konuşmaya sabitle",
53
53
  "Pinned by": "Tarafından sabitlendi",
54
- "Please allow Audio permissions in settings.": "",
55
- "Please enable access to your photos and videos so you can share them.": "",
56
- "Please select a channel first": "",
54
+ "Please allow Audio permissions in settings.": "Lütfen ayarlarda ses izinlerine izin verin",
55
+ "Please enable access to your photos and videos so you can share them.": "Paylaşım yapabilmek için lutfen fotoğraflarınıza ve videolarınıza erişimi etkinleştirin.",
56
+ "Please select a channel first": "Lütfen önce bir kanal seçiniz",
57
57
  "Reconnecting...": "Yeniden Bağlanılıyor...",
58
- "Reply": "",
59
- "Reply to Message": "",
60
- "Resend": "",
58
+ "Reply": "Yanıtla",
59
+ "Reply to Message": "Mesajı Yanıtla",
60
+ "Resend": "Yeniden gönder",
61
61
  "Search GIFs": "GIF Ara",
62
- "Select More Photos": "",
63
- "Send Anyway": "",
62
+ "Select More Photos": "Daha Fazla Fotoğraf Seçin",
63
+ "Send Anyway": "Yine de Gönder",
64
64
  "Send a message": "Mesaj gönder",
65
- "Sending links is not allowed in this conversation": "",
65
+ "Sending links is not allowed in this conversation": "Bu konuşmada bağlantı göndermek desteklenmiyor",
66
66
  "Slow mode ON": "Yavaş Mod Açık",
67
- "The message has been reported to a moderator.": "",
68
- "Thread Reply": "",
69
- "Unblock User": "",
70
- "Unknown User": "",
71
- "Unmute User": "",
72
- "Unpin from Conversation": "",
73
- "Unread Messages": "",
67
+ "The message has been reported to a moderator.": "Mesaj moderatöre bildirildi.",
68
+ "Thread Reply": "Konu Yanıtı",
69
+ "Unblock User": "Kullanıcının engelini kaldır",
70
+ "Unknown User": "Bilinmeyen kullanıcı",
71
+ "Unmute User": "Kullanıcının sesini aç",
72
+ "Unpin from Conversation": "Sabitlemeyi kaldır",
73
+ "Unread Messages": "Okunmamış Mesajlar",
74
74
  "Video": "Video",
75
75
  "You": "Sen",
76
- "You can't send messages in this channel": "",
76
+ "You can't send messages in this channel": "Bu konuşmaya mesaj gönderemezsiniz",
77
+ "timestamp/ChannelPreviewStatus": "{{ timestamp | timestampFormatter(calendar: true; calendarFormats: {\"lastDay\":\"[Dün]\",\"lastWeek\":\"dddd\",\"nextDay\":\"[Yarın]\",\"nextWeek\":\"dddd [saat] LT\",\"sameDay\":\"LT\",\"sameElse\":\"L\"}) }}",
78
+ "timestamp/ImageGalleryHeader": "{{ timestamp | timestampFormatter(calendar: true) }}",
79
+ "timestamp/InlineDateSeparator": "{{ timestamp | timestampFormatter(calendar: true) }}",
80
+ "timestamp/MessageEditedTimestamp": "{{ timestamp | timestampFormatter(calendar: true) }}",
81
+ "timestamp/MessageSystem": "{{ timestamp | timestampFormatter(calendar: true) }}",
82
+ "timestamp/MessageTimestamp": "{{ timestamp | timestampFormatter(format: LT) }}",
83
+ "timestamp/StickyHeader": "{{ timestamp | timestampFormatter(calendar: true) }}",
77
84
  "{{ firstUser }} and {{ nonSelfUserLength }} more are typing": "{{ firstUser }} ve {{ nonSelfUserLength }} kişi daha yazıyor",
78
- "{{ index }} of {{ photoLength }}": "",
79
- "{{ replyCount }} Replies": "",
85
+ "{{ index }} of {{ photoLength }}": "{{ index }} / {{ photoLength }}",
86
+ "{{ replyCount }} Replies": "{{ replyCount }} Cevap",
80
87
  "{{ replyCount }} Thread Replies": "{{responseCount}} Konu Cevapı",
81
88
  "{{ user }} is typing": "{{ user }} yazıyor",
82
- "🏙 Attachment...": ""
89
+ "🏙 Attachment...": "🏙 Ek..."
83
90
  }
package/src/index.ts CHANGED
@@ -1,3 +1,6 @@
1
+ /** i18next polyfill to handle intl format for pluralization. For more info see https://www.i18next.com/misc/json-format#i-18-next-json-v4 */
2
+ import 'intl-pluralrules';
3
+
1
4
  export * from './components';
2
5
  export * from './hooks';
3
6
  export { registerNativeHandlers, NetInfo, iOS14RefreshGallerySelection } from './native';
@@ -9,7 +12,7 @@ export * from './icons';
9
12
  export * from './types/types';
10
13
 
11
14
  export * from './utils/patchMessageTextCommand';
12
- export * from './utils/Streami18n';
15
+ export * from './utils/i18n/Streami18n';
13
16
  export * from './utils/utils';
14
17
  export * from './utils/StreamChatRN';
15
18
 
@@ -4,7 +4,7 @@ import localeData from 'dayjs/plugin/localeData';
4
4
 
5
5
  import frTranslations from '../../i18n/fr.json';
6
6
  import nlTranslations from '../../i18n/nl.json';
7
- import { Streami18n } from '../Streami18n';
7
+ import { Streami18n } from '../i18n/Streami18n';
8
8
 
9
9
  Dayjs.extend(localeData);
10
10
 
@@ -183,3 +183,25 @@ describe('setLanguage - switch to french', () => {
183
183
  }
184
184
  });
185
185
  });
186
+
187
+ describe('formatters property', () => {
188
+ it('contains the default timestampFormatter', () => {
189
+ expect(new Streami18n().formatters.timestampFormatter).toBeDefined();
190
+ });
191
+ it('allows to override the default timestampFormatter', async () => {
192
+ const i18n = new Streami18n({
193
+ formatters: { timestampFormatter: () => () => 'custom' },
194
+ translationsForLanguage: { abc: '{{ value | timestampFormatter }}' },
195
+ });
196
+ await i18n.init();
197
+ expect(i18n.t('abc')).toBe('custom');
198
+ });
199
+ it('allows to add new custom formatter', async () => {
200
+ const i18n = new Streami18n({
201
+ formatters: { customFormatter: () => () => 'custom' },
202
+ translationsForLanguage: { abc: '{{ value | customFormatter }}' },
203
+ });
204
+ await i18n.init();
205
+ expect(i18n.t('abc')).toBe('custom');
206
+ });
207
+ });
@@ -8,19 +8,26 @@ import i18n, { FallbackLng, TFunction } from 'i18next';
8
8
 
9
9
  import type moment from 'moment';
10
10
 
11
- import type { TDateTimeParser } from '../contexts/translationContext/TranslationContext';
12
- import enTranslations from '../i18n/en.json';
13
- import esTranslations from '../i18n/es.json';
14
- import frTranslations from '../i18n/fr.json';
15
- import heTranslations from '../i18n/he.json';
16
- import hiTranslations from '../i18n/hi.json';
17
- import itTranslations from '../i18n/it.json';
18
- import jaTranslations from '../i18n/ja.json';
19
- import koTranslations from '../i18n/ko.json';
20
- import nlTranslations from '../i18n/nl.json';
21
- import ptBRTranslations from '../i18n/pt-BR.json';
22
- import ruTranslations from '../i18n/ru.json';
23
- import trTranslations from '../i18n/tr.json';
11
+ import { calendarFormats } from './calendarFormats';
12
+ import {
13
+ CustomFormatters,
14
+ PredefinedFormatters,
15
+ predefinedFormatters,
16
+ } from './predefinedFormatters';
17
+
18
+ import type { TDateTimeParser } from '../../contexts/translationContext/TranslationContext';
19
+ import enTranslations from '../../i18n/en.json';
20
+ import esTranslations from '../../i18n/es.json';
21
+ import frTranslations from '../../i18n/fr.json';
22
+ import heTranslations from '../../i18n/he.json';
23
+ import hiTranslations from '../../i18n/hi.json';
24
+ import itTranslations from '../../i18n/it.json';
25
+ import jaTranslations from '../../i18n/ja.json';
26
+ import koTranslations from '../../i18n/ko.json';
27
+ import nlTranslations from '../../i18n/nl.json';
28
+ import ptBRTranslations from '../../i18n/pt-br.json';
29
+ import ruTranslations from '../../i18n/ru.json';
30
+ import trTranslations from '../../i18n/tr.json';
24
31
 
25
32
  import 'dayjs/locale/es';
26
33
  import 'dayjs/locale/fr';
@@ -41,7 +48,7 @@ import 'dayjs/locale/tr';
41
48
  */
42
49
  import 'dayjs/locale/en';
43
50
 
44
- import type { DefaultStreamChatGenerics } from '../types/types';
51
+ import type { DefaultStreamChatGenerics } from '../../types/types';
45
52
 
46
53
  const defaultNS = 'translation';
47
54
  const defaultLng = 'en';
@@ -49,6 +56,7 @@ const defaultLng = 'en';
49
56
  Dayjs.extend(updateLocale);
50
57
 
51
58
  Dayjs.updateLocale('en', {
59
+ calendar: calendarFormats.en,
52
60
  format: {
53
61
  L: 'DD/MM/YYYY',
54
62
  LL: 'D MMMM YYYY',
@@ -59,37 +67,18 @@ Dayjs.updateLocale('en', {
59
67
  },
60
68
  });
61
69
 
62
- Dayjs.updateLocale('nl', {
63
- calendar: {
64
- lastDay: '[gisteren om] LT',
65
- lastWeek: '[afgelopen] dddd [om] LT',
66
- nextDay: '[morgen om] LT',
67
- nextWeek: 'dddd [om] LT',
68
- sameDay: '[vandaag om] LT',
69
- sameElse: 'L',
70
- },
70
+ Dayjs.updateLocale('es', {
71
+ calendar: calendarFormats.es,
71
72
  });
72
-
73
- Dayjs.updateLocale('it', {
74
- calendar: {
75
- lastDay: '[Ieri alle] LT',
76
- lastWeek: '[lo scorso] dddd [alle] LT',
77
- nextDay: '[Domani alle] LT',
78
- nextWeek: 'dddd [alle] LT',
79
- sameDay: '[Oggi alle] LT',
80
- sameElse: 'L',
81
- },
73
+ Dayjs.updateLocale('fr', {
74
+ calendar: calendarFormats.fr,
75
+ });
76
+ Dayjs.updateLocale('he', {
77
+ calendar: calendarFormats.he,
82
78
  });
83
79
 
84
80
  Dayjs.updateLocale('hi', {
85
- calendar: {
86
- lastDay: '[कल] LT',
87
- lastWeek: '[पिछले] dddd, LT',
88
- nextDay: '[कल] LT',
89
- nextWeek: 'dddd, LT',
90
- sameDay: '[आज] LT',
91
- sameElse: 'L',
92
- },
81
+ calendar: calendarFormats.hi,
93
82
 
94
83
  /**
95
84
  * Hindi notation for meridiems are quite fuzzy in practice. While there exists
@@ -116,35 +105,26 @@ Dayjs.updateLocale('hi', {
116
105
 
117
106
  meridiemParse: /रात|सुबह|दोपहर|शाम/,
118
107
  });
119
-
120
- Dayjs.updateLocale('fr', {
121
- calendar: {
122
- lastDay: '[Hier à] LT',
123
- lastWeek: 'dddd [dernier à] LT',
124
- nextDay: '[Demain à] LT',
125
- nextWeek: 'dddd [à] LT',
126
- sameDay: '[Aujourd’hui à] LT',
127
- sameElse: 'L',
128
- },
108
+ Dayjs.updateLocale('it', {
109
+ calendar: calendarFormats.it,
129
110
  });
130
-
131
- Dayjs.updateLocale('tr', {
132
- calendar: {
133
- lastDay: '[dün] LT',
134
- lastWeek: '[geçen] dddd [saat] LT',
135
- nextDay: '[yarın saat] LT',
136
- nextWeek: '[gelecek] dddd [saat] LT',
137
- sameDay: '[bugün saat] LT',
138
- sameElse: 'L',
139
- },
111
+ Dayjs.updateLocale('ja', {
112
+ calendar: calendarFormats.ja,
113
+ });
114
+ Dayjs.updateLocale('ko', {
115
+ calendar: calendarFormats.ko,
116
+ });
117
+ Dayjs.updateLocale('nl', {
118
+ calendar: calendarFormats.nl,
119
+ });
120
+ Dayjs.updateLocale('pt-br', {
121
+ calendar: calendarFormats['pt-br'],
140
122
  });
141
-
142
123
  Dayjs.updateLocale('ru', {
143
- calendar: {
144
- lastDay: '[Вчера, в] LT',
145
- nextDay: '[Завтра, в] LT',
146
- sameDay: '[Сегодня, в] LT',
147
- },
124
+ calendar: calendarFormats.ru,
125
+ });
126
+ Dayjs.updateLocale('tr', {
127
+ calendar: calendarFormats.tr,
148
128
  });
149
129
 
150
130
  const en_locale = {
@@ -171,11 +151,12 @@ const en_locale = {
171
151
  const isDayJs = (dateTimeParser: typeof Dayjs | typeof moment): dateTimeParser is typeof Dayjs =>
172
152
  (dateTimeParser as typeof Dayjs).extend !== undefined;
173
153
 
174
- type Options = {
154
+ type Streami18nOptions = {
175
155
  DateTimeParser?: typeof Dayjs | typeof moment;
176
156
  dayjsLocaleConfigForLanguage?: Partial<ILocale>;
177
157
  debug?: boolean;
178
158
  disableDateTimeTranslations?: boolean;
159
+ formatters?: Partial<PredefinedFormatters> & CustomFormatters;
179
160
  language?: string;
180
161
  logger?: (msg?: string) => void;
181
162
  translationsForLanguage?: Partial<typeof enTranslations>;
@@ -184,7 +165,7 @@ type Options = {
184
165
  type I18NextConfig = {
185
166
  debug: boolean;
186
167
  fallbackLng: false | FallbackLng;
187
- interpolation: { escapeValue: boolean };
168
+ interpolation: { escapeValue: boolean; formatSeparator: string };
188
169
  keySeparator: false | string;
189
170
  lng: string;
190
171
  nsSeparator: false | string;
@@ -405,6 +386,7 @@ export class Streami18n {
405
386
  logger: (msg?: string) => void;
406
387
  currentLanguage: string;
407
388
  DateTimeParser: typeof Dayjs | typeof moment;
389
+ formatters: PredefinedFormatters & CustomFormatters = predefinedFormatters;
408
390
  isCustomDateTimeParser: boolean;
409
391
  i18nextConfig: I18NextConfig;
410
392
 
@@ -434,7 +416,7 @@ export class Streami18n {
434
416
  *
435
417
  * @param {*} options
436
418
  */
437
- constructor(options: Options = {}, i18nextConfig: Partial<I18NextConfig> = {}) {
419
+ constructor(options: Streami18nOptions = {}, i18nextConfig: Partial<I18NextConfig> = {}) {
438
420
  const finalOptions = {
439
421
  ...defaultStreami18nOptions,
440
422
  ...options,
@@ -445,6 +427,7 @@ export class Streami18n {
445
427
 
446
428
  this.currentLanguage = finalOptions.language;
447
429
  this.DateTimeParser = finalOptions.DateTimeParser;
430
+ this.formatters = { ...predefinedFormatters, ...options?.formatters };
448
431
 
449
432
  try {
450
433
  /**
@@ -491,7 +474,7 @@ export class Streami18n {
491
474
  this.i18nextConfig = {
492
475
  debug: finalOptions.debug,
493
476
  fallbackLng: false,
494
- interpolation: { escapeValue: false },
477
+ interpolation: { escapeValue: false, formatSeparator: '|' },
495
478
  keySeparator: false,
496
479
  lng: this.currentLanguage,
497
480
  nsSeparator: false,
@@ -556,6 +539,12 @@ export class Streami18n {
556
539
  this.onTFunctionOverrideListeners.forEach((listener) => listener(this.t));
557
540
  }
558
541
  this.initialized = true;
542
+ if (this.formatters) {
543
+ Object.entries(this.formatters).forEach(([name, formatterFactory]) => {
544
+ if (!formatterFactory) return;
545
+ this.i18nInstance.services.formatter?.add(name, formatterFactory(this));
546
+ });
547
+ }
559
548
  } catch (error) {
560
549
  this.logger(`Something went wrong with init: ${JSON.stringify(error)}`);
561
550
  }
@@ -0,0 +1,110 @@
1
+ type CalendarFormats = {
2
+ lastDay: string;
3
+ lastWeek: string;
4
+ nextDay: string;
5
+ nextWeek: string;
6
+ sameDay: string;
7
+ sameElse: string;
8
+ };
9
+
10
+ /**
11
+ * Calendar formats for different languages.
12
+ */
13
+ export const calendarFormats: Record<string, CalendarFormats> = {
14
+ en: {
15
+ lastDay: '[Yesterday]',
16
+ lastWeek: 'dddd',
17
+ nextDay: '[Tomorrow]',
18
+ nextWeek: 'dddd [at] LT',
19
+ sameDay: '[Today]',
20
+ sameElse: 'L',
21
+ },
22
+ es: {
23
+ lastDay: '[Ayer]',
24
+ lastWeek: 'dddd',
25
+ nextDay: '[Mañana]',
26
+ nextWeek: 'dddd [a las] LT',
27
+ sameDay: '[Hoy]',
28
+ sameElse: 'L',
29
+ },
30
+ fr: {
31
+ lastDay: '[Hier]',
32
+ lastWeek: 'dddd',
33
+ nextDay: '[Demain]',
34
+ nextWeek: 'dddd [à] LT',
35
+ sameDay: "[Aujourd'hui]",
36
+ sameElse: 'L',
37
+ },
38
+ he: {
39
+ lastDay: '[אתמול]',
40
+ lastWeek: 'dddd',
41
+ nextDay: '[מחר]',
42
+ nextWeek: 'dddd [בשעה] LT',
43
+ sameDay: '[היום]',
44
+ sameElse: 'L',
45
+ },
46
+ hi: {
47
+ lastDay: '[कल]',
48
+ lastWeek: 'dddd',
49
+ nextDay: '[कल]',
50
+ nextWeek: 'dddd [को] LT',
51
+ sameDay: '[आज]',
52
+ sameElse: 'L',
53
+ },
54
+ it: {
55
+ lastDay: '[Ieri]',
56
+ lastWeek: 'dddd',
57
+ nextDay: '[Domani]',
58
+ nextWeek: 'dddd [alle] LT',
59
+ sameDay: '[Oggi]',
60
+ sameElse: 'L',
61
+ },
62
+ ja: {
63
+ lastDay: '[昨日]',
64
+ lastWeek: 'dddd',
65
+ nextDay: '[明日]',
66
+ nextWeek: 'dddd [の] LT',
67
+ sameDay: '[今日]',
68
+ sameElse: 'L',
69
+ },
70
+ ko: {
71
+ lastDay: '[어제]',
72
+ lastWeek: 'dddd',
73
+ nextDay: '[내일]',
74
+ nextWeek: 'dddd [LT에]',
75
+ sameDay: '[오늘]',
76
+ sameElse: 'L',
77
+ },
78
+ nl: {
79
+ lastDay: '[Gisteren]',
80
+ lastWeek: 'dddd',
81
+ nextDay: '[Morgen]',
82
+ nextWeek: 'dddd [om] LT',
83
+ sameDay: '[Vandaag]',
84
+ sameElse: 'L',
85
+ },
86
+ 'pt-br': {
87
+ lastDay: '[Ontem]',
88
+ lastWeek: 'dddd',
89
+ nextDay: '[Amanhã]',
90
+ nextWeek: 'dddd [às] LT',
91
+ sameDay: '[Hoje]',
92
+ sameElse: 'L',
93
+ },
94
+ ru: {
95
+ lastDay: '[Вчера]',
96
+ lastWeek: 'dddd',
97
+ nextDay: '[Завтра]',
98
+ nextWeek: 'dddd [в] LT',
99
+ sameDay: '[Сегодня]',
100
+ sameElse: 'L', // L is the localized date format
101
+ },
102
+ tr: {
103
+ lastDay: '[Dün]',
104
+ lastWeek: 'dddd',
105
+ nextDay: '[Yarın]',
106
+ nextWeek: 'dddd [saat] LT',
107
+ sameDay: '[Bugün]',
108
+ sameElse: 'L',
109
+ },
110
+ };
@@ -0,0 +1,76 @@
1
+ import type { TimestampFormatterOptions } from './predefinedFormatters';
2
+
3
+ import {
4
+ isDayOrMoment,
5
+ TranslatorFunctions,
6
+ } from '../../contexts/translationContext/TranslationContext';
7
+
8
+ type DateFormatterOptions = TimestampFormatterOptions &
9
+ Partial<TranslatorFunctions> & {
10
+ /**
11
+ * The timestamp to be formatted.
12
+ */
13
+ date?: string | Date;
14
+ /*
15
+ * Lookup key in the language corresponding translations sheet to perform date formatting
16
+ */
17
+ timestampTranslationKey?: string;
18
+ };
19
+
20
+ export const noParsingFunctionWarning =
21
+ 'MessageTimestamp was called but there is no datetime parsing function available';
22
+
23
+ /**
24
+ * Utility function to format the date string.
25
+ */
26
+ export function getDateString({
27
+ calendar,
28
+ calendarFormats,
29
+ date,
30
+ format,
31
+ t,
32
+ tDateTimeParser,
33
+ timestampTranslationKey,
34
+ }: DateFormatterOptions): string | number | undefined {
35
+ if (!date || (typeof date === 'string' && !Date.parse(date))) {
36
+ return;
37
+ }
38
+
39
+ if (!tDateTimeParser) {
40
+ console.log(noParsingFunctionWarning);
41
+ return;
42
+ }
43
+
44
+ if (t && timestampTranslationKey) {
45
+ const options: TimestampFormatterOptions = {};
46
+ if (typeof calendar !== 'undefined' && calendar !== null) {
47
+ options.calendar = calendar;
48
+ }
49
+ if (typeof calendarFormats !== 'undefined' && calendarFormats !== null) {
50
+ options.calendarFormats = calendarFormats;
51
+ }
52
+ if (typeof format !== 'undefined' && format !== null) {
53
+ options.format = format;
54
+ }
55
+ const translatedTimestamp = t(timestampTranslationKey, {
56
+ ...options,
57
+ timestamp: new Date(date),
58
+ });
59
+ const translationKeyFound = timestampTranslationKey !== translatedTimestamp;
60
+ if (translationKeyFound) return translatedTimestamp;
61
+ }
62
+
63
+ const parsedTime = tDateTimeParser(date);
64
+
65
+ if (isDayOrMoment(parsedTime)) {
66
+ /**
67
+ * parsedTime.calendar is guaranteed on the type but is only
68
+ * available when a user calls dayjs.extend(calendar)
69
+ */
70
+ return calendar && parsedTime.calendar
71
+ ? parsedTime.calendar(undefined, calendarFormats)
72
+ : parsedTime.format(format);
73
+ }
74
+
75
+ return new Date(date).toDateString();
76
+ }