From c04b8b47ebaa4c58b8cc9bd901ba880fafea8ac7 Mon Sep 17 00:00:00 2001 From: devsyncwrld Date: Tue, 1 Sep 2026 16:59:50 -0300 Subject: [PATCH] i18n: translate the chat composer and messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Catching up on the fork's rule that every update also translates one existing system — three updates went by without one. The composer's placeholder takes the channel as a parameter rather than being concatenated, since Portuguese puts the channel elsewhere in the sentence than English does. The translation hook is bound to `tr` in these two files, not `t`: both already use `t` for transfer records in inner scopes, which shadowed the function and made it uncallable exactly where it was needed. --- docs/roadmap-resenha.md | 1 + packages/web/src/components/chat/Message.tsx | 8 +++-- .../web/src/components/chat/MessageInput.tsx | 32 +++++++++++-------- packages/web/src/i18n/locales/en.ts | 19 +++++++++++ packages/web/src/i18n/locales/pt-BR.ts | 19 +++++++++++ 5 files changed, 62 insertions(+), 17 deletions(-) diff --git a/docs/roadmap-resenha.md b/docs/roadmap-resenha.md index 791b5096..2aaf80b5 100644 --- a/docs/roadmap-resenha.md +++ b/docs/roadmap-resenha.md @@ -72,6 +72,7 @@ fixas por `t('chave')`. O que faltar cai para o inglês sozinho. - Configurações → Privacidade - Configurações → Conexões (nasceu bilíngue) - Seletor de GIF +- Chat: composer e mensagens (placeholder, anexos, responder, reações) - Registro de auditoria e Estatísticas (nasceram bilíngues) ### Fila sugerida de tradução diff --git a/packages/web/src/components/chat/Message.tsx b/packages/web/src/components/chat/Message.tsx index 2b0c6e40..11544225 100644 --- a/packages/web/src/components/chat/Message.tsx +++ b/packages/web/src/components/chat/Message.tsx @@ -1,4 +1,5 @@ import React, { useState, useRef, useEffect, useCallback } from 'react'; +import { useT } from '../../i18n'; import { createPortal } from 'react-dom'; import type { MessageWithUser, Embed, User } from '@backspace/shared'; import { MarkdownRenderer } from './MarkdownRenderer'; @@ -131,6 +132,7 @@ export function Message({ message, isCompact, isFirstInGroup, previousMessageId const editMessage = useChatStore((s) => s.editMessage); const deleteMessage = useChatStore((s) => s.deleteMessage); const members = useSpaceStore((s) => s.members); + const tr = useT(); const openUserProfile = useUIStore((s) => s.openUserProfile); const pending = isPendingMessage(message) ? message.__pending : null; @@ -676,7 +678,7 @@ export function Message({ message, isCompact, isFirstInGroup, previousMessageId className={`p-1 hover:bg-interactive-hover rounded transition-colors text-[14px] leading-none ${ showReactionPicker ? 'text-accent-primary' : 'text-txt-tertiary hover:text-txt-secondary' }`} - title="Add reaction" + title={tr('chat.message.addReaction')} > @@ -687,7 +689,7 @@ export function Message({ message, isCompact, isFirstInGroup, previousMessageId
- Replying to + {tr('chat.composer.replyingTo')} {chatReplyTo.user.displayName ?? chatReplyTo.user.username} @@ -783,7 +785,7 @@ export function MessageInput({ channelId, channelName, placeholder }: MessageInp