Skip to content

Commit ae01557

Browse files
committed
fix: missing translation keys from message preview
1 parent 1e80353 commit ae01557

13 files changed

Lines changed: 245 additions & 13 deletions

File tree

package/src/hooks/messagePreview/useMessagePreviewText.tsx

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { useGroupedAttachments } from './useGroupedAttachments';
1111

1212
import { useChatContext } from '../../contexts/chatContext/ChatContext';
1313
import { useStateStore } from '../../hooks/useStateStore';
14+
import { useTranslationContext } from '../../contexts/translationContext/TranslationContext';
1415

1516
const selector = (nextValue: PollState) => ({
1617
name: nextValue.name,
@@ -21,6 +22,7 @@ export const useMessagePreviewText = ({
2122
}: {
2223
message?: LocalMessage | MessageResponse | DraftMessage | null;
2324
}) => {
25+
const { t } = useTranslationContext();
2426
const { client } = useChatContext();
2527
const poll = client.polls.fromState(message?.poll_id ?? '');
2628
const { name: pollName } = useStateStore(poll?.state, selector) ?? {};
@@ -36,7 +38,7 @@ export const useMessagePreviewText = ({
3638
const onlyVoiceRecordings =
3739
voiceRecordings?.length && voiceRecordings?.length === attachmentsLength;
3840
if (message?.type === 'deleted') {
39-
return 'Message deleted';
41+
return t('Message deleted');
4042
}
4143

4244
if (pollName) {
@@ -49,13 +51,13 @@ export const useMessagePreviewText = ({
4951
(message?.shared_location as LiveLocationPayload)?.end_at &&
5052
new Date((message?.shared_location as LiveLocationPayload)?.end_at) > new Date()
5153
) {
52-
return 'Live Location';
54+
return t('Live Location');
5355
}
54-
return 'Location';
56+
return t('Location');
5557
}
5658

5759
if (giphys?.length) {
58-
return 'Giphy';
60+
return t('Giphy');
5961
}
6062

6163
if (message?.text) {
@@ -64,39 +66,41 @@ export const useMessagePreviewText = ({
6466

6567
if (onlyImages) {
6668
if (images?.length === 1) {
67-
return 'Photo';
69+
return t('Photo');
6870
} else {
69-
return `${images?.length} Photos`;
71+
return t('{{count}} Photos', { count: images?.length });
7072
}
7173
}
7274

7375
if (onlyVideos) {
7476
if (videos?.length === 1) {
75-
return 'Video';
77+
return t('Video');
7678
} else {
77-
return `${videos?.length} Videos`;
79+
return t(`{{count}} Videos`, { count: videos?.length });
7880
}
7981
}
8082

8183
if (onlyAudio) {
8284
if (audios?.length === 1) {
83-
return 'Audio';
85+
return t('Audio');
8486
} else {
85-
return `${audios?.length} Audios`;
87+
return t('{{count}} Audios', { count: audios?.length });
8688
}
8789
}
8890

8991
if (onlyVoiceRecordings) {
9092
if (voiceRecordings?.length === 1) {
91-
return `Voice message (${dayjs.duration(voiceRecordings?.[0]?.duration ?? 0, 'seconds').format('m:ss')})`;
93+
return t(`Voice message ({{duration}})`, {
94+
duration: dayjs.duration(voiceRecordings?.[0]?.duration ?? 0, 'seconds').format('m:ss'),
95+
});
9296
} else {
93-
return `${voiceRecordings?.length} Voice messages`;
97+
return t('{{count}} Voice messages', { count: voiceRecordings?.length });
9498
}
9599
}
96100

97101
if (onlyFiles && files?.length === 1) {
98102
return files?.[0]?.title;
99103
}
100104

101-
return `${attachmentsLength} Files`;
105+
return t('{{count}} Files', { count: attachmentsLength });
102106
};

package/src/i18n/en.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"Are you sure you want to permanently delete this message?": "Are you sure you want to permanently delete this message?",
1515
"Are you sure?": "Are you sure?",
1616
"Ask a question": "Ask a question",
17+
"Audio": "Audio",
1718
"Ban User": "Ban User",
1819
"Block User": "Block User",
1920
"Cancel": "Cancel",
@@ -46,11 +47,13 @@
4647
"Flag Message": "Flag Message",
4748
"Flag action failed either due to a network issue or the message is already flagged": "Flag action failed either due to a network issue or the message is already flagged.",
4849
"Generating...": "Generating...",
50+
"Giphy": "Giphy",
4951
"Hold to start recording.": "Hold to start recording.",
5052
"How about sending your first message to a friend?": "How about sending your first message to a friend?",
5153
"Instant Commands": "Instant Commands",
5254
"Let's start chatting!": "Let's start chatting!",
5355
"Links are disabled": "Links are disabled",
56+
"Live Location": "Live Location",
5457
"Loading channels...": "Loading channels...",
5558
"Loading messages...": "Loading messages...",
5659
"Loading threads...": "Loading threads...",
@@ -127,6 +130,7 @@
127130
"View {{count}} comments_one": "View {{count}} comment",
128131
"View {{count}} comments_other": "View {{count}} comments",
129132
"Voice message": "Voice message",
133+
"Voice message ({{duration}})": "Voice message ({{duration}})",
130134
"Your comment": "Your comment",
131135
"You": "You",
132136
"You can't send messages in this channel": "You can't send messages in this channel",
@@ -156,6 +160,21 @@
156160
"Message failed to send": "Message failed to send",
157161
"and {{ count }} others": "and {{ count }} others",
158162
"{{ user }} voted: {{ option }}": "{{ user }} voted: {{ option }}",
163+
"{{count}} Audios_many": "{{count}} Audios",
164+
"{{count}} Audios_one": "{{count}} Audio",
165+
"{{count}} Audios_other": "{{count}} Audios",
166+
"{{count}} Files_many": "{{count}} Files",
167+
"{{count}} Files_one": "{{count}} File",
168+
"{{count}} Files_other": "{{count}} Files",
169+
"{{count}} Photos_many": "{{count}} Photos",
170+
"{{count}} Photos_one": "{{count}} Photo",
171+
"{{count}} Photos_other": "{{count}} Photos",
172+
"{{count}} Voice messages_many": "{{count}} Voice messages",
173+
"{{count}} Voice messages_one": "{{count}} Voice message",
174+
"{{count}} Voice messages_other": "{{count}} Voice messages",
175+
"{{count}} Videos_many": "{{count}} Videos",
176+
"{{count}} Videos_one": "{{count}} Video",
177+
"{{count}} Videos_other": "{{count}} Videos",
159178
"{{count}} votes_many": "{{count}} votes",
160179
"{{count}} votes_one": "{{count}} vote",
161180
"{{count}} votes_other": "{{count}} votes",

package/src/i18n/es.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"Are you sure you want to permanently delete this message?": "¿Estás seguro de que deseas eliminar permanentemente este mensaje?",
1515
"Are you sure?": "¿Estás seguro?",
1616
"Ask a question": "Hacer una pregunta",
17+
"Audio": "Audio",
1718
"Ban User": "Bloquear Usuario",
1819
"Block User": "Bloquear usuario",
1920
"Cancel": "Cancelar",
@@ -46,11 +47,13 @@
4647
"Flag Message": "Reportar mensaje",
4748
"Flag action failed either due to a network issue or the message is already flagged": "El reporte falló debido a un problema de red o el mensaje ya fue reportado.",
4849
"Generating...": "Generando...",
50+
"Giphy": "Giphy",
4951
"Hold to start recording.": "Mantén presionado para comenzar a grabar.",
5052
"How about sending your first message to a friend?": "¿Qué tal enviar tu primer mensaje a un amigo?",
5153
"Instant Commands": "Comandos instantáneos",
5254
"Let's start chatting!": "¡Empecemos a charlar!",
5355
"Links are disabled": "Los enlaces están desactivados",
56+
"Live Location": "Ubicación en vivo",
5457
"Loading channels...": "Cargando canales...",
5558
"Loading messages...": "Cargando mensajes...",
5659
"Loading threads...": "Cargando hilos...",
@@ -127,6 +130,7 @@
127130
"View {{count}} comments_one": "Ver {{count}} comentario",
128131
"View {{count}} comments_other": "Ver {{count}} comentarios",
129132
"Voice message": "Mensaje de voz",
133+
"Voice message ({{duration}})": "Mensaje de voz ({{duration}})",
130134
"Your comment": "Tu comentario",
131135
"You": "",
132136
"You can't send messages in this channel": "No puedes enviar mensajes en este canal",
@@ -156,6 +160,21 @@
156160
"Message failed to send": "El mensaje no se pudo enviar",
157161
"and {{ count }} others": "y {{ count }} más",
158162
"{{ user }} voted: {{ option }}": "{{ user }} votó: {{ option }}",
163+
"{{count}} Audios_many": "{{count}} audios",
164+
"{{count}} Audios_one": "{{count}} audio",
165+
"{{count}} Audios_other": "{{count}} audios",
166+
"{{count}} Files_many": "{{count}} archivos",
167+
"{{count}} Files_one": "{{count}} archivo",
168+
"{{count}} Files_other": "{{count}} archivos",
169+
"{{count}} Photos_many": "{{count}} fotos",
170+
"{{count}} Photos_one": "{{count}} foto",
171+
"{{count}} Photos_other": "{{count}} fotos",
172+
"{{count}} Voice messages_many": "{{count}} mensajes de voz",
173+
"{{count}} Voice messages_one": "{{count}} mensaje de voz",
174+
"{{count}} Voice messages_other": "{{count}} mensajes de voz",
175+
"{{count}} Videos_many": "{{count}} vídeos",
176+
"{{count}} Videos_one": "{{count}} vídeo",
177+
"{{count}} Videos_other": "{{count}} vídeos",
159178
"{{count}} votes_many": "{{count}} votos",
160179
"{{count}} votes_one": "{{count}} voto",
161180
"{{count}} votes_other": "{{count}} votos",

package/src/i18n/fr.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"Are you sure you want to permanently delete this message?": "Êtes-vous sûr de vouloir supprimer définitivement ce message?",
1515
"Are you sure?": "Es-tu sûr ?",
1616
"Ask a question": "Poser une question",
17+
"Audio": "Audio",
1718
"Ban User": "Bannir Utilisateur",
1819
"Block User": "Bloquer un utilisateur",
1920
"Cancel": "Annuler",
@@ -46,11 +47,13 @@
4647
"Flag Message": "Signaler le message",
4748
"Flag action failed either due to a network issue or the message is already flagged": "L'action de signalisation a échoué en raison d'un problème de réseau ou le message est déjà signalé.",
4849
"Generating...": "Génération...",
50+
"Giphy": "Giphy",
4951
"Hold to start recording.": "Hold to start recording.",
5052
"How about sending your first message to a friend?": "Et si vous envoyiez votre premier message à un ami ?",
5153
"Instant Commands": "Commandes Instantanées",
5254
"Let's start chatting!": "Commençons à discuter !",
5355
"Links are disabled": "Links are disabled",
56+
"Live Location": "Position en direct",
5457
"Loading channels...": "Chargement des canaux...",
5558
"Loading messages...": "Chargement des messages...",
5659
"Loading threads...": "Chargement des fils...",
@@ -127,6 +130,7 @@
127130
"View {{count}} comments_one": "Voir {{count}} commentaire",
128131
"View {{count}} comments_other": "Voir {{count}} commentaires",
129132
"Voice message": "Message vocal",
133+
"Voice message ({{duration}})": "Message vocal ({{duration}})",
130134
"Your comment": "Votre commentaire",
131135
"You": "Toi",
132136
"You can't send messages in this channel": "You can't send messages in this channel",
@@ -156,6 +160,21 @@
156160
"Message failed to send": "Le message n'a pas pu être envoyé",
157161
"and {{ count }} others": "et {{ count }} autres",
158162
"{{ user }} voted: {{ option }}": "{{ user }} a voté: {{ option }}",
163+
"{{count}} Audios_many": "{{count}} audios",
164+
"{{count}} Audios_one": "{{count}} audio",
165+
"{{count}} Audios_other": "{{count}} audios",
166+
"{{count}} Files_many": "{{count}} fichiers",
167+
"{{count}} Files_one": "{{count}} fichier",
168+
"{{count}} Files_other": "{{count}} fichiers",
169+
"{{count}} Photos_many": "{{count}} photos",
170+
"{{count}} Photos_one": "{{count}} photo",
171+
"{{count}} Photos_other": "{{count}} photos",
172+
"{{count}} Voice messages_many": "{{count}} messages vocaux",
173+
"{{count}} Voice messages_one": "{{count}} message vocal",
174+
"{{count}} Voice messages_other": "{{count}} messages vocaux",
175+
"{{count}} Videos_many": "{{count}} vidéos",
176+
"{{count}} Videos_one": "{{count}} vidéo",
177+
"{{count}} Videos_other": "{{count}} vidéos",
159178
"{{count}} votes_many": "{{count}} votes",
160179
"{{count}} votes_one": "{{count}} vote",
161180
"{{count}} votes_other": "{{count}} votes",

package/src/i18n/he.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"Are you sure you want to permanently delete this message?": "האם את/ה בטוח/ה שאת/ה רוצה למחוק את ההודעה הזו לצמיתות?",
1515
"Are you sure?": "האם אתה בטוח?",
1616
"Ask a question": "שאל שאלה",
17+
"Audio": "אודיו",
1718
"Ban User": "לחסום משתמש",
1819
"Block User": "חסום משתמש",
1920
"Cancel": "ביטול",
@@ -46,11 +47,13 @@
4647
"Flag Message": "סמן הודעה",
4748
"Flag action failed either due to a network issue or the message is already flagged": "פעולת הסימון נכשלה בגלל בעיית רשת או שההודעה כבר סומנה.",
4849
"Generating...": "מייצר...",
50+
"Giphy": "Giphy",
4951
"Hold to start recording.": "לחץ והחזק כדי להתחיל להקליט.",
5052
"How about sending your first message to a friend?": "מה דעתך לשלוח את ההודעה הראשונה שלך לחבר?",
5153
"Instant Commands": "פעולות מיידיות",
5254
"Let's start chatting!": "בואו נתחיל לשוחח!",
5355
"Links are disabled": "הקישורים מבוטלים",
56+
"Live Location": "מיקום חי",
5457
"Loading channels...": "השיחות בטעינה...",
5558
"Loading messages...": "ההודעות בטעינה..",
5659
"Loading threads...": "טוען שרשורים...",
@@ -127,6 +130,7 @@
127130
"View {{count}} comments_one": "הצג {{count}} תגובה",
128131
"View {{count}} comments_other": "הצג {{count}} תגובות",
129132
"Voice message": "הודעת קול",
133+
"Voice message ({{duration}})": "הודעת קול ({{duration}})",
130134
"Your comment": "התגובה שלך",
131135
"You": "את/ה",
132136
"You can't send messages in this channel": "את/ב לא יכול/ה לשלוח הודעות בשיחה זו",
@@ -156,6 +160,21 @@
156160
"Message failed to send": "ההודעה לא נשלחה",
157161
"and {{ count }} others": "ועוד {{ count }} משתמש/ים",
158162
"{{ user }} voted: {{ option }}": "{{ user }} הצבע: {{ option }}",
163+
"{{count}} Audios_many": "{{count}} קבצי אודיו",
164+
"{{count}} Audios_one": "{{count}} קובץ אודיו",
165+
"{{count}} Audios_other": "{{count}} קבצי אודיו",
166+
"{{count}} Files_many": "{{count}} קבצים",
167+
"{{count}} Files_one": "{{count}} קובץ",
168+
"{{count}} Files_other": "{{count}} קבצים",
169+
"{{count}} Photos_many": "{{count}} תמונות",
170+
"{{count}} Photos_one": "{{count}} תמונה",
171+
"{{count}} Photos_other": "{{count}} תמונות",
172+
"{{count}} Voice messages_many": "{{count}} הודעות קול",
173+
"{{count}} Voice messages_one": "{{count}} הודעת קול",
174+
"{{count}} Voice messages_other": "{{count}} הודעות קול",
175+
"{{count}} Videos_many": "{{count}} סרטונים",
176+
"{{count}} Videos_one": "{{count}} סרטון",
177+
"{{count}} Videos_other": "{{count}} סרטונים",
159178
"{{count}} votes_many": "{{count}} הצבעות",
160179
"{{count}} votes_one": "{{count}} הצבעה",
161180
"{{count}} votes_other": "{{count}} הצבעות",

package/src/i18n/hi.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"Are you sure you want to permanently delete this message?": "क्या आप वाकई इस संदेश को स्थायी रूप से हटाना चाहते हैं?",
1515
"Are you sure?": "क्या आप सुनिश्चित हैं?",
1616
"Ask a question": "एक प्रश्न पूछें",
17+
"Audio": "ऑडियो",
1718
"Ban User": "उपयोगकर्ता को प्रतिबंधित करें",
1819
"Block User": "उपयोगकर्ता को रोक देना, ब्लॉक यूजर",
1920
"Cancel": "रद्द करें",
@@ -46,11 +47,13 @@
4647
"Flag Message": "झंडा संदेश",
4748
"Flag action failed either due to a network issue or the message is already flagged": "फ़्लैग कार्रवाई या तो नेटवर्क समस्या के कारण विफल हो गई या संदेश पहले से फ़्लैग किया गया है।",
4849
"Generating...": "जनरेट कर रहा है...",
50+
"Giphy": "Giphy",
4951
"Hold to start recording.": "रिकॉर्डिंग शुरू करने के लिए दबाएं।",
5052
"How about sending your first message to a friend?": "किसी मित्र को अपना पहला संदेश भेजने के बारे में क्या ख़याल है?",
5153
"Instant Commands": "त्वरित कमांड",
5254
"Let's start chatting!": "आइए चैट करना शुरू करें!",
5355
"Links are disabled": "लिंक अक्षम हैं",
56+
"Live Location": "लाइव लोकेशन",
5457
"Loading channels...": "चैनल लोड हो रहे हैं...",
5558
"Loading messages...": "मेसेजस लोड हो रहे हैं...",
5659
"Loading threads...": "थ्रेड्स लोड हो रहे हैं...",
@@ -127,6 +130,7 @@
127130
"View {{count}} comments_one": "{{count}} टिप्पणी देखें",
128131
"View {{count}} comments_other": "{{count}} टिप्पणियाँ देखें",
129132
"Voice message": "वॉइस संदेश",
133+
"Voice message ({{duration}})": "वॉइस संदेश ({{duration}})",
130134
"Your comment": "आपकी टिप्पणी",
131135
"You": "आप",
132136
"You can't send messages in this channel": "आप इस चैनल में संदेश नहीं भेज सकते",
@@ -156,6 +160,21 @@
156160
"Message failed to send": "मैसेज भेजने में विफल",
157161
"and {{ count }} others": "और {{ count }} अन्य",
158162
"{{ user }} voted: {{ option }}": "{{ user }} वोट दिया: {{ option }}",
163+
"{{count}} Audios_many": "{{count}} ऑडियो",
164+
"{{count}} Audios_one": "{{count}} ऑडियो",
165+
"{{count}} Audios_other": "{{count}} ऑडियो",
166+
"{{count}} Files_many": "{{count}} फ़ाइलें",
167+
"{{count}} Files_one": "{{count}} फ़ाइल",
168+
"{{count}} Files_other": "{{count}} फ़ाइलें",
169+
"{{count}} Photos_many": "{{count}} फ़ोटो",
170+
"{{count}} Photos_one": "{{count}} फ़ोटो",
171+
"{{count}} Photos_other": "{{count}} फ़ोटो",
172+
"{{count}} Voice messages_many": "{{count}} वॉइस संदेश",
173+
"{{count}} Voice messages_one": "{{count}} वॉइस संदेश",
174+
"{{count}} Voice messages_other": "{{count}} वॉइस संदेश",
175+
"{{count}} Videos_many": "{{count}} वीडियो",
176+
"{{count}} Videos_one": "{{count}} वीडियो",
177+
"{{count}} Videos_other": "{{count}} वीडियो",
159178
"{{count}} votes_many": "{{count}} वोट",
160179
"{{count}} votes_one": "{{count}} वोट",
161180
"{{count}} votes_other": "{{count}} वोट",

0 commit comments

Comments
 (0)