fix(web): replace hardcoded English strings with i18n in floating chat widget (#14095)

## Summary
- Replace 3 hardcoded English strings in `floating-chat-widget.tsx` with
`react-i18next` `t()` calls so the widget respects the `locale` query
parameter
- Add `useTranslation` hook to the component
- Add translation keys (`chat.chatSupport`, `chat.replyInstantly`,
`chat.typeYourMessage`) to all 14 locale files

## Strings replaced
| Original | i18n key |
|---|---|
| `'Chat Support'` | `t('chat.chatSupport')` |
| `'We typically reply instantly'` | `t('chat.replyInstantly')` |
| `'Type your message...'` | `t('chat.typeYourMessage')` |

Closes #14072

Co-authored-by: khanhkhanhlele <namkhanh2172@gmail.com>
This commit is contained in:
xinmotlanthua
2026-04-14 19:12:56 +07:00
committed by GitHub
parent a98b64326c
commit e1dede1366
16 changed files with 53 additions and 6 deletions

View File

@@ -4,6 +4,7 @@ import { MessageType, SharedFrom } from '@/constants/chat';
import { useFetchExternalAgentInputs } from '@/hooks/use-agent-request';
import { useFetchExternalChatInfo } from '@/hooks/use-chat-request';
import i18n, { changeLanguageAsync } from '@/locales/config';
import { useTranslation } from 'react-i18next';
import { useSendNextSharedMessage } from '@/pages/agent/hooks/use-send-shared-message';
import { MessageCircle, Minimize2, Send, X } from 'lucide-react';
import React, { useCallback, useEffect, useRef, useState } from 'react';
@@ -14,6 +15,7 @@ import {
import FloatingChatWidgetMarkdown from './floating-chat-widget-markdown';
const FloatingChatWidget = () => {
const { t } = useTranslation();
const [isOpen, setIsOpen] = useState(false);
const [isMinimized, setIsMinimized] = useState(false);
const [inputValue, setInputValue] = useState('');
@@ -386,10 +388,10 @@ const FloatingChatWidget = () => {
</div>
<div>
<h3 className="font-semibold text-sm">
{title || 'Chat Support'}
{title || t('chat.chatSupport')}
</h3>
<p className="text-xs text-blue-100">
We typically reply instantly
{t('chat.replyInstantly')}
</p>
</div>
</div>
@@ -489,7 +491,7 @@ const FloatingChatWidget = () => {
handleInputChange(e);
}}
onKeyPress={handleKeyPress}
placeholder="Type your message..."
placeholder={t('chat.typeYourMessage')}
rows={1}
className="w-full resize-none border border-gray-300 rounded-2xl px-4 py-3 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent text-black"
style={{ minHeight: '44px', maxHeight: '120px' }}
@@ -540,10 +542,10 @@ const FloatingChatWidget = () => {
</div>
<div>
<h3 className="font-semibold text-sm">
{title || 'Chat Support'}
{title || t('chat.chatSupport')}
</h3>
<p className="text-xs text-blue-100">
We typically reply instantly
{t('chat.replyInstantly')}
</p>
</div>
</div>
@@ -666,7 +668,7 @@ const FloatingChatWidget = () => {
handleInputChange(e);
}}
onKeyPress={handleKeyPress}
placeholder="Type your message..."
placeholder={t('chat.typeYourMessage')}
rows={1}
className="w-full resize-none border border-gray-300 rounded-2xl px-4 py-3 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent text-black"
style={{ minHeight: '44px', maxHeight: '120px' }}

View File

@@ -652,6 +652,9 @@ export default {
delete: 'يمسح',
},
chat: {
chatSupport: 'دعم الدردشة',
replyInstantly: 'نرد عادةً على الفور',
typeYourMessage: 'اكتب رسالتك...',
messagePlaceholder: 'اكتب رسالتك هنا...',
exit: 'مخرج',
multipleModels: 'نماذج متعددة',

View File

@@ -726,6 +726,9 @@ The above is the content you need to summarize.`,
delete: 'Изтрий',
},
chat: {
chatSupport: 'Чат поддръжка',
replyInstantly: 'Обикновено отговаряме веднага',
typeYourMessage: 'Напишете съобщението си...',
messagePlaceholder: 'Въведете вашето съобщение тук...',
exit: 'Изход',
multipleModels: 'Множество модели',

View File

@@ -736,6 +736,9 @@ Diese Auto-Tag-Funktion verbessert den Abruf, indem sie eine weitere Schicht dom
delete: 'Löschen',
},
chat: {
chatSupport: 'Chat-Support',
replyInstantly: 'Wir antworten in der Regel sofort',
typeYourMessage: 'Nachricht eingeben...',
messagePlaceholder: 'Geben Sie hier Ihre Nachricht ein...',
exit: 'Verlassen',
multipleModels: 'Mehrere Modelle',

View File

@@ -764,6 +764,9 @@ This auto-tagging feature enhances retrieval by adding another layer of domain-s
delete: 'Delete',
},
chat: {
chatSupport: 'Chat Support',
replyInstantly: 'We typically reply instantly',
typeYourMessage: 'Type your message...',
messagePlaceholder: 'Type your message here...',
exit: 'Exit',
multipleModels: 'Multiple models',

View File

@@ -181,6 +181,9 @@ export default {
// Otros bloques de traducción
// Continua con la misma estructura
chat: {
chatSupport: 'Soporte de chat',
replyInstantly: 'Normalmente respondemos al instante',
typeYourMessage: 'Escribe tu mensaje...',
newConversation: 'Nueva conversación',
createAssistant: 'Crear un asistente',
assistantSetting: 'Configuración del asistente',

View File

@@ -337,6 +337,9 @@ export default {
delete: 'Supprimer',
},
chat: {
chatSupport: 'Support par chat',
replyInstantly: 'Nous répondons généralement instantanément',
typeYourMessage: 'Tapez votre message...',
newConversation: 'Nouvelle conversation',
createAssistant: 'Créer un assistant',
assistantSetting: 'Paramètres de lassistant',

View File

@@ -352,6 +352,9 @@ export default {
mind: 'Peta pikiran',
},
chat: {
chatSupport: 'Dukungan Obrolan',
replyInstantly: 'Kami biasanya membalas secara instan',
typeYourMessage: 'Ketik pesan Anda...',
newConversation: 'Percakapan baru',
createAssistant: 'Buat Asisten',
assistantSetting: 'Pengaturan Asisten',

View File

@@ -533,6 +533,9 @@ Quanto sopra è il contenuto che devi riassumere.`,
delete: 'Elimina',
},
chat: {
chatSupport: 'Supporto chat',
replyInstantly: 'Di solito rispondiamo istantaneamente',
typeYourMessage: 'Scrivi il tuo messaggio...',
messagePlaceholder: 'Scrivi il tuo messaggio qui...',
exit: 'Esci',
multipleModels: 'Modelli multipli',

View File

@@ -350,6 +350,9 @@ export default {
questionTip: `質問が指定されている場合、チャンクの埋め込みはそれらに基づきます。`,
},
chat: {
chatSupport: 'チャットサポート',
replyInstantly: '通常、即座に返信します',
typeYourMessage: 'メッセージを入力...',
messagePlaceholder: 'メッセージを入力してください...',
exit: '終了',
multipleModels: '複数モデル',

View File

@@ -349,6 +349,9 @@ export default {
questionTip: `Se houver perguntas fornecidas, a incorporação do fragmento será baseada nelas.`,
},
chat: {
chatSupport: 'Suporte por chat',
replyInstantly: 'Normalmente respondemos instantaneamente',
typeYourMessage: 'Digite sua mensagem...',
newConversation: 'Nova conversa',
createAssistant: 'Criar um Assistente',
assistantSetting: 'Configuração do Assistente',

View File

@@ -767,6 +767,9 @@ export default {
delete: 'Удалить',
},
chat: {
chatSupport: 'Чат-поддержка',
replyInstantly: 'Обычно мы отвечаем мгновенно',
typeYourMessage: 'Введите сообщение...',
messagePlaceholder: 'Введите ваше сообщение здесь...',
exit: 'Выход',
multipleModels: 'Несколько моделей',

View File

@@ -752,6 +752,9 @@ Bu otomatik etiketleme özelliği, mevcut datasete alanına özgü bilgi katman
delete: 'Sil',
},
chat: {
chatSupport: 'Sohbet Desteği',
replyInstantly: 'Genellikle anında yanıt veririz',
typeYourMessage: 'Mesajınızı yazın...',
messagePlaceholder: 'Mesajınızı buraya yazın...',
exit: ıkış',
multipleModels: 'Birden fazla model',

View File

@@ -393,6 +393,9 @@ export default {
'Nếu có những câu hỏi được đưa ra, việc nhúng phần đó sẽ dựa trên những câu hỏi đó.',
},
chat: {
chatSupport: 'Hỗ trợ trò chuyện',
replyInstantly: 'Chúng tôi thường phản hồi ngay lập tức',
typeYourMessage: 'Nhập tin nhắn của bạn...',
newConversation: 'Cuộc trò chuyện mới',
createAssistant: 'Tạo trợ lý',
assistantSetting: 'Cài đặt trợ lý',

View File

@@ -424,6 +424,9 @@ export default {
delete: '删除',
},
chat: {
chatSupport: '聊天支援',
replyInstantly: '我們通常會即時回覆',
typeYourMessage: '輸入您的訊息...',
newConversation: '新會話',
createAssistant: '新建助理',
assistantSetting: '助理設置',

View File

@@ -684,6 +684,9 @@ General实体和关系提取提示来自 GitHub - microsoft/graphrag基于
delete: '删除',
},
chat: {
chatSupport: '聊天支持',
replyInstantly: '我们通常会即时回复',
typeYourMessage: '输入您的消息...',
messagePlaceholder: '请输入消息...',
exit: '退出',
multipleModels: '多模型',