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.
- package/lib/commonjs/components/Channel/Channel.js +7 -1
- package/lib/commonjs/components/Channel/Channel.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js +2 -0
- package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewStatus.js +18 -3
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewStatus.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/hooks/useLatestMessagePreview.js +4 -17
- package/lib/commonjs/components/ChannelPreview/hooks/useLatestMessagePreview.js.map +1 -1
- package/lib/commonjs/components/Chat/Chat.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryHeader.js +9 -6
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryHeader.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageEditedTimestamp.js +4 -5
- package/lib/commonjs/components/Message/MessageSimple/MessageEditedTimestamp.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageFooter.js +8 -8
- package/lib/commonjs/components/Message/MessageSimple/MessageFooter.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageTimestamp.js +21 -18
- package/lib/commonjs/components/Message/MessageSimple/MessageTimestamp.js.map +1 -1
- package/lib/commonjs/components/MessageList/InlineDateSeparator.js +14 -12
- package/lib/commonjs/components/MessageList/InlineDateSeparator.js.map +1 -1
- package/lib/commonjs/components/MessageList/MessageList.js +4 -28
- package/lib/commonjs/components/MessageList/MessageList.js.map +1 -1
- package/lib/commonjs/components/MessageList/MessageSystem.js +14 -8
- package/lib/commonjs/components/MessageList/MessageSystem.js.map +1 -1
- package/lib/commonjs/components/MessageList/StickyHeader.js +36 -0
- package/lib/commonjs/components/MessageList/StickyHeader.js.map +1 -0
- package/lib/commonjs/components/index.js +11 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/contexts/channelContext/ChannelContext.js.map +1 -1
- package/lib/commonjs/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/commonjs/hooks/useStreami18n.js +1 -1
- package/lib/commonjs/i18n/en.json +88 -81
- package/lib/commonjs/i18n/es.json +88 -81
- package/lib/commonjs/i18n/fr.json +88 -81
- package/lib/commonjs/i18n/he.json +88 -81
- package/lib/commonjs/i18n/hi.json +88 -81
- package/lib/commonjs/i18n/it.json +88 -81
- package/lib/commonjs/i18n/ja.json +88 -81
- package/lib/commonjs/i18n/ko.json +88 -81
- package/lib/commonjs/i18n/nl.json +88 -81
- package/lib/commonjs/i18n/pt-br.json +90 -0
- package/lib/commonjs/i18n/ru.json +88 -81
- package/lib/commonjs/i18n/tr.json +88 -81
- package/lib/commonjs/index.js +2 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/{module/utils → commonjs/utils/i18n}/Streami18n.js +62 -69
- package/lib/commonjs/utils/i18n/Streami18n.js.map +1 -0
- package/lib/commonjs/utils/i18n/calendarFormats.js +104 -0
- package/lib/commonjs/utils/i18n/calendarFormats.js.map +1 -0
- package/lib/commonjs/utils/i18n/getDateString.js +47 -0
- package/lib/commonjs/utils/i18n/getDateString.js.map +1 -0
- package/lib/commonjs/utils/i18n/predefinedFormatters.js +40 -0
- package/lib/commonjs/utils/i18n/predefinedFormatters.js.map +1 -0
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Channel/Channel.js +7 -1
- package/lib/module/components/Channel/Channel.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreateMessagesContext.js +2 -0
- package/lib/module/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
- package/lib/module/components/ChannelPreview/ChannelPreviewStatus.js +18 -3
- package/lib/module/components/ChannelPreview/ChannelPreviewStatus.js.map +1 -1
- package/lib/module/components/ChannelPreview/hooks/useLatestMessagePreview.js +4 -17
- package/lib/module/components/ChannelPreview/hooks/useLatestMessagePreview.js.map +1 -1
- package/lib/module/components/Chat/Chat.js.map +1 -1
- package/lib/module/components/ImageGallery/components/ImageGalleryHeader.js +9 -6
- package/lib/module/components/ImageGallery/components/ImageGalleryHeader.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageEditedTimestamp.js +4 -5
- package/lib/module/components/Message/MessageSimple/MessageEditedTimestamp.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageFooter.js +8 -8
- package/lib/module/components/Message/MessageSimple/MessageFooter.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageTimestamp.js +21 -18
- package/lib/module/components/Message/MessageSimple/MessageTimestamp.js.map +1 -1
- package/lib/module/components/MessageList/InlineDateSeparator.js +14 -12
- package/lib/module/components/MessageList/InlineDateSeparator.js.map +1 -1
- package/lib/module/components/MessageList/MessageList.js +4 -28
- package/lib/module/components/MessageList/MessageList.js.map +1 -1
- package/lib/module/components/MessageList/MessageSystem.js +14 -8
- package/lib/module/components/MessageList/MessageSystem.js.map +1 -1
- package/lib/module/components/MessageList/StickyHeader.js +36 -0
- package/lib/module/components/MessageList/StickyHeader.js.map +1 -0
- package/lib/module/components/index.js +11 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/contexts/channelContext/ChannelContext.js.map +1 -1
- package/lib/module/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/module/hooks/useStreami18n.js +1 -1
- package/lib/module/i18n/en.json +88 -81
- package/lib/module/i18n/es.json +88 -81
- package/lib/module/i18n/fr.json +88 -81
- package/lib/module/i18n/he.json +88 -81
- package/lib/module/i18n/hi.json +88 -81
- package/lib/module/i18n/it.json +88 -81
- package/lib/module/i18n/ja.json +88 -81
- package/lib/module/i18n/ko.json +88 -81
- package/lib/module/i18n/nl.json +88 -81
- package/lib/module/i18n/pt-br.json +90 -0
- package/lib/module/i18n/ru.json +88 -81
- package/lib/module/i18n/tr.json +88 -81
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/{commonjs/utils → module/utils/i18n}/Streami18n.js +62 -69
- package/lib/module/utils/i18n/Streami18n.js.map +1 -0
- package/lib/module/utils/i18n/calendarFormats.js +104 -0
- package/lib/module/utils/i18n/calendarFormats.js.map +1 -0
- package/lib/module/utils/i18n/getDateString.js +47 -0
- package/lib/module/utils/i18n/getDateString.js.map +1 -0
- package/lib/module/utils/i18n/predefinedFormatters.js +40 -0
- package/lib/module/utils/i18n/predefinedFormatters.js.map +1 -0
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Channel/Channel.d.ts +1 -1
- package/lib/typescript/components/Channel/Channel.d.ts.map +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts.map +1 -1
- package/lib/typescript/components/ChannelPreview/ChannelPreviewStatus.d.ts.map +1 -1
- package/lib/typescript/components/ChannelPreview/hooks/useLatestMessagePreview.d.ts +1 -1
- package/lib/typescript/components/ChannelPreview/hooks/useLatestMessagePreview.d.ts.map +1 -1
- package/lib/typescript/components/Chat/Chat.d.ts +1 -1
- package/lib/typescript/components/Chat/Chat.d.ts.map +1 -1
- package/lib/typescript/components/ImageGallery/components/ImageGalleryHeader.d.ts.map +1 -1
- package/lib/typescript/components/Message/MessageSimple/MessageEditedTimestamp.d.ts +2 -2
- package/lib/typescript/components/Message/MessageSimple/MessageEditedTimestamp.d.ts.map +1 -1
- package/lib/typescript/components/Message/MessageSimple/MessageFooter.d.ts.map +1 -1
- package/lib/typescript/components/Message/MessageSimple/MessageTimestamp.d.ts +2 -13
- package/lib/typescript/components/Message/MessageSimple/MessageTimestamp.d.ts.map +1 -1
- package/lib/typescript/components/Message/hooks/useMessageActionHandlers.d.ts +1 -1
- package/lib/typescript/components/Message/hooks/useMessageActions.d.ts +1 -1
- package/lib/typescript/components/MessageList/DateHeader.d.ts +1 -1
- package/lib/typescript/components/MessageList/DateHeader.d.ts.map +1 -1
- package/lib/typescript/components/MessageList/InlineDateSeparator.d.ts +7 -1
- package/lib/typescript/components/MessageList/InlineDateSeparator.d.ts.map +1 -1
- package/lib/typescript/components/MessageList/MessageList.d.ts +1 -2
- package/lib/typescript/components/MessageList/MessageList.d.ts.map +1 -1
- package/lib/typescript/components/MessageList/MessageSystem.d.ts +3 -0
- package/lib/typescript/components/MessageList/MessageSystem.d.ts.map +1 -1
- package/lib/typescript/components/MessageList/StickyHeader.d.ts +18 -0
- package/lib/typescript/components/MessageList/StickyHeader.d.ts.map +1 -0
- package/lib/typescript/components/index.d.ts +1 -0
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/contexts/channelContext/ChannelContext.d.ts +2 -3
- package/lib/typescript/contexts/channelContext/ChannelContext.d.ts.map +1 -1
- package/lib/typescript/contexts/messageContext/MessageContext.d.ts +1 -1
- package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +1 -1
- package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts +6 -0
- package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts.map +1 -1
- package/lib/typescript/contexts/overlayContext/OverlayContext.d.ts +1 -1
- package/lib/typescript/contexts/overlayContext/OverlayContext.d.ts.map +1 -1
- package/lib/typescript/hooks/useStreami18n.d.ts +1 -1
- package/lib/typescript/hooks/useStreami18n.d.ts.map +1 -1
- package/lib/typescript/i18n/en.json +88 -81
- package/lib/typescript/i18n/es.json +88 -81
- package/lib/typescript/i18n/fr.json +88 -81
- package/lib/typescript/i18n/he.json +88 -81
- package/lib/typescript/i18n/hi.json +88 -81
- package/lib/typescript/i18n/it.json +88 -81
- package/lib/typescript/i18n/ja.json +88 -81
- package/lib/typescript/i18n/ko.json +88 -81
- package/lib/typescript/i18n/nl.json +88 -81
- package/lib/typescript/i18n/pt-br.json +90 -0
- package/lib/typescript/i18n/ru.json +88 -81
- package/lib/typescript/i18n/tr.json +88 -81
- package/lib/typescript/index.d.ts +3 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/utils/{Streami18n.d.ts → i18n/Streami18n.d.ts} +16 -10
- package/lib/typescript/utils/i18n/Streami18n.d.ts.map +1 -0
- package/lib/typescript/utils/i18n/calendarFormats.d.ts +14 -0
- package/lib/typescript/utils/i18n/calendarFormats.d.ts.map +1 -0
- package/lib/typescript/utils/i18n/getDateString.d.ts +16 -0
- package/lib/typescript/utils/i18n/getDateString.d.ts.map +1 -0
- package/lib/typescript/utils/i18n/predefinedFormatters.d.ts +13 -0
- package/lib/typescript/utils/i18n/predefinedFormatters.d.ts.map +1 -0
- package/package.json +10 -10
- package/src/components/Attachment/__tests__/Giphy.test.js +1 -1
- package/src/components/Channel/Channel.tsx +6 -1
- package/src/components/Channel/hooks/useCreateMessagesContext.ts +2 -0
- package/src/components/ChannelPreview/ChannelPreviewStatus.tsx +16 -2
- package/src/components/ChannelPreview/hooks/useLatestMessagePreview.ts +7 -28
- package/src/components/Chat/Chat.tsx +1 -1
- package/src/components/Chat/__tests__/Chat.test.js +1 -1
- package/src/components/ImageGallery/components/ImageGalleryHeader.tsx +13 -3
- package/src/components/Message/MessageSimple/MessageEditedTimestamp.tsx +10 -5
- package/src/components/Message/MessageSimple/MessageFooter.tsx +10 -7
- package/src/components/Message/MessageSimple/MessageTimestamp.tsx +20 -29
- package/src/components/Message/MessageSimple/__tests__/MessageStatus.test.js +1 -1
- package/src/components/MessageList/DateHeader.tsx +1 -1
- package/src/components/MessageList/InlineDateSeparator.tsx +20 -15
- package/src/components/MessageList/MessageList.tsx +4 -31
- package/src/components/MessageList/MessageSystem.tsx +20 -8
- package/src/components/MessageList/StickyHeader.tsx +42 -0
- package/src/components/MessageList/__tests__/MessageSystem.test.js +8 -3
- package/src/components/MessageList/__tests__/ScrollToBottomButton.test.js +1 -1
- package/src/components/MessageList/__tests__/TypingIndicator.test.js +1 -1
- package/src/components/Thread/__tests__/Thread.test.js +1 -1
- package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap +1 -1
- package/src/components/index.ts +1 -0
- package/src/contexts/channelContext/ChannelContext.tsx +2 -1
- package/src/contexts/messagesContext/MessagesContext.tsx +6 -0
- package/src/contexts/overlayContext/OverlayContext.tsx +1 -1
- package/src/hooks/useStreami18n.ts +1 -1
- package/src/i18n/en.json +8 -1
- package/src/i18n/es.json +73 -66
- package/src/i18n/fr.json +73 -66
- package/src/i18n/he.json +73 -66
- package/src/i18n/hi.json +73 -66
- package/src/i18n/it.json +73 -66
- package/src/i18n/ja.json +73 -66
- package/src/i18n/ko.json +75 -68
- package/src/i18n/nl.json +73 -66
- package/src/i18n/pt-br.json +90 -0
- package/src/i18n/ru.json +73 -66
- package/src/i18n/tr.json +73 -66
- package/src/index.ts +4 -1
- package/src/utils/__tests__/Streami18n.test.js +23 -1
- package/src/utils/{Streami18n.ts → i18n/Streami18n.ts} +60 -71
- package/src/utils/i18n/calendarFormats.ts +110 -0
- package/src/utils/i18n/getDateString.ts +76 -0
- package/src/utils/i18n/predefinedFormatters.ts +63 -0
- package/src/version.json +1 -1
- package/lib/commonjs/i18n/pt-BR.json +0 -83
- package/lib/commonjs/utils/Streami18n.js.map +0 -1
- package/lib/commonjs/utils/getDateString.js +0 -31
- package/lib/commonjs/utils/getDateString.js.map +0 -1
- package/lib/module/i18n/pt-BR.json +0 -83
- package/lib/module/utils/Streami18n.js.map +0 -1
- package/lib/module/utils/getDateString.js +0 -31
- package/lib/module/utils/getDateString.js.map +0 -1
- package/lib/typescript/i18n/pt-BR.json +0 -83
- package/lib/typescript/utils/Streami18n.d.ts.map +0 -1
- package/lib/typescript/utils/getDateString.d.ts +0 -30
- package/lib/typescript/utils/getDateString.d.ts.map +0 -1
- package/src/i18n/pt-BR.json +0 -83
- 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
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
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 '
|
|
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('
|
|
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
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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
|
-
|
|
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
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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
|
-
|
|
145
|
-
|
|
146
|
-
|
|
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
|
|
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:
|
|
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
|
+
}
|