Skip to content

Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.

feat(web): translate the composer

Kilyncda733364e75
diff --git a/apps/web/AGENTS.md b/apps/web/AGENTS.md
index 5781fd0e..4d8937cc 100644
--- a/apps/web/AGENTS.md
+++ b/apps/web/AGENTS.md
@@ -266,7 +266,7 @@ build:assets` to check the initial JS budget.
helpers.
- A label on a translated surface follows the language, so CSS and DOM
queries never select by its text. Use a class or a `data-*` marker such as
- `data-voice-area`, not `[aria-label="…"]`.
+ `data-voice-area` and `data-chat-composer`, not `[aria-label="…"]`.
- A translated control tells Voice Mode what clicking it does with a
marker, never with words in its label: `data-voice-risk="never"` for
deleting, removing, sending, leaving, signing out, paying, archiving or
@@ -276,6 +276,10 @@ build:assets` to check the initial JS budget.
that closes its panel or dialog. An `ActionMenu` item takes `voiceRisk`.
`voice-risk-markers.test.ts` fails when a control named by such a message
lacks its marker.
+ - Text this client keeps beyond the screen (the Outbox, saved state) is
+ stored as a reason or a key and worded when it is shown, so it follows a
+ language switch and a reload. `pending-message-failure.ts` is the pattern:
+ the Outbox stores `failure.reason`, the hook words it with `t`.
- Names and text that come from TeamHub or from people (Agent names, message
previews, server error messages) are data and are shown as they are.
- Add a language: add it to `LANGUAGES` and `catalogLoaders` in
diff --git a/apps/web/src/features/rooms/chat/composer-agent-peek.tsx b/apps/web/src/features/rooms/chat/composer-agent-peek.tsx
index 354ea941..041d0199 100644
--- a/apps/web/src/features/rooms/chat/composer-agent-peek.tsx
+++ b/apps/web/src/features/rooms/chat/composer-agent-peek.tsx
@@ -6,12 +6,15 @@ import {
useState,
} from "react";
+import { useT } from "@/i18n/use-translation";
+
import { useAgentAvatarRecord } from "../members/actor-avatar-image";
import {
agentAvatarAppearance,
resolveAgentAvatarKey,
} from "../members/agent-avatar";
import { AgentAvatarPortrait } from "../members/agent-avatar-portrait";
+import { composerMessages } from "./composer.messages";
/** Typing must run this long, with pauses no longer than the gap below. */
export const PEEK_TYPING_MS = 2500;
@@ -236,6 +239,7 @@ function PeekingAgent({
onReturnFocus?: () => void;
visible: boolean;
}) {
+ const t = useT();
const buttonRef = useRef<HTMLButtonElement>(null);
const returnFocusRef = useRef(onReturnFocus);
useLayoutEffect(() => {
@@ -268,9 +272,12 @@ function PeekingAgent({
return (
// Pointer interaction keeps focus in the draft; keyboard users can also dismiss it.
<button
+ data-voice-close
ref={buttonRef}
aria-hidden={!visible}
- aria-label={`Dismiss ${agent.display_name} avatar`}
+ aria-label={t(composerMessages.dismissAgentAvatar, {
+ name: agent.display_name,
+ })}
type="button"
tabIndex={visible ? 0 : -1}
className={`relative size-11 shrink-0 not-last:-ml-2 transition-transform duration-500 ease-[cubic-bezier(0.34,1.4,0.64,1)] ${visible ? "pointer-events-auto cursor-pointer" : ""}`}
diff --git a/apps/web/src/features/rooms/chat/composer.messages.ts b/apps/web/src/features/rooms/chat/composer.messages.ts
new file mode 100644
index 00000000..38669770
--- /dev/null
+++ b/apps/web/src/features/rooms/chat/composer.messages.ts
@@ -0,0 +1,160 @@
+import { defineMessages } from "@/i18n/messages";
+
+/** The message composer, its pickers and notices, and the errors of sending. */
+export const composerMessages = defineMessages("composer", {
+ // The input itself.
+ messageRoom: "Message Room",
+ messageThisRoom: "Message this Room",
+ messagePeer: "Message {name}",
+ sendMessage: "Send message",
+ lengthCount: "{count} / {limit}",
+ messageTooLong: "Message must be {limit} characters or fewer.",
+ messageNotSent: "Message could not be sent",
+ listSeparator: ", ",
+
+ // Document contexts, references and the reply context above the input.
+ artifactContexts: "Artifact contexts",
+ openContextVersion: "Open {filename} Version {version}",
+ contextVersion: "Version {version} · {room}",
+ removeContextVersion: "Remove {filename} Version {version}",
+ removeContext: "Remove context",
+ composerReferences: "Composer references",
+ openProfile: "Open {name} profile",
+ openDocument: "Open {name}",
+ replyContext: "Selected reply context",
+ removeFromReplyContext: "Remove {name} from reply context",
+ removeReplyContext: "Remove reply context",
+
+ // Attachments.
+ attachFile: "Attach file",
+ chooseAttachments: "Choose message attachments",
+ pendingAttachments: "Pending attachments",
+ previewFile: "Preview {name}",
+ removeFile: "Remove {name}",
+ uploadingFile: "Uploading {name}",
+ uploadingPercent: "Uploading {percent}%",
+ retryUpload: "Retry upload {name}",
+ downloadFile: "Download {name}",
+ closeImagePreview: "Close image preview",
+ fileError: "{name}: {error}",
+ uploadFailed: "Upload failed.",
+ attachmentTooLarge:
+ "Attachments can be up to {limit}, and this file is {size}.",
+ attachmentLimit: "Attach up to {limit} files at a time.",
+ attachmentCleanupFailed: "Attachment cleanup failed.",
+ attachmentCleanupFailedDetail: "Attachment cleanup failed: {detail}",
+ dropFilesTitle: "Release to add to the current message",
+ dropFilesLimit: "Up to 5 files",
+
+ // The mention picker.
+ mentionPicker: "Mention people or documents",
+ mentionTabAll: "all",
+ mentionTabPeople: "people",
+ mentionTabDocs: "docs",
+ noMatchingResults: "No matching results",
+ noMatchingPeople: "No matching people",
+ noMatchingDocuments: "No matching documents",
+ agent: "Agent",
+ person: "Person",
+ doc: "Doc",
+ updatedRecently: "Updated recently",
+ updatedToday: "Updated today {time}",
+ updatedYesterday: "Updated yesterday {time}",
+ updatedDaysAgo: "Updated {days}d ago {time}",
+ updatedOn: "Updated {date} {time}",
+
+ // The Skill picker.
+ skill: "Skill",
+ skillToken: "Skill {token}",
+ skillsFor: "Skills for {name}",
+ skillsForAgent: "Skills for <agent>{name}</agent>",
+ noMatchingSkills: "No matching skills for {name}",
+ selectedSkillDescription: "Selected Skill description",
+ selectSkill: "Select a Skill.",
+ noDescription: "No description available.",
+
+ // Documents and mentions that cannot be sent as written.
+ documentFallbackName: "Document",
+ documentCannotBeShared: "Document cannot be shared in this Room.",
+ documentShareFailed:
+ "Document could not be shared in this Room. Check your access and try again.",
+ documentLinkLoading: "Document link is still loading.",
+ documentReferencesUnavailable:
+ "Document references are unavailable in this conversation.",
+ documentsOutsideRoomFailed:
+ "Documents outside this Room could not be loaded.",
+ referencesLoadingRetry: "Message references are still loading. Try again.",
+ referencesLoadingReview:
+ "Message references are still loading. Exit to review the draft.",
+ unavailableMentionsRemove: {
+ one: "{names} is not available in this Room. Remove the mention to send.",
+ other:
+ "{names} are not available in this Room. Remove the mentions to send.",
+ },
+ unavailableMentionsReview: {
+ one: "{names} is not available in this Room. Exit to review the draft.",
+ other: "{names} are not available in this Room. Exit to review the draft.",
+ },
+
+ // Thinking effort, shown on the model pill and in the Agent's settings.
+ effortNone: "None",
+ effortLow: "Low",
+ effortMedium: "Medium",
+ effortHigh: "High",
+ effortExtraHigh: "Extra high",
+ effortMaximum: "Maximum",
+ effortUltra: "Ultra",
+ loadingSettings: "Loading settings…",
+
+ // Notices above the input.
+ agentsUnavailable: "Your agents are unavailable",
+ localAgentStatusUnavailable:
+ "Local Agent status is unavailable. You can still send messages; replies may be delayed.",
+ agentStatusUnavailable:
+ "Agent status is unavailable. Messages remain read-only.",
+ agentDeleted:
+ "This Agent has been deleted. Message and Run history remain available.",
+ lastConfirmedAt: "Last confirmed at {time}",
+ reconnectingLocalComputer: "Reconnecting to Local Computer…",
+ checkingLocalComputer: "Checking Local Computer status…",
+ keepSending: "You can keep sending messages.",
+ agentUnavailable: "Agent unavailable",
+ checkLocalRuntime: "Check the Local Computer Runtime and try again.",
+ agentCannotReply:
+ "You can still send messages. This Agent cannot reply until its Runtime recovers.",
+ dismissAgentAvatar: "Dismiss {name} avatar",
+
+ // Delivery: what a Message that did not go through says.
+ outboxRestoreFailed:
+ "Saved Messages could not be restored from browser storage. Reload or check browser storage before sending.",
+ outboxRestoreFailedDetail:
+ "Saved Messages could not be restored from browser storage: {detail} Reload or check browser storage before sending.",
+ outboxNormalizationFailed:
+ "Saved Messages were restored, but their interrupted delivery state could not be updated. They remain available in this tab; retry after checking browser storage.",
+ outboxNormalizationFailedDetail:
+ "Saved Messages were restored, but their interrupted delivery state could not be updated: {detail} They remain available in this tab; retry after checking browser storage.",
+ outboxCleanupFailed:
+ "This Message was sent, but its local retry record could not be cleared. Retry to reconcile it safely.",
+ outboxCleanupFailedDetail:
+ "This Message was sent, but its local retry record could not be cleared: {detail} Retry to reconcile it safely.",
+ outboxCancelFailed:
+ "Delivery was canceled, but its local retry record could not be cleared. Try cancel again.",
+ outboxCancelFailedDetail:
+ "Delivery was canceled, but its local retry record could not be cleared: {detail} Try cancel again.",
+ deliveryMayHaveReached:
+ "Delivery may already have reached TeamHub. Retry with the same idempotency key to reconcile it safely.",
+ deliveryUnconfirmed:
+ "TeamHub did not confirm whether this Message was committed. Retry checks the same intent.",
+ deliveryInterrupted:
+ "Delivery was interrupted. Retry to confirm whether this Message was sent.",
+ saveLocallyStorageFull:
+ "This Message could not be saved locally because browser storage is full. Free storage and retry.",
+ saveLocallyFailed:
+ "This Message could not be saved locally. Check browser storage and retry.",
+ saveLocallyFailedDetail: "This Message could not be saved locally: {detail}",
+
+ // The microphone when the composer starts voice input.
+ microphoneInUse: "Another voice input is using the microphone",
+ microphoneHardwareRecording: "Hardware recording is using the microphone",
+ microphoneOtherTab: "The microphone is active in another tab",
+});
diff --git a/apps/web/src/features/rooms/chat/direct-agent-model-switch.tsx b/apps/web/src/features/rooms/chat/direct-agent-model-switch.tsx
index 4b46b73d..a73f9b33 100644
--- a/apps/web/src/features/rooms/chat/direct-agent-model-switch.tsx
+++ b/apps/web/src/features/rooms/chat/direct-agent-model-switch.tsx
@@ -3,29 +3,21 @@ import { lazy, Suspense, useState } from "react";
import { tenantLocalModelsQueryKey } from "@/features/local-models/local-models-queries";
import { teamHubData } from "@/features/teamhub/teamhub-api";
import { type TeamHubClient } from "@/features/teamhub/teamhub-client";
-import type {
- TeamHubAgentReasoningEffort,
- TeamHubTenantAgent,
-} from "@/features/teamhub/teamhub-types";
+import type { TeamHubTenantAgent } from "@/features/teamhub/teamhub-types";
+import { useT } from "@/i18n/use-translation";
import type { AgentRuntimeUpdateInput } from "../members/edit-agent-runtime-dialog";
const EditAgentRuntimeDialog = lazy(async () => ({
default: (await import("../members/edit-agent-runtime-dialog"))
.EditAgentRuntimeDialog,
}));
-import { useResolvedAgentModelLabel } from "../members/use-agent-model-selection";
+import {
+ reasoningEffortMessages,
+ useResolvedAgentModelLabel,
+} from "../members/use-agent-model-selection";
import { tenantAgentsQueryKey } from "../room-queries";
+import { composerMessages } from "./composer.messages";
import "./direct-agent-model-switch.css";
-const EFFORT_LABEL: Record<TeamHubAgentReasoningEffort, string> = {
- none: "None",
- low: "Low",
- medium: "Medium",
- high: "High",
- xhigh: "Extra high",
- max: "Maximum",
- ultra: "Ultra",
-};
-
interface Props {
client: TeamHubClient;
currentActorId?: string;
@@ -42,6 +34,7 @@ export function DirectAgentModelSwitch(props: Props) {
}
function RuntimeSettingsEntry({ client, registration, tenantId, busy }: Props) {
+ const t = useT();
const queryClient = useQueryClient();
const [open, setOpen] = useState(false);
const effort = registration.runtime.reasoning_effort;
@@ -106,7 +99,7 @@ function RuntimeSettingsEntry({ client, registration, tenantId, busy }: Props) {
<>
{" "}
<span className="agent-model-switch-trigger-effort">
- {EFFORT_LABEL[effort]}
+ {t(reasoningEffortMessages[effort])}
</span>
</>
) : null}
@@ -115,7 +108,7 @@ function RuntimeSettingsEntry({ client, registration, tenantId, busy }: Props) {
<Suspense
fallback={
<span role="status" className="text-xs text-app-muted">
- Loading settings…
+ {t(composerMessages.loadingSettings)}
</span>
}
>
diff --git a/apps/web/src/features/rooms/chat/message-composer.tsx b/apps/web/src/features/rooms/chat/message-composer.tsx
index 00a8e07e..b617d653 100644
--- a/apps/web/src/features/rooms/chat/message-composer.tsx
+++ b/apps/web/src/features/rooms/chat/message-composer.tsx
@@ -1,4 +1,12 @@
import type { TeamHubVoiceLiveTurnMarker } from "@/features/teamhub/teamhub-types";
+import { commonMessages } from "@/i18n/common.messages";
+import {
+ formatLocale,
+ type Translate,
+ type Translation,
+} from "@/i18n/language";
+import type { Message } from "@/i18n/messages";
+import { RichMessage, useT, useTranslation } from "@/i18n/use-translation";
import { dateTimeFormat } from "@/lib/date-format";
import {
AlertCircleIcon,
@@ -57,6 +65,7 @@ import type {
VoiceDocumentSelection,
} from "../room-drafts";
import type { ComposerAttachment } from "./composer-attachment-drafts";
+import { composerMessages } from "./composer.messages";
import { VoiceMaterialsPreview } from "./voice-mode/voice-materials-preview";
import { useVoiceMediaPolicy } from "@/features/rooms/voice-control/use-voice-media-policy";
import type {
@@ -111,10 +120,16 @@ import {
useComposerVoiceTurn,
} from "./use-composer-voice";
-const composerDateFormatter = dateTimeFormat({
- day: "numeric",
- month: "short",
-});
+const composerDateFormatters = new Map<string, Intl.DateTimeFormat>();
+
+function composerDateFormatter(locale: string) {
+ let formatter = composerDateFormatters.get(locale);
+ if (!formatter) {
+ formatter = dateTimeFormat({ day: "numeric", month: "short" }, locale);
+ composerDateFormatters.set(locale, formatter);
+ }
+ return formatter;
+}
export interface MessageComposition {
voiceLiveTurn?: TeamHubVoiceLiveTurnMarker;
@@ -244,7 +259,7 @@ const MessageComposerContent = forwardRef<
function useMessageComposer(
{
agentOptionsReady,
- ariaLabel = "Message Room",
+ ariaLabel,
attachmentDraftKey,
attachmentEnabled = false,
autoFocus = false,
@@ -269,7 +284,7 @@ function useMessageComposer(
onRemoveContextMessage,
onSend,
onStageAttachment,
- placeholder = "Message this Room",
+ placeholder,
resolveDocumentLink,
selectedContextMessages = [],
skillOptions = [],
@@ -279,6 +294,7 @@ function useMessageComposer(
}: MessageComposerProps,
ref: ForwardedRef<MessageComposerHandle>,
) {
+ const t = useT();
// Sub-hooks run in this order so their effects keep the order the composer
// relies on: material sync, attachment cleanup, handle and layout, then the
// Voice Mode session binding.
@@ -370,7 +386,10 @@ function useMessageComposer(
activeMentionIndex: picker.activeMentionIndex,
activePickerLength: picker.activePickerLength,
availableMentionTabs: picker.availableMentionTabs,
- ariaLabel,
+ ariaLabel: ariaLabel ?? t(composerMessages.messageRoom),
+ // Voice Mode finds the chat composer by this marker, not by its label,
+ // which follows the language.
+ chatComposer: ariaLabel === undefined,
attachmentEnabled,
attachmentError: attachments.attachmentError,
documentContexts: draft.documentContexts,
@@ -401,7 +420,7 @@ function useMessageComposer(
onCancel,
onOpenProfile,
onRemoveContextMessage,
- placeholder,
+ placeholder: placeholder ?? t(composerMessages.messageThisRoom),
resolvingDocumentLinks: draft.resolvingDocumentLinks,
removeAttachment: attachments.removeAttachment,
retryAttachment: attachments.retryAttachment,
@@ -461,6 +480,7 @@ function MessageComposerView({
voiceModeTarget,
voiceMaterialRows,
} = controller;
+ const t = useT();
const peek = useComposerPeek();
const { submitted: peekSubmitted } = peek;
useEffect(() => {
@@ -521,7 +541,7 @@ function MessageComposerView({
onRemove={onRemoveContextMessage}
/>
<AttachmentError
- message={attachmentError ?? failedUploadMessage(selectedFiles)}
+ message={attachmentError ?? failedUploadMessage(selectedFiles, t)}
/>
<AttachmentPreviews
attachments={selectedFiles}
@@ -603,6 +623,7 @@ function ComposerEditor({
ariaLabel,
autoFocus,
body,
+ chatComposer,
closePicker,
disabled,
documentOptions,
@@ -661,6 +682,7 @@ function ComposerEditor({
}
aria-autocomplete="list"
aria-controls={mentionQuery || skillQuery ? mentionListId : undefined}
+ data-chat-composer={chatComposer ? "" : undefined}
className="message-composer-input relative z-[1] block w-full resize-none bg-transparent outline-none"
maxLength={TEAMHUB_MESSAGE_MAX_LENGTH}
onChange={(event) => {
@@ -829,16 +851,23 @@ function DocumentContextChips({
onOpen?: (context: RoomComposerDocumentContext) => void;
onRemove: (context: RoomComposerDocumentContext) => void;
}) {
+ const t = useT();
if (contexts.length === 0) return null;
return (
- <div aria-label="Artifact contexts" className="mb-2 flex flex-wrap gap-2">
+ <div
+ aria-label={t(composerMessages.artifactContexts)}
+ className="mb-2 flex flex-wrap gap-2"
+ >
{contexts.map((context) => (
<div
className="flex min-w-0 max-w-full items-center gap-1 rounded-md border border-app-border-strong bg-app-surface-soft p-1"
key={context.documentVersionId}
>
<button
- aria-label={`Open ${context.filename} Version ${context.versionNumber}`}
+ aria-label={t(composerMessages.openContextVersion, {
+ filename: context.filename,
+ version: String(context.versionNumber),
+ })}
className="flex min-w-0 items-center gap-2 rounded px-1.5 py-1 text-left focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-app-focus"
disabled={!onOpen}
onClick={() => onOpen?.(context)}
@@ -854,7 +883,10 @@ function DocumentContextChips({
{context.filename}
</span>
<span className="block truncate text-[12px] text-app-subtle">
- Version {context.versionNumber} · {context.sourceRoomName}
+ {t(composerMessages.contextVersion, {
+ room: context.sourceRoomName,
+ version: String(context.versionNumber),
+ })}
</span>
</span>
{onOpen ? (
@@ -866,10 +898,14 @@ function DocumentContextChips({
) : null}
</button>
<Button
- aria-label={`Remove ${context.filename} Version ${context.versionNumber}`}
+ data-voice-risk="never"
+ aria-label={t(composerMessages.removeContextVersion, {
+ filename: context.filename,
+ version: String(context.versionNumber),
+ })}
onClick={() => onRemove(context)}
size="compactIcon"
- title="Remove context"
+ title={t(composerMessages.removeContext)}
tone="ghost"
>
<Icon icon={Cancel01Icon} size={14} />
@@ -931,6 +967,7 @@ function ComposerHighlight({
skillOptions: MessageSkillOption[];
skillReferences: TeamHubMessageSkillReference[];
}) {
+ const t = useT();
const references = findComposerReferenceMatches(
body,
mentions,
@@ -1003,8 +1040,10 @@ function ComposerHighlight({
: Boolean(onOpenDocument);
const label =
reference.kind === "actor"
- ? `Open ${reference.actor.display_name} profile`
- : `Open ${reference.document.name}`;
+ ? t(composerMessages.openProfile, {
+ name: reference.actor.display_name,
+ })
+ : t(composerMessages.openDocument, { name: reference.document.name });
const token = actionable ? (
<span
aria-label={label}
@@ -1050,7 +1089,7 @@ function ComposerHighlight({
return (
<div
- aria-label="Composer references"
+ aria-label={t(composerMessages.composerReferences)}
className="message-composer-highlight-layer absolute inset-0 overflow-hidden"
role="group"
>
@@ -1151,7 +1190,9 @@ function SkillReferenceToken({
skill: MessageSkillOption;
token: string;
}) {
- const description = skill.description?.trim() || "No description available.";
+ const t = useT();
+ const description =
+ skill.description?.trim() || t(composerMessages.noDescription);
const tooltipId = useId();
const [tooltipPosition, setTooltipPosition] = useState<{
left: number;
@@ -1170,7 +1211,7 @@ function SkillReferenceToken({
<>
<span
aria-describedby={tooltipPosition ? tooltipId : undefined}
- aria-label={`Skill ${token}`}
+ aria-label={t(composerMessages.skillToken, { token })}
className="message-composer-reference"
data-reference-kind="skill"
onBlur={() => setTooltipPosition(undefined)}
@@ -1196,7 +1237,7 @@ function SkillReferenceToken({
>
<p className="line-clamp-6">{description}</p>
<p className="mt-1 text-[12px] font-medium text-app-subtle">
- Skill
+ {t(composerMessages.skill)}
</p>
</div>,
document.body,
@@ -1213,10 +1254,11 @@ function ReplyContextPreview({
messages: TeamHubMessage[];
onRemove?: (messageId: string) => void;
}) {
+ const t = useT();
if (!messages.length) return null;
return (
<div
- aria-label="Selected reply context"
+ aria-label={t(composerMessages.replyContext)}
className="mb-2 max-h-36 space-y-1 overflow-y-auto border-b border-app-border pb-2 pr-1"
>
{messages.map((message) => (
@@ -1231,10 +1273,13 @@ function ReplyContextPreview({
{markdownPlainText(message.raw_message)}
</span>
<Button
- aria-label={`Remove ${message.author.display_name} from reply context`}
+ data-voice-risk="never"
+ aria-label={t(composerMessages.removeFromReplyContext, {
+ name: message.author.display_name,
+ })}
onClick={() => onRemove?.(message.id)}
size="compactIcon"
- title="Remove reply context"
+ title={t(composerMessages.removeReplyContext)}
tone="ghost"
>
<Icon icon={Cancel01Icon} size={14} />
@@ -1246,12 +1291,18 @@ function ReplyContextPreview({
}
// A failed chip only shows an icon, so name the failure where it can be read.
-function failedUploadMessage(attachments: readonly ComposerAttachment[]) {
+function failedUploadMessage(
+ attachments: readonly ComposerAttachment[],
+ t: Translate,
+) {
const failed = attachments.find(
(attachment) => attachment.status === "failed",
);
if (!failed) return null;
- return `${failed.file.name}: ${failed.error ?? "Upload failed."}`;
+ return t(composerMessages.fileError, {
+ error: failed.error ?? t(composerMessages.uploadFailed),
+ name: failed.file.name,
+ });
}
function AttachmentError({ message }: { message: string | null }) {
@@ -1275,6 +1326,7 @@ function MessageLengthStatus({
error: string | null;
id: string;
}) {
+ const t = useT();
if (!error && bodyLength < TEAMHUB_MESSAGE_MAX_LENGTH * 0.9) return null;
return (
<p
@@ -1285,7 +1337,10 @@ function MessageLengthStatus({
role={error ? "alert" : "status"}
>
{error ??
- `${bodyLength.toLocaleString()} / ${TEAMHUB_MESSAGE_MAX_LENGTH.toLocaleString()}`}
+ t(composerMessages.lengthCount, {
+ count: bodyLength,
+ limit: TEAMHUB_MESSAGE_MAX_LENGTH,
+ })}
</p>
);
}
@@ -1317,6 +1372,7 @@ function ComposerToolbar({
voiceModeEntered?: boolean;
keepSendWithVoice?: boolean;
}) {
+ const t = useT();
const showAttach = attachmentEnabled && !voiceModeEntered;
const showTools = !submitLabel && !voiceModeEntered && Boolean(modelSwitch);
const hasLeftTools = showAttach || showTools;
@@ -1327,18 +1383,18 @@ function ComposerToolbar({
{showAttach ? (
<>
<Button
- aria-label="Attach file"
+ aria-label={t(composerMessages.attachFile)}
className="composer-attach-button"
disabled={disabled}
onClick={() => fileInputRef.current?.click()}
size="compactIcon"
- title="Attach file"
+ title={t(composerMessages.attachFile)}
tone="ghost"
>
<Icon icon={PlusSignIcon} size={16} />
</Button>
<input
- aria-label="Choose message attachments"
+ aria-label={t(composerMessages.chooseAttachments)}
className="sr-only"
disabled={disabled}
multiple
@@ -1358,7 +1414,7 @@ function ComposerToolbar({
<>
{onCancel ? (
<Button onClick={onCancel} size="compact" tone="ghost">
- Cancel
+ {t(commonMessages.cancel)}
</Button>
) : null}
<Button
@@ -1376,7 +1432,8 @@ function ComposerToolbar({
{voiceModeControls}
{!voiceModeControls || keepSendWithVoice ? (
<Button
- aria-label="Send message"
+ data-voice-risk="never"
+ aria-label={t(composerMessages.sendMessage)}
className="message-composer-send disabled:!opacity-100"
disabled={sendDisabled}
onClick={onSend}
@@ -1402,13 +1459,14 @@ function AttachmentPreviews({
onRemove: (attachment: ComposerAttachment) => void;
onRetry: (attachment: ComposerAttachment) => void;
}) {
+ const t = useT();
if (!attachments.length) {
return null;
}
return (
<div
- aria-label="Pending attachments"
+ aria-label={t(composerMessages.pendingAttachments)}
className="workspace-scrollbar mb-2 flex min-w-0 items-center gap-2 overflow-x-auto px-1"
role="region"
>
@@ -1433,6 +1491,7 @@ function AttachmentPreview({
onRemove: () => void;
onRetry: () => void;
}) {
+ const t = useT();
const { file } = attachment;
const [previewOpen, setPreviewOpen] = useState(false);
const [objectUrl, setObjectUrl] = useState<string>();
@@ -1466,7 +1525,7 @@ function AttachmentPreview({
return (
<div className="group relative h-8 shrink-0">
<button
- aria-label={`Preview ${file.name}`}
+ aria-label={t(composerMessages.previewFile, { name: file.name })}
className="block h-8 overflow-hidden rounded-md border border-border focus-visible:outline-2 focus-visible:outline-app-focus"
onClick={() => setPreviewOpen(true)}
type="button"
@@ -1478,7 +1537,8 @@ function AttachmentPreview({
/>
</button>
<button
- aria-label={`Remove ${file.name}`}
+ data-voice-risk="never"
+ aria-label={t(composerMessages.removeFile, { name: file.name })}
className="pointer-events-none absolute right-0 top-0 flex size-4 items-center justify-center rounded-bl bg-foreground/60 text-background opacity-0 transition-opacity group-hover:pointer-events-auto group-hover:opacity-100 group-focus-within:pointer-events-auto group-focus-within:opacity-100 focus-visible:outline-2 focus-visible:outline-app-focus [@media(hover:none)]:pointer-events-auto [@media(hover:none)]:opacity-100"
onClick={onRemove}
type="button"
@@ -1502,7 +1562,7 @@ function AttachmentPreview({
>
{attachment.status === "uploading" ? (
<span
- aria-label={`Uploading ${file.name}`}
+ aria-label={t(composerMessages.uploadingFile, { name: file.name })}
className="inline-flex size-4 shrink-0 animate-spin motion-reduce:animate-none"
role="status"
>
@@ -1522,7 +1582,9 @@ function AttachmentPreview({
{attachment.status === "uploading" ? (
<div className={`flex min-w-0 flex-1 items-center px-1 ${token.text}`}>
<span className="sr-only">
- Uploading {Math.round(attachment.progress * 100)}%
+ {t(composerMessages.uploadingPercent, {
+ percent: Math.round(attachment.progress * 100),
+ })}
</span>
<span className="min-w-0 flex-1 truncate">{file.name}</span>
<span className="shrink-0">
@@ -1531,7 +1593,7 @@ function AttachmentPreview({
</div>
) : attachment.status === "failed" ? (
<button
- aria-label={`Retry upload ${file.name}`}
+ aria-label={t(composerMessages.retryUpload, { name: file.name })}
className="min-w-0 flex-1 truncate px-1 text-left text-app-danger focus-visible:outline-2 focus-visible:outline-app-focus"
onClick={onRetry}
title={attachment.error}
@@ -1541,7 +1603,7 @@ function AttachmentPreview({
</button>
) : (
<button
- aria-label={`Download ${file.name}`}
+ aria-label={t(composerMessages.downloadFile, { name: file.name })}
className={`min-w-0 flex-1 truncate px-1 text-left focus-visible:outline-2 focus-visible:outline-app-focus ${token.text}`}
onClick={download}
type="button"
@@ -1550,7 +1612,8 @@ function AttachmentPreview({
</button>
)}
<button
- aria-label={`Remove ${file.name}`}
+ data-voice-risk="never"
+ aria-label={t(composerMessages.removeFile, { name: file.name })}
className="flex size-3 shrink-0 items-center justify-center text-muted-foreground/60 hover:text-muted-foreground focus-visible:outline-2 focus-visible:outline-app-focus"
onClick={onRemove}
type="button"
@@ -1570,9 +1633,10 @@ function ImageAttachmentDialog({
objectUrl: string;
onClose: () => void;
}) {
+ const t = useT();
return (
<ModalDialog
- ariaLabel={`Preview ${file.name}`}
+ ariaLabel={t(composerMessages.previewFile, { name: file.name })}
className="overflow-hidden"
closeOnBackdrop
onClose={onClose}
@@ -1583,7 +1647,8 @@ function ImageAttachmentDialog({
{file.name}
</p>
<Button
- aria-label="Close image preview"
+ data-voice-close
+ aria-label={t(composerMessages.closeImagePreview)}
onClick={onClose}
size="compactIcon"
tone="ghost"
@@ -1659,6 +1724,12 @@ function attachmentTokenPresentation(file: File) {
};
}
+const mentionTabMessages = {
+ all: composerMessages.mentionTabAll,
+ docs: composerMessages.mentionTabDocs,
+ people: composerMessages.mentionTabPeople,
+} satisfies Record<MentionTab, Message>;
+
function MentionMenu({
activeIndex,
items,
@@ -1678,6 +1749,7 @@ function MentionMenu({
tab: MentionTab;
tabs: readonly MentionTab[];
}) {
+ const t = useT();
const listRef = useRef<HTMLDivElement>(null);
const menuRef = useRef<HTMLDivElement>(null);
const tabRefs = useRef<Partial<Record<MentionTab, HTMLButtonElement>>>({});
@@ -1752,7 +1824,7 @@ function MentionMenu({
return (
<div
- aria-label="Mention people or documents"
+ aria-label={t(composerMessages.mentionPicker)}
className="app-floating-enter message-mention-menu absolute bottom-[calc(100%+8px)] left-0 z-30 flex max-h-[min(26rem,calc(100dvh-7rem))] w-[min(24rem,calc(100vw-1.5rem))] flex-col overflow-hidden bg-popover shadow-md [border-radius:var(--app-panel-radius)]"
ref={menuRef}
>
@@ -1798,7 +1870,7 @@ function MentionMenu({
tabIndex={tab === value ? 0 : -1}
type="button"
>
- {value}
+ {t(mentionTabMessages[value])}
</button>
))}
</div>
@@ -1809,7 +1881,7 @@ function MentionMenu({
role="tabpanel"
>
<div
- aria-label="Mention people or documents"
+ aria-label={t(composerMessages.mentionPicker)}
className="workspace-scrollbar min-h-0 flex-1 overflow-y-auto p-1.5"
id={listId}
ref={listRef}
@@ -1832,12 +1904,13 @@ function MentionMenu({
))
) : (
<p className="px-3 py-5 text-center text-xs text-app-muted">
- No matching{" "}
- {tab === "docs"
- ? "documents"
- : tab === "people"
- ? "people"
- : "results"}
+ {t(
+ tab === "docs"
+ ? composerMessages.noMatchingDocuments
+ : tab === "people"
+ ? composerMessages.noMatchingPeople
+ : composerMessages.noMatchingResults,
+ )}
</p>
)}
</div>
@@ -1859,6 +1932,8 @@ function MentionOption({
onSelect: () => void;
onSelectionChange: () => void;
}) {
+ const translation = useTranslation();
+ const { t } = translation;
const disabled = false;
return (
<button
@@ -1895,17 +1970,19 @@ function MentionOption({
<span className="block truncate text-[12px] text-app-subtle">
{item.kind === "actor"
? item.actor.kind === "agent"
- ? "Agent"
+ ? t(composerMessages.agent)
: formatMentionToken(item.actor)
- : `Updated ${formatRelativeDate(item.document.updatedAt)}`}
+ : documentUpdatedLabel(item.document.updatedAt, translation)}
</span>
</span>
<span className="shrink-0 text-[10px] font-medium text-app-muted">
- {item.kind === "document"
- ? "Doc"
- : item.actor.kind === "agent"
- ? "Agent"
- : "Person"}
+ {t(
+ item.kind === "document"
+ ? composerMessages.doc
+ : item.actor.kind === "agent"
+ ? composerMessages.agent
+ : composerMessages.person,
+ )}
</span>
</button>
);
@@ -1928,6 +2005,7 @@ function SkillMenu({
onSelect: (skill: MessageSkillOption) => void;
onSelectionChange: (index: number) => void;
}) {
+ const t = useT();
const listRef = useRef<HTMLDivElement>(null);
useLayoutEffect(() => {
listRef.current
@@ -1945,12 +2023,20 @@ function SkillMenu({
size="xs"
/>
<span className="min-w-0 truncate text-xs font-medium text-app-muted">
- Skills for <span className="text-app-ink">{agent.display_name}</span>
+ <RichMessage
+ message={composerMessages.skillsForAgent}
+ tags={{
+ agent: (name) => <span className="text-app-ink">{name}</span>,
+ }}
+ values={{ name: agent.display_name }}
+ />
</span>
</div>
<div className="grid min-h-0 flex-1 sm:grid-cols-[minmax(0,15rem)_minmax(0,1fr)]">
<div
- aria-label={`Skills for ${agent.display_name}`}
+ aria-label={t(composerMessages.skillsFor, {
+ name: agent.display_name,
+ })}
className="workspace-scrollbar min-h-14 overflow-y-auto p-1.5 sm:border-r sm:border-app-border"
id={listId}
ref={listRef}
@@ -1981,19 +2067,21 @@ function SkillMenu({
{skill.name}
</span>
<span className="mt-0.5 line-clamp-2 text-[12px] leading-4 text-app-subtle sm:hidden">
- {skill.description || "No description available."}
+ {skill.description || t(composerMessages.noDescription)}
</span>
</span>
</button>
))
) : (
<p className="px-3 py-5 text-center text-xs text-app-muted">
- No matching skills for {agent.display_name}
+ {t(composerMessages.noMatchingSkills, {
+ name: agent.display_name,
+ })}
</p>
)}
</div>
<div
- aria-label="Selected Skill description"
+ aria-label={t(composerMessages.selectedSkillDescription)}
className="workspace-scrollbar hidden min-h-0 overflow-y-auto bg-app-surface-soft p-4 sm:block"
role="region"
>
@@ -2003,14 +2091,16 @@ function SkillMenu({
{formatSkillToken(selectedSkill, options)}
</p>
<p className="mt-2 whitespace-pre-wrap text-sm leading-5 text-app-body">
- {selectedSkill.description || "No description available."}
+ {selectedSkill.description || t(composerMessages.noDescription)}
</p>
<p className="mt-3 text-[12px] font-medium text-app-subtle">
- Skill
+ {t(composerMessages.skill)}
</p>
</>
) : (
- <p className="text-sm text-app-muted">Select a Skill.</p>
+ <p className="text-sm text-app-muted">
+ {t(composerMessages.selectSkill)}
+ </p>
)}
</div>
</div>
@@ -2018,23 +2108,22 @@ function SkillMenu({
);
}
-function formatRelativeDate(value: string) {
+/** When a Document in the picker last changed, as one sentence. */
+function documentUpdatedLabel(value: string, { language, t }: Translation) {
const timestamp = Date.parse(value);
- if (!Number.isFinite(timestamp)) return "recently";
+ if (!Number.isFinite(timestamp)) return t(composerMessages.updatedRecently);
const date = new Date(timestamp);
const time = [date.getHours(), date.getMinutes(), date.getSeconds()]
.map((value) => String(value).padStart(2, "0"))
.join(":");
const days = Math.round((Date.now() - timestamp) / 86_400_000);
- const day =
- days <= 0
- ? "today"
- : days === 1
- ? "yesterday"
- : days < 30
- ? `${days}d ago`
- : composerDateFormatter.format(timestamp);
- return `${day} ${time}`;
+ if (days <= 0) return t(composerMessages.updatedToday, { time });
+ if (days === 1) return t(composerMessages.updatedYesterday, { time });
+ if (days < 30) return t(composerMessages.updatedDaysAgo, { days, time });
+ return t(composerMessages.updatedOn, {
+ date: composerDateFormatter(formatLocale(language)).format(timestamp),
+ time,
+ });
}
/** The composer's Agent mention: avatar over the "@", name in its colour. */
diff --git a/apps/web/src/features/rooms/chat/message-row.tsx b/apps/web/src/features/rooms/chat/message-row.tsx
index ce64b09e..e2d98bf0 100644
--- a/apps/web/src/features/rooms/chat/message-row.tsx
+++ b/apps/web/src/features/rooms/chat/message-row.tsx
@@ -83,6 +83,7 @@ import {
import { applySearchTermHighlight } from "./search-term-highlight";
import { settledCardNotice } from "../cards/card-notice";
import { CardNoticeRows } from "./card-notice-rows";
+import type { PendingMessageFailure } from "./pending-message-failure";
import { ReplyContext } from "./reply-context";
import { RoomNoticeRow } from "./room-notice-row";
import { ThreadReplyPreview } from "./thread-reply-preview";
@@ -108,7 +109,10 @@ export interface PendingRoomMessage {
clientId: string;
// Epoch milliseconds of the first send; retries keep it.
createdAt: number;
+ // TeamHub's own words for a refusal, or the sentence an older client stored.
error?: string;
+ // Why this client could not finish the send; worded when it is shown.
+ failure?: PendingMessageFailure;
mentions: TeamHubActorRef[];
status: "failed" | "sending" | "unknown";
}
diff --git a/apps/web/src/features/rooms/chat/pending-message-failure.ts b/apps/web/src/features/rooms/chat/pending-message-failure.ts
new file mode 100644
index 00000000..7b22bab8
--- /dev/null
+++ b/apps/web/src/features/rooms/chat/pending-message-failure.ts
@@ -0,0 +1,54 @@
+import type { Translate } from "@/i18n/language";
+
+import { composerMessages } from "./composer.messages";
+
+/**
+ * Why this client could not finish a send. The Outbox stores the reason, never
+ * the sentence, so a pending row reads in the language on screen after a
+ * switch or a reload. A stored name keeps its meaning forever.
+ */
+export type PendingMessageFailureReason =
+ | "delivery_interrupted"
+ | "delivery_may_have_reached"
+ | "delivery_unconfirmed"
+ | "local_save_failed"
+ | "local_storage_full"
+ | "outbox_cancel_failed"
+ | "outbox_cleanup_failed";
+
+export interface PendingMessageFailure {
+ reason: PendingMessageFailureReason;
+ /** What the browser said about a storage failure; shown as it came. */
+ detail?: string;
+}
+
+/** The sentence for a failure; nothing for a reason this client does not know. */
+export function describePendingMessageFailure(
+ { detail, reason }: PendingMessageFailure,
+ t: Translate,
+): string | undefined {
+ switch (reason) {
+ case "delivery_interrupted":
+ return t(composerMessages.deliveryInterrupted);
+ case "delivery_may_have_reached":
+ return t(composerMessages.deliveryMayHaveReached);
+ case "delivery_unconfirmed":
+ return t(composerMessages.deliveryUnconfirmed);
+ case "local_save_failed":
+ return detail
+ ? t(composerMessages.saveLocallyFailedDetail, { detail })
+ : t(composerMessages.saveLocallyFailed);
+ case "local_storage_full":
+ return t(composerMessages.saveLocallyStorageFull);
+ case "outbox_cancel_failed":
+ return detail
+ ? t(composerMessages.outboxCancelFailedDetail, { detail })
+ : t(composerMessages.outboxCancelFailed);
+ case "outbox_cleanup_failed":
+ return detail
+ ? t(composerMessages.outboxCleanupFailedDetail, { detail })
+ : t(composerMessages.outboxCleanupFailed);
+ default:
+ return undefined;
+ }
+}
diff --git a/apps/web/src/features/rooms/chat/room-chat-composer-notices.tsx b/apps/web/src/features/rooms/chat/room-chat-composer-notices.tsx
index d09bfd45..c48f6d16 100644
--- a/apps/web/src/features/rooms/chat/room-chat-composer-notices.tsx
+++ b/apps/web/src/features/rooms/chat/room-chat-composer-notices.tsx
@@ -1,4 +1,8 @@
import { Button } from "@/components/ui/button";
+import { commonMessages } from "@/i18n/common.messages";
+import { useT } from "@/i18n/use-translation";
+
+import { composerMessages } from "./composer.messages";
interface RoomChatComposerNoticesProps {
agentDirectoryError: boolean;
@@ -9,14 +13,15 @@ export function RoomChatComposerNotices({
agentDirectoryError,
onRetryAgents,
}: RoomChatComposerNoticesProps) {
+ const t = useT();
return agentDirectoryError ? (
<div
className="room-readable mt-1.5 flex items-center justify-between gap-3 px-1 text-xs text-app-muted"
role="alert"
>
- <span>Your agents are unavailable</span>
+ <span>{t(composerMessages.agentsUnavailable)}</span>
<Button onClick={onRetryAgents} size="compact" tone="secondary">
- Retry
+ {t(commonMessages.retry)}
</Button>
</div>
) : null;
diff --git a/apps/web/src/features/rooms/chat/room-chat-composer-section.tsx b/apps/web/src/features/rooms/chat/room-chat-composer-section.tsx
index 16ece0d6..a5e9d05c 100644
--- a/apps/web/src/features/rooms/chat/room-chat-composer-section.tsx
+++ b/apps/web/src/features/rooms/chat/room-chat-composer-section.tsx
@@ -2,6 +2,9 @@ import { lazy, Suspense, type ComponentProps } from "react";
import { isRunWorking } from "@/features/teamhub/run-status";
import { teamHubData } from "@/features/teamhub/teamhub-api";
+import { commonMessages } from "@/i18n/common.messages";
+import { translate } from "@/i18n/language";
+import { useT } from "@/i18n/use-translation";
import { RoomRejoinBanner } from "../room-participation";
import { readRoomComposerDraft, writeRoomComposerDraft } from "../room-drafts";
@@ -14,6 +17,7 @@ import { SharedStreamingStatus } from "./shared-streaming-status";
import { AgentStreamingStatusDock } from "./message-timeline";
import { roomOffersVoiceMaterials } from "./voice-mode/voice-materials-context";
import { RoomComposerDock } from "./room-composer-dock";
+import { composerMessages } from "./composer.messages";
import type { RoomChatData } from "./use-room-chat-data";
import type { RoomChatConversationState } from "./use-room-chat-conversation-state";
import type { RoomChatTimelineActions } from "./use-room-chat-timeline-actions";
@@ -36,6 +40,7 @@ export function RoomChatComposerSection({
data,
state,
}: RoomChatComposerSectionProps) {
+ const t = useT();
const {
client,
documentsPending,
@@ -80,12 +85,12 @@ export function RoomChatComposerSection({
>
{shareableDocuments.isError ? (
<p role="alert" className="px-4 py-2 text-sm text-app-danger">
- Documents outside this Room could not be loaded.{" "}
+ {t(composerMessages.documentsOutsideRoomFailed)}{" "}
<button
type="button"
onClick={() => void shareableDocuments.refetch()}
>
- Retry
+ {t(commonMessages.retry)}
</button>
</p>
) : null}
@@ -190,11 +195,12 @@ export function RoomChatComposerSection({
onStageAttachment={delivery.stageAttachment}
placeholder={
room.kind === "direct" && room.direct_peer
- ? `Message ${
- actorDisplayNames[room.direct_peer?.id ?? ""] ??
- room.direct_peer?.display_name
- }`
- : "Message this Room"
+ ? t(composerMessages.messagePeer, {
+ name:
+ actorDisplayNames[room.direct_peer?.id ?? ""] ??
+ room.direct_peer?.display_name,
+ })
+ : t(composerMessages.messageThisRoom)
}
ref={interactions.composerRef}
resolveDocumentLink={(link) => resolveRoomDocumentLink(data, link)}
@@ -216,7 +222,7 @@ async function resolveRoomDocumentLink(
link: RoomDocumentLink,
) {
if (link.tenantId !== tenantId) {
- throw new Error("Document cannot be shared in this Room.");
+ throw new Error(translate(composerMessages.documentCannotBeShared));
}
try {
const document = await teamHubData(
@@ -261,7 +267,7 @@ async function resolveRoomDocumentLink(
updatedAt: document.updated_at,
};
} catch {
- throw new Error("Document cannot be shared in this Room.");
+ throw new Error(translate(composerMessages.documentCannotBeShared));
}
}
diff --git a/apps/web/src/features/rooms/chat/room-chat-impl.tsx b/apps/web/src/features/rooms/chat/room-chat-impl.tsx
index 26bb55f9..229bb7ee 100644
--- a/apps/web/src/features/rooms/chat/room-chat-impl.tsx
+++ b/apps/web/src/features/rooms/chat/room-chat-impl.tsx
@@ -1,7 +1,9 @@
import { useEffect, useRef } from "react";
import { FileDropTarget } from "@/components/ui/file-drop-target";
+import { useT } from "@/i18n/use-translation";
+import { composerMessages } from "./composer.messages";
import { MessageForwardDialog } from "./message-forward-dialog";
import { RoomReadStateSync } from "./room-read-state-sync";
import { AnotherMeIntro } from "./another-me-intro";
@@ -13,6 +15,7 @@ import { RoomChatTimelineSection } from "./room-chat-timeline-section";
import { RoomChatComposerSection } from "./room-chat-composer-section";
export function RoomChatImpl() {
+ const t = useT();
// The sub-hooks run in this order so their effects keep the order the Room
// chat relies on: data reads, then conversation state, then actions.
const data = useRoomChatData();
@@ -44,9 +47,9 @@ export function RoomChatImpl() {
onFiles={(files) => {
interactions.composerRef.current?.addFiles(files);
}}
- subtitle="Up to 5 files"
+ subtitle={t(composerMessages.dropFilesLimit)}
testId="room-chat-file-drop-target"
- title="Release to add to the current message"
+ title={t(composerMessages.dropFilesTitle)}
>
<RoomChatTimelineSection actions={actions} data={data} state={state} />
{forwardMessage ? (
diff --git a/apps/web/src/features/rooms/chat/room-composer-dock.tsx b/apps/web/src/features/rooms/chat/room-composer-dock.tsx
index dd9d3525..d96c2dd9 100644
--- a/apps/web/src/features/rooms/chat/room-composer-dock.tsx
+++ b/apps/web/src/features/rooms/chat/room-composer-dock.tsx
@@ -1,3 +1,6 @@
+import { commonMessages } from "@/i18n/common.messages";
+import { formatLocale } from "@/i18n/language";
+import { useT, useTranslation } from "@/i18n/use-translation";
import { formatDateTime } from "@/lib/date-format";
import type { PropsWithChildren } from "react";
@@ -9,6 +12,7 @@ import type {
TeamHubTenantAgent,
TeamHubTenantAgentAvailabilitySnapshot,
} from "@/features/teamhub/teamhub-types";
+import { composerMessages } from "./composer.messages";
export function projectDirectPeerState(
room: TeamHubRoom,
@@ -53,6 +57,7 @@ function DirectPeerAvailability({
onRetry: () => void;
state: ReturnType<typeof projectDirectPeerState>;
}>) {
+ const t = useT();
if (state.deleted) return <DeletedAgentNotice />;
if (state.directoryUnavailable) {
return <AgentDirectoryUnavailableNotice onRetry={onRetry} />;
@@ -64,8 +69,7 @@ function DirectPeerAvailability({
className="room-notice-enter room-readable py-3 text-sm text-app-muted"
role="status"
>
- Local Agent status is unavailable. You can still send messages;
- replies may be delayed.
+ {t(composerMessages.localAgentStatusUnavailable)}
</p>
) : state.runtimeIssue ? (
<LocalRuntimeAttentionNotice status={state.runtimeIssue} />
@@ -100,26 +104,28 @@ export function RoomComposerDock({
}
function AgentDirectoryUnavailableNotice({ onRetry }: { onRetry: () => void }) {
+ const t = useT();
return (
<div
className="room-readable flex items-center justify-between gap-3 border-t border-[var(--app-status-warning-border)] py-4 text-sm text-app-body"
role="alert"
>
- <span>Agent status is unavailable. Messages remain read-only.</span>
+ <span>{t(composerMessages.agentStatusUnavailable)}</span>
<Button onClick={onRetry} size="compact" tone="secondary">
- Retry
+ {t(commonMessages.retry)}
</Button>
</div>
);
}
function DeletedAgentNotice() {
+ const t = useT();
return (
<div
className="room-readable border-t border-app-border py-4 text-sm text-app-muted"
role="status"
>
- This Agent has been deleted. Message and Run history remain available.
+ {t(composerMessages.agentDeleted)}
</div>
);
}
@@ -131,6 +137,7 @@ function LocalRuntimeAttentionNotice({
TeamHubTenantAgentAvailabilitySnapshot["local_runtime_status"]
>;
}) {
+ const { language, t } = useTranslation();
const authenticationRequired = status.status === "authentication_required";
const reconnecting = status.connection_status === "reconnecting";
const unknown =
@@ -146,17 +153,25 @@ function LocalRuntimeAttentionNotice({
role="status"
title={
status.observed_at
- ? `Last confirmed at ${formatDateTime(status.observed_at)}`
+ ? t(composerMessages.lastConfirmedAt, {
+ time: formatDateTime(
+ status.observed_at,
+ undefined,
+ formatLocale(language),
+ ),
+ })
: undefined
}
>
<StatusDot tone="warning" />
<span className="font-medium text-app-ink">
- {reconnecting
- ? "Reconnecting to Local Computer…"
- : "Checking Local Computer status…"}
+ {t(
+ reconnecting
+ ? composerMessages.reconnectingLocalComputer
+ : composerMessages.checkingLocalComputer,
+ )}
</span>
- <span>You can keep sending messages.</span>
+ <span>{t(composerMessages.keepSending)}</span>
</div>
);
}
@@ -165,7 +180,7 @@ function LocalRuntimeAttentionNotice({
className="room-readable border-t border-[var(--app-status-warning-border)] py-4 text-sm text-app-body"
role="status"
>
- <p className="mb-1 font-medium">Agent unavailable</p>
+ <p className="mb-1 font-medium">{t(composerMessages.agentUnavailable)}</p>
{authenticationRequired ? (
<LocalRuntimeAuthenticationGuidance
runtimeType={status.runtime_type}
@@ -173,12 +188,11 @@ function LocalRuntimeAttentionNotice({
/>
) : (
<p className="mt-1 text-app-muted">
- {status.message ?? "Check the Local Computer Runtime and try again."}
+ {status.message ?? t(composerMessages.checkLocalRuntime)}
</p>
)}
<p className="mt-1 text-app-muted">
- You can still send messages. This Agent cannot reply until its Runtime
- recovers.
+ {t(composerMessages.agentCannotReply)}
</p>
</div>
);
diff --git a/apps/web/src/features/rooms/chat/use-composer-attachments.ts b/apps/web/src/features/rooms/chat/use-composer-attachments.ts
index bacd8acb..b7788385 100644
--- a/apps/web/src/features/rooms/chat/use-composer-attachments.ts
+++ b/apps/web/src/features/rooms/chat/use-composer-attachments.ts
@@ -9,11 +9,13 @@ import {
import { createTeamHubIdempotencyKey } from "@/features/teamhub/teamhub-client";
import { TeamHubError } from "@/features/teamhub/teamhub-error";
+import { translate } from "@/i18n/language";
import { formatBytes } from "@/lib/format-bytes";
import {
type ComposerAttachment,
composerAttachmentStore,
} from "./composer-attachment-drafts";
+import { composerMessages } from "./composer.messages";
import type { MessageComposerProps } from "./message-composer";
import {
decodeLocalImage,
@@ -215,8 +217,10 @@ export function useComposerAttachments({
}).catch((error) =>
setAttachmentError(
error instanceof Error
- ? `Attachment cleanup failed: ${error.message}`
- : "Attachment cleanup failed.",
+ ? translate(composerMessages.attachmentCleanupFailedDetail, {
+ detail: error.message,
+ })
+ : translate(composerMessages.attachmentCleanupFailed),
),
);
}
@@ -268,15 +272,22 @@ function uploadFailureCopy(error: unknown, file: File) {
(detail) => detail.code === "too_large",
)?.limit_bytes;
if (limit !== undefined)
- return `Attachments can be up to ${formatBytes(limit)}, and this file is ${formatBytes(file.size)}.`;
+ return translate(composerMessages.attachmentTooLarge, {
+ limit: formatBytes(limit),
+ size: formatBytes(file.size),
+ });
}
- return error instanceof Error ? error.message : "Upload failed.";
+ return error instanceof Error
+ ? error.message
+ : translate(composerMessages.uploadFailed);
}
function validateMessageAttachments(files: File[]) {
if (files.length > maximumAttachmentCount) {
return {
- error: `Attach up to ${maximumAttachmentCount} files at a time.`,
+ error: translate(composerMessages.attachmentLimit, {
+ limit: maximumAttachmentCount,
+ }),
files: [],
};
}
diff --git a/apps/web/src/features/rooms/chat/use-composer-document-paste.ts b/apps/web/src/features/rooms/chat/use-composer-document-paste.ts
index d5bc7b72..230e28f5 100644
--- a/apps/web/src/features/rooms/chat/use-composer-document-paste.ts
+++ b/apps/web/src/features/rooms/chat/use-composer-document-paste.ts
@@ -1,6 +1,8 @@
import type { ClipboardEvent } from "react";
import { readDocumentClipboardLink } from "@/features/rooms/files/document-clipboard-link";
+import { translate } from "@/i18n/language";
+import { composerMessages } from "./composer.messages";
import type { MessageComposerProps } from "./message-composer";
import {
formatDocumentToken,
@@ -64,7 +66,9 @@ export function useComposerDocumentPaste({
);
const provisional: MessageDocumentOption = {
documentId: link.documentId,
- name: clipboardLink?.title ?? "Document",
+ name:
+ clipboardLink?.title ??
+ translate(composerMessages.documentFallbackName),
tenantId: link.tenantId,
updatedAt: "",
};
@@ -104,7 +108,7 @@ export function useComposerDocumentPaste({
(resolved.tenantId !== undefined &&
resolved.tenantId !== link.tenantId)
) {
- throw new Error("Document cannot be shared in this Room.");
+ throw new Error(translate(composerMessages.documentCannotBeShared));
}
const options = [...documentOptions, resolved];
const token = formatDocumentToken(resolved, options);
@@ -147,7 +151,7 @@ export function useComposerDocumentPaste({
setMessageError(
error instanceof Error
? error.message
- : "Document cannot be shared in this Room.",
+ : translate(composerMessages.documentCannotBeShared),
);
})
.finally(() => {
diff --git a/apps/web/src/features/rooms/chat/use-composer-draft.ts b/apps/web/src/features/rooms/chat/use-composer-draft.ts
index 68309cb9..79e9b735 100644
--- a/apps/web/src/features/rooms/chat/use-composer-draft.ts
+++ b/apps/web/src/features/rooms/chat/use-composer-draft.ts
@@ -2,10 +2,12 @@ import { useId, useRef, useState } from "react";
import type { TeamHubMessageSkillReference } from "@/features/teamhub/teamhub-message-content";
import type { TeamHubActorRef } from "@/features/teamhub/teamhub-types";
+import { translate } from "@/i18n/language";
import type {
RoomComposerDocumentContext,
RoomComposerDocumentReference,
} from "../room-drafts";
+import { composerMessages } from "./composer.messages";
import type { MessageComposerDraft } from "./message-composer";
import {
activeDocumentReferences,
@@ -177,18 +179,27 @@ export type ComposerReferences = ReturnType<
>;
export function messageLengthError() {
- return `Message must be ${TEAMHUB_MESSAGE_MAX_LENGTH.toLocaleString()} characters or fewer.`;
+ return translate(composerMessages.messageTooLong, {
+ limit: TEAMHUB_MESSAGE_MAX_LENGTH,
+ });
}
/** Names unavailable mentions; `nextStep` tells the user how to proceed. */
export function unavailableMentionsError(
mentions: TeamHubActorRef[],
- nextStep: (noun: string) => string,
+ nextStep: "remove" | "review",
) {
- const names = mentions.map(formatMentionToken).join(", ");
- const verb = mentions.length === 1 ? "is" : "are";
- const noun = mentions.length === 1 ? "mention" : "mentions";
- return `${names} ${verb} not available in this Room. ${nextStep(noun)}`;
+ return translate(
+ nextStep === "remove"
+ ? composerMessages.unavailableMentionsRemove
+ : composerMessages.unavailableMentionsReview,
+ {
+ count: mentions.length,
+ names: mentions
+ .map(formatMentionToken)
+ .join(translate(composerMessages.listSeparator)),
+ },
+ );
}
export function findDocumentOption(
diff --git a/apps/web/src/features/rooms/chat/use-composer-reference-insertion.ts b/apps/web/src/features/rooms/chat/use-composer-reference-insertion.ts
index 0c538128..90edb62d 100644
--- a/apps/web/src/features/rooms/chat/use-composer-reference-insertion.ts
+++ b/apps/web/src/features/rooms/chat/use-composer-reference-insertion.ts
@@ -1,4 +1,6 @@
import type { TeamHubActorRef } from "@/features/teamhub/teamhub-types";
+import { translate } from "@/i18n/language";
+import { composerMessages } from "./composer.messages";
import type { MessageComposerProps } from "./message-composer";
import {
formatDocumentToken,
@@ -77,7 +79,7 @@ export function useComposerReferenceInsertion({
if (!mentionQuery) return;
if (document.requiresRoomBinding) {
if (!resolveDocumentLink || !document.tenantId) {
- setMessageError("Document cannot be shared in this Room.");
+ setMessageError(translate(composerMessages.documentCannotBeShared));
return;
}
const selection = mentionQuery;
@@ -116,9 +118,7 @@ export function useComposerReferenceInsertion({
]);
})
.catch(() =>
- setMessageError(
- "Document could not be shared in this Room. Check your access and try again.",
- ),
+ setMessageError(translate(composerMessages.documentShareFailed)),
)
.finally(() => {
resolvingDocumentLinksRef.current = Math.max(
diff --git a/apps/web/src/features/rooms/chat/use-composer-send.ts b/apps/web/src/features/rooms/chat/use-composer-send.ts
index 3c0024ea..d7aec5ca 100644
--- a/apps/web/src/features/rooms/chat/use-composer-send.ts
+++ b/apps/web/src/features/rooms/chat/use-composer-send.ts
@@ -1,4 +1,6 @@
+import { translate } from "@/i18n/language";
import type { VoiceDocumentSelection } from "../room-drafts";
+import { composerMessages } from "./composer.messages";
import type {
MessageComposerProps,
MessageComposition,
@@ -67,7 +69,7 @@ export function useComposerSend({
}
if (resolvingDocumentLinksRef.current > 0) {
- setMessageError("Document link is still loading.");
+ setMessageError(translate(composerMessages.documentLinkLoading));
return;
}
@@ -91,16 +93,11 @@ export function useComposerSend({
unavailableMentions,
} = resolveReferences(normalized);
if (pendingAvailability) {
- setMessageError("Message references are still loading. Try again.");
+ setMessageError(translate(composerMessages.referencesLoadingRetry));
return;
}
if (unavailableMentions.length) {
- setMessageError(
- unavailableMentionsError(
- unavailableMentions,
- (noun) => `Remove the ${noun} to send.`,
- ),
- );
+ setMessageError(unavailableMentionsError(unavailableMentions, "remove"));
return;
}
@@ -163,7 +160,9 @@ export function useComposerSend({
selectedSkillsRef.current = skillReferences;
updateBody(normalized, committedDocumentContexts);
setMessageError(
- error instanceof Error ? error.message : "Message could not be sent",
+ error instanceof Error
+ ? error.message
+ : translate(composerMessages.messageNotSent),
);
} finally {
setSubmitting(false);
@@ -182,7 +181,7 @@ export function useComposerSend({
if (!ids.length) return;
if (!voiceModeTarget || !resolveDocumentLink)
throw new Error(
- "Document references are unavailable in this conversation.",
+ translate(composerMessages.documentReferencesUnavailable),
);
await Promise.all(
ids.map((documentId) =>
diff --git a/apps/web/src/features/rooms/chat/use-composer-voice.ts b/apps/web/src/features/rooms/chat/use-composer-voice.ts
index a2ca97b8..14f69d9e 100644
--- a/apps/web/src/features/rooms/chat/use-composer-voice.ts
+++ b/apps/web/src/features/rooms/chat/use-composer-voice.ts
@@ -2,6 +2,8 @@ import { useEffect, useLayoutEffect, useRef, useState } from "react";
import type { TeamHubVoiceLiveTurnMarker } from "@/features/teamhub/teamhub-types";
import type { TeamHubMessage } from "@/features/teamhub/teamhub-types";
+import { translate } from "@/i18n/language";
+import { composerMessages } from "./composer.messages";
import type { MessageComposition } from "./message-composer";
import { formatMentionToken } from "./message-mentions";
import {
@@ -135,15 +137,10 @@ export function useComposerVoiceTurn({
try {
// Inside the try so a rejected turn releases its claimed materials.
if (references.pendingAvailability)
- throw new Error(
- "Message references are still loading. Exit to review the draft.",
- );
+ throw new Error(translate(composerMessages.referencesLoadingReview));
if (references.unavailableMentions.length)
throw new Error(
- unavailableMentionsError(
- references.unavailableMentions,
- () => "Exit to review the draft.",
- ),
+ unavailableMentionsError(references.unavailableMentions, "review"),
);
snapshot ??= withVoiceMaterials(
{
diff --git a/apps/web/src/features/rooms/chat/use-room-message-delivery.test.tsx b/apps/web/src/features/rooms/chat/use-room-message-delivery.test.tsx
index d2440216..016eb0c5 100644
--- a/apps/web/src/features/rooms/chat/use-room-message-delivery.test.tsx
+++ b/apps/web/src/features/rooms/chat/use-room-message-delivery.test.tsx
@@ -21,6 +21,10 @@ import type {
TeamHubMessagePage,
} from "@/features/teamhub/teamhub-types";
+import { setLanguage } from "@/i18n/language";
+import zhCN from "@/i18n/locales/zh-CN.json";
+
+import { composerMessages } from "./composer.messages";
import {
roomMessageSender,
type RoomMessageSender,
@@ -442,6 +446,155 @@ describe("Room Message delivery identity", () => {
await waitFor(() => expect(createMessage).toHaveBeenCalledTimes(2));
});
+ it("words a failed send in the language on screen after a switch and a reload", async () => {
+ const outbox = createMemoryRoomMessageOutbox();
+ const scope = testOutboxScope("room-1");
+ const createMessage = vi
+ .fn<RoomMessageSender["createMessage"]>()
+ .mockRejectedValue(new TypeError("Failed to fetch"));
+ const queryClient = new QueryClient();
+ const wrapper = ({ children }: { children: ReactNode }) => (
+ <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
+ );
+ const renderDelivery = () =>
+ renderHook(
+ () =>
+ useRoomMessageDelivery({
+ composition: sender(createMessage),
+ messagesQueryKey: ["messages"],
+ outbox,
+ outboxScope: scope,
+ roomId: scope.roomId,
+ }),
+ { wrapper },
+ );
+ const english = composerMessages.deliveryUnconfirmed.source;
+ const chinese = zhCN.composer.deliveryUnconfirmed;
+ const first = renderDelivery();
+
+ act(() => {
+ void first.result.current.sendMessage({
+ body: "Fails in English",
+ files: [],
+ mentions: [],
+ });
+ });
+ await waitFor(() =>
+ expect(first.result.current.outgoing[0]).toMatchObject({
+ error: english,
+ status: "unknown",
+ }),
+ );
+ // The Outbox keeps the reason, not the sentence.
+ await waitFor(async () =>
+ expect((await outbox.list(scope))[0]).toMatchObject({
+ failure: { reason: "delivery_unconfirmed" },
+ status: "unknown",
+ }),
+ );
+ expect((await outbox.list(scope))[0]?.error).toBeUndefined();
+
+ await act(() => setLanguage("zh-CN"));
+ expect(first.result.current.outgoing[0]?.error).toBe(chinese);
+
+ first.unmount();
+ const reloaded = renderDelivery();
+ await waitFor(() =>
+ expect(reloaded.result.current.outgoing[0]).toMatchObject({
+ body: "Fails in English",
+ error: chinese,
+ status: "unknown",
+ }),
+ );
+
+ await act(() => setLanguage("en"));
+ expect(reloaded.result.current.outgoing[0]?.error).toBe(english);
+ });
+
+ it("words an interrupted send and a storage failure in the language on screen", async () => {
+ const stored = createMemoryRoomMessageOutbox();
+ const scope = testOutboxScope("room-1");
+ await stored.put(persistedIntent(scope, "local-1", "Was still sending"));
+ const outbox = {
+ ...stored,
+ put: vi
+ .fn<(intent: PersistedRoomMessageIntent) => Promise<void>>()
+ .mockRejectedValue(new Error("IndexedDB transaction aborted.")),
+ } satisfies typeof stored;
+ const queryClient = new QueryClient();
+ const wrapper = ({ children }: { children: ReactNode }) => (
+ <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
+ );
+ const { result } = renderHook(
+ () =>
+ useRoomMessageDelivery({
+ composition: liveComposition(messageClient().client),
+ messagesQueryKey: ["messages"],
+ outbox,
+ outboxScope: scope,
+ roomId: scope.roomId,
+ }),
+ { wrapper },
+ );
+ await waitFor(() =>
+ expect(result.current.outgoing[0]?.error).toBe(
+ composerMessages.deliveryInterrupted.source,
+ ),
+ );
+ await waitFor(() =>
+ expect(result.current.outboxError).toContain(
+ "IndexedDB transaction aborted.",
+ ),
+ );
+ const englishOutboxError = result.current.outboxError;
+
+ await act(() => setLanguage("zh-CN"));
+ expect(result.current.outgoing[0]?.error).toBe(
+ zhCN.composer.deliveryInterrupted,
+ );
+ // The browser's own words stay; the sentence around them changes.
+ expect(result.current.outboxError).toContain(
+ "IndexedDB transaction aborted.",
+ );
+ expect(result.current.outboxError).not.toBe(englishOutboxError);
+ });
+
+ it("keeps the sentence an older client stored with a failed send", async () => {
+ const outbox = createMemoryRoomMessageOutbox();
+ const scope = testOutboxScope("room-1");
+ await outbox.put({
+ ...persistedIntent(scope, "local-1", "Stored before reasons"),
+ error: "A sentence stored by an older client.",
+ status: "unknown",
+ });
+ const queryClient = new QueryClient();
+ const wrapper = ({ children }: { children: ReactNode }) => (
+ <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
+ );
+ const { result } = renderHook(
+ () =>
+ useRoomMessageDelivery({
+ composition: liveComposition(messageClient().client),
+ messagesQueryKey: ["messages"],
+ outbox,
+ outboxScope: scope,
+ roomId: scope.roomId,
+ }),
+ { wrapper },
+ );
+ await waitFor(() =>
+ expect(result.current.outgoing[0]?.error).toBe(
+ "A sentence stored by an older client.",
+ ),
+ );
+
+ await act(() => setLanguage("zh-CN"));
+ expect(result.current.outgoing[0]).toMatchObject({
+ error: "A sentence stored by an older client.",
+ status: "unknown",
+ });
+ });
+
it("restores a failed Message after remount and retries the original idempotent intent", async () => {
const outbox = createMemoryRoomMessageOutbox();
const createMessage = vi
diff --git a/apps/web/src/features/rooms/chat/use-room-message-delivery.ts b/apps/web/src/features/rooms/chat/use-room-message-delivery.ts
index 777ade0d..62abcaf6 100644
--- a/apps/web/src/features/rooms/chat/use-room-message-delivery.ts
+++ b/apps/web/src/features/rooms/chat/use-room-message-delivery.ts
@@ -1,16 +1,23 @@
import { type QueryKey, useQueryClient } from "@tanstack/react-query";
-import { useCallback, useEffect, useRef, useState } from "react";
+import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { createTeamHubIdempotencyKey } from "@/features/teamhub/teamhub-client";
-import { classifyTeamHubCommandFailure } from "@/features/teamhub/teamhub-command-outcome";
+import { TeamHubError } from "@/features/teamhub/teamhub-error";
import type { TeamHubMessagePresentation } from "@/features/teamhub/teamhub-runtime";
import type { TeamHubMessage } from "@/features/teamhub/teamhub-types";
+import type { Translate } from "@/i18n/language";
+import { useT } from "@/i18n/use-translation";
import {
releaseLocalImage,
rememberLocalMessageImage,
} from "@/features/rooms/files/local-message-images";
+import { composerMessages } from "./composer.messages";
import type { MessageComposition } from "./message-composer";
+import {
+ describePendingMessageFailure,
+ type PendingMessageFailure,
+} from "./pending-message-failure";
import {
browserRoomMessageOutbox,
type PersistedRoomMessageIntent,
@@ -24,6 +31,12 @@ import { roomDiagnostic } from "@/lib/room-diagnostics";
type OutgoingMessage = PersistedRoomMessageIntent;
+/** Why saved Messages could not be read back or brought up to date. */
+interface OutboxFailure {
+ reason: "normalization_failed" | "restore_failed";
+ detail: string;
+}
+
type RoomMessageComposition = MessageComposition & {
wireBody?: string;
contextMessages?: TeamHubMessage[];
@@ -65,7 +78,8 @@ export function useRoomMessageDelivery({
}) {
const queryClient = useQueryClient();
const [outgoing, setOutgoing] = useState<OutgoingMessage[]>([]);
- const [outboxError, setOutboxError] = useState<string>();
+ const t = useT();
+ const [outboxFailure, setOutboxFailure] = useState<OutboxFailure>();
const [presentations, setPresentations] = useState<
Record<string, TeamHubMessagePresentation>
>({});
@@ -87,7 +101,7 @@ export function useRoomMessageDelivery({
tenantId: outboxTenantId,
};
let canceled = false;
- setOutboxError(undefined);
+ setOutboxFailure(undefined);
async function restore() {
try {
const restored = await outbox.list(scope);
@@ -112,10 +126,16 @@ export function useRoomMessageDelivery({
(result): result is PromiseRejectedResult =>
result.status === "rejected",
);
- setOutboxError(outboxNormalizationFailureMessage(failure?.reason));
+ setOutboxFailure({
+ detail: storageFailureDetail(failure?.reason),
+ reason: "normalization_failed",
+ });
} catch (error) {
if (canceled) return;
- setOutboxError(outboxRestoreFailureMessage(error));
+ setOutboxFailure({
+ detail: storageFailureDetail(error),
+ reason: "restore_failed",
+ });
}
}
void restore();
@@ -439,12 +459,21 @@ export function useRoomMessageDelivery({
[composition, roomId],
);
+ // The stored intents carry reasons; the sentences are made here, so they
+ // follow the language on screen.
+ const shownOutgoing = useMemo(
+ () => outgoing.map((intent) => withFailureText(intent, t)),
+ [outgoing, t],
+ );
+
return {
cancelAttachment,
cancelMessage,
enqueueMessage,
- outboxError,
- outgoing,
+ outboxError: outboxFailure
+ ? describeOutboxFailure(outboxFailure, t)
+ : undefined,
+ outgoing: shownOutgoing,
presentations,
retryMessage,
sendMessage,
@@ -452,18 +481,40 @@ export function useRoomMessageDelivery({
};
}
+/** What the browser said about a storage failure, when it said anything. */
function storageFailureDetail(error: unknown) {
- return error instanceof Error && error.message.trim()
- ? `: ${error.message.trim()}`
- : ".";
+ return error instanceof Error ? error.message.trim() : "";
+}
+
+function describeOutboxFailure(
+ { detail, reason }: OutboxFailure,
+ t: Translate,
+) {
+ if (reason === "restore_failed")
+ return detail
+ ? t(composerMessages.outboxRestoreFailedDetail, { detail })
+ : t(composerMessages.outboxRestoreFailed);
+ return detail
+ ? t(composerMessages.outboxNormalizationFailedDetail, { detail })
+ : t(composerMessages.outboxNormalizationFailed);
}
-function outboxRestoreFailureMessage(error: unknown) {
- return `Saved Messages could not be restored from browser storage${storageFailureDetail(error)} Reload or check browser storage before sending.`;
+/** The intent as a row shows it: its failure worded in the language on screen. */
+function withFailureText(intent: OutgoingMessage, t: Translate) {
+ if (!intent.failure) return intent;
+ const error = describePendingMessageFailure(intent.failure, t);
+ return error ? { ...intent, error } : intent;
}
-function outboxNormalizationFailureMessage(error: unknown) {
- return `Saved Messages were restored, but their interrupted delivery state could not be updated${storageFailureDetail(error)} They remain available in this tab; retry after checking browser storage.`;
+/** A failure this client words itself; any earlier sentence is dropped. */
+function clientFailure(
+ reason: PendingMessageFailure["reason"],
+ detail?: string,
+): Pick<OutgoingMessage, "error" | "failure"> {
+ return {
+ error: undefined,
+ failure: detail ? { detail, reason } : { reason },
+ };
}
function canceledAfterNetworkStartedIntent(
@@ -471,8 +522,7 @@ function canceledAfterNetworkStartedIntent(
): OutgoingMessage {
return {
...intent,
- error:
- "Delivery may already have reached TeamHub. Retry with the same idempotency key to reconcile it safely.",
+ ...clientFailure("delivery_may_have_reached"),
status: "unknown",
};
}
@@ -483,7 +533,7 @@ function outboxCleanupFailedIntent(
): OutgoingMessage {
return {
...intent,
- error: `This Message was sent, but its local retry record could not be cleared${storageFailureDetail(error)} Retry to reconcile it safely.`,
+ ...clientFailure("outbox_cleanup_failed", storageFailureDetail(error)),
status: "unknown",
};
}
@@ -494,7 +544,7 @@ function outboxCancelFailedIntent(
): OutgoingMessage {
return {
...intent,
- error: `Delivery was canceled, but its local retry record could not be cleared${storageFailureDetail(error)} Try cancel again.`,
+ ...clientFailure("outbox_cancel_failed", storageFailureDetail(error)),
status: "failed",
};
}
@@ -509,6 +559,7 @@ function sendingIntent(intent: OutgoingMessage): OutgoingMessage {
status: "staging",
})),
error: undefined,
+ failure: undefined,
status: "sending",
};
}
@@ -517,20 +568,21 @@ function failedIntent(
intent: OutgoingMessage,
error: unknown,
): OutgoingMessage {
- const failure = classifyTeamHubCommandFailure(
- error,
- "this Message was committed",
- "Retry checks the same intent.",
- );
+ // TeamHub's refusal is final and says why in its own words; anything else
+ // leaves the outcome open, which is a reason this client words itself.
+ const refused = error instanceof TeamHubError;
+ const message = refused ? error.message : undefined;
return {
...intent,
attachments: intent.attachments.map((attachment) => ({
...attachment,
- error: failure.message,
+ error: message,
status: "failed",
})),
- error: failure.message,
- status: failure.kind,
+ ...(refused
+ ? { error: message, failure: undefined }
+ : clientFailure("delivery_unconfirmed")),
+ status: refused ? "failed" : "unknown",
};
}
@@ -538,21 +590,16 @@ function outboxPersistenceFailedIntent(
intent: OutgoingMessage,
error: unknown,
): OutgoingMessage {
- const detail = error instanceof Error ? error.message.trim() : "";
- const message =
- error instanceof DOMException && error.name === "QuotaExceededError"
- ? "This Message could not be saved locally because browser storage is full. Free storage and retry."
- : detail
- ? `This Message could not be saved locally: ${detail}`
- : "This Message could not be saved locally. Check browser storage and retry.";
return {
...intent,
attachments: intent.attachments.map((attachment) => ({
...attachment,
- error: message,
+ error: undefined,
status: "failed",
})),
- error: message,
+ ...(error instanceof DOMException && error.name === "QuotaExceededError"
+ ? clientFailure("local_storage_full")
+ : clientFailure("local_save_failed", storageFailureDetail(error))),
status: "failed",
};
}
@@ -561,8 +608,7 @@ function normalizeRestoredIntent(intent: PersistedRoomMessageIntent) {
if (intent.status !== "sending") return intent;
return {
...intent,
- error:
- "Delivery was interrupted. Retry to confirm whether this Message was sent.",
+ ...clientFailure("delivery_interrupted"),
status: "unknown" as const,
};
}
diff --git a/apps/web/src/features/rooms/chat/voice-mode/live/voice-page-reader.test.ts b/apps/web/src/features/rooms/chat/voice-mode/live/voice-page-reader.test.ts
index 16f8fec3..2c98a785 100644
--- a/apps/web/src/features/rooms/chat/voice-mode/live/voice-page-reader.test.ts
+++ b/apps/web/src/features/rooms/chat/voice-mode/live/voice-page-reader.test.ts
@@ -29,7 +29,7 @@ beforeEach(() => {
<li>Codex 10:21 <p>Build passed</p></li>
</ul>
<p>The release plan is still in review.</p>
- <textarea aria-label="Message Room">Unsent draft</textarea>
+ <textarea aria-label="Message Room" data-chat-composer>Unsent draft</textarea>
</main>
<section aria-label="Voice Mode window"><p>Text in the voice window</p></section>`;
});
diff --git a/apps/web/src/features/rooms/chat/voice-mode/live/voice-page-reader.ts b/apps/web/src/features/rooms/chat/voice-mode/live/voice-page-reader.ts
index 6d71cea7..64ebbd1b 100644
--- a/apps/web/src/features/rooms/chat/voice-mode/live/voice-page-reader.ts
+++ b/apps/web/src/features/rooms/chat/voice-mode/live/voice-page-reader.ts
@@ -7,7 +7,7 @@
const voiceWindow = '[aria-label="Voice Mode window"]';
const outsideContent = `${voiceWindow}, [data-voice-area], aside[aria-label$=" sidebar"], [aria-hidden="true"], [inert]`;
// The Human's unsent draft and secrets are never read.
-const privateInput = `input, textarea, select, [aria-label="Message Room"]`;
+const privateInput = `input, textarea, select, [data-chat-composer]`;
// A chat message row is one block, read with its author and time.
const messageRow = "article[data-message-author]";
const blocks = `${messageRow}, h1, h2, h3, h4, h5, h6, p, li, blockquote, pre, td, th, dt, dd, figcaption, [role="article"], [role="listitem"], [role="row"]`;
diff --git a/apps/web/src/features/rooms/chat/voice-mode/voice-mode-controls.tsx b/apps/web/src/features/rooms/chat/voice-mode/voice-mode-controls.tsx
index 020a5418..d1a950fb 100644
--- a/apps/web/src/features/rooms/chat/voice-mode/voice-mode-controls.tsx
+++ b/apps/web/src/features/rooms/chat/voice-mode/voice-mode-controls.tsx
@@ -24,6 +24,8 @@ import styles from "./voice-mode.module.css";
import { voiceModeStatusLabel } from "./voice-mode-presentation";
import { openVoicePip } from "./voice-pip";
import { LazyVoiceKeyDialog } from "@/features/rooms/voice-control/lazy-voice-key-dialog";
+import { useT } from "@/i18n/use-translation";
+import { voiceModeMessages } from "./voice-mode.messages";
export type { VoiceModePresentation } from "./voice-mode-presentation";
@@ -62,6 +64,7 @@ export function VoiceModeControls(props: {
/** The deployment's voice support, read once by the composer. */
policy: TeamHubVoiceMediaPolicy | undefined;
}) {
+ const t = useT();
const voice = useOptionalVoiceModeSession();
const { roomId, tenantId } = props.target;
// xAI makes Voice Mode a Live conversation; with Soniox alone it dictates.
@@ -108,7 +111,9 @@ export function VoiceModeControls(props: {
)
.catch((cause: unknown) => {
setStartError(
- cause instanceof Error ? cause.message : "Unable to start Voice Mode",
+ cause instanceof Error
+ ? cause.message
+ : t(voiceModeMessages.unableToStart),
);
})
.finally(() => setStarting(false));
@@ -118,18 +123,26 @@ export function VoiceModeControls(props: {
return (
<>
<Button
- aria-label={closing ? "Finishing Voice Mode" : "Start Voice Mode"}
+ aria-label={t(
+ closing ? voiceModeMessages.finishing : voiceModeMessages.start,
+ )}
title={
startError ??
(closing
- ? "Finishing last words and releasing the microphone"
+ ? t(voiceModeMessages.finishingHint)
: elsewhere
- ? `Voice Mode is on in ${elsewhere.target.roomName || "another Room"}`
- : modes.live
- ? "Voice Mode: a live conversation with Grok"
- : modes.dictation
- ? "Voice Mode: sends when you finish speaking"
- : "Voice Mode: add a Soniox or xAI key to start")
+ ? elsewhere.target.roomName
+ ? t(voiceModeMessages.onInRoom, {
+ room: elsewhere.target.roomName,
+ })
+ : t(voiceModeMessages.onInAnotherRoom)
+ : t(
+ modes.live
+ ? voiceModeMessages.liveHint
+ : modes.dictation
+ ? voiceModeMessages.dictationHint
+ : voiceModeMessages.keyHint,
+ ))
}
className="message-composer-send"
disabled={starting || closing || props.disabled || Boolean(elsewhere)}
@@ -168,13 +181,13 @@ export function VoiceModeControls(props: {
return (
<div
className={styles.panel}
- aria-label="Voice Mode controls"
+ aria-label={t(voiceModeMessages.controls)}
data-settling={settling || undefined}
role="group"
>
<span className={styles.lead}>
<Icon icon={AudioWave01Icon} size={14} />
- <span className={styles.label}>Voice input</span>
+ <span className={styles.label}>{t(voiceModeMessages.voiceInput)}</span>
</span>
<LiveVoiceWaveform active={active} />
{settling ? (
@@ -185,12 +198,12 @@ export function VoiceModeControls(props: {
</span>
) : null}
<span className="sr-only" role="status">
- {voiceModeStatusLabel({ ...state, entered })}
+ {voiceModeStatusLabel({ ...state, entered }, t)}
</span>
{state.canRetry ? (
<Button
- aria-label="Retry voice message"
- title="Retry the same voice message"
+ aria-label={t(voiceModeMessages.retry)}
+ title={t(voiceModeMessages.retryHint)}
size="compactIcon"
tone="ghost"
disabled={state.sending}
@@ -200,7 +213,9 @@ export function VoiceModeControls(props: {
</Button>
) : null}
<Button
- aria-label={muted ? "Unmute microphone" : "Mute microphone"}
+ aria-label={t(
+ muted ? voiceModeMessages.unmute : voiceModeMessages.mute,
+ )}
aria-pressed={muted}
className={styles.mute}
disabled={!state.microphoneActive || state.status === "closing"}
@@ -216,7 +231,11 @@ export function VoiceModeControls(props: {
</Button>
{soundOff === undefined ? null : (
<Button
- aria-label={soundOff ? "Turn reply sound on" : "Turn reply sound off"}
+ aria-label={t(
+ soundOff
+ ? voiceModeMessages.replySoundOn
+ : voiceModeMessages.replySoundOff,
+ )}
aria-pressed={soundOff}
className={styles.sound}
onClick={() => voice?.setSoundOff(!soundOff)}
@@ -231,7 +250,7 @@ export function VoiceModeControls(props: {
</Button>
)}
<Button
- aria-label="Exit Voice Mode"
+ aria-label={t(voiceModeMessages.exit)}
className={styles.exit}
disabled={state.status === "closing"}
onClick={() => voice?.exit()}
diff --git a/apps/web/src/features/rooms/chat/voice-mode/voice-mode-presentation.ts b/apps/web/src/features/rooms/chat/voice-mode/voice-mode-presentation.ts
index fd39c897..075041b0 100644
--- a/apps/web/src/features/rooms/chat/voice-mode/voice-mode-presentation.ts
+++ b/apps/web/src/features/rooms/chat/voice-mode/voice-mode-presentation.ts
@@ -1,4 +1,7 @@
+import type { Translate } from "@/i18n/language";
+import type { Message } from "@/i18n/messages";
import type { VoiceModeState } from "./voice-mode-controller";
+import { voiceModeMessages } from "./voice-mode.messages";
export interface VoiceModePresentation {
entered: boolean;
@@ -14,20 +17,25 @@ export interface VoiceModePresentation {
prefix?: string;
}
-/** Describes actual state only; the browser does not invent a VAD countdown. */
-export function voiceModeStatusLabel(state: VoiceModePresentation): string {
+/**
+ * Describes actual state only; the browser does not invent a VAD countdown.
+ * A translated surface passes its `t`; the others read it in English.
+ */
+export function voiceModeStatusLabel(
+ state: VoiceModePresentation,
+ t?: Translate,
+): string {
+ const text = (message: Message<string>) => (t ? t(message) : message.source);
if (state.error) return state.error;
- if (state.status === "closing")
- return "Microphone off · Finishing last words…";
+ if (state.status === "closing") return text(voiceModeMessages.statusClosing);
if (state.status === "connecting")
return state.microphoneActive
- ? "Connecting transcription…"
- : "Connecting microphone…";
- if (state.status === "error")
- return "Voice input stopped · Exit to review your draft";
+ ? text(voiceModeMessages.statusConnectingTranscription)
+ : text(voiceModeMessages.statusConnectingMicrophone);
+ if (state.status === "error") return text(voiceModeMessages.statusStopped);
if (!state.entered || state.status === "paused")
- return "Microphone off · Draft kept";
- if (state.flushing) return "Finishing this message… You can keep speaking";
- if (state.sending) return "Sending message… You can keep speaking";
- return "Listening · Sends when you finish speaking";
+ return text(voiceModeMessages.statusPaused);
+ if (state.flushing) return text(voiceModeMessages.statusFlushing);
+ if (state.sending) return text(voiceModeMessages.statusSending);
+ return text(voiceModeMessages.statusListening);
}
diff --git a/apps/web/src/features/rooms/chat/voice-mode/voice-mode.messages.ts b/apps/web/src/features/rooms/chat/voice-mode/voice-mode.messages.ts
new file mode 100644
index 00000000..88347275
--- /dev/null
+++ b/apps/web/src/features/rooms/chat/voice-mode/voice-mode.messages.ts
@@ -0,0 +1,36 @@
+import { defineMessages } from "@/i18n/messages";
+
+/** Voice Mode in the composer. */
+export const voiceModeMessages = defineMessages("voiceMode", {
+ // The composer button before Voice Mode starts.
+ start: "Start Voice Mode",
+ finishing: "Finishing Voice Mode",
+ finishingHint: "Finishing last words and releasing the microphone",
+ onInRoom: "Voice Mode is on in {room}",
+ onInAnotherRoom: "Voice Mode is on in another Room",
+ liveHint: "Voice Mode: a live conversation with Grok",
+ dictationHint: "Voice Mode: sends when you finish speaking",
+ keyHint: "Voice Mode: add a Soniox or xAI key to start",
+ unableToStart: "Unable to start Voice Mode",
+
+ // The bar that replaces the composer toolbar while Voice Mode is on.
+ controls: "Voice Mode controls",
+ voiceInput: "Voice input",
+ retry: "Retry voice message",
+ retryHint: "Retry the same voice message",
+ mute: "Mute microphone",
+ unmute: "Unmute microphone",
+ replySoundOn: "Turn reply sound on",
+ replySoundOff: "Turn reply sound off",
+ exit: "Exit Voice Mode",
+
+ // What Voice Mode is doing, read to screen readers.
+ statusClosing: "Microphone off · Finishing last words…",
+ statusConnectingTranscription: "Connecting transcription…",
+ statusConnectingMicrophone: "Connecting microphone…",
+ statusStopped: "Voice input stopped · Exit to review your draft",
+ statusPaused: "Microphone off · Draft kept",
+ statusFlushing: "Finishing this message… You can keep speaking",
+ statusSending: "Sending message… You can keep speaking",
+ statusListening: "Listening · Sends when you finish speaking",
+});
diff --git a/apps/web/src/features/rooms/chat/voice-mode/voice-risk-markers.test.ts b/apps/web/src/features/rooms/chat/voice-mode/voice-risk-markers.test.ts
index 7f829ec9..e7603a72 100644
--- a/apps/web/src/features/rooms/chat/voice-mode/voice-risk-markers.test.ts
+++ b/apps/web/src/features/rooms/chat/voice-mode/voice-risk-markers.test.ts
@@ -39,6 +39,8 @@ const notActions: Record<string, string> = {
"says the Agent of a direct chat was deleted; the link only opens the chat",
"/src/features/rooms/room-secondary-navigation.tsx: roomList.deleted":
"says the Agent of a direct chat was deleted; the link only opens the chat",
+ "/src/features/rooms/chat/voice-mode/voice-mode-controls.tsx: voiceMode.dictationHint":
+ "describes the button that starts Voice Mode, which sends nothing itself",
};
type Need = "confirm" | "never" | "close";
diff --git a/apps/web/src/features/rooms/chat/voice-mode/voice-ui-bridge.test.ts b/apps/web/src/features/rooms/chat/voice-mode/voice-ui-bridge.test.ts
index e32336c4..2948e6df 100644
--- a/apps/web/src/features/rooms/chat/voice-mode/voice-ui-bridge.test.ts
+++ b/apps/web/src/features/rooms/chat/voice-mode/voice-ui-bridge.test.ts
@@ -440,7 +440,7 @@ describe("Voice Mode screen actions", () => {
it("lists named text fields and fills one as typing would, never a password", () => {
document.body.innerHTML = `
<main>
- <textarea aria-label="Message Room">Draft</textarea>
+ <textarea aria-label="Message Room" data-chat-composer>Draft</textarea>
<input type="search" placeholder="Search files" />
<input type="password" aria-label="Password" />
<input aria-label="Read only" readonly />
diff --git a/apps/web/src/features/rooms/chat/voice-mode/voice-ui-bridge.ts b/apps/web/src/features/rooms/chat/voice-mode/voice-ui-bridge.ts
index 379cf68f..b023db92 100644
--- a/apps/web/src/features/rooms/chat/voice-mode/voice-ui-bridge.ts
+++ b/apps/web/src/features/rooms/chat/voice-mode/voice-ui-bridge.ts
@@ -546,7 +546,7 @@ export function voiceTextFields(): VoiceTextField[] {
return fields;
}
-const composer = '[aria-label^="Message "]';
+const composer = "[data-chat-composer]";
/**
* Fills a text field as typing would: the native setter, then an input
diff --git a/apps/web/src/features/rooms/members/use-agent-model-selection.ts b/apps/web/src/features/rooms/members/use-agent-model-selection.ts
index 84dd700e..10b31aef 100644
--- a/apps/web/src/features/rooms/members/use-agent-model-selection.ts
+++ b/apps/web/src/features/rooms/members/use-agent-model-selection.ts
@@ -4,11 +4,15 @@ import { useState } from "react";
import { localComputersQueryOptions } from "@/features/local-computer/local-computer-queries";
import { localModelsQueryOptions } from "@/features/local-models/local-models-queries";
import type { TeamHubClient } from "@/features/teamhub/teamhub-client";
+import { translate, type Translate } from "@/i18n/language";
+import type { Message } from "@/i18n/messages";
import type {
TeamHubAgentReasoningEffort,
TeamHubTenantAgent,
} from "@/features/teamhub/teamhub-types";
+import { composerMessages } from "../chat/composer.messages";
+
interface RuntimeModel {
id: string;
label: string;
@@ -47,18 +51,22 @@ export function useAgentModelSelection(models: readonly RuntimeModel[]) {
};
}
-export function reasoningEffortLabel(value: TeamHubAgentReasoningEffort) {
- return (
- {
- none: "None",
- low: "Low",
- medium: "Medium",
- high: "High",
- xhigh: "Extra high",
- max: "Maximum",
- ultra: "Ultra",
- } satisfies Record<TeamHubAgentReasoningEffort, string>
- )[value];
+export const reasoningEffortMessages = {
+ none: composerMessages.effortNone,
+ low: composerMessages.effortLow,
+ medium: composerMessages.effortMedium,
+ high: composerMessages.effortHigh,
+ xhigh: composerMessages.effortExtraHigh,
+ max: composerMessages.effortMaximum,
+ ultra: composerMessages.effortUltra,
+} satisfies Record<TeamHubAgentReasoningEffort, Message>;
+
+/** The effort's name; a component passes its own `t` to follow the language. */
+export function reasoningEffortLabel(
+ value: TeamHubAgentReasoningEffort,
+ t: Translate = translate,
+) {
+ return t(reasoningEffortMessages[value]);
}
/**
diff --git a/apps/web/src/features/rooms/voice-control/use-composer-microphone.ts b/apps/web/src/features/rooms/voice-control/use-composer-microphone.ts
index 5fc8543f..6c9456ef 100644
--- a/apps/web/src/features/rooms/voice-control/use-composer-microphone.ts
+++ b/apps/web/src/features/rooms/voice-control/use-composer-microphone.ts
@@ -1,5 +1,8 @@
import { useCallback } from "react";
+import { translate } from "@/i18n/language";
+
+import { composerMessages } from "../chat/composer.messages";
import { tryAcquireVoicePublisherLease } from "./voice-publisher-lease";
import type { VoiceControlState } from "./use-voice-control-state";
@@ -27,9 +30,11 @@ export function useComposerMicrophone(
refs.startPromiseRef.current ||
refs.enablePromiseRef.current
)
- throw new Error("Another voice input is using the microphone");
+ throw new Error(translate(composerMessages.microphoneInUse));
if (recording()) {
- throw new Error("Hardware recording is using the microphone");
+ throw new Error(
+ translate(composerMessages.microphoneHardwareRecording),
+ );
}
// Chat dictation has a separate purpose and must not reuse a hardware
// session or re-enable its listener when the dictation lease is released.
@@ -40,11 +45,11 @@ export function useComposerMicrophone(
refs.enablePromiseRef.current ||
recording()
)
- throw new Error("Another voice input is using the microphone");
+ throw new Error(translate(composerMessages.microphoneInUse));
if (!refs.publisherLeaseRef.current) {
const release = await tryAcquireVoicePublisherLease(tenantId);
if (!release)
- throw new Error("The microphone is active in another tab");
+ throw new Error(translate(composerMessages.microphoneOtherTab));
if (
refs.composerLeaseRef.current ||
refs.startPromiseRef.current ||
@@ -52,7 +57,7 @@ export function useComposerMicrophone(
recording()
) {
release();
- throw new Error("Another voice input is using the microphone");
+ throw new Error(translate(composerMessages.microphoneInUse));
}
refs.publisherLeaseRef.current = release;
}
diff --git a/apps/web/src/i18n/locales/zh-CN.glossary.md b/apps/web/src/i18n/locales/zh-CN.glossary.md
index ccffb384..a9d055cc 100644
--- a/apps/web/src/i18n/locales/zh-CN.glossary.md
+++ b/apps/web/src/i18n/locales/zh-CN.glossary.md
@@ -53,7 +53,7 @@ elsewhere.
| Reaction | 表情回应 | |
| Forward | 转发 | |
| Mention | 提及 | `@` stays as it is. |
-| Member | 成员 | |
+| Member, Person, People | 成员 | Also a Human's tag in the mention picker. |
| Owner | 所有者 | |
| Document | 文档 | |
| File | 文件 | |
diff --git a/apps/web/src/i18n/locales/zh-CN.json b/apps/web/src/i18n/locales/zh-CN.json
index 06a23ec5..fd525d42 100644
--- a/apps/web/src/i18n/locales/zh-CN.json
+++ b/apps/web/src/i18n/locales/zh-CN.json
@@ -633,6 +633,119 @@
"noticeApprovedUnknownWithOutcome": "{who}批准了“{title}”,结果未知:{outcome}",
"noticeEnded": "“{title}”已结束"
},
+ "composer": {
+ "messageRoom": "给 Room 发消息",
+ "messageThisRoom": "给这个 Room 发消息",
+ "messagePeer": "给 {name} 发消息",
+ "sendMessage": "发送消息",
+ "lengthCount": "{count} / {limit}",
+ "messageTooLong": "消息不能超过 {limit} 个字符。",
+ "messageNotSent": "消息发送失败",
+ "listSeparator": "、",
+ "artifactContexts": "文档上下文",
+ "openContextVersion": "打开 {filename} 版本 {version}",
+ "contextVersion": "版本 {version} · {room}",
+ "removeContextVersion": "移除 {filename} 版本 {version}",
+ "removeContext": "移除上下文",
+ "composerReferences": "输入框中的引用",
+ "openProfile": "打开 {name} 的个人资料",
+ "openDocument": "打开 {name}",
+ "replyContext": "已选的回复消息",
+ "removeFromReplyContext": "移除 {name} 的消息",
+ "removeReplyContext": "移除回复的消息",
+ "attachFile": "添加附件",
+ "chooseAttachments": "选择消息附件",
+ "pendingAttachments": "待发送的附件",
+ "previewFile": "预览 {name}",
+ "removeFile": "移除 {name}",
+ "uploadingFile": "正在上传 {name}",
+ "uploadingPercent": "已上传 {percent}%",
+ "retryUpload": "重新上传 {name}",
+ "downloadFile": "下载 {name}",
+ "closeImagePreview": "关闭图片预览",
+ "fileError": "{name}:{error}",
+ "uploadFailed": "上传失败。",
+ "attachmentTooLarge": "附件最大 {limit},这个文件有 {size}。",
+ "attachmentLimit": "一次最多添加 {limit} 个文件。",
+ "attachmentCleanupFailed": "附件清理失败。",
+ "attachmentCleanupFailedDetail": "附件清理失败:{detail}",
+ "dropFilesTitle": "松开即可添加到当前消息",
+ "dropFilesLimit": "最多 5 个文件",
+ "mentionPicker": "提及成员或文档",
+ "mentionTabAll": "全部",
+ "mentionTabPeople": "成员",
+ "mentionTabDocs": "文档",
+ "noMatchingResults": "没有匹配的结果",
+ "noMatchingPeople": "没有匹配的成员",
+ "noMatchingDocuments": "没有匹配的文档",
+ "agent": "Agent",
+ "person": "成员",
+ "doc": "文档",
+ "updatedRecently": "最近更新",
+ "updatedToday": "更新于今天 {time}",
+ "updatedYesterday": "更新于昨天 {time}",
+ "updatedDaysAgo": "更新于 {days} 天前 {time}",
+ "updatedOn": "更新于 {date} {time}",
+ "skill": "Skill",
+ "skillToken": "Skill {token}",
+ "skillsFor": "{name} 的 Skill",
+ "skillsForAgent": "<agent>{name}</agent> 的 Skill",
+ "noMatchingSkills": "{name} 没有匹配的 Skill",
+ "selectedSkillDescription": "所选 Skill 的说明",
+ "selectSkill": "选择一个 Skill。",
+ "noDescription": "暂无说明。",
+ "documentFallbackName": "文档",
+ "documentCannotBeShared": "无法在这个 Room 中分享这个文档。",
+ "documentShareFailed": "无法在这个 Room 中分享这个文档。请检查你的访问权限后重试。",
+ "documentLinkLoading": "文档链接还在加载。",
+ "documentReferencesUnavailable": "这个对话中无法引用文档。",
+ "documentsOutsideRoomFailed": "无法加载这个 Room 之外的文档。",
+ "referencesLoadingRetry": "消息中的引用还在加载,请稍后重试。",
+ "referencesLoadingReview": "消息中的引用还在加载。请退出语音模式检查草稿。",
+ "unavailableMentionsRemove": {
+ "other": "{names} 在这个 Room 中不可用。移除提及后即可发送。"
+ },
+ "unavailableMentionsReview": {
+ "other": "{names} 在这个 Room 中不可用。请退出语音模式检查草稿。"
+ },
+ "effortNone": "无",
+ "effortLow": "低",
+ "effortMedium": "中",
+ "effortHigh": "高",
+ "effortExtraHigh": "超高",
+ "effortMaximum": "最高",
+ "effortUltra": "极限",
+ "loadingSettings": "正在加载设置…",
+ "agentsUnavailable": "你的 Agent 暂时不可用",
+ "localAgentStatusUnavailable": "无法获取本地 Agent 的状态。你仍然可以发送消息,回复可能会延迟。",
+ "agentStatusUnavailable": "无法获取 Agent 的状态。消息暂时只能查看。",
+ "agentDeleted": "这个 Agent 已被删除。消息和运行记录仍可查看。",
+ "lastConfirmedAt": "上次确认时间:{time}",
+ "reconnectingLocalComputer": "正在重新连接本地电脑…",
+ "checkingLocalComputer": "正在检查本地电脑状态…",
+ "keepSending": "你可以继续发送消息。",
+ "agentUnavailable": "Agent 不可用",
+ "checkLocalRuntime": "请检查本地电脑上的 Runtime,然后重试。",
+ "agentCannotReply": "你仍然可以发送消息。Runtime 恢复之前,这个 Agent 无法回复。",
+ "dismissAgentAvatar": "隐藏 {name} 的头像",
+ "outboxRestoreFailed": "无法从浏览器存储中恢复已保存的消息。请重新加载页面,或检查浏览器存储后再发送。",
+ "outboxRestoreFailedDetail": "无法从浏览器存储中恢复已保存的消息({detail})。请重新加载页面,或检查浏览器存储后再发送。",
+ "outboxNormalizationFailed": "已恢复保存的消息,但未能更新它们中断的发送状态。这些消息在当前标签页中仍可使用;请检查浏览器存储后重试。",
+ "outboxNormalizationFailedDetail": "已恢复保存的消息,但未能更新它们中断的发送状态({detail})。这些消息在当前标签页中仍可使用;请检查浏览器存储后重试。",
+ "outboxCleanupFailed": "这条消息已发送,但未能清除本地的重试记录。请重试以完成核对。",
+ "outboxCleanupFailedDetail": "这条消息已发送,但未能清除本地的重试记录({detail})。请重试以完成核对。",
+ "outboxCancelFailed": "已取消发送,但未能清除本地的重试记录。请再取消一次。",
+ "outboxCancelFailedDetail": "已取消发送,但未能清除本地的重试记录({detail})。请再取消一次。",
+ "deliveryMayHaveReached": "消息可能已经送达 TeamHub。请重试,重试会使用同一个幂等键核对结果,不会重复发送。",
+ "deliveryUnconfirmed": "TeamHub 未确认这条消息是否已提交。重试会核对同一次发送。",
+ "deliveryInterrupted": "发送被中断。请重试以确认这条消息是否已发送。",
+ "saveLocallyStorageFull": "浏览器存储已满,这条消息无法保存到本地。请清理存储空间后重试。",
+ "saveLocallyFailed": "这条消息无法保存到本地。请检查浏览器存储后重试。",
+ "saveLocallyFailedDetail": "这条消息无法保存到本地:{detail}",
+ "microphoneInUse": "另一个语音输入正在使用麦克风",
+ "microphoneHardwareRecording": "硬件录音正在使用麦克风",
+ "microphoneOtherTab": "麦克风正在另一个标签页中使用"
+ },
"runtimeStatus": {
"stateCanceled": "已取消",
"stateCompleted": "已完成",
@@ -765,5 +878,33 @@
"failureCleanupUnconfirmed": "无法确认 Runtime 进程已停止。请先检查 Local Computer,再开始新的运行。",
"failureResponseTooLarge": "Agent 的回复超出了一条 Room 消息的容量。请让它回答得短一些,或把结果做成文件。",
"failureUnclassified": "运行因系统无法识别的错误而停止。请重试;如果再次出现,请把发生时间告诉管理员。"
+ },
+ "voiceMode": {
+ "start": "开启语音模式",
+ "finishing": "正在结束语音模式",
+ "finishingHint": "正在处理最后几句话并释放麦克风",
+ "onInRoom": "语音模式正在“{room}”中使用",
+ "onInAnotherRoom": "语音模式正在另一个 Room 中使用",
+ "liveHint": "语音模式:与 Grok 实时对话",
+ "dictationHint": "语音模式:说完后自动发送",
+ "keyHint": "语音模式:添加 Soniox 或 xAI 密钥后即可使用",
+ "unableToStart": "无法开启语音模式",
+ "controls": "语音模式控制",
+ "voiceInput": "语音输入",
+ "retry": "重试语音消息",
+ "retryHint": "重试同一条语音消息",
+ "mute": "将麦克风静音",
+ "unmute": "取消麦克风静音",
+ "replySoundOn": "取消回复声音静音",
+ "replySoundOff": "将回复声音静音",
+ "exit": "退出语音模式",
+ "statusClosing": "麦克风已关闭 · 正在处理最后几句话…",
+ "statusConnectingTranscription": "正在连接转写服务…",
+ "statusConnectingMicrophone": "正在连接麦克风…",
+ "statusStopped": "语音输入已停止 · 退出后可检查草稿",
+ "statusPaused": "麦克风已关闭 · 草稿已保留",
+ "statusFlushing": "正在完成这条消息,你可以继续说话",
+ "statusSending": "正在发送消息,你可以继续说话",
+ "statusListening": "正在聆听 · 说完后自动发送"
}
}