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 chat area

Kilyn563a95a96dcf
diff --git a/apps/web/src/features/rooms/cards/agent-change-fields.tsx b/apps/web/src/features/rooms/cards/agent-change-fields.tsx
index 832d793f..f31af7d8 100644
--- a/apps/web/src/features/rooms/cards/agent-change-fields.tsx
+++ b/apps/web/src/features/rooms/cards/agent-change-fields.tsx
@@ -2,6 +2,10 @@ import { ArrowRight01Icon } from "@hugeicons/core-free-icons";
import { Fragment } from "react";
import { Icon } from "@/components/ui/icon";
+import type { Message } from "@/i18n/messages";
+import { useT } from "@/i18n/use-translation";
+
+import { cardsMessages } from "./cards.messages";
export interface AgentFieldChange {
field: "name" | "description" | "prompt";
@@ -9,10 +13,10 @@ export interface AgentFieldChange {
after: string;
}
-const fieldLabel: Record<AgentFieldChange["field"], string> = {
- description: "Description",
- name: "Name",
- prompt: "Instructions",
+const fieldLabel: Record<AgentFieldChange["field"], Message<string>> = {
+ description: cardsMessages.fieldDescription,
+ name: cardsMessages.fieldName,
+ prompt: cardsMessages.instructions,
};
/** The name and description: the current value, then the new one. Shared by
@@ -22,16 +26,17 @@ export function AgentChangeFields({
}: {
changes: readonly AgentFieldChange[];
}) {
+ const t = useT();
return (
<dl className="grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-1.5 rounded-lg border border-app-border bg-app-surface px-3 py-2 text-xs leading-5">
{changes.map((change) => (
<Fragment key={change.field}>
- <dt className="text-app-muted">{fieldLabel[change.field]}</dt>
+ <dt className="text-app-muted">{t(fieldLabel[change.field])}</dt>
<dd className="flex min-w-0 flex-wrap items-center gap-x-1.5 text-app-ink">
{change.before === undefined ? null : (
<>
<del className="whitespace-pre-wrap [overflow-wrap:anywhere] text-app-muted">
- {change.before || "None"}
+ {change.before || t(cardsMessages.none)}
</del>
<Icon
className="shrink-0 text-app-muted"
diff --git a/apps/web/src/features/rooms/cards/approval-card-parts.tsx b/apps/web/src/features/rooms/cards/approval-card-parts.tsx
index e617f018..8c027f49 100644
--- a/apps/web/src/features/rooms/cards/approval-card-parts.tsx
+++ b/apps/web/src/features/rooms/cards/approval-card-parts.tsx
@@ -11,8 +11,12 @@ import { flushSync } from "react-dom";
import { AutoHeight } from "@/components/ui/auto-height";
import { Button } from "@/components/ui/button";
import { Icon } from "@/components/ui/icon";
+import type { VoiceRisk } from "@/features/rooms/chat/voice-mode/voice-ui-bridge";
+import { useT } from "@/i18n/use-translation";
import { cn } from "@/lib/cn";
+import { cardsMessages } from "./cards.messages";
+
/**
* One row in a card's box: a 32px muted icon square, one truncated line and
* an optional 12px second line. With `onToggle` the row is a button that
@@ -130,32 +134,43 @@ const subtleControl =
* denies.
*/
export function DecisionActions({
- approveLabel = "Approve",
- denyLabel = "Deny",
+ approveLabel: approveText,
+ approveRisk = approveText === undefined ? "confirm" : undefined,
+ denyLabel: denyText,
+ denyRisk = denyText === undefined ? "confirm" : undefined,
disabled,
onApprove,
onDeny,
reasonRequired = false,
}: {
approveLabel?: string;
+ /** What Voice Mode risks by approving, as on `data-voice-risk`. */
+ approveRisk?: VoiceRisk;
denyLabel?: string;
+ /** What Voice Mode risks by denying, as on `data-voice-risk`. */
+ denyRisk?: VoiceRisk;
disabled: boolean;
onApprove: () => void;
onDeny: (reason?: string) => void;
reasonRequired?: boolean;
}) {
+ const t = useT();
+ const approveLabel = approveText ?? t(cardsMessages.approve);
+ const denyLabel = denyText ?? t(cardsMessages.deny);
const [composing, setComposing] = useState(false);
const [draft, setDraft] = useState("");
const inputRef = useRef<HTMLInputElement>(null);
const toggleRef = useRef<HTMLButtonElement>(null);
const hasDraft = draft.trim() !== "";
- const toggleLabel = composing
- ? reasonRequired
- ? "Close the reason"
- : "Deny without a reason"
- : hasDraft
- ? "Continue your reason"
- : "Add a reason";
+ const toggleLabel = t(
+ composing
+ ? reasonRequired
+ ? cardsMessages.closeReason
+ : cardsMessages.denyWithoutReason
+ : hasDraft
+ ? cardsMessages.continueReason
+ : cardsMessages.addReason,
+ );
function deny(reason?: string) {
if (reasonRequired && !reason) {
@@ -188,7 +203,7 @@ export function DecisionActions({
return (
<div
- aria-label="Approval actions"
+ aria-label={t(cardsMessages.approvalActions)}
className={cn(
"grid w-full gap-2 transition-[grid-template-columns] duration-[var(--app-emphasized-duration)] ease-[var(--app-out-quint)] motion-reduce:transition-none",
composing
@@ -200,6 +215,7 @@ export function DecisionActions({
<Button
aria-label={approveLabel}
className="group/tip w-full"
+ data-voice-risk={approveRisk}
disabled={disabled}
onClick={onApprove}
size={composing ? "icon" : "large"}
@@ -233,6 +249,7 @@ export function DecisionActions({
"inline-flex h-9 w-full items-center justify-center whitespace-nowrap rounded-l-lg px-4 text-sm font-medium text-secondary-foreground",
subtleControl,
)}
+ data-voice-risk={denyRisk}
disabled={disabled}
onClick={() => deny()}
type="button"
@@ -249,17 +266,18 @@ export function DecisionActions({
inert={!composing}
>
<input
- aria-label="Reason for denying"
+ aria-label={t(cardsMessages.denyReasonLabel)}
className="h-full w-0 min-w-0 flex-1 bg-transparent text-sm text-foreground outline-none placeholder:text-app-placeholder"
disabled={disabled}
onChange={(event) => setDraft(event.target.value)}
onKeyDown={onReasonKeyDown}
- placeholder="Reason, then press Enter"
+ placeholder={t(cardsMessages.denyReasonPlaceholder)}
ref={inputRef}
value={draft}
/>
<button
- aria-label="Deny with this reason"
+ aria-label={t(cardsMessages.denyWithReason)}
+ data-voice-risk="confirm"
className="inline-flex size-7 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground hover:opacity-90 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-app-focus disabled:opacity-45"
disabled={disabled || (reasonRequired && !hasDraft)}
onClick={() => deny(draft.trim())}
@@ -272,6 +290,8 @@ export function DecisionActions({
<button
aria-label={toggleLabel}
aria-pressed={composing}
+ data-voice-close={composing && reasonRequired ? "" : undefined}
+ data-voice-risk={composing && !reasonRequired ? "confirm" : undefined}
className={cn(
"group/tip relative inline-flex size-9 shrink-0 items-center justify-center rounded-r-lg",
subtleControl,
@@ -348,8 +368,9 @@ export function FullCallBlock({
input: string;
tool: string;
}) {
+ const t = useT();
return (
- <DetailBlock label={<>Full call · {tool}</>}>
+ <DetailBlock label={t(cardsMessages.fullCall, { tool })}>
<pre className="max-h-64 overflow-auto px-3 py-2 font-mono text-xs leading-5 text-app-ink">
{formatInput(input)}
</pre>
diff --git a/apps/web/src/features/rooms/cards/card-notice.ts b/apps/web/src/features/rooms/cards/card-notice.ts
index d69531af..4083fdea 100644
--- a/apps/web/src/features/rooms/cards/card-notice.ts
+++ b/apps/web/src/features/rooms/cards/card-notice.ts
@@ -1,6 +1,15 @@
import type { TeamHubMessageCard } from "@/features/teamhub/teamhub-types";
import { webSearchBackendName } from "@/features/web-search/web-search-backends";
+import { commonMessages } from "@/i18n/common.messages";
+import type { Translate, Translation } from "@/i18n/language";
+import {
+ formatMessageParts,
+ type Message,
+ type MessageArguments,
+ type MessagePart,
+} from "@/i18n/messages";
+import { cardsMessages } from "./cards.messages";
import { connectedAppDisplayName } from "./connected-app-names";
/**
@@ -8,13 +17,20 @@ import { connectedAppDisplayName } from "./connected-app-names";
* one centered system line, the way Room notices do: who did what to what.
* The object links to where the result lives. A card still waiting or still
* running returns null and stays a card.
+ *
+ * The notice holds the card and its reader, not text: `cardNoticeLines`
+ * writes the lines in the language on screen.
*/
export interface CardNotice {
- text: string;
- /** The object in the line, linked to where the result lives. */
- link?: { label: string; to: NoticeTarget };
- /** Further lines, one per answer after the first on a question card. */
- more?: string[];
+ card: TeamHubMessageCard;
+ viewerId: string | undefined;
+}
+
+/** One system line: its text, cut where the `link` span sits. */
+export interface CardNoticeLine {
+ parts: readonly MessagePart[];
+ /** Where the line's `link` span goes: where the result lives. */
+ link?: NoticeTarget;
}
export type NoticeTarget = { room: string } | "apps";
@@ -37,88 +53,132 @@ export function settledCardNotice(
const finishedApproval =
card.kind === "runtime_permission" && card.status === "approved";
if (runningStatuses.has(card.status) && !finishedApproval) return null;
+ return { card, viewerId };
+}
- const who =
- card.decided_by && card.decided_by.id === viewerId
- ? "You"
- : (card.decided_by?.display_name ?? "Someone");
- const title = `“${card.title}”`;
+/**
+ * The lines of a settled card: the main line, then one per answer after the
+ * first on a question card.
+ */
+export function cardNoticeLines(
+ { card, viewerId }: CardNotice,
+ translation: Translation,
+): CardNoticeLine[] {
+ const { t } = translation;
+ const line = <M extends Message>(
+ message: M,
+ ...values: MessageArguments<M["source"]>
+ ): CardNoticeLine => ({
+ parts: formatMessageParts(
+ message,
+ translation.language,
+ translation.catalog,
+ values[0],
+ ),
+ });
+
+ const who = !card.decided_by
+ ? t(cardsMessages.noticeSomeone)
+ : card.decided_by.id === viewerId
+ ? t(commonMessages.you)
+ : t(cardsMessages.noticeActor, { name: card.decided_by.display_name });
+ const title = card.title;
const reason = card.answer?.comment?.trim();
const outcome = card.outcome?.trim();
- const withOutcome = outcome ? `: ${outcome}` : "";
if (card.kind === "question") {
if (card.status !== "answered") {
- return { text: `No one answered ${title} in time` };
+ return [line(cardsMessages.noticeUnanswered, { title })];
}
const given = card.answer?.answers ?? {};
- const lines = (card.question?.questions ?? []).map(
- (question) =>
- `${who} answered “${question.prompt}” with “${answerLabels(question, given[question.id]) || "No answer"}”`,
+ const lines = (card.question?.questions ?? []).map((question) =>
+ line(cardsMessages.noticeAnswered, {
+ answer:
+ answerLabels(question, given[question.id], t) ||
+ t(cardsMessages.noAnswer),
+ question: question.prompt,
+ who,
+ }),
);
- if (reason) lines.push(`${who} added “${reason}”`);
- return { text: lines[0] ?? "", more: lines.slice(1) };
+ if (reason)
+ lines.push(line(cardsMessages.noticeAddedNote, { note: reason, who }));
+ return lines.length ? lines : [{ parts: [] }];
}
if (card.status === "expired") {
- return { text: `${title} expired` };
+ return [line(cardsMessages.noticeExpired, { title })];
}
if (card.status === "denied") {
- return {
- text: `${who} declined ${title}${reason ? `: “${reason}”` : ""}`,
- };
+ return [
+ reason
+ ? line(cardsMessages.noticeDeclinedWithReason, { reason, title, who })
+ : line(cardsMessages.noticeDeclined, { title, who }),
+ ];
}
switch (card.kind) {
case "runtime_permission":
- return {
- text:
- card.status === "consumed"
- ? `${who} allowed ${title} once, and it ran`
- : `${who} allowed ${title} once`,
- };
+ return [
+ card.status === "consumed"
+ ? line(cardsMessages.noticeAllowedOnceRan, { title, who })
+ : line(cardsMessages.noticeAllowedOnce, { title, who }),
+ ];
case "browser_connection":
- return { text: `${who} connected Chrome` };
+ return [line(cardsMessages.noticeConnectedChrome, { who })];
case "provider_key":
- return { text: `${who} added the Composio API key` };
+ return [line(cardsMessages.noticeAddedComposioKey, { who })];
case "search_key": {
const shown = card.search_key?.backend;
const saved = card.answer?.backend ?? shown;
if (!saved) break;
- const added = `${who} added a ${webSearchBackendName(saved)} key`;
- return {
- text:
- shown && saved !== shown
- ? `${added} instead of ${webSearchBackendName(shown)}`
- : added,
- };
+ const backend = webSearchBackendName(saved);
+ return [
+ shown && saved !== shown
+ ? line(cardsMessages.noticeAddedSearchKeyInstead, {
+ backend,
+ requested: webSearchBackendName(shown),
+ who,
+ })
+ : line(cardsMessages.noticeAddedSearchKey, { backend, who }),
+ ];
}
case "connection_auth": {
- const app = connectedAppDisplayName(card.connection_auth?.app_key);
- return card.status === "succeeded"
- ? {
- text: `${who} connected `,
- link: { label: app, to: "apps" },
- }
- : { text: `${title} did not finish${withOutcome}` };
+ if (card.status === "succeeded") {
+ const app = connectedAppDisplayName(card.connection_auth?.app_key);
+ return [
+ {
+ ...line(cardsMessages.noticeConnectedApp, { app, who }),
+ link: "apps",
+ },
+ ];
+ }
+ return [
+ outcome
+ ? line(cardsMessages.noticeDidNotFinishWithOutcome, {
+ outcome,
+ title,
+ })
+ : line(cardsMessages.noticeDidNotFinish, { title }),
+ ];
}
case "computer_permission":
- return { text: `${who} granted ${title}` };
+ return [line(cardsMessages.noticeGranted, { title, who })];
case "profile_setup_apps":
case "profile_setup_sources":
- return {
- text:
- card.answer?.decision === "skipped"
- ? `${who} skipped ${title}`
- : `${who} completed ${title}`,
- };
+ return [
+ card.answer?.decision === "skipped"
+ ? line(cardsMessages.noticeSkipped, { title, who })
+ : line(cardsMessages.noticeCompleted, { title, who }),
+ ];
case "room_creation": {
const room = card.room_creation;
if (card.status === "succeeded" && room?.created_room_id) {
- return {
- text: `${who} created Room `,
- link: { label: room.name, to: { room: room.created_room_id } },
- };
+ return [
+ {
+ ...line(cardsMessages.noticeCreatedRoom, { room: room.name, who }),
+ link: { room: room.created_room_id },
+ },
+ ];
}
break;
}
@@ -128,29 +188,42 @@ export function settledCardNotice(
// Connector writes, Agent changes and Room creations TeamHub ran.
if (card.status === "succeeded") {
- return { text: `${who} approved ${title}` };
+ return [line(cardsMessages.noticeApproved, { title, who })];
}
if (card.status === "failed") {
- return {
- text: `${who} approved ${title}, but it failed${withOutcome}`,
- };
+ return [
+ outcome
+ ? line(cardsMessages.noticeApprovedFailedWithOutcome, {
+ outcome,
+ title,
+ who,
+ })
+ : line(cardsMessages.noticeApprovedFailed, { title, who }),
+ ];
}
if (card.status === "unknown") {
- return {
- text: `${who} approved ${title}; the result is unknown${withOutcome}`,
- };
+ return [
+ outcome
+ ? line(cardsMessages.noticeApprovedUnknownWithOutcome, {
+ outcome,
+ title,
+ who,
+ })
+ : line(cardsMessages.noticeApprovedUnknown, { title, who }),
+ ];
}
- return { text: `${title} ended` };
+ return [line(cardsMessages.noticeEnded, { title })];
}
function answerLabels(
question: Question,
value: string | string[] | undefined,
+ t: Translate,
): string {
const chosen = Array.isArray(value) ? value : value ? [value] : [];
return chosen
.map(
(id) => question.options?.find((option) => option.id === id)?.label ?? id,
)
- .join(", ");
+ .join(t(cardsMessages.listSeparator));
}
diff --git a/apps/web/src/features/rooms/cards/cards.messages.ts b/apps/web/src/features/rooms/cards/cards.messages.ts
new file mode 100644
index 00000000..0b525c91
--- /dev/null
+++ b/apps/web/src/features/rooms/cards/cards.messages.ts
@@ -0,0 +1,266 @@
+import { defineMessages } from "@/i18n/messages";
+
+/**
+ * The cards in the chat: what the client writes around a request (buttons,
+ * status lines, fixed headings, hints, errors) and the system line a settled
+ * card becomes. Titles, questions, options and bodies come with the card.
+ */
+export const cardsMessages = defineMessages("cards", {
+ // Shared by several cards.
+ cardDecisionFailed: "Card decision failed.",
+ cardUpdateFailed: "The card could not be updated.",
+ decisionMismatch:
+ "Card decision response does not match the active Room command.",
+ expired: "Expired",
+ connected: "Connected",
+ notConnected: "Not connected",
+ connect: "Connect",
+ connectApp: "Connect {name}",
+ notNow: "Not now",
+ none: "None",
+ listSeparator: ", ",
+ granted: "Granted",
+ dontAllow: "Don't allow",
+ notAllowed: "Not allowed",
+ instructions: "Instructions",
+ send: "Send",
+
+ // Approve or deny, with a reason.
+ approve: "Approve",
+ deny: "Deny",
+ approvalActions: "Approval actions",
+ closeReason: "Close the reason",
+ denyWithoutReason: "Deny without a reason",
+ continueReason: "Continue your reason",
+ addReason: "Add a reason",
+ denyReasonLabel: "Reason for denying",
+ denyReasonPlaceholder: "Reason, then press Enter",
+ denyWithReason: "Deny with this reason",
+ fullCall: "Full call · {tool}",
+
+ // The approval card: its label, its words and how it ended.
+ labelPermissionRequest: "Permission request",
+ labelRoomCreation: "Room creation",
+ labelConfirmationRequest: "Confirmation request",
+ createRoom: "Create Room",
+ create: "Create",
+ created: "Created",
+ dontCreate: "Don't create",
+ notCreated: "Not created",
+ creating: "Creating…",
+ apply: "Apply",
+ applied: "Applied",
+ dontApply: "Don't apply",
+ notApplied: "Not applied",
+ applying: "Applying…",
+ allowOnce: "Allow once",
+ allowedOnce: "Allowed once",
+ running: "Running…",
+ sent: "Sent",
+ dontSend: "Don't send",
+ notSent: "Not sent",
+ sending: "Sending…",
+ done: "Done",
+ denied: "Denied",
+ approvedUntil: "{approved} until {time}",
+ approvedUsed: "{approved} · Used",
+ failed: "Failed",
+ failedWithOutcome: "Failed: {outcome}",
+ resultUnknown: "Result unknown",
+ resultUnknownWithOutcome: "Result unknown: {outcome}",
+ deniedWithReason: "{denied} · “{reason}”",
+ agentFieldDescription: "description",
+ agentFieldName: "name",
+ agentFieldInstructions: "instructions",
+ newAgent: "New Agent {name}",
+ changeAgent: "Change {name}",
+ newRoom: "New Room {name}",
+ memberCount: { one: "{count} member", other: "{count} members" },
+ memberCountWithNames: {
+ one: "{count} member · {names}",
+ other: "{count} members · {names}",
+ },
+
+ // An Agent change.
+ fieldDescription: "Description",
+ fieldName: "Name",
+ newInstructions: "New instructions",
+ currentInstructions: "Current instructions",
+ showLess: "Show less",
+ showFullInstructions: "Show full instructions",
+
+ // A Room creation and its first message.
+ membersLine: "<label>Members: </label>{names}",
+ openRoom: "Open Room",
+ initialTaskInput: "Initial task input",
+ referenceTarget: "Reference target: {name} ({type})",
+ spaceMember: "Space member",
+ fileSegment: "File: {name}",
+ meetingSummary: "Meeting summary",
+ documentSegment: "Document: {name}",
+ artifactDirectory: "Artifact directory: {path}",
+ skillSegment: "Skill: {name}",
+
+ // A Runtime permission.
+ screenshotUnavailable: "The screenshot is no longer available.",
+ screenshotOwnerOnly: "Only {name} can see the screenshot.",
+ screenshotAlt: "The screen before this action, with its target marked",
+ screenshotCaption: "Before the action · the target is marked",
+ diffLabel: "Diff · +{added} −{removed}",
+ scriptLabel: "Script · {path}",
+ scriptLabelWithHash: "Script · {path} · sha256 {hash}",
+ pageElement: "Page element",
+ pageUrl: "Page",
+ pageTitle: "Title",
+ pageTarget: "Element",
+
+ // A connected app write.
+ noSubject: "No subject",
+ emailToLine: "To {recipients}",
+ emailFrom: "From",
+ emailTo: "To",
+ emailCc: "Cc",
+ emailBcc: "Bcc",
+ emailSubject: "Subject",
+ messageWhere: "Where",
+ messagePreview: "Message preview",
+ noMessageText: "No message text.",
+ attachments: "Attachments",
+ messageBody: "Message body",
+
+ // A question.
+ labelHumanInteraction: "Human interaction requested",
+ previousQuestion: "Previous question",
+ nextQuestion: "Next question",
+ chooseAny: "Choose any",
+ next: "Next",
+ other: "Other…",
+ ownAnswerTo: "Your own answer to {question}",
+ ownAnswer: "Your own answer",
+
+ // The Another Me setup cards.
+ labelAnotherMeSetup: "AnotherMe setup",
+ linkCount: { one: "{count} link", other: "{count} links" },
+ fileCount: { one: "{count} file", other: "{count} files" },
+ sharedItems: "Shared {items}",
+ sharedLinksAndFiles: "Shared {links} and {files}",
+ nothingShared: "Nothing shared",
+ skipped: "Skipped",
+ sharedSources: "Shared sources",
+ fileNoLongerAvailable:
+ "A file is no longer available. Remove it and upload it again.",
+ replyConnected: "Connected",
+ skipForNow: "Skip for now",
+ connectYourApps: "Connect your apps",
+ more: "More",
+ verifyingConnection: "Verifying connection…",
+ continueConnecting: "Continue",
+ notAvailableYet: "Not available yet",
+ linkInvalid: "Enter a full link that starts with http:// or https://.",
+ linkAlreadyAdded: "That link is already added.",
+ linkLimit: "You can add up to {max} links.",
+ uploadFailed: "Upload failed.",
+ fileLimit: "You can upload up to {max} files.",
+ thatsAll: "That's all",
+ skip: "Skip",
+ websiteOrFiles: "Website or files",
+ uploadedSize: "Uploaded · {size}",
+ removeItem: "Remove {name}",
+ pasteLink: "Paste a link",
+ addLink: "Add link",
+ uploadFiles: "Upload files",
+ sourcesAddedHint: "Added here. Select That's all to share with Another Me.",
+ sourcesEmptyHint:
+ "Add a link or upload a file, then select That's all to share.",
+ added: "Added",
+
+ // A connection authorization.
+ labelAppAuthorization: "App authorization requested",
+ requestedAccount: "Requested account: {account}",
+ authorizing: "Authorizing…",
+ signInFailed: "Failed: the sign-in did not complete",
+ appUnavailableForAgents: "This app is unavailable for Agent access.",
+ authorizationNotStarted: "Authorization could not be started.",
+ authorizationNotCancelled: "Authorization could not be cancelled.",
+ openAuthorizationWindow: "Open authorization window",
+ popupBlocked:
+ "Your browser blocked the authorization popup. Allow popups and try again.",
+ allowAgent: "Allow {name}",
+ allow: "Allow",
+ accountsNotLoaded: "Accounts could not be loaded.",
+ appAccount: "{app} account",
+ accountPending: "{account} (pending)",
+ accountNeedsReconnecting: "{account} (needs reconnecting)",
+ connectNewAccount: "Connect a new account",
+
+ // A Composio API key request.
+ labelComposioKey: "Composio API key requested",
+ neededToConnect: "Needed to connect {app}",
+ everyAppNeedsIt: "Every connected app needs it",
+ composioApiKey: "Composio API key",
+ addKey: "Add key",
+ continuesOnceKeySaved: "{agent} continues once the key is saved.",
+ addComposioKeyTitle: "Add a Composio API key",
+ keyAdded: "Key added",
+ noKeyAdded: "No key added",
+ notCompleted: "Not completed",
+
+ // A browser connection.
+ labelBrowserConnection: "Browser connection requested",
+ everydayChrome: "Everyday Chrome",
+ continuesOnceConnected: "{agent} continues once you connect.",
+ browserConnectionFailed: "Failed: the connection did not complete",
+
+ // A system permission of a Computer.
+ labelSystemPermission: "System permission requested",
+ subjectComputerUse: "Computer use (CuaDriver)",
+ permissionAccessibility: "Accessibility",
+ permissionScreenRecording: "Screen Recording",
+ stateNotRequested: "Not requested yet",
+ stateUnknown: "Unknown",
+ declined: "Declined",
+ relaunchLinger: "Relaunch Linger",
+ request: "Request",
+ openSettings: "Open Settings",
+ stepDidNotRun: "The step did not run.",
+ permissionsUnreadable: "The Mac's permissions could not be read.",
+ relaunchToApply: "Relaunch Linger to apply",
+ openLingerOnThatMac: "Open Linger on that Mac to grant these permissions.",
+ opensOn: "Opens on {name}",
+ opensOnThatMac: "Opens on that Mac",
+
+ // The system line of a settled card. `{who}` is "You", "Someone" or
+ // `noticeActor`; a translation that needs a space after a name puts it in
+ // `noticeActor`.
+ noticeActor: "{name}",
+ noticeSomeone: "Someone",
+ noAnswer: "No answer",
+ noticeUnanswered: "No one answered “{title}” in time",
+ noticeAnswered: "{who} answered “{question}” with “{answer}”",
+ noticeAddedNote: "{who} added “{note}”",
+ noticeExpired: "“{title}” expired",
+ noticeDeclined: "{who} declined “{title}”",
+ noticeDeclinedWithReason: "{who} declined “{title}”: “{reason}”",
+ noticeAllowedOnce: "{who} allowed “{title}” once",
+ noticeAllowedOnceRan: "{who} allowed “{title}” once, and it ran",
+ noticeConnectedChrome: "{who} connected Chrome",
+ noticeAddedComposioKey: "{who} added the Composio API key",
+ noticeAddedSearchKey: "{who} added a {backend} key",
+ noticeAddedSearchKeyInstead:
+ "{who} added a {backend} key instead of {requested}",
+ noticeConnectedApp: "{who} connected <link>{app}</link>",
+ noticeDidNotFinish: "“{title}” did not finish",
+ noticeDidNotFinishWithOutcome: "“{title}” did not finish: {outcome}",
+ noticeGranted: "{who} granted “{title}”",
+ noticeSkipped: "{who} skipped “{title}”",
+ noticeCompleted: "{who} completed “{title}”",
+ noticeCreatedRoom: "{who} created Room <link>{room}</link>",
+ noticeApproved: "{who} approved “{title}”",
+ noticeApprovedFailed: "{who} approved “{title}”, but it failed",
+ noticeApprovedFailedWithOutcome:
+ "{who} approved “{title}”, but it failed: {outcome}",
+ noticeApprovedUnknown: "{who} approved “{title}”; the result is unknown",
+ noticeApprovedUnknownWithOutcome:
+ "{who} approved “{title}”; the result is unknown: {outcome}",
+ noticeEnded: "“{title}” ended",
+});
diff --git a/apps/web/src/features/rooms/cards/creation-message-preview.tsx b/apps/web/src/features/rooms/cards/creation-message-preview.tsx
index ea659fda..b856c7dc 100644
--- a/apps/web/src/features/rooms/cards/creation-message-preview.tsx
+++ b/apps/web/src/features/rooms/cards/creation-message-preview.tsx
@@ -1,4 +1,7 @@
import type { TeamHubMessageSegment } from "@/features/teamhub/teamhub-types";
+import { useT } from "@/i18n/use-translation";
+
+import { cardsMessages } from "./cards.messages";
const emptyActorDisplayNames: Readonly<Record<string, string>> = {};
const taskOutputRequirementsPrefix = "[Task output requirements v1]";
@@ -56,6 +59,7 @@ export function CreationMessagePreview({
actorDisplayNames?: Readonly<Record<string, string>>;
segments: readonly TeamHubMessageSegment[];
}) {
+ const t = useT();
const occurrences = new Map<string, number>();
const structuredSegments = segments.flatMap((segment) => {
if (segment.type === "text") {
@@ -77,7 +81,9 @@ export function CreationMessagePreview({
return (
<div>
- <p className="font-medium text-app-body">Initial task input</p>
+ <p className="font-medium text-app-body">
+ {t(cardsMessages.initialTaskInput)}
+ </p>
<p className="mt-1 whitespace-pre-wrap border-l-2 border-app-border pl-2.5 [overflow-wrap:anywhere] text-sm leading-5 text-app-body">
{visibleContent}
</p>
@@ -90,22 +96,35 @@ export function CreationMessagePreview({
>
{segment.type === "reference" ? (
<span>
- Reference target:{" "}
- {actorDisplayNames[segment.target] ?? "Space member"} (
- {segment.target_type})
+ {t(cardsMessages.referenceTarget, {
+ name:
+ actorDisplayNames[segment.target] ??
+ t(cardsMessages.spaceMember),
+ type: segment.target_type,
+ })}
</span>
) : segment.type === "file" ? (
- <span>File: {segment.content}</span>
+ <span>
+ {t(cardsMessages.fileSegment, { name: segment.content })}
+ </span>
) : segment.type === "html_fragment" ? (
<span>{segment.content}</span>
) : segment.type === "meeting_notes" ? (
- <span>Meeting summary</span>
+ <span>{t(cardsMessages.meetingSummary)}</span>
) : segment.type === "document" ? (
- <span>Document: {segment.content}</span>
+ <span>
+ {t(cardsMessages.documentSegment, { name: segment.content })}
+ </span>
) : segment.type === "artifact_tree" ? (
- <span>Artifact directory: {segment.root_path}</span>
+ <span>
+ {t(cardsMessages.artifactDirectory, {
+ path: segment.root_path,
+ })}
+ </span>
) : (
- <span>Skill: {segment.content}</span>
+ <span>
+ {t(cardsMessages.skillSegment, { name: segment.content })}
+ </span>
)}
</li>
))}
diff --git a/apps/web/src/features/rooms/cards/decision-agent-change-view.tsx b/apps/web/src/features/rooms/cards/decision-agent-change-view.tsx
index 78bf4744..8f3a1163 100644
--- a/apps/web/src/features/rooms/cards/decision-agent-change-view.tsx
+++ b/apps/web/src/features/rooms/cards/decision-agent-change-view.tsx
@@ -2,8 +2,10 @@ import { ArrowDown01Icon } from "@hugeicons/core-free-icons";
import { useState } from "react";
import { Icon } from "@/components/ui/icon";
+import { useT } from "@/i18n/use-translation";
import { AgentChangeFields } from "./agent-change-fields";
+import { cardsMessages } from "./cards.messages";
import type { DecisionMessageCard } from "./decision-card";
type AgentChangeView = NonNullable<DecisionMessageCard["agent_change"]>;
@@ -31,6 +33,7 @@ export function AgentChangeDecisionView({ view }: { view: AgentChangeView }) {
* replaces.
*/
function InstructionsChange({ change }: { change: AgentChange }) {
+ const t = useT();
const [open, setOpen] = useState(false);
const replacing = change.before !== undefined;
const expandable =
@@ -40,13 +43,17 @@ function InstructionsChange({ change }: { change: AgentChange }) {
return (
<>
<InstructionsText
- label={replacing ? "New instructions" : "Instructions"}
+ label={t(
+ replacing
+ ? cardsMessages.newInstructions
+ : cardsMessages.instructions,
+ )}
open={open}
text={change.after}
/>
{open && replacing ? (
<InstructionsText
- label="Current instructions"
+ label={t(cardsMessages.currentInstructions)}
open
text={change.before ?? ""}
/>
@@ -63,7 +70,9 @@ function InstructionsChange({ change }: { change: AgentChange }) {
icon={ArrowDown01Icon}
size={14}
/>
- {open ? "Show less" : "Show full instructions"}
+ {t(
+ open ? cardsMessages.showLess : cardsMessages.showFullInstructions,
+ )}
</button>
) : null}
</>
@@ -79,6 +88,7 @@ function InstructionsText({
open: boolean;
text: string;
}) {
+ const t = useT();
return (
<section
aria-label={label}
@@ -88,7 +98,7 @@ function InstructionsText({
<p
className={`whitespace-pre-wrap [overflow-wrap:anywhere] text-app-ink ${open ? "max-h-64 overflow-auto" : "line-clamp-4"}`}
>
- {text || "None"}
+ {text || t(cardsMessages.none)}
</p>
</section>
);
diff --git a/apps/web/src/features/rooms/cards/decision-browser-connection-view.tsx b/apps/web/src/features/rooms/cards/decision-browser-connection-view.tsx
index a3d0c0c7..8299c9ec 100644
--- a/apps/web/src/features/rooms/cards/decision-browser-connection-view.tsx
+++ b/apps/web/src/features/rooms/cards/decision-browser-connection-view.tsx
@@ -9,9 +9,13 @@ import { lazy, Suspense, useState } from "react";
import { Button } from "@/components/ui/button";
import { Icon, type IconSvgElement } from "@/components/ui/icon";
+import { translate } from "@/i18n/language";
+import type { Message } from "@/i18n/messages";
+import { useT } from "@/i18n/use-translation";
import { CardActions, CardError, CardRow } from "./approval-card-parts";
import { CardBox, CardDone, type ReceiptTone } from "./card-shell";
+import { cardsMessages } from "./cards.messages";
import type { DecisionMessageCard } from "./decision-card";
import type { RoomCardDecision } from "./room-message-card-contract";
@@ -21,8 +25,6 @@ const BrowserConnectionDialog = lazy(() =>
),
);
-const label = "Browser connection requested";
-
/**
* Asks the owner of an Agent's Local Computer to connect their everyday
* Chrome. The token goes from the dialog to that Computer only; TeamHub
@@ -42,6 +44,7 @@ export function BrowserConnectionDecision({
onDecision: (decision: RoomCardDecision) => Promise<void> | void;
tenantId: string;
}) {
+ const t = useT();
const [open, setOpen] = useState(false);
const [busy, setBusy] = useState(false);
const [error, setError] = useState("");
@@ -62,7 +65,7 @@ export function BrowserConnectionDecision({
setError(
cause instanceof Error
? cause.message
- : "The card could not be updated.",
+ : translate(cardsMessages.cardUpdateFailed),
);
} finally {
setBusy(false);
@@ -72,13 +75,20 @@ export function BrowserConnectionDecision({
const result = card.status === "pending" ? null : browserResult(card);
return (
<>
- <CardBox heading={card.title} label={label}>
+ <CardBox
+ heading={card.title}
+ label={t(cardsMessages.labelBrowserConnection)}
+ >
<CardRow
icon={<Icon icon={Globe02Icon} size={16} />}
- title="Everyday Chrome"
+ title={t(cardsMessages.everydayChrome)}
/>
{result ? (
- <CardDone icon={result.icon} text={result.text} tone={result.tone} />
+ <CardDone
+ icon={result.icon}
+ text={t(result.text)}
+ tone={result.tone}
+ />
) : owner ? (
<CardActions>
<Button
@@ -87,7 +97,7 @@ export function BrowserConnectionDecision({
size="large"
tone="primary"
>
- Connect
+ {t(cardsMessages.connect)}
</Button>
<Button
disabled={busy}
@@ -95,7 +105,7 @@ export function BrowserConnectionDecision({
size="large"
tone="subtle"
>
- Not now
+ {t(cardsMessages.notNow)}
</Button>
</CardActions>
) : null}
@@ -106,7 +116,9 @@ export function BrowserConnectionDecision({
<BrowserConnectionDialog
computerId={card.browser_connection?.computer_id ?? ""}
onClose={() => setOpen(false)}
- reason={`${agentName} continues once you connect.`}
+ reason={t(cardsMessages.continuesOnceConnected, {
+ agent: agentName,
+ })}
tenantId={tenantId}
/>
</Suspense>
@@ -118,20 +130,24 @@ export function BrowserConnectionDecision({
/** How a settled browser connection ended, in a few words. */
function browserResult(card: DecisionMessageCard): {
icon: IconSvgElement;
- text: string;
+ text: Message<string>;
tone: ReceiptTone;
} {
if (card.answer?.decision === "connected")
- return { icon: Tick02Icon, text: "Connected", tone: "success" };
+ return { icon: Tick02Icon, text: cardsMessages.connected, tone: "success" };
switch (card.status) {
case "denied":
- return { icon: Cancel01Icon, text: "Not connected", tone: "muted" };
+ return {
+ icon: Cancel01Icon,
+ text: cardsMessages.notConnected,
+ tone: "muted",
+ };
case "expired":
- return { icon: Clock01Icon, text: "Expired", tone: "muted" };
+ return { icon: Clock01Icon, text: cardsMessages.expired, tone: "muted" };
default:
return {
icon: AlertCircleIcon,
- text: "Failed: the connection did not complete",
+ text: cardsMessages.browserConnectionFailed,
tone: "danger",
};
}
diff --git a/apps/web/src/features/rooms/cards/decision-card.tsx b/apps/web/src/features/rooms/cards/decision-card.tsx
index af97c797..fb009a77 100644
--- a/apps/web/src/features/rooms/cards/decision-card.tsx
+++ b/apps/web/src/features/rooms/cards/decision-card.tsx
@@ -15,7 +15,17 @@ import { lazy, type ReactNode, Suspense, useState } from "react";
import { Button } from "@/components/ui/button";
import { Icon, type IconSvgElement } from "@/components/ui/icon";
+import type { VoiceRisk } from "@/features/rooms/chat/voice-mode/voice-ui-bridge";
import type { TeamHubMessageCard } from "@/features/teamhub/teamhub-types";
+import {
+ formatLocale,
+ translate,
+ type Translate,
+ type Translation,
+} from "@/i18n/language";
+import type { Message } from "@/i18n/messages";
+import { useTranslation } from "@/i18n/use-translation";
+import { formatDateTime } from "@/lib/date-format";
import {
CardActions,
@@ -25,6 +35,7 @@ import {
DecisionActions,
} from "./approval-card-parts";
import { CardBox, CardDone, type ReceiptTone } from "./card-shell";
+import { cardsMessages } from "./cards.messages";
import { ConnectedAppIcon } from "./connected-app-identity";
import { connectedAppDisplayName } from "./connected-app-names";
import { AgentChangeDecisionView } from "./decision-agent-change-view";
@@ -175,6 +186,8 @@ function ApprovalDecision({
roomMemberDecisionAllowed,
tenantId,
}: DecisionCardProps) {
+ const translation = useTranslation();
+ const { t } = translation;
const [now] = useState(Date.now);
const [open, setOpen] = useState(false);
const [submitting, setSubmitting] = useState(false);
@@ -206,23 +219,26 @@ function ApprovalDecision({
});
} catch (error) {
setDecisionError(
- error instanceof Error ? error.message : "Card decision failed.",
+ error instanceof Error
+ ? error.message
+ : translate(cardsMessages.cardDecisionFailed),
);
} finally {
setSubmitting(false);
}
}
- const label =
+ const label = t(
card.kind === "runtime_permission"
- ? "Permission request"
+ ? cardsMessages.labelPermissionRequest
: roomCreation
- ? "Room creation"
- : "Confirmation request";
+ ? cardsMessages.labelRoomCreation
+ : cardsMessages.labelConfirmationRequest,
+ );
const words = approvalWords(card);
// The title heads the box; the row then names what runs without repeating it.
- const summary = approvalSummary(card, actorDisplayNames, card.title);
- const done = doneLine(state, card, words);
+ const summary = approvalSummary(card, actorDisplayNames, card.title, t);
+ const done = doneLine(state, card, words, translation);
const screenshot = card.runtime_permission?.screenshot ? (
<PermissionScreenshot
canSee={currentActorId === card.decision_owner.id}
@@ -277,31 +293,35 @@ function ApprovalDecision({
<CardActions>
{email ? (
<div
- aria-label="Approval actions"
+ aria-label={t(cardsMessages.approvalActions)}
className="flex gap-2"
role="group"
>
<Button
+ data-voice-risk={words.approveRisk}
disabled={submitting}
onClick={() => void decide("approve")}
size="large"
tone="primary"
>
- {words.approve}
+ {t(words.approve)}
</Button>
<Button
+ data-voice-risk={words.denyRisk}
disabled={submitting}
onClick={() => void decide("deny")}
size="large"
tone="ghost"
>
- {words.deny}
+ {t(words.deny)}
</Button>
</div>
) : (
<DecisionActions
- approveLabel={words.approve}
- denyLabel={words.deny}
+ approveLabel={t(words.approve)}
+ approveRisk={words.approveRisk}
+ denyLabel={t(words.deny)}
+ denyRisk={words.denyRisk}
disabled={submitting}
onApprove={() => void decide("approve")}
onDeny={(reason) => void decide("deny", reason)}
@@ -352,68 +372,75 @@ function decisionState(card: DecisionMessageCard, now: number): DecisionState {
}
interface ApprovalWords {
- approve: string;
- approved: string;
- deny: string;
- denied: string;
- running: string;
+ approve: Message<string>;
+ /** What Voice Mode risks by clicking approve or deny (`data-voice-risk`). */
+ approveRisk?: VoiceRisk;
+ approved: Message<string>;
+ deny: Message<string>;
+ denyRisk?: VoiceRisk;
+ denied: Message<string>;
+ running: Message<string>;
}
/** The buttons and outcomes in the words of what the approval does. */
function approvalWords(card: DecisionMessageCard): ApprovalWords {
if (card.room_creation)
return {
- approve: "Create Room",
- approved: "Created",
- deny: "Don't create",
- denied: "Not created",
- running: "Creating…",
+ approve: cardsMessages.createRoom,
+ approved: cardsMessages.created,
+ deny: cardsMessages.dontCreate,
+ denied: cardsMessages.notCreated,
+ running: cardsMessages.creating,
};
if (card.agent_change?.action === "create")
return {
- approve: "Create",
- approved: "Created",
- deny: "Don't create",
- denied: "Not created",
- running: "Creating…",
+ approve: cardsMessages.create,
+ approved: cardsMessages.created,
+ deny: cardsMessages.dontCreate,
+ denied: cardsMessages.notCreated,
+ running: cardsMessages.creating,
};
if (card.agent_change)
return {
- approve: "Apply",
- approved: "Applied",
- deny: "Don't apply",
- denied: "Not applied",
- running: "Applying…",
+ approve: cardsMessages.apply,
+ approved: cardsMessages.applied,
+ deny: cardsMessages.dontApply,
+ denied: cardsMessages.notApplied,
+ running: cardsMessages.applying,
};
if (card.runtime_permission)
return {
- approve: "Allow once",
- approved: "Allowed once",
- deny: "Don't allow",
- denied: "Not allowed",
- running: "Running…",
+ approve: cardsMessages.allowOnce,
+ approved: cardsMessages.allowedOnce,
+ deny: cardsMessages.dontAllow,
+ denied: cardsMessages.notAllowed,
+ running: cardsMessages.running,
};
if (card.connector_write?.kind === "message")
return {
- approve: "Send",
- approved: "Sent",
- deny: "Don't send",
- denied: "Not sent",
- running: "Sending…",
+ approve: cardsMessages.send,
+ approveRisk: "never",
+ approved: cardsMessages.sent,
+ deny: cardsMessages.dontSend,
+ denyRisk: "never",
+ denied: cardsMessages.notSent,
+ running: cardsMessages.sending,
};
return {
- approve: "Approve",
- approved: "Done",
- deny: "Deny",
- denied: "Denied",
- running: "Running…",
+ approve: cardsMessages.approve,
+ approveRisk: "confirm",
+ approved: cardsMessages.done,
+ deny: cardsMessages.deny,
+ denyRisk: "confirm",
+ denied: cardsMessages.denied,
+ running: cardsMessages.running,
};
}
-const fieldNames: Record<string, string> = {
- description: "description",
- name: "name",
- prompt: "instructions",
+const fieldNames: Record<string, Message<string>> = {
+ description: cardsMessages.agentFieldDescription,
+ name: cardsMessages.agentFieldName,
+ prompt: cardsMessages.agentFieldInstructions,
};
/** The one row that says what will actually run, as TeamHub froze it. */
@@ -421,6 +448,7 @@ function approvalSummary(
card: DecisionMessageCard,
actorDisplayNames: Readonly<Record<string, string>> = {},
prompt: string,
+ t: Translate,
): { detail?: string; icon: ReactNode; title: string } {
const write = card.connector_write;
if (write) {
@@ -467,19 +495,20 @@ function approvalSummary(
const description = change.changes.find(
(item) => item.field === "description",
)?.after;
- const changed = change.changes.map(
- (item) => fieldNames[item.field] ?? item.field,
- );
+ const changed = change.changes.map((item) => {
+ const name = fieldNames[item.field];
+ return name ? t(name) : item.field;
+ });
return {
detail: create
? description || undefined
: changed.length
- ? capitalize(changed.join(", "))
+ ? capitalize(changed.join(t(cardsMessages.listSeparator)))
: undefined,
icon: <Icon icon={create ? UserAdd01Icon : UserEdit01Icon} size={16} />,
title: create
- ? `New Agent ${change.agent_name}`
- : `Change ${change.agent_name}`,
+ ? t(cardsMessages.newAgent, { name: change.agent_name })
+ : t(cardsMessages.changeAgent, { name: change.agent_name }),
};
}
const room = card.room_creation;
@@ -488,11 +517,13 @@ function approvalSummary(
const names = room.member_ids
.map((id) => actorDisplayNames[id])
.filter(Boolean)
- .join(", ");
+ .join(t(cardsMessages.listSeparator));
return {
- detail: `${count} ${count === 1 ? "member" : "members"}${names ? ` · ${names}` : ""}`,
+ detail: names
+ ? t(cardsMessages.memberCountWithNames, { count, names })
+ : t(cardsMessages.memberCount, { count }),
icon: <Icon icon={UserGroupIcon} size={16} />,
- title: `New Room ${room.name}`,
+ title: t(cardsMessages.newRoom, { name: room.name }),
};
}
return {
@@ -528,62 +559,85 @@ function doneLine(
state: DecisionState,
card: DecisionMessageCard,
words: ApprovalWords,
+ translation: Translation,
): { icon: IconSvgElement; text: string; tone: ReceiptTone } | null {
+ const { t } = translation;
+ const approved = t(words.approved);
const outcome = card.outcome?.trim();
switch (state) {
case "approved":
return {
icon: Tick02Icon,
text: card.expires_at
- ? `${words.approved} until ${formatTime(card.expires_at)}`
- : words.approved,
+ ? t(cardsMessages.approvedUntil, {
+ approved,
+ time: formatTime(card.expires_at, translation),
+ })
+ : approved,
tone: "success",
};
case "used":
return {
icon: Tick02Icon,
- text: `${words.approved} · Used`,
+ text: t(cardsMessages.approvedUsed, { approved }),
tone: "success",
};
case "running":
- return { icon: Loading03Icon, text: words.running, tone: "muted" };
+ return { icon: Loading03Icon, text: t(words.running), tone: "muted" };
case "done":
- return { icon: Tick02Icon, text: words.approved, tone: "success" };
+ return { icon: Tick02Icon, text: approved, tone: "success" };
case "failed":
return {
icon: AlertCircleIcon,
- text: outcome ? `Failed: ${outcome}` : "Failed",
+ text: outcome
+ ? t(cardsMessages.failedWithOutcome, { outcome })
+ : t(cardsMessages.failed),
tone: "danger",
};
case "unknown":
return {
icon: HelpCircleIcon,
- text: outcome ? `Result unknown: ${outcome}` : "Result unknown",
+ text: outcome
+ ? t(cardsMessages.resultUnknownWithOutcome, { outcome })
+ : t(cardsMessages.resultUnknown),
tone: "warning",
};
case "denied": {
const reason = card.answer?.comment?.trim();
return {
icon: Cancel01Icon,
- text: reason ? `${words.denied} · “${reason}”` : words.denied,
+ text: reason
+ ? t(cardsMessages.deniedWithReason, {
+ denied: t(words.denied),
+ reason,
+ })
+ : t(words.denied),
tone: "muted",
};
}
case "expired":
- return { icon: Clock01Icon, text: "Expired", tone: "muted" };
+ return {
+ icon: Clock01Icon,
+ text: t(cardsMessages.expired),
+ tone: "muted",
+ };
default:
return null;
}
}
-// English like the rest of the card, in the viewer's time zone.
-const expiryFormat = new Intl.DateTimeFormat("en-US", {
+const expiryOptions: Intl.DateTimeFormatOptions = {
day: "numeric",
hour: "numeric",
minute: "2-digit",
month: "short",
-});
+};
-function formatTime(value: string) {
- return expiryFormat.format(new Date(value));
+/** In the language of the card and the viewer's time zone. */
+function formatTime(value: string, translation: Translation) {
+ return formatDateTime(
+ value,
+ expiryOptions,
+ formatLocale(translation.language),
+ );
}
diff --git a/apps/web/src/features/rooms/cards/decision-computer-permission-view.tsx b/apps/web/src/features/rooms/cards/decision-computer-permission-view.tsx
index 7eb93c7d..75802e00 100644
--- a/apps/web/src/features/rooms/cards/decision-computer-permission-view.tsx
+++ b/apps/web/src/features/rooms/cards/decision-computer-permission-view.tsx
@@ -23,9 +23,13 @@ import {
import { localComputersQueryOptions } from "@/features/local-computer/local-computer-queries";
import { TeamHubError } from "@/features/teamhub/teamhub-error";
import { useTeamHubRuntime } from "@/features/teamhub/teamhub-runtime";
+import { translate } from "@/i18n/language";
+import type { Message } from "@/i18n/messages";
+import { useT } from "@/i18n/use-translation";
import { CardActions, CardError } from "./approval-card-parts";
import { CardBox, CardDone, type ReceiptTone } from "./card-shell";
+import { cardsMessages } from "./cards.messages";
import type { DecisionMessageCard } from "./decision-card";
import type { RoomCardDecision } from "./room-message-card-contract";
@@ -36,28 +40,28 @@ type Entry =
type CardState = "waiting" | "relaunch" | "granted" | "declined" | "expired";
type FinishedState = Extract<CardState, "granted" | "declined" | "expired">;
-const label = "System permission requested";
-const subjectLabels: Record<Subject, string> = {
+// "Linger" is the product's name; the other subject is described.
+const subjectLabels: Record<Subject, Message<string> | string> = {
linger: "Linger",
- computer_use: "Computer use (CuaDriver)",
+ computer_use: cardsMessages.subjectComputerUse,
};
-const permissionLabels: Record<PermissionId, string> = {
- accessibility: "Accessibility",
- screen_recording: "Screen Recording",
+const permissionLabels: Record<PermissionId, Message<string>> = {
+ accessibility: cardsMessages.permissionAccessibility,
+ screen_recording: cardsMessages.permissionScreenRecording,
};
-const stateLabels: Record<Entry["state"], string> = {
- denied: "Not allowed",
- granted: "Granted",
- not_determined: "Not requested yet",
- unknown: "Unknown",
+const stateLabels: Record<Entry["state"], Message<string>> = {
+ denied: cardsMessages.notAllowed,
+ granted: cardsMessages.granted,
+ not_determined: cardsMessages.stateNotRequested,
+ unknown: cardsMessages.stateUnknown,
};
const finishedCopy: Record<
FinishedState,
- { icon: IconSvgElement; text: string; tone: ReceiptTone }
+ { icon: IconSvgElement; text: Message<string>; tone: ReceiptTone }
> = {
- declined: { icon: Cancel01Icon, text: "Declined", tone: "muted" },
- expired: { icon: Clock01Icon, text: "Expired", tone: "muted" },
- granted: { icon: Tick02Icon, text: "Granted", tone: "success" },
+ declined: { icon: Cancel01Icon, text: cardsMessages.declined, tone: "muted" },
+ expired: { icon: Clock01Icon, text: cardsMessages.expired, tone: "muted" },
+ granted: { icon: Tick02Icon, text: cardsMessages.granted, tone: "success" },
};
function cardState(
@@ -81,21 +85,21 @@ function cardState(
function nextAction(
subject: Subject,
entry: Entry,
-): { action: ComputerPermissionAction; label: string } | undefined {
+): { action: ComputerPermissionAction; label: Message<string> } | undefined {
if (entry.state === "granted") return undefined;
if (entry.relaunch_required && subject === "linger")
return {
action: { action: "relaunch", subject },
- label: "Relaunch Linger",
+ label: cardsMessages.relaunchLinger,
};
if (entry.prompt === "available" && entry.state === "not_determined")
return {
action: { action: "prompt", subject, permission: entry.id },
- label: "Request",
+ label: cardsMessages.request,
};
return {
action: { action: "open_settings", subject, permission: entry.id },
- label: "Open Settings",
+ label: cardsMessages.openSettings,
};
}
@@ -141,6 +145,7 @@ export function ComputerPermissionDecision({
const computerId = view?.computer_id ?? "";
const subject: Subject = view?.subject ?? "linger";
const requested = view?.permissions ?? [];
+ const t = useT();
const { client } = useTeamHubRuntime();
const queryClient = useQueryClient();
const desktop = useDesktopComputer();
@@ -162,9 +167,9 @@ export function ComputerPermissionDecision({
...localComputersQueryOptions(client, tenantId),
enabled: interactive && !local,
});
- const computerName =
- inventory.data?.items.find((item) => item.computer_id === computerId)
- ?.display_name ?? "that Mac";
+ const computerName = inventory.data?.items.find(
+ (item) => item.computer_id === computerId,
+ )?.display_name;
const act = useMutation({
mutationFn: async (action: ComputerPermissionAction) => {
const ipc = local ? desktopPermissions() : undefined;
@@ -176,7 +181,9 @@ export function ComputerPermissionDecision({
},
onError: (cause) =>
setError(
- cause instanceof Error ? cause.message : "The step did not run.",
+ cause instanceof Error
+ ? cause.message
+ : translate(cardsMessages.stepDidNotRun),
),
onMutate: () => setError(""),
onSuccess: (next) => {
@@ -192,7 +199,7 @@ export function ComputerPermissionDecision({
status.error && !offline
? status.error instanceof Error
? status.error.message
- : "The Mac's permissions could not be read."
+ : t(cardsMessages.permissionsUnreadable)
: "";
const liveEntries = interactive
@@ -222,7 +229,7 @@ export function ComputerPermissionDecision({
setError(
cause instanceof Error
? cause.message
- : "The card could not be updated.",
+ : translate(cardsMessages.cardUpdateFailed),
);
} finally {
setBusy(false);
@@ -233,10 +240,16 @@ export function ComputerPermissionDecision({
state === "granted" || state === "declined" || state === "expired"
? finishedCopy[state]
: null;
+ const subjectName = subjectLabels[subject];
+ const subjectLabel =
+ typeof subjectName === "string" ? subjectName : t(subjectName);
return (
<>
- <CardBox heading={card.title} label={label}>
+ <CardBox
+ heading={card.title}
+ label={t(cardsMessages.labelSystemPermission)}
+ >
<ul className="flex flex-col">
{rows.map(({ id, entry }) => {
const step =
@@ -249,20 +262,22 @@ export function ComputerPermissionDecision({
>
<div className="min-w-0 flex-1">
<p className="truncate text-sm text-app-ink">
- {subjectLabels[subject]} · {permissionLabels[id]}
+ {subjectLabel} · {t(permissionLabels[id])}
</p>
{entry && !granted ? (
<p className="truncate text-xs text-app-muted">
- {entry.relaunch_required
- ? "Relaunch Linger to apply"
- : stateLabels[entry.state]}
+ {t(
+ entry.relaunch_required
+ ? cardsMessages.relaunchToApply
+ : stateLabels[entry.state],
+ )}
</p>
) : null}
</div>
{granted ? (
<span className="inline-flex shrink-0 items-center gap-1 text-xs font-medium text-app-success">
<Icon icon={Tick02Icon} size={14} />
- Granted
+ {t(cardsMessages.granted)}
</span>
) : step ? (
<Button
@@ -271,7 +286,7 @@ export function ComputerPermissionDecision({
size="large"
tone="subtle"
>
- {step.label}
+ {t(step.label)}
</Button>
) : null}
</li>
@@ -281,19 +296,21 @@ export function ComputerPermissionDecision({
{finished ? (
<CardDone
icon={finished.icon}
- text={finished.text}
+ text={t(finished.text)}
tone={finished.tone}
/>
) : (
<>
{interactive && offline ? (
<p className="pb-1 text-xs text-app-muted">
- Open Linger on that Mac to grant these permissions.
+ {t(cardsMessages.openLingerOnThatMac)}
</p>
) : null}
{interactive && status.data && !local ? (
<p className="pb-1 [overflow-wrap:anywhere] text-xs text-app-muted">
- Opens on {computerName}
+ {computerName
+ ? t(cardsMessages.opensOn, { name: computerName })
+ : t(cardsMessages.opensOnThatMac)}
</p>
) : null}
{owner && pending ? (
@@ -304,7 +321,7 @@ export function ComputerPermissionDecision({
size="large"
tone="subtle"
>
- Don't allow
+ {t(cardsMessages.dontAllow)}
</Button>
</CardActions>
) : null}
diff --git a/apps/web/src/features/rooms/cards/decision-connection-auth-view.tsx b/apps/web/src/features/rooms/cards/decision-connection-auth-view.tsx
index 21dd9488..dff0d0dd 100644
--- a/apps/web/src/features/rooms/cards/decision-connection-auth-view.tsx
+++ b/apps/web/src/features/rooms/cards/decision-connection-auth-view.tsx
@@ -28,9 +28,14 @@ import {
import { openOAuthUrl } from "@/features/apps/oauth-popup";
import { useTeamHubRuntime } from "@/features/teamhub/teamhub-runtime";
import type { TeamHubExternalConnection } from "@/features/teamhub/teamhub-types";
+import { commonMessages } from "@/i18n/common.messages";
+import { translate } from "@/i18n/language";
+import type { Message } from "@/i18n/messages";
+import { useT } from "@/i18n/use-translation";
import { CardActions, CardError, CardRow } from "./approval-card-parts";
import { CardBox, CardDone, type ReceiptTone } from "./card-shell";
+import { cardsMessages } from "./cards.messages";
import { ConnectedAppIcon } from "./connected-app-identity";
import { connectedAppDisplayName } from "./connected-app-names";
import type { DecisionMessageCard } from "./decision-card";
@@ -43,8 +48,6 @@ interface Props {
onDecision: (decision: RoomCardDecision) => Promise<void> | void;
}
-const label = "App authorization requested";
-
/** The account picker value for a new account; never a connection id. */
const NEW_ACCOUNT = "__new_account__";
@@ -59,6 +62,7 @@ export function ConnectionAuthDecision({
currentActorId,
...rest
}: Props) {
+ const t = useT();
const { client } = useTeamHubRuntime();
const catalog = useQuery(externalAppsQueryOptions(client));
const appKey = card.connection_auth?.app_key ?? "";
@@ -74,7 +78,11 @@ export function ConnectionAuthDecision({
appName={appName}
card={card}
done={
- <CardDone icon={result.icon} text={result.text} tone={result.tone} />
+ <CardDone
+ icon={result.icon}
+ text={t(result.text)}
+ tone={result.tone}
+ />
}
/>
);
@@ -110,22 +118,32 @@ function ConnectionAuthCard({
done?: ReactNode;
error?: string;
}) {
+ const t = useT();
return (
<>
- <CardBox heading={card.title} label={label}>
+ <CardBox
+ heading={card.title}
+ label={t(cardsMessages.labelAppAuthorization)}
+ >
<CardRow
icon={<ConnectedAppIcon appKey={appKey} size={16} />}
title={appName}
/>
{card.connection_auth?.account ? (
<p className="pb-1 text-sm text-muted-foreground [overflow-wrap:anywhere]">
- {`Requested account: ${card.connection_auth.account}`}
+ {t(cardsMessages.requestedAccount, {
+ account: card.connection_auth.account,
+ })}
</p>
) : null}
{children}
{done ??
(card.status === "authorizing" ? (
- <CardDone icon={Loading03Icon} text="Authorizing…" tone="muted" />
+ <CardDone
+ icon={Loading03Icon}
+ text={t(cardsMessages.authorizing)}
+ tone="muted"
+ />
) : null)}
{actions ? <CardActions>{actions}</CardActions> : null}
{error ? <CardError>{error}</CardError> : null}
@@ -137,20 +155,28 @@ function ConnectionAuthCard({
/** How a settled authorization ended, in a few words. */
function authorizationResult(card: DecisionMessageCard): {
icon: IconSvgElement;
- text: string;
+ text: Message<string>;
tone: ReceiptTone;
} {
switch (card.status) {
case "succeeded":
- return { icon: Tick02Icon, text: "Connected", tone: "success" };
+ return {
+ icon: Tick02Icon,
+ text: cardsMessages.connected,
+ tone: "success",
+ };
case "denied":
- return { icon: Cancel01Icon, text: "Not connected", tone: "muted" };
+ return {
+ icon: Cancel01Icon,
+ text: cardsMessages.notConnected,
+ tone: "muted",
+ };
case "expired":
- return { icon: Clock01Icon, text: "Expired", tone: "muted" };
+ return { icon: Clock01Icon, text: cardsMessages.expired, tone: "muted" };
default:
return {
icon: AlertCircleIcon,
- text: "Failed: the sign-in did not complete",
+ text: cardsMessages.signInFailed,
tone: "danger",
};
}
@@ -163,6 +189,7 @@ function ConnectionAuthorizationActions({
messageId,
onDecision,
}: Omit<Props, "currentActorId"> & { appKey: string; appName: string }) {
+ const t = useT();
const { client } = useTeamHubRuntime();
const queryClient = useQueryClient();
const [selectedId, setSelectedId] = useState("");
@@ -258,7 +285,7 @@ function ConnectionAuthorizationActions({
}
if (!connection) {
if (!app || !app.capabilities.includes("agent_tools"))
- throw new Error("This app is unavailable for Agent access.");
+ throw new Error(translate(cardsMessages.appUnavailableForAgents));
// Resume an open pending attempt of this app instead of adding a row.
const pending = openPendingExternalConnection(
connections.data?.connections ?? [],
@@ -294,7 +321,7 @@ function ConnectionAuthorizationActions({
setError(
cause instanceof Error
? cause.message
- : "Authorization could not be started.",
+ : translate(cardsMessages.authorizationNotStarted),
);
} finally {
setBusy(false);
@@ -309,7 +336,7 @@ function ConnectionAuthorizationActions({
setError(
cause instanceof Error
? cause.message
- : "Authorization could not be cancelled.",
+ : translate(cardsMessages.authorizationNotCancelled),
);
} finally {
setBusy(false);
@@ -323,42 +350,44 @@ function ConnectionAuthorizationActions({
(canConnectNew || available.length > 1);
const primaryAction = resumeUrl ? (
<Button
- aria-label="Open authorization window"
+ aria-label={t(cardsMessages.openAuthorizationWindow)}
disabled={busy}
size="large"
tone="primary"
onClick={() => {
if (!openOAuthUrl(resumeUrl))
- setError(
- "Your browser blocked the authorization popup. Allow popups and try again.",
- );
+ setError(translate(cardsMessages.popupBlocked));
}}
>
- Open
+ {t(commonMessages.open)}
</Button>
) : authorizing ? null : selected ? (
<Button
aria-label={
selected.status === "active"
- ? `Allow ${agentName}`
- : `Connect ${appName}`
+ ? t(cardsMessages.allowAgent, { name: agentName })
+ : t(cardsMessages.connectApp, { name: appName })
}
disabled={busy}
onClick={() => void authorize(false)}
size="large"
tone="primary"
>
- {selected.status === "active" ? "Allow" : "Connect"}
+ {t(
+ selected.status === "active"
+ ? cardsMessages.allow
+ : cardsMessages.connect,
+ )}
</Button>
) : loading || canConnectNew ? (
<Button
- aria-label={`Connect ${appName}`}
+ aria-label={t(cardsMessages.connectApp, { name: appName })}
disabled={busy || loading}
onClick={() => void authorize(true)}
size="large"
tone="primary"
>
- Connect
+ {t(cardsMessages.connect)}
</Button>
) : null;
@@ -373,7 +402,7 @@ function ConnectionAuthorizationActions({
size="large"
tone="subtle"
>
- {authorizing ? "Cancel" : "Not now"}
+ {t(authorizing ? commonMessages.cancel : cardsMessages.notNow)}
</Button>
</>
}
@@ -385,32 +414,39 @@ function ConnectionAuthorizationActions({
(loadError
? loadError instanceof Error
? loadError.message
- : "Accounts could not be loaded."
+ : t(cardsMessages.accountsNotLoaded)
: undefined)
}
>
{showPicker ? (
<div className="pb-1">
<Select
- aria-label={`${appName} account`}
+ aria-label={t(cardsMessages.appAccount, { app: appName })}
className="h-8 w-full px-2.5 text-sm"
disabled={busy}
onValueChange={setSelectedId}
value={selected?.id ?? (canConnectNew ? NEW_ACCOUNT : "")}
>
- {available.map((connection) => (
- <SelectItem key={connection.id} value={connection.id}>
- {`${accountIdentityText(connection.provider, connection.identity_label) || appName}${
- connection.status === "active"
- ? ""
+ {available.map((connection) => {
+ const account =
+ accountIdentityText(
+ connection.provider,
+ connection.identity_label,
+ ) || appName;
+ return (
+ <SelectItem key={connection.id} value={connection.id}>
+ {connection.status === "active"
+ ? account
: connection.status === "pending"
- ? " (pending)"
- : " (needs reconnecting)"
- }`}
- </SelectItem>
- ))}
+ ? t(cardsMessages.accountPending, { account })
+ : t(cardsMessages.accountNeedsReconnecting, { account })}
+ </SelectItem>
+ );
+ })}
{canConnectNew ? (
- <SelectItem value={NEW_ACCOUNT}>Connect a new account</SelectItem>
+ <SelectItem value={NEW_ACCOUNT}>
+ {t(cardsMessages.connectNewAccount)}
+ </SelectItem>
) : null}
</Select>
</div>
diff --git a/apps/web/src/features/rooms/cards/decision-connector-write-view.tsx b/apps/web/src/features/rooms/cards/decision-connector-write-view.tsx
index a5ecde2f..2488d1f5 100644
--- a/apps/web/src/features/rooms/cards/decision-connector-write-view.tsx
+++ b/apps/web/src/features/rooms/cards/decision-connector-write-view.tsx
@@ -8,10 +8,13 @@ import { Fragment, useId, useMemo, useState } from "react";
import { AutoHeight } from "@/components/ui/auto-height";
import { Icon } from "@/components/ui/icon";
+import type { Message } from "@/i18n/messages";
+import { useT } from "@/i18n/use-translation";
import { cn } from "@/lib/cn";
import { MessageMarkdown } from "../chat/message-markdown";
import { CardRowDetails, FullCallBlock } from "./approval-card-parts";
+import { cardsMessages } from "./cards.messages";
import type { DecisionMessageCard } from "./decision-card";
import { SlackMrkdwn } from "./slack-mrkdwn";
@@ -27,6 +30,7 @@ export function EmailDecisionView({
account: string;
message: ConnectorWriteMessage;
}) {
+ const t = useT();
const [open, setOpen] = useState(false);
const previewId = useId();
return (
@@ -45,7 +49,7 @@ export function EmailDecisionView({
size={16}
/>
<span className="min-w-0 flex-1 text-sm font-semibold text-app-ink [overflow-wrap:anywhere]">
- {message.subject?.trim() || "No subject"}
+ {message.subject?.trim() || t(cardsMessages.noSubject)}
</span>
<Icon
className={cn(
@@ -60,7 +64,9 @@ export function EmailDecisionView({
{message.to?.length ? (
<AutoHeight open={!open}>
<p className="pt-1 text-sm text-app-muted [overflow-wrap:anywhere]">
- To {message.to.map(displayEmailAddress).join(", ")}
+ {t(cardsMessages.emailToLine, {
+ recipients: message.to.map(displayEmailAddress).join(", "),
+ })}
</p>
</AutoHeight>
) : null}
@@ -108,27 +114,33 @@ function MessagePreview({
emailFrom?: string;
message: ConnectorWriteMessage;
}) {
+ const t = useT();
const email = emailFrom !== undefined;
function recipients(addresses?: string[]) {
return (email ? addresses?.map(displayEmailAddress) : addresses)?.join(
", ",
);
}
- const rows: [string, string | undefined][] = [
+ const rows: [Message<string>, string | undefined][] = [
[
- "From",
+ cardsMessages.emailFrom,
emailFrom === undefined ? undefined : displayEmailAddress(emailFrom),
],
- ["To", recipients(message.to)],
- ["Cc", recipients(message.cc) || (email ? "None" : undefined)],
- ["Bcc", recipients(message.bcc)],
- ["Subject", email ? undefined : message.subject],
- ["Where", message.destination],
+ [cardsMessages.emailTo, recipients(message.to)],
+ [
+ cardsMessages.emailCc,
+ recipients(message.cc) || (email ? t(cardsMessages.none) : undefined),
+ ],
+ [cardsMessages.emailBcc, recipients(message.bcc)],
+ [cardsMessages.emailSubject, email ? undefined : message.subject],
+ [cardsMessages.messageWhere, message.destination],
];
- const shown = rows.filter((row): row is [string, string] => Boolean(row[1]));
+ const shown = rows.filter((row): row is [Message<string>, string] =>
+ Boolean(row[1]),
+ );
return (
<section
- aria-label="Message preview"
+ aria-label={t(cardsMessages.messagePreview)}
className={cn(
email
? "mt-2"
@@ -151,11 +163,11 @@ function MessagePreview({
? "grid grid-cols-[3rem_minmax(0,1fr)] gap-x-3 py-3"
: "contents"
}
- key={label}
+ key={label.id}
>
- <dt className="text-app-muted">{label}</dt>
+ <dt className="text-app-muted">{t(label)}</dt>
<dd
- className={`[overflow-wrap:anywhere] text-app-ink ${label === "Subject" ? "font-semibold" : ""}`}
+ className={`[overflow-wrap:anywhere] text-app-ink ${label === cardsMessages.emailSubject ? "font-semibold" : ""}`}
>
{value}
</dd>
@@ -170,11 +182,13 @@ function MessagePreview({
format={message.format}
/>
) : (
- <p className="px-3 py-2.5 text-xs text-app-muted">No message text.</p>
+ <p className="px-3 py-2.5 text-xs text-app-muted">
+ {t(cardsMessages.noMessageText)}
+ </p>
)}
{message.attachments?.length ? (
<ul
- aria-label="Attachments"
+ aria-label={t(cardsMessages.attachments)}
className="flex flex-wrap gap-1.5 border-t border-app-border px-3 py-2"
>
{message.attachments.map((name, index) => (
@@ -241,6 +255,7 @@ function HtmlMessageBody({
expanded: boolean;
html: string;
}) {
+ const t = useT();
const [height, setHeight] = useState(120);
const source = useMemo(
() => htmlEmailDocument(html, expanded),
@@ -264,7 +279,7 @@ function HtmlMessageBody({
sandbox="allow-popups allow-popups-to-escape-sandbox allow-same-origin"
srcDoc={source}
style={{ height }}
- title="Message body"
+ title={t(cardsMessages.messageBody)}
/>
);
}
diff --git a/apps/web/src/features/rooms/cards/decision-profile-setup-view.tsx b/apps/web/src/features/rooms/cards/decision-profile-setup-view.tsx
index dffd0cbd..05659c37 100644
--- a/apps/web/src/features/rooms/cards/decision-profile-setup-view.tsx
+++ b/apps/web/src/features/rooms/cards/decision-profile-setup-view.tsx
@@ -32,6 +32,8 @@ import {
type TeamHubClient,
} from "@/features/teamhub/teamhub-client";
import { useTeamHubRuntime } from "@/features/teamhub/teamhub-runtime";
+import { translate, type Translate } from "@/i18n/language";
+import { useT } from "@/i18n/use-translation";
import type {
TeamHubExternalApp,
TeamHubExternalConnection,
@@ -40,6 +42,7 @@ import type {
import { CardActions, CardError } from "./approval-card-parts";
import { CardBox, CardDone } from "./card-shell";
+import { cardsMessages } from "./cards.messages";
import { connectedAppDisplayName } from "./connected-app-names";
import type { DecisionMessageCard } from "./decision-card";
import type { RoomCardDecision } from "./room-message-card-contract";
@@ -86,10 +89,14 @@ function SetupCard({
children?: ReactNode;
error?: string | null;
}) {
- const done = card.status === "pending" ? null : setupDone(card);
+ const t = useT();
+ const done = card.status === "pending" ? null : setupDone(card, t);
return (
<>
- <CardBox heading={card.title} label="AnotherMe setup">
+ <CardBox
+ heading={card.title}
+ label={t(cardsMessages.labelAnotherMeSetup)}
+ >
{children}
{done ? (
<CardDone icon={done.icon} text={done.text} tone={done.tone} />
@@ -103,52 +110,73 @@ function SetupCard({
}
/** How an answered setup card ended, in a few words. */
-function setupDone(card: Card) {
+function setupDone(card: Card, t: Translate) {
const decision =
card.status === "answered" ? card.answer?.decision : undefined;
const links = card.answer?.links?.length ?? 0;
const files = card.answer?.attachment_upload_ids?.length ?? 0;
- const shared = [
- links ? plural(links, "link") : "",
- files ? plural(files, "file") : "",
- ]
- .filter(Boolean)
- .join(" and ");
+ const linkCount = t(cardsMessages.linkCount, { count: links });
+ const fileCount = t(cardsMessages.fileCount, { count: files });
if (decision === "connected")
- return { icon: Tick02Icon, text: "Connected", tone: "success" as const };
+ return {
+ icon: Tick02Icon,
+ text: t(cardsMessages.connected),
+ tone: "success" as const,
+ };
if (decision === "done")
return {
icon: Tick02Icon,
- text: shared ? `Shared ${shared}` : "Nothing shared",
+ text:
+ links && files
+ ? t(cardsMessages.sharedLinksAndFiles, {
+ files: fileCount,
+ links: linkCount,
+ })
+ : links || files
+ ? t(cardsMessages.sharedItems, {
+ items: links ? linkCount : fileCount,
+ })
+ : t(cardsMessages.nothingShared),
tone: "success" as const,
};
if (decision === "skipped")
- return { icon: Cancel01Icon, text: "Skipped", tone: "muted" as const };
- return { icon: Clock01Icon, text: "Expired", tone: "muted" as const };
+ return {
+ icon: Cancel01Icon,
+ text: t(cardsMessages.skipped),
+ tone: "muted" as const,
+ };
+ return {
+ icon: Clock01Icon,
+ text: t(cardsMessages.expired),
+ tone: "muted" as const,
+ };
}
/** What an answered sources card shared. */
function SharedSources({ card }: { card: Card }) {
+ const t = useT();
const links = card.answer?.links ?? [];
const fileCount = card.answer?.attachment_upload_ids?.length ?? 0;
if (card.answer?.decision !== "done" || (!links.length && !fileCount))
return null;
return (
- <section aria-label="Shared sources" className={listClassName}>
+ <section
+ aria-label={t(cardsMessages.sharedSources)}
+ className={listClassName}
+ >
{links.map((url) => (
<SourceRow icon={Link01Icon} key={url} label={linkLabel(url)} />
))}
{fileCount ? (
- <SourceRow icon={File01Icon} label={plural(fileCount, "file")} />
+ <SourceRow
+ icon={File01Icon}
+ label={t(cardsMessages.fileCount, { count: fileCount })}
+ />
) : null}
</section>
);
}
-function plural(count: number, noun: string) {
- return `${count} ${noun}${count === 1 ? "" : "s"}`;
-}
-
function useSetupDecision({ card, messageId, onDecision }: Props) {
const [submitting, setSubmitting] = useState(false);
const [error, setError] = useState<string | null>(null);
@@ -170,10 +198,10 @@ function useSetupDecision({ card, messageId, onDecision }: Props) {
setError(
caught instanceof TeamHubError &&
caught.code === "ATTACHMENT_UPLOAD_UNAVAILABLE"
- ? "A file is no longer available. Remove it and upload it again."
+ ? translate(cardsMessages.fileNoLongerAvailable)
: caught instanceof Error
? caught.message
- : "Card decision failed.",
+ : translate(cardsMessages.cardDecisionFailed),
);
} finally {
setSubmitting(false);
@@ -183,6 +211,7 @@ function useSetupDecision({ card, messageId, onDecision }: Props) {
}
function ProfileSetupApps(props: Props) {
+ const t = useT();
const { card, currentActorId } = props;
const { client } = useTeamHubRuntime();
const catalog = useQuery(externalAppsQueryOptions(client));
@@ -206,8 +235,11 @@ function ProfileSetupApps(props: Props) {
<SetupReplies
decision={decision}
replies={[
- { decision: "connected", label: "Connected" },
- { decision: "skipped", label: "Skip for now" },
+ {
+ decision: "connected",
+ label: t(cardsMessages.replyConnected),
+ },
+ { decision: "skipped", label: t(cardsMessages.skipForNow) },
]}
/>
) : undefined
@@ -215,7 +247,10 @@ function ProfileSetupApps(props: Props) {
card={card}
error={decision.error}
>
- <section aria-label="Connect your apps" className={listClassName}>
+ <section
+ aria-label={t(cardsMessages.connectYourApps)}
+ className={listClassName}
+ >
{[...apps, ...(expanded ? moreApps : [])].map((key) => (
<SetupAppRow
app={catalogApp(key)}
@@ -249,7 +284,7 @@ function ProfileSetupApps(props: Props) {
</span>
))}
</span>
- <span className="flex-1">More</span>
+ <span className="flex-1">{t(cardsMessages.more)}</span>
<Icon icon={ArrowDown01Icon} size={14} />
</button>
) : null}
@@ -273,6 +308,7 @@ function SetupAppRow({
interactive: boolean;
showConnections: boolean;
}) {
+ const t = useT();
const flow = useConnectAppFlow();
const name = appName(app, appKey);
const active = showConnections
@@ -301,16 +337,16 @@ function SetupAppRow({
/>
<span className="truncate">
{accountIdentityText(active.provider, active.identity_label) ??
- "Connected"}
+ t(cardsMessages.connected)}
</span>
</span>
) : verifying && showConnections ? (
<span className="text-xs text-muted-foreground" role="status">
- Verifying connection…
+ {t(cardsMessages.verifyingConnection)}
</span>
) : app && showConnections ? (
<Button
- aria-label={`Connect ${name}`}
+ aria-label={t(cardsMessages.connectApp, { name })}
disabled={
!interactive || !flow.canStart(app) || flow.connection.isPending
}
@@ -318,11 +354,15 @@ function SetupAppRow({
size="large"
tone="subtle"
>
- {pending ? "Continue" : "Connect"}
+ {t(
+ pending
+ ? cardsMessages.continueConnecting
+ : cardsMessages.connect,
+ )}
</Button>
) : showConnections && catalogLoaded && !app ? (
<span className="text-xs text-muted-foreground">
- Not available yet
+ {t(cardsMessages.notAvailableYet)}
</span>
) : null}
</div>
@@ -344,6 +384,7 @@ type SourceItem =
};
function ProfileSetupSources(props: Props) {
+ const t = useT();
const { card, currentActorId, roomId } = props;
const { client } = useTeamHubRuntime();
const [items, setItems] = useState<SourceItem[]>([]);
@@ -372,11 +413,11 @@ function ProfileSetupSources(props: Props) {
function validateLink(link: string) {
return !isProfileSourceLink(link)
- ? "Enter a full link that starts with http:// or https://."
+ ? translate(cardsMessages.linkInvalid)
: links.includes(link)
- ? "That link is already added."
+ ? translate(cardsMessages.linkAlreadyAdded)
: links.length >= MAX_LINKS
- ? `You can add up to ${MAX_LINKS} links.`
+ ? translate(cardsMessages.linkLimit, { max: MAX_LINKS })
: null;
}
@@ -410,7 +451,10 @@ function ProfileSetupSources(props: Props) {
} catch (caught) {
if (controller.signal.aborted) return;
updateFile(id, {
- error: caught instanceof Error ? caught.message : "Upload failed.",
+ error:
+ caught instanceof Error
+ ? caught.message
+ : translate(cardsMessages.uploadFailed),
});
}
}
@@ -419,7 +463,7 @@ function ProfileSetupSources(props: Props) {
const room = MAX_FILES - files.length;
setInputError(
selected.length > room
- ? `You can upload up to ${MAX_FILES} files.`
+ ? translate(cardsMessages.fileLimit, { max: MAX_FILES })
: null,
);
const added = selected.slice(0, Math.max(room, 0)).map((file) => ({
@@ -470,8 +514,8 @@ function ProfileSetupSources(props: Props) {
});
}}
replies={[
- { decision: "done", label: "That's all" },
- { decision: "skipped", label: "Skip" },
+ { decision: "done", label: t(cardsMessages.thatsAll) },
+ { decision: "skipped", label: t(cardsMessages.skip) },
]}
/>
) : undefined
@@ -481,7 +525,10 @@ function ProfileSetupSources(props: Props) {
>
{canDecide ? (
<>
- <section aria-label="Website or files" className={listClassName}>
+ <section
+ aria-label={t(cardsMessages.websiteOrFiles)}
+ className={listClassName}
+ >
{items.map((item) =>
item.kind === "link" ? (
<LinkRow
@@ -507,12 +554,17 @@ function ProfileSetupSources(props: Props) {
) : (
<span className="text-xs text-app-muted tabular-nums">
{item.upload
- ? `Uploaded · ${formatFileSize(item.file.size)}`
+ ? t(cardsMessages.uploadedSize, {
+ size: formatFileSize(item.file.size),
+ })
: `${Math.round(item.progress * 100)}%`}
</span>
)}
<Button
- aria-label={`Remove ${item.file.name}`}
+ data-voice-risk="never"
+ aria-label={t(cardsMessages.removeItem, {
+ name: item.file.name,
+ })}
onClick={() => removeFile(item.id)}
size="compactIcon"
tone="ghost"
@@ -526,7 +578,7 @@ function ProfileSetupSources(props: Props) {
)}
<div className={rowClassName}>
<input
- aria-label="Paste a link"
+ aria-label={t(cardsMessages.pasteLink)}
className="h-8 min-w-0 flex-1 bg-transparent text-sm text-foreground outline-none placeholder:text-app-placeholder"
onChange={(event) => {
setDraft(event.target.value);
@@ -538,7 +590,7 @@ function ProfileSetupSources(props: Props) {
event.preventDefault();
addLink();
}}
- placeholder="Paste a link"
+ placeholder={t(cardsMessages.pasteLink)}
value={draft}
/>
<Button
@@ -547,7 +599,7 @@ function ProfileSetupSources(props: Props) {
size="large"
tone="subtle"
>
- Add link
+ {t(cardsMessages.addLink)}
</Button>
<Button
disabled={files.length >= MAX_FILES}
@@ -555,10 +607,10 @@ function ProfileSetupSources(props: Props) {
size="large"
tone="subtle"
>
- Upload files
+ {t(cardsMessages.uploadFiles)}
</Button>
<input
- aria-label="Upload files"
+ aria-label={t(cardsMessages.uploadFiles)}
className="hidden"
multiple
onChange={(event) => {
@@ -572,8 +624,8 @@ function ProfileSetupSources(props: Props) {
</section>
<p className="pb-1 text-xs text-app-muted" role="status">
{items.length
- ? "Added here. Select That's all to share with Another Me."
- : "Add a link or upload a file, then select That's all to share."}
+ ? t(cardsMessages.sourcesAddedHint)
+ : t(cardsMessages.sourcesEmptyHint)}
</p>
{inputError ? (
<p className="pb-1 text-xs text-app-danger" role="alert">
@@ -589,15 +641,19 @@ function ProfileSetupSources(props: Props) {
}
function LinkRow({ url, onRemove }: { url: string; onRemove: () => void }) {
+ const t = useT();
return (
<SourceRow
icon={Link01Icon}
label={linkLabel(url)}
trailing={
<>
- <span className="text-xs text-app-muted">Added</span>
+ <span className="text-xs text-app-muted">
+ {t(cardsMessages.added)}
+ </span>
<Button
- aria-label={`Remove ${url}`}
+ data-voice-risk="never"
+ aria-label={t(cardsMessages.removeItem, { name: url })}
onClick={onRemove}
size="compactIcon"
tone="ghost"
diff --git a/apps/web/src/features/rooms/cards/decision-provider-key-view.tsx b/apps/web/src/features/rooms/cards/decision-provider-key-view.tsx
index 22c8a9e4..c0c2ffe6 100644
--- a/apps/web/src/features/rooms/cards/decision-provider-key-view.tsx
+++ b/apps/web/src/features/rooms/cards/decision-provider-key-view.tsx
@@ -15,15 +15,17 @@ import { externalAppsQueryOptions } from "@/features/apps/connected-apps-queries
import { ComposioKeyForm } from "@/features/apps/provider-key-form";
import { ComposioKeyGuide } from "@/features/apps/provider-key-guide";
import { useTeamHubRuntime } from "@/features/teamhub/teamhub-runtime";
+import { translate } from "@/i18n/language";
+import type { Message } from "@/i18n/messages";
+import { useT } from "@/i18n/use-translation";
import { CardActions, CardError, CardRow } from "./approval-card-parts";
import { CardBox, CardDone, type ReceiptTone } from "./card-shell";
+import { cardsMessages } from "./cards.messages";
import { connectedAppDisplayName } from "./connected-app-names";
import type { DecisionMessageCard } from "./decision-card";
import type { RoomCardDecision } from "./room-message-card-contract";
-const label = "Composio API key requested";
-
/**
* Asks the Agent's Human for the deployment's Composio API key, which every
* Connected App needs. The key goes from the dialog to TeamHub's key setting,
@@ -41,6 +43,7 @@ export function ProviderKeyDecision({
messageId: string;
onDecision: (decision: RoomCardDecision) => Promise<void> | void;
}) {
+ const t = useT();
const { client } = useTeamHubRuntime();
const catalog = useQuery(externalAppsQueryOptions(client));
const [open, setOpen] = useState(false);
@@ -63,7 +66,7 @@ export function ProviderKeyDecision({
setError(
cause instanceof Error
? cause.message
- : "The card could not be updated.",
+ : translate(cardsMessages.cardUpdateFailed),
);
} finally {
setBusy(false);
@@ -73,18 +76,24 @@ export function ProviderKeyDecision({
const result = card.status === "pending" ? null : keyResult(card);
return (
<>
- <CardBox heading={card.title} label={label}>
+ <CardBox heading={card.title} label={t(cardsMessages.labelComposioKey)}>
<CardRow
detail={
appKey
- ? `Needed to connect ${connectedAppDisplayName(appKey)}`
- : "Every connected app needs it"
+ ? t(cardsMessages.neededToConnect, {
+ app: connectedAppDisplayName(appKey),
+ })
+ : t(cardsMessages.everyAppNeedsIt)
}
icon={<Icon icon={Key01Icon} size={16} />}
- title="Composio API key"
+ title={t(cardsMessages.composioApiKey)}
/>
{result ? (
- <CardDone icon={result.icon} text={result.text} tone={result.tone} />
+ <CardDone
+ icon={result.icon}
+ text={t(result.text)}
+ tone={result.tone}
+ />
) : owner ? (
<CardActions>
<Button
@@ -93,7 +102,7 @@ export function ProviderKeyDecision({
size="large"
tone="primary"
>
- Add key
+ {t(cardsMessages.addKey)}
</Button>
<Button
disabled={busy}
@@ -101,7 +110,7 @@ export function ProviderKeyDecision({
size="large"
tone="subtle"
>
- Not now
+ {t(cardsMessages.notNow)}
</Button>
</CardActions>
) : null}
@@ -111,10 +120,12 @@ export function ProviderKeyDecision({
<ModalDialog
className="app-key-dialog"
closeOnBackdrop
- description={`${card.requester.display_name} continues once the key is saved.`}
+ description={t(cardsMessages.continuesOnceKeySaved, {
+ agent: card.requester.display_name,
+ })}
onClose={() => setOpen(false)}
size="md"
- title="Add a Composio API key"
+ title={t(cardsMessages.addComposioKeyTitle)}
>
<div className="space-y-4 px-5 py-5 text-sm text-app-body">
{catalog.data?.provider_key.can_save === false ? (
@@ -135,12 +146,20 @@ export function ProviderKeyDecision({
/** How a settled key request ended, in a few words. */
function keyResult(card: DecisionMessageCard): {
icon: IconSvgElement;
- text: string;
+ text: Message<string>;
tone: ReceiptTone;
} {
if (card.answer?.decision === "configured")
- return { icon: Tick02Icon, text: "Key added", tone: "success" };
+ return { icon: Tick02Icon, text: cardsMessages.keyAdded, tone: "success" };
if (card.status === "denied")
- return { icon: Cancel01Icon, text: "No key added", tone: "muted" };
- return { icon: AlertCircleIcon, text: "Not completed", tone: "danger" };
+ return {
+ icon: Cancel01Icon,
+ text: cardsMessages.noKeyAdded,
+ tone: "muted",
+ };
+ return {
+ icon: AlertCircleIcon,
+ text: cardsMessages.notCompleted,
+ tone: "danger",
+ };
}
diff --git a/apps/web/src/features/rooms/cards/decision-question-view.test.tsx b/apps/web/src/features/rooms/cards/decision-question-view.test.tsx
index 5712525d..5bc10ea9 100644
--- a/apps/web/src/features/rooms/cards/decision-question-view.test.tsx
+++ b/apps/web/src/features/rooms/cards/decision-question-view.test.tsx
@@ -1,8 +1,10 @@
import { fireEvent, render, screen } from "@testing-library/react";
import { describe, expect, it, vi } from "vitest";
+import { getTranslation } from "@/i18n/language";
+
import type { DecisionMessageCard } from "./decision-card";
-import { settledCardNotice } from "./card-notice";
+import { cardNoticeLines, settledCardNotice } from "./card-notice";
import { QuestionDecision } from "./decision-question-view";
const assignee = {
@@ -69,6 +71,20 @@ function questionsCard(
};
}
+/** The system lines a settled card becomes, as the reader sees them. */
+function noticeLines(
+ card: Parameters<typeof settledCardNotice>[0],
+ viewerId: string,
+) {
+ const notice = settledCardNotice(card, viewerId);
+ return (
+ notice &&
+ cardNoticeLines(notice, getTranslation()).map((line) =>
+ line.parts.map((part) => part.text).join(""),
+ )
+ );
+}
+
describe("QuestionDecision", () => {
function renderCard(
card: DecisionMessageCard,
@@ -173,16 +189,16 @@ describe("QuestionDecision", () => {
const card = questionsCard("answered");
const { container } = renderCard(card);
expect(container).toBeEmptyDOMElement();
- expect(settledCardNotice(card, assignee.id)).toMatchObject({
- text: "You answered “What would you rather do this weekend?” with “Go for a walk”",
- more: ["You answered “Which day?” with “Saturday”"],
- });
+ expect(noticeLines(card, assignee.id)).toEqual([
+ "You answered “What would you rather do this weekend?” with “Go for a walk”",
+ "You answered “Which day?” with “Saturday”",
+ ]);
});
it("names someone else who answered, and keeps a note and their own words", () => {
const card = questionsCard("answered");
expect(
- settledCardNotice(
+ noticeLines(
{
...card,
answer: {
@@ -193,19 +209,17 @@ describe("QuestionDecision", () => {
},
"someone-else",
),
- ).toMatchObject({
- text: "mallory answered “What would you rather do this weekend?” with “Go hiking”",
- more: [
- "mallory answered “Which day?” with “Sunday”",
- "mallory added “Back by six.”",
- ],
- });
+ ).toEqual([
+ "mallory answered “What would you rather do this weekend?” with “Go hiking”",
+ "mallory answered “Which day?” with “Sunday”",
+ "mallory added “Back by six.”",
+ ]);
});
it("says an expired question went unanswered", () => {
- expect(settledCardNotice(questionsCard("expired"), assignee.id)?.text).toBe(
+ expect(noticeLines(questionsCard("expired"), assignee.id)).toEqual([
"No one answered “Please answer a few easy questions.” in time",
- );
+ ]);
});
it("keeps a waiting question a card", () => {
diff --git a/apps/web/src/features/rooms/cards/decision-question-view.tsx b/apps/web/src/features/rooms/cards/decision-question-view.tsx
index e7a2d468..9716ee26 100644
--- a/apps/web/src/features/rooms/cards/decision-question-view.tsx
+++ b/apps/web/src/features/rooms/cards/decision-question-view.tsx
@@ -7,10 +7,13 @@ import { useEffect, useRef, useState } from "react";
import { Button } from "@/components/ui/button";
import { Icon } from "@/components/ui/icon";
+import { translate } from "@/i18n/language";
+import { useT } from "@/i18n/use-translation";
import { AutoHeight } from "@/components/ui/auto-height";
import { CardBox, CardHeading } from "./card-shell";
+import { cardsMessages } from "./cards.messages";
import type { DecisionMessageCard } from "./decision-card";
import type { RoomCardDecision } from "./room-message-card-contract";
@@ -41,6 +44,7 @@ export function QuestionDecision({
messageId: string;
onDecision: (decision: RoomCardDecision) => Promise<void> | void;
}) {
+ const t = useT();
const [decisionError, setDecisionError] = useState<string | null>(null);
const [answers, setAnswers] = useState<AnswerMap>({});
const [stepIndex, setStepIndex] = useState(0);
@@ -66,7 +70,9 @@ export function QuestionDecision({
});
} catch (error) {
setDecisionError(
- error instanceof Error ? error.message : "Card decision failed.",
+ error instanceof Error
+ ? error.message
+ : translate(cardsMessages.cardDecisionFailed),
);
} finally {
setSubmitting(false);
@@ -125,7 +131,7 @@ export function QuestionDecision({
const written = writtenAnswer(activeQuestion, value).trim() !== "";
return (
- <CardBox label="Human interaction requested">
+ <CardBox label={t(cardsMessages.labelHumanInteraction)}>
<AutoHeight>
<div className={stepped ? "card-step-in" : undefined} key={stepIndex}>
<CardHeading>{activeQuestion.prompt}</CardHeading>
@@ -171,7 +177,7 @@ export function QuestionDecision({
{questions.length > 1 ? (
<>
<button
- aria-label="Previous question"
+ aria-label={t(cardsMessages.previousQuestion)}
className="inline-flex size-8 items-center justify-center rounded-md hover:bg-muted hover:text-app-ink disabled:opacity-35"
disabled={stepIndex === 0 || submitting}
onClick={() => goToStep(stepIndex - 1)}
@@ -183,7 +189,7 @@ export function QuestionDecision({
{stepIndex + 1} / {questions.length}
</span>
<button
- aria-label="Next question"
+ aria-label={t(cardsMessages.nextQuestion)}
className="inline-flex size-8 items-center justify-center rounded-md hover:bg-muted hover:text-app-ink disabled:opacity-35"
disabled={
submitting ||
@@ -197,11 +203,12 @@ export function QuestionDecision({
</button>
</>
) : checkbox ? (
- <span>Choose any</span>
+ <span>{t(cardsMessages.chooseAny)}</span>
) : null}
</div>
{checkbox || written ? (
<Button
+ data-voice-risk={isFinalStep ? "never" : undefined}
disabled={submitting || !hasAnswer(activeQuestion, value)}
onClick={() => {
if (isFinalStep) {
@@ -213,7 +220,7 @@ export function QuestionDecision({
size="large"
tone="primary"
>
- {isFinalStep ? "Send" : "Next"}
+ {t(isFinalStep ? cardsMessages.send : cardsMessages.next)}
</Button>
) : null}
</div>
@@ -241,6 +248,7 @@ function OtherRow({
question: InteractionQuestion;
value: string;
}) {
+ const t = useT();
const [writing, setWriting] = useState(value !== "");
const field = useRef<HTMLInputElement>(null);
useEffect(() => {
@@ -254,19 +262,21 @@ function OtherRow({
onClick={() => setWriting(true)}
type="button"
>
- Other…
+ {t(cardsMessages.other)}
</button>
);
}
return (
<label className="question-choice question-choice-writing">
<input
- aria-label={`Your own answer to ${question.prompt}`}
+ aria-label={t(cardsMessages.ownAnswerTo, {
+ question: question.prompt,
+ })}
className="min-w-0 flex-1 bg-transparent text-sm text-app-ink outline-none placeholder:text-app-placeholder"
disabled={disabled}
maxLength={question.input === "checkbox" ? 200 : 10000}
onChange={(event) => onWrite(event.target.value)}
- placeholder="Your own answer"
+ placeholder={t(cardsMessages.ownAnswer)}
ref={field}
value={value}
/>
diff --git a/apps/web/src/features/rooms/cards/decision-room-creation-view.tsx b/apps/web/src/features/rooms/cards/decision-room-creation-view.tsx
index 0c6d51c3..72ca6de3 100644
--- a/apps/web/src/features/rooms/cards/decision-room-creation-view.tsx
+++ b/apps/web/src/features/rooms/cards/decision-room-creation-view.tsx
@@ -2,7 +2,9 @@ import { UserGroupIcon } from "@hugeicons/core-free-icons";
import { Link } from "react-router";
import { Icon } from "@/components/ui/icon";
+import { RichMessage, useT } from "@/i18n/use-translation";
+import { cardsMessages } from "./cards.messages";
import { CreationMessagePreview } from "./creation-message-preview";
import type { DecisionMessageCard } from "./decision-card";
@@ -21,13 +23,23 @@ export function RoomCreationDecisionView({
actorDisplayNames?: Readonly<Record<string, string>>;
view: RoomCreationView;
}) {
+ const t = useT();
return (
<div className="space-y-1.5 text-xs text-app-muted">
<p className="[overflow-wrap:anywhere]">
- <span className="font-medium text-app-body">Members: </span>
- {view.member_ids
- .map((actorId) => actorDisplayNames[actorId] ?? actorId)
- .join(", ")}
+ <RichMessage
+ message={cardsMessages.membersLine}
+ tags={{
+ label: (text) => (
+ <span className="font-medium text-app-body">{text}</span>
+ ),
+ }}
+ values={{
+ names: view.member_ids
+ .map((actorId) => actorDisplayNames[actorId] ?? actorId)
+ .join(t(cardsMessages.listSeparator)),
+ }}
+ />
</p>
<CreationMessagePreview
actorDisplayNames={actorDisplayNames}
@@ -45,6 +57,7 @@ export function OpenCreatedRoomLink({
roomId: string;
tenantId: string;
}) {
+ const t = useT();
return (
<Link
className="typed-card-link"
@@ -53,7 +66,7 @@ export function OpenCreatedRoomLink({
)}/chat`}
>
<Icon icon={UserGroupIcon} size={14} />
- Open Room
+ {t(cardsMessages.openRoom)}
</Link>
);
}
diff --git a/apps/web/src/features/rooms/cards/decision-runtime-permission-view.tsx b/apps/web/src/features/rooms/cards/decision-runtime-permission-view.tsx
index 1c99edd5..cc7ea110 100644
--- a/apps/web/src/features/rooms/cards/decision-runtime-permission-view.tsx
+++ b/apps/web/src/features/rooms/cards/decision-runtime-permission-view.tsx
@@ -2,8 +2,10 @@ import { SquareLock02Icon } from "@hugeicons/core-free-icons";
import { useState } from "react";
import { Icon } from "@/components/ui/icon";
+import { useT } from "@/i18n/use-translation";
import { DetailBlock, FullCallBlock } from "./approval-card-parts";
+import { cardsMessages } from "./cards.messages";
import type { DecisionMessageCard } from "./decision-card";
type RuntimePermissionView = NonNullable<
@@ -43,21 +45,22 @@ export function PermissionScreenshot({
ownerName: string;
screenshot: NonNullable<RuntimePermissionView["screenshot"]>;
}) {
+ const t = useT();
const [failed, setFailed] = useState(false);
if (!canSee || failed) {
return (
<p className="flex items-center gap-1.5 rounded-lg bg-muted px-3 py-2 text-xs text-muted-foreground">
<Icon className="shrink-0" icon={SquareLock02Icon} size={14} />
{canSee
- ? "The screenshot is no longer available."
- : `Only ${ownerName} can see the screenshot.`}
+ ? t(cardsMessages.screenshotUnavailable)
+ : t(cardsMessages.screenshotOwnerOnly, { name: ownerName })}
</p>
);
}
return (
<figure className="m-0 overflow-hidden rounded-lg border border-app-border bg-app-surface">
<img
- alt="The screen before this action, with its target marked"
+ alt={t(cardsMessages.screenshotAlt)}
className="block h-auto w-full"
height={screenshot.height}
loading="lazy"
@@ -66,7 +69,7 @@ export function PermissionScreenshot({
width={screenshot.width}
/>
<figcaption className="border-t border-app-border bg-app-surface-soft px-3 py-1.5 text-xs text-app-muted">
- Before the action · the target is marked
+ {t(cardsMessages.screenshotCaption)}
</figcaption>
</figure>
);
@@ -87,9 +90,16 @@ export function diffStats(patch: string) {
}
function DiffBlock({ patch }: { patch: string }) {
+ const t = useT();
const { added, lines, removed } = diffStats(patch);
return (
- <DetailBlock label={`Diff · +${added} −${removed}`}>
+ <DetailBlock
+ // Line counts keep plain digits, as a diff tool writes them.
+ label={t(cardsMessages.diffLabel, {
+ added: String(added),
+ removed: String(removed),
+ })}
+ >
<div className="max-h-80 overflow-auto py-1 font-mono text-xs leading-5">
{lines.map((line, index) => (
<div
@@ -125,14 +135,17 @@ function ScriptBlock({
}: {
script: NonNullable<RuntimePermissionView["script"]>;
}) {
+ const t = useT();
const lines = script.body.split("\n");
return (
<DetailBlock
label={
- <>
- Script · {script.path}
- {script.sha256 ? ` · sha256 ${script.sha256.slice(0, 12)}` : null}
- </>
+ script.sha256
+ ? t(cardsMessages.scriptLabelWithHash, {
+ hash: script.sha256.slice(0, 12),
+ path: script.path,
+ })
+ : t(cardsMessages.scriptLabel, { path: script.path })
}
>
<div className="max-h-80 overflow-auto py-1 font-mono text-xs leading-5 text-app-ink">
@@ -157,6 +170,7 @@ function PageBlock({
}: {
page: NonNullable<RuntimePermissionView["page"]>;
}) {
+ const t = useT();
const element = [
page.target_role,
page.target_name && `"${page.target_name}"`,
@@ -164,15 +178,15 @@ function PageBlock({
.filter(Boolean)
.join(" ");
return (
- <DetailBlock label="Page element">
+ <DetailBlock label={t(cardsMessages.pageElement)}>
<dl className="grid grid-cols-[4.5rem_minmax(0,1fr)] gap-x-3 gap-y-1 px-3 py-2 text-xs leading-5">
- <dt className="text-app-muted">Page</dt>
+ <dt className="text-app-muted">{t(cardsMessages.pageUrl)}</dt>
<dd className="[overflow-wrap:anywhere] font-mono text-app-ink">
{page.url}
</dd>
{page.title ? (
<>
- <dt className="text-app-muted">Title</dt>
+ <dt className="text-app-muted">{t(cardsMessages.pageTitle)}</dt>
<dd className="[overflow-wrap:anywhere] text-app-ink">
{page.title}
</dd>
@@ -180,7 +194,7 @@ function PageBlock({
) : null}
{element ? (
<>
- <dt className="text-app-muted">Element</dt>
+ <dt className="text-app-muted">{t(cardsMessages.pageTarget)}</dt>
<dd className="[overflow-wrap:anywhere] font-mono text-app-ink">
{element}
</dd>
diff --git a/apps/web/src/features/rooms/cards/decision-search-key-view.test.tsx b/apps/web/src/features/rooms/cards/decision-search-key-view.test.tsx
index c11297d7..20d86238 100644
--- a/apps/web/src/features/rooms/cards/decision-search-key-view.test.tsx
+++ b/apps/web/src/features/rooms/cards/decision-search-key-view.test.tsx
@@ -9,10 +9,11 @@ import {
import { describe, expect, it, vi } from "vitest";
import { TeamHubRuntimeProvider } from "@/features/teamhub/teamhub-runtime";
+import { getTranslation } from "@/i18n/language";
import { createTestTeamHubRuntime } from "@/test/teamhub-test-runtime";
import { teamHubErrorResponse } from "@/test/teamhub-test-server";
-import { settledCardNotice } from "./card-notice";
+import { cardNoticeLines, settledCardNotice } from "./card-notice";
import { DecisionCard, type DecisionMessageCard } from "./decision-card";
const card: DecisionMessageCard = {
@@ -246,18 +247,26 @@ describe("Web search key notice", () => {
status: "answered" as const,
});
+ /** The system line a settled card becomes, as the reader sees it. */
+ function noticeText(next: DecisionMessageCard, viewerId: string) {
+ const notice = settledCardNotice(next, viewerId);
+ return (
+ notice &&
+ cardNoticeLines(notice, getTranslation())
+ .map((line) => line.parts.map((part) => part.text).join(""))
+ .join("\n")
+ );
+ }
+
it("names the backend whose key was saved", () => {
expect(
- settledCardNotice(
+ noticeText(
settled({ backend: "tavily", decision: "configured" }),
"alice",
- )?.text,
+ ),
).toBe("You added a Tavily key");
expect(
- settledCardNotice(
- settled({ backend: "brave", decision: "configured" }),
- "bob",
- )?.text,
+ noticeText(settled({ backend: "brave", decision: "configured" }), "bob"),
).toBe("Alice added a Brave Search key instead of Tavily");
});
diff --git a/apps/web/src/features/rooms/cards/room-card-decision-controller.ts b/apps/web/src/features/rooms/cards/room-card-decision-controller.ts
index fe2747a1..649da0ee 100644
--- a/apps/web/src/features/rooms/cards/room-card-decision-controller.ts
+++ b/apps/web/src/features/rooms/cards/room-card-decision-controller.ts
@@ -4,7 +4,9 @@ import {
TeamHubError,
} from "@/features/teamhub/teamhub-client";
import type { TeamHubMessage } from "@/features/teamhub/teamhub-types";
+import { translate } from "@/i18n/language";
+import { cardsMessages } from "./cards.messages";
import type { RoomCardDecision } from "./room-message-card-contract";
export function createRoomCardDecisionController({
@@ -120,7 +122,5 @@ function assertDecisionIdentity(
}
function invalidDecisionResult(): never {
- throw new Error(
- "Card decision response does not match the active Room command.",
- );
+ throw new Error(translate(cardsMessages.decisionMismatch));
}
diff --git a/apps/web/src/features/rooms/chat/another-me-intro.tsx b/apps/web/src/features/rooms/chat/another-me-intro.tsx
index 0ebac00e..55486c75 100644
--- a/apps/web/src/features/rooms/chat/another-me-intro.tsx
+++ b/apps/web/src/features/rooms/chat/another-me-intro.tsx
@@ -2,6 +2,9 @@ import { useEffect, useRef, useState } from "react";
import { createPortal } from "react-dom";
import { ActorAvatar } from "@/features/rooms/members/actor-avatar";
+import { useT } from "@/i18n/use-translation";
+
+import { chatMessages } from "./chat.messages";
/** How long Another Me holds its greeting before it moves to the sidebar. */
const GREETING_HOLD_MS = 2400;
@@ -28,6 +31,7 @@ export function AnotherMeIntro({
humanName: string;
onDone: () => void;
}) {
+ const t = useT();
const backdropRef = useRef<HTMLDivElement>(null);
const avatarRef = useRef<HTMLDivElement>(null);
const textRef = useRef<HTMLDivElement>(null);
@@ -108,10 +112,12 @@ export function AnotherMeIntro({
role="status"
>
<p className="text-2xl text-foreground">
- Hi{humanName ? `, ${humanName}` : ""}
+ {humanName
+ ? t(chatMessages.introGreetingNamed, { name: humanName })
+ : t(chatMessages.introGreeting)}
</p>
<p className="mt-1 text-sm text-muted-foreground">
- {`I'm ${agent.display_name}.`}
+ {t(chatMessages.introSelf, { name: agent.display_name })}
</p>
</div>
</div>
diff --git a/apps/web/src/features/rooms/chat/background-tasks-indicator.test.tsx b/apps/web/src/features/rooms/chat/background-tasks-indicator.test.tsx
index 297a7153..6ff1e715 100644
--- a/apps/web/src/features/rooms/chat/background-tasks-indicator.test.tsx
+++ b/apps/web/src/features/rooms/chat/background-tasks-indicator.test.tsx
@@ -11,6 +11,7 @@ import { describe, expect, it, vi } from "vitest";
import { createTestTeamHubRuntime } from "@/test/teamhub-test-runtime";
import type { TestRouteRequest } from "@/test/teamhub-test-server";
import type { TeamHubRoomBackgroundTask } from "@/features/teamhub/teamhub-types";
+import { translate } from "@/i18n/language";
import {
BackgroundTasksIndicator,
BackgroundTasksPill,
@@ -157,8 +158,8 @@ describe("BackgroundTasksIndicator", () => {
describe("runningFor", () => {
it("uses the coarsest unit that fits", () => {
- expect(runningFor("2026-10-28T14:30:30Z", now)).toBe("just now");
- expect(runningFor("2026-10-28T12:00:00Z", now)).toBe("2 h");
- expect(runningFor("2026-10-25T14:31:00Z", now)).toBe("3 d");
+ expect(runningFor("2026-10-28T14:30:30Z", now, translate)).toBe("just now");
+ expect(runningFor("2026-10-28T12:00:00Z", now, translate)).toBe("2 h");
+ expect(runningFor("2026-10-25T14:31:00Z", now, translate)).toBe("3 d");
});
});
diff --git a/apps/web/src/features/rooms/chat/background-tasks-indicator.tsx b/apps/web/src/features/rooms/chat/background-tasks-indicator.tsx
index bbad7866..2f4aab4f 100644
--- a/apps/web/src/features/rooms/chat/background-tasks-indicator.tsx
+++ b/apps/web/src/features/rooms/chat/background-tasks-indicator.tsx
@@ -2,9 +2,13 @@ import { ArrowUp01Icon } from "@hugeicons/core-free-icons";
import { lazy, Suspense, useEffect, useId, useRef, useState } from "react";
import { Icon } from "@/components/ui/icon";
+import { commonMessages } from "@/i18n/common.messages";
+import type { Translate } from "@/i18n/language";
+import { useT } from "@/i18n/use-translation";
import { cn } from "@/lib/cn";
import type { TeamHubClient } from "@/features/teamhub/teamhub-client";
import type { TeamHubRoomBackgroundTask } from "@/features/teamhub/teamhub-types";
+import { runtimeStatusMessages as m } from "../runtime-status/runtime-status.messages";
import { CancelTaskButton } from "./cancel-task-button";
import {
useCancelRoomBackgroundTask,
@@ -75,6 +79,7 @@ export function BackgroundTasksPill({
onOpen?: (task: TeamHubRoomBackgroundTask) => void;
tasks: readonly TeamHubRoomBackgroundTask[];
}) {
+ const t = useT();
const [open, setOpen] = useState(false);
const root = useRef<HTMLDivElement>(null);
const listId = useId();
@@ -101,12 +106,12 @@ export function BackgroundTasksPill({
>
{open ? (
<section
- aria-label="Background tasks"
+ aria-label={t(m.backgroundTasks)}
className="absolute bottom-full left-1/2 mb-1.5 w-[min(360px,calc(100vw-48px))] -translate-x-1/2 rounded-xl bg-popover p-1.5 shadow-md"
id={listId}
>
<p className="px-2 pt-1 pb-1.5 text-[12px] leading-[18px] font-[470] text-app-muted">
- Background tasks
+ {t(m.backgroundTasks)}
</p>
<ul className="flex flex-col">
{tasks.map((task) => (
@@ -115,7 +120,7 @@ export function BackgroundTasksPill({
key={task.id}
>
<button
- aria-label={`Open task ${task.title}`}
+ aria-label={t(m.openTask, { title: task.title })}
className="grid min-w-0 flex-1 grid-cols-[6px_minmax(0,1fr)_auto] items-baseline gap-x-2.5 rounded-md py-1.5 pr-1 pl-2 text-left focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-app-focus disabled:cursor-default"
disabled={!onOpen}
onClick={() => {
@@ -132,7 +137,7 @@ export function BackgroundTasksPill({
{task.title}
</span>
<span className="text-[12px] leading-[18px] text-app-muted tabular-nums">
- {runningFor(task.created_at, now)}
+ {runningFor(task.created_at, now, t)}
</span>
<span className="col-span-2 col-start-2 truncate text-[12px] leading-[18px] text-app-muted">
{task.requirement}
@@ -162,9 +167,7 @@ export function BackgroundTasksPill({
aria-hidden="true"
className="size-[11px] animate-spin rounded-full border-[1.5px] border-app-border-strong border-t-app-link motion-reduce:animate-none"
/>
- {count === 1
- ? "1 task running in the background"
- : `${count} tasks running in the background`}
+ {t(m.backgroundTasksRunning, { count })}
<span
className={cn(
"inline-flex text-app-muted transition-transform",
@@ -179,13 +182,15 @@ export function BackgroundTasksPill({
}
/** How long a Task has been running, in the coarsest unit that fits. */
-export function runningFor(createdAt: string, now: number) {
+export function runningFor(createdAt: string, now: number, t: Translate) {
const minutes = Math.max(
0,
Math.floor((now - new Date(createdAt).getTime()) / 60_000),
);
- if (minutes < 1) return "just now";
- if (minutes < 60) return `${minutes} min`;
+ if (minutes < 1) return t(commonMessages.justNow);
+ if (minutes < 60) return t(m.runningMinutes, { minutes });
const hours = Math.floor(minutes / 60);
- return hours < 24 ? `${hours} h` : `${Math.floor(hours / 24)} d`;
+ return hours < 24
+ ? t(m.runningHours, { hours })
+ : t(m.runningDays, { days: Math.floor(hours / 24) });
}
diff --git a/apps/web/src/features/rooms/chat/cancel-task-button.tsx b/apps/web/src/features/rooms/chat/cancel-task-button.tsx
index bc7c8d47..f256ae5c 100644
--- a/apps/web/src/features/rooms/chat/cancel-task-button.tsx
+++ b/apps/web/src/features/rooms/chat/cancel-task-button.tsx
@@ -1,8 +1,12 @@
import { useState } from "react";
import { Button } from "@/components/ui/button";
+import { commonMessages } from "@/i18n/common.messages";
+import { useT } from "@/i18n/use-translation";
import { cn } from "@/lib/cn";
+import { runtimeStatusMessages as m } from "../runtime-status/runtime-status.messages";
+
/**
* Cancels one Task's current turn. The Room's Meta is told and can resume
* it later, so no confirmation is asked.
@@ -17,13 +21,14 @@ export function CancelTaskButton({
prominent?: boolean;
title: string;
}) {
+ const t = useT();
const [state, setState] = useState<"idle" | "pending" | "error">("idle");
return (
<Button
aria-label={
state === "error"
- ? `Cancel of ${title} was not confirmed; retry`
- : `Cancel ${title}`
+ ? t(m.cancelTaskNotConfirmed, { title })
+ : t(m.cancelTask, { title })
}
className={cn(
!prominent &&
@@ -43,12 +48,12 @@ export function CancelTaskButton({
type="button"
>
{state === "pending"
- ? "Canceling"
+ ? t(m.canceling)
: state === "error"
- ? "Retry"
+ ? t(commonMessages.retry)
: prominent
- ? "Cancel task"
- : "Cancel"}
+ ? t(m.cancelTaskAction)
+ : t(commonMessages.cancel)}
</Button>
);
}
diff --git a/apps/web/src/features/rooms/chat/card-notice-rows.tsx b/apps/web/src/features/rooms/chat/card-notice-rows.tsx
index 5ce012a4..eb6365f0 100644
--- a/apps/web/src/features/rooms/chat/card-notice-rows.tsx
+++ b/apps/web/src/features/rooms/chat/card-notice-rows.tsx
@@ -1,6 +1,13 @@
+import { Fragment } from "react";
import { Link } from "react-router";
-import type { CardNotice, NoticeTarget } from "../cards/card-notice";
+import { useTranslation } from "@/i18n/use-translation";
+
+import {
+ cardNoticeLines,
+ type CardNotice,
+ type NoticeTarget,
+} from "../cards/card-notice";
const pillClass =
"inline-block max-w-full rounded-[14px] bg-muted px-3 py-1 text-center text-xs leading-[18px] text-muted-foreground [overflow-wrap:anywhere]";
@@ -17,26 +24,28 @@ export function CardNoticeRows({
notice: CardNotice;
tenantId: string;
}) {
+ const translation = useTranslation();
return (
<div
className="room-notice-row flex flex-col items-center gap-1.5 py-1"
data-message-kind="card_notice"
role="note"
>
- <span className={pillClass}>
- {notice.text}
- {notice.link ? (
- <Link
- className="font-medium text-app-ink underline-offset-2 hover:underline"
- to={targetPath(tenantId, notice.link.to)}
- >
- {notice.link.label}
- </Link>
- ) : null}
- </span>
- {notice.more?.map((line) => (
- <span className={pillClass} key={line}>
- {line}
+ {cardNoticeLines(notice, translation).map((line, lineIndex) => (
+ <span className={pillClass} key={lineIndex}>
+ {line.parts.map((part, partIndex) =>
+ part.tag === "link" && line.link ? (
+ <Link
+ className="font-medium text-app-ink underline-offset-2 hover:underline"
+ key={partIndex}
+ to={targetPath(tenantId, line.link)}
+ >
+ {part.text}
+ </Link>
+ ) : (
+ <Fragment key={partIndex}>{part.text}</Fragment>
+ ),
+ )}
</span>
))}
</div>
diff --git a/apps/web/src/features/rooms/chat/chat.messages.ts b/apps/web/src/features/rooms/chat/chat.messages.ts
new file mode 100644
index 00000000..ee4b33f2
--- /dev/null
+++ b/apps/web/src/features/rooms/chat/chat.messages.ts
@@ -0,0 +1,162 @@
+import { defineMessages } from "@/i18n/messages";
+
+/** The chat area: the timeline, Message rows and their actions, Threads. */
+export const chatMessages = defineMessages("chat", {
+ messageTime: "{date} at {time}",
+ mentionAuthor: "Mention {name}",
+ authorUnavailable: "{name} is unavailable right now",
+ authorNotInRoom: "{name} is no longer in this Room",
+ scheduledTask: "Scheduled task: {name}",
+ replyContext: "Reply context",
+ pendingReplyContext: "Pending reply context",
+ forwardMessage: "Forward message",
+ replyToMessage: "Reply to message",
+ replyToThread: "Reply to thread",
+ addReaction: "Add reaction",
+ copyMessage: "Copy message",
+ moreMessageActions: "More message actions",
+ sending: "Sending...",
+ deliveryUnknown: "Delivery status unknown",
+ notSent: "Not sent",
+ connectFailed: "Failed to connect to the server...",
+ // File and Document attachments.
+ openFile: "Open {name}",
+ previewFile: "Preview {name}",
+ fileUnavailable: "{name} is unavailable",
+ loadingFile: "Loading {name}",
+ loadingImage: "Loading image...",
+ fileCount: { one: "{count} file", other: "{count} files" },
+ folderCount: { one: "{count} folder", other: "{count} folders" },
+ fileTypeArchive: "Archive",
+ fileTypeAudio: "Audio",
+ fileTypeCode: "Code",
+ fileTypeDocument: "Document",
+ fileTypeImage: "Image",
+ fileTypeVideo: "Video",
+ fileTypeWorkflow: "Workflow",
+ fileTypeText: "Text",
+ fileTypeOnlineDocument: "Online document",
+ untitledDocument: "Document",
+ // Timeline chrome.
+ emptyTimelineTitle: "Start the conversation",
+ emptyTimelineBody: "Messages are shared with every current Room member.",
+ loadingEarlierMessages: "Loading earlier Messages",
+ jumpToLatest: "Jump to latest messages",
+ roomTimeline: "Room timeline",
+ // Room notices.
+ noticeAgentCreated:
+ "<author>{author}</author> created <agent>{agent}</agent> and added it to this Room",
+ noticeAgentCreatedAfterYourApproval:
+ "<author>{author}</author> created <agent>{agent}</agent> after your approval",
+ noticeAgentCreatedAfterApproval:
+ "<author>{author}</author> created <agent>{agent}</agent> after {approver}'s approval",
+ noticeMemberAdded:
+ "<author>{author}</author> added <member>{member}</member> to this Room",
+ noticeAgentSetUpOwnIdentity:
+ "{before} set up its identity as <agent>{agent}</agent>",
+ noticeAgentSetUpBy:
+ "<author>{author}</author> set up {before} as <agent>{agent}</agent>",
+ noticeAgentUpdated:
+ "<author>{author}</author> updated <agent>{agent}</agent>",
+ noticeFieldName: "name",
+ noticeFieldDescription: "description",
+ noticeFieldPrompt: "prompt",
+ noticeFieldInstructions: "instructions",
+ listSeparator: ", ",
+ viewProfile: "View profile",
+ openDirectChat: "Open direct chat",
+ hideChanges: "Hide changes",
+ showChanges: "Show changes",
+ instructionsUpdated: "Instructions updated",
+ viewInAgentInfo: "View in Agent Info",
+ // Threads.
+ replyCount: { one: "{count} reply", other: "{count} replies" },
+ openThread: "Open thread, {replies}",
+ messageThread: "Message Thread",
+ thread: "Thread",
+ replyInThread: "Reply in Thread",
+ replyInThisThread: "Reply in this Thread",
+ openingThread: "Opening Thread…",
+ threadStillOpening: "Thread is still opening.",
+ threadTimeline: "Thread timeline",
+ replies: "Replies",
+ loadEarlierReplies: "Load earlier replies",
+ // A Room the reader has left.
+ leftRoom: "You left this room. Rejoin to send and receive messages.",
+ joining: "Joining...",
+ joinRoom: "Join {name}",
+ // Reactions.
+ reactions: "Reactions",
+ formerMember: "Former member",
+ agentReactor: "{name} (Agent)",
+ reactionSummary: "{emoji} {count}: {names}",
+ reactionNotSaved: "Reaction was not saved. Try again.",
+ searchResults: "Search results",
+ recommended: "Recommended",
+ searchAllEmoji: "Search all emoji",
+ searchEmoji: "Search emoji",
+ emojiCategories: "Emoji categories",
+ emoji: "Emoji",
+ loadingEmoji: "Loading emoji…",
+ noMatchingEmoji: "No matching emoji",
+ emojiPeople: "Smileys & People",
+ emojiNature: "Animals & Nature",
+ emojiFoods: "Food & Drink",
+ emojiActivity: "Activity",
+ emojiPlaces: "Travel & Places",
+ emojiObjects: "Objects",
+ emojiSymbols: "Symbols",
+ emojiFlags: "Flags",
+ // Message bodies.
+ sourceLinkUnavailable: "Source link unavailable",
+ copyCode: "Copy code",
+ widgetActions: "Widget actions",
+ copyToClipboard: "Copy to clipboard",
+ downloadFile: "Download file",
+ filePreviewUnavailable: "File preview is unavailable",
+ profileSources: "Profile sources",
+ introGreeting: "Hi",
+ introGreetingNamed: "Hi, {name}",
+ introSelf: "I'm {name}.",
+ // Meeting notes.
+ meetingNotes: "Meeting notes",
+ meetingSummary: "Meeting summary",
+ pullingKeyPoints: "Pulling the key points out of the transcript…",
+ fullNotesReady: "Full meeting notes are ready",
+ fullNotesSoon:
+ "Full meeting notes in a few minutes, in <link>Library › Meetings</link>",
+ // Forwarding a Message.
+ forwardTargetChanged:
+ "A target changed while forwarding. Refresh and try again.",
+ forwardFailed:
+ "The message could not be forwarded. You may not have permission to share one of its documents.",
+ forwardTo: "Forward to",
+ forward: "Forward",
+ searchForwardTargets: "Search forward targets",
+ forwardAgents: "Agents",
+ forwardRooms: "Rooms",
+ selectedForwardTargets: "Selected forward targets",
+ removeSelectedTarget: "Remove selected target",
+ targetSelected: "Selected",
+ selectTarget: "Select",
+ // An email drafted on a canvas.
+ email: "Email",
+ emailNoSubject: "No subject",
+ openInSidePanel: "Open in side panel",
+ collapseEmail: "Collapse email",
+ expandEmail: "Expand email",
+ emailTo: "To {recipients}",
+ emailNoRecipients: "No recipients",
+ emailSent: "Sent",
+ emailSending: "Sending…",
+ emailResultUnknown: "Result unknown",
+ emailResultUnknownWithError: "Result unknown: {error}",
+ emailFailed: "Failed",
+ emailFailedWithError: "Failed: {error}",
+ approvalActions: "Approval actions",
+ emailSend: "Send",
+ emailSendAgain: "Send again",
+ emailDontSend: "Don't send",
+ emailSendFrom: "Send from",
+ gmailAccount: "Gmail account",
+});
diff --git a/apps/web/src/features/rooms/chat/jump-to-latest-button.tsx b/apps/web/src/features/rooms/chat/jump-to-latest-button.tsx
index 807d690a..6b1fc13b 100644
--- a/apps/web/src/features/rooms/chat/jump-to-latest-button.tsx
+++ b/apps/web/src/features/rooms/chat/jump-to-latest-button.tsx
@@ -1,8 +1,10 @@
import { ArrowDown02Icon } from "@hugeicons/core-free-icons";
import { Icon } from "@/components/ui/icon";
+import { useT } from "@/i18n/use-translation";
import { RunningDots } from "../task-sidebar/running-dots";
+import { chatMessages } from "./chat.messages";
/**
* Floats above the composer while the reader is away from the newest Message.
@@ -16,9 +18,10 @@ export function JumpToLatestButton({
agentWorking: boolean;
onClick: () => void;
}) {
+ const t = useT();
return (
<button
- aria-label="Jump to latest messages"
+ aria-label={t(chatMessages.jumpToLatest)}
className="app-floating-enter absolute bottom-3 left-1/2 z-10 inline-flex size-9 -translate-x-1/2 items-center justify-center rounded-full border border-border bg-background text-muted-foreground shadow-md transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
data-agent-working={agentWorking}
onClick={onClick}
diff --git a/apps/web/src/features/rooms/chat/message-card.tsx b/apps/web/src/features/rooms/chat/message-card.tsx
index fa2fa5d3..6e1152e2 100644
--- a/apps/web/src/features/rooms/chat/message-card.tsx
+++ b/apps/web/src/features/rooms/chat/message-card.tsx
@@ -1,6 +1,9 @@
import type { ReactNode } from "react";
import { Link } from "react-router";
+import { commonMessages } from "@/i18n/common.messages";
+import { useT } from "@/i18n/use-translation";
+
import { ActorAvatar } from "../members/actor-avatar";
import { useProfileCardContent } from "./profile-card-content";
@@ -64,6 +67,7 @@ function MessageCardLayout({
}: MessageCardProps & {
profileContent?: ReturnType<typeof useProfileCardContent>;
}) {
+ const t = useT();
if (!profile) {
// A delivery shows only its files, like any Message's files; the Agent
// says what they are in its own words. A card without files, or a
@@ -142,7 +146,7 @@ function MessageCardLayout({
className="inline-flex min-h-9 items-center justify-center rounded-full border border-app-border px-4 text-sm font-medium text-app-ink transition-colors hover:bg-app-surface-soft focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-app-focus"
to={profile.wikiPath}
>
- Open
+ {t(commonMessages.open)}
</Link>
</div>
) : null}
diff --git a/apps/web/src/features/rooms/chat/message-forward-dialog.tsx b/apps/web/src/features/rooms/chat/message-forward-dialog.tsx
index b4b0aa02..c4a43887 100644
--- a/apps/web/src/features/rooms/chat/message-forward-dialog.tsx
+++ b/apps/web/src/features/rooms/chat/message-forward-dialog.tsx
@@ -17,7 +17,11 @@ import {
type TeamHubClient,
} from "@/features/teamhub/teamhub-client";
import type { TeamHubMessage } from "@/features/teamhub/teamhub-types";
+import { commonMessages } from "@/i18n/common.messages";
+import { translate } from "@/i18n/language";
+import { useT } from "@/i18n/use-translation";
import { tenantActorsQueryOptions } from "../room-queries";
+import { chatMessages } from "./chat.messages";
type TargetKind = "agent" | "room";
@@ -38,6 +42,7 @@ export function MessageForwardDialog({
const [query, setQuery] = useState("");
const [sending, setSending] = useState(false);
const [error, setError] = useState<string | null>(null);
+ const t = useT();
const actors = useQuery(tenantActorsQueryOptions(client, tenantId));
const rooms = useQuery({
queryFn: () =>
@@ -92,8 +97,8 @@ export function MessageForwardDialog({
} catch (forwardError) {
setError(
forwardError instanceof TeamHubError && forwardError.status === 409
- ? "A target changed while forwarding. Refresh and try again."
- : "The message could not be forwarded. You may not have permission to share one of its documents.",
+ ? translate(chatMessages.forwardTargetChanged)
+ : translate(chatMessages.forwardFailed),
);
} finally {
setSending(false);
@@ -105,18 +110,18 @@ export function MessageForwardDialog({
closeOnBackdrop
onClose={onClose}
size="lg"
- title="Forward to"
+ title={t(chatMessages.forwardTo)}
footer={
<>
<Button onClick={onClose} tone="ghost">
- Cancel
+ {t(commonMessages.cancel)}
</Button>
<Button
disabled={!selected.length}
loading={sending}
onClick={() => void forward()}
>
- <Icon icon={SentIcon} size={16} /> Forward
+ <Icon icon={SentIcon} size={16} /> {t(chatMessages.forward)}
</Button>
</>
}
@@ -130,17 +135,17 @@ export function MessageForwardDialog({
}}
>
<input
- aria-label="Search forward targets"
+ aria-label={t(chatMessages.searchForwardTargets)}
className="h-11 min-w-0 flex-1 rounded-md border border-app-border px-3 text-sm outline-none focus:border-app-focus"
onChange={(event) => setSearchInput(event.target.value)}
onKeyDown={(event) => {
if (event.key === "Enter") setQuery(searchInput);
}}
- placeholder="Search"
+ placeholder={t(commonMessages.search)}
value={searchInput}
/>
<Button
- aria-label="Search"
+ aria-label={t(commonMessages.search)}
size="icon"
tone="secondary"
type="submit"
@@ -159,19 +164,22 @@ export function MessageForwardDialog({
size="compact"
tone={kind === targetKind ? "primary" : "secondary"}
>
- {targetKind === "agent" ? "Agents" : "Rooms"}
+ {targetKind === "agent"
+ ? t(chatMessages.forwardAgents)
+ : t(chatMessages.forwardRooms)}
</Button>
))}
</div>
{selected.length ? (
<div
- aria-label="Selected forward targets"
+ aria-label={t(chatMessages.selectedForwardTargets)}
className="mt-3 flex flex-wrap gap-2"
>
{selected.map((targetId) => {
const target = targetById.get(targetId);
return (
<button
+ data-voice-risk="never"
aria-pressed="true"
className="inline-flex items-center gap-1 rounded-full bg-app-selected px-2.5 py-1 text-xs text-app-ink"
key={targetId}
@@ -180,7 +188,7 @@ export function MessageForwardDialog({
current.filter((id) => id !== targetId),
)
}
- title="Remove selected target"
+ title={t(chatMessages.removeSelectedTarget)}
type="button"
>
<Icon icon={Tick02Icon} size={14} />{" "}
@@ -209,7 +217,9 @@ export function MessageForwardDialog({
>
<span className="text-sm text-app-ink">{target.label}</span>
<span className="text-xs text-app-muted">
- {checked ? "Selected" : "Select"}
+ {checked
+ ? t(chatMessages.targetSelected)
+ : t(chatMessages.selectTarget)}
</span>
</button>
);
diff --git a/apps/web/src/features/rooms/chat/message-grouping.ts b/apps/web/src/features/rooms/chat/message-grouping.ts
index 2f4e5a20..38606a68 100644
--- a/apps/web/src/features/rooms/chat/message-grouping.ts
+++ b/apps/web/src/features/rooms/chat/message-grouping.ts
@@ -1,24 +1,42 @@
import type { TeamHubMessage } from "@/features/teamhub/teamhub-types";
+import { formatLocale, type Translation } from "@/i18n/language";
import { dateTimeFormat } from "@/lib/date-format";
import { settledCardNotice } from "../cards/card-notice";
import { knownRoomMessageCard } from "../cards/room-message-card";
+import { chatMessages } from "./chat.messages";
-const messageDateFormatter = dateTimeFormat({
- weekday: "long",
- month: "long",
- day: "numeric",
- year: "numeric",
-});
-const messageClockFormatter = dateTimeFormat({
- hour: "numeric",
- minute: "2-digit",
-});
+const messageTimeFormatters = new Map<
+ string,
+ { date: Intl.DateTimeFormat; clock: Intl.DateTimeFormat }
+>();
+
+function messageTimeFormatter(locale: string) {
+ let formatters = messageTimeFormatters.get(locale);
+ if (!formatters) {
+ formatters = {
+ date: dateTimeFormat(
+ { weekday: "long", month: "long", day: "numeric", year: "numeric" },
+ locale,
+ ),
+ clock: dateTimeFormat({ hour: "numeric", minute: "2-digit" }, locale),
+ };
+ messageTimeFormatters.set(locale, formatters);
+ }
+ return formatters;
+}
/** Conversation separator, e.g. "Friday, October 23, 2026 at 3:04 PM". */
-export function formatMessageTime(timestamp: string) {
- const date = new Date(timestamp);
- return `${messageDateFormatter.format(date)} at ${messageClockFormatter.format(date)}`;
+export function formatMessageTime(
+ timestamp: string,
+ { language, t }: Translation,
+) {
+ const value = new Date(timestamp);
+ const { date, clock } = messageTimeFormatter(formatLocale(language));
+ return t(chatMessages.messageTime, {
+ date: date.format(value),
+ time: clock.format(value),
+ });
}
export function messageStartsConversation(
diff --git a/apps/web/src/features/rooms/chat/message-html-fragment.tsx b/apps/web/src/features/rooms/chat/message-html-fragment.tsx
index 3da28fd0..3f9ea8d7 100644
--- a/apps/web/src/features/rooms/chat/message-html-fragment.tsx
+++ b/apps/web/src/features/rooms/chat/message-html-fragment.tsx
@@ -7,8 +7,11 @@ import {
import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
import { Icon } from "@/components/ui/icon";
+import { commonMessages } from "@/i18n/common.messages";
+import { useT } from "@/i18n/use-translation";
import { writeClipboardText } from "@/lib/clipboard";
+import { chatMessages } from "./chat.messages";
import {
appFontFaces,
currentFragmentTheme,
@@ -181,6 +184,7 @@ function FragmentHostActions({ html, title }: { html: string; title: string }) {
const rootRef = useRef<HTMLDivElement>(null);
const [open, setOpen] = useState(false);
const [copied, setCopied] = useState(false);
+ const t = useT();
useEffect(() => {
if (!open) return;
@@ -212,7 +216,7 @@ function FragmentHostActions({ html, title }: { html: string; title: string }) {
<button
aria-expanded={open}
aria-haspopup="menu"
- aria-label="Widget actions"
+ aria-label={t(chatMessages.widgetActions)}
className="flex size-7 items-center justify-center rounded-md border border-transparent bg-app-surface text-app-muted shadow-sm transition-colors hover:bg-app-hover hover:text-app-ink"
onClick={() => setOpen((current) => !current)}
type="button"
@@ -242,7 +246,9 @@ function FragmentHostActions({ html, title }: { html: string; title: string }) {
) : (
<Icon icon={Copy01Icon} size={16} />
)}
- {copied ? "Copied" : "Copy to clipboard"}
+ {copied
+ ? t(commonMessages.copied)
+ : t(chatMessages.copyToClipboard)}
</button>
<button
className="flex w-full shrink-0 items-center gap-2.5 whitespace-nowrap rounded-lg px-2 py-2 text-left text-sm text-app-ink hover:bg-app-hover"
@@ -254,7 +260,7 @@ function FragmentHostActions({ html, title }: { html: string; title: string }) {
type="button"
>
<Icon icon={Download04Icon} size={16} />
- Download file
+ {t(chatMessages.downloadFile)}
</button>
</div>
) : null}
diff --git a/apps/web/src/features/rooms/chat/message-mail-canvas.tsx b/apps/web/src/features/rooms/chat/message-mail-canvas.tsx
index ff683b18..5269401a 100644
--- a/apps/web/src/features/rooms/chat/message-mail-canvas.tsx
+++ b/apps/web/src/features/rooms/chat/message-mail-canvas.tsx
@@ -23,6 +23,7 @@ import { Icon } from "@/components/ui/icon";
import { Select, SelectItem } from "@/components/ui/select";
import { useTeamHubRuntime } from "@/features/teamhub/teamhub-runtime";
import { useWikiDocumentLinks } from "@/features/wiki/wiki-document-links";
+import { useT } from "@/i18n/use-translation";
import { cn } from "@/lib/cn";
import { CardActions, CardRowDetails } from "../cards/approval-card-parts";
import { CardBox, CardDone } from "../cards/card-shell";
@@ -33,6 +34,7 @@ import {
import "../documents/room-document-blocknote.css";
import { UnifiedDocumentBody } from "../documents/unified-document-body";
import { useUnifiedDocumentPageModel } from "../documents/use-unified-document-page-model";
+import { chatMessages } from "./chat.messages";
const iconButton =
"inline-flex size-7 shrink-0 items-center justify-center rounded-md text-app-muted transition-colors duration-150 hover:bg-accent hover:text-app-ink focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-app-focus motion-reduce:transition-none";
@@ -61,10 +63,11 @@ export function MessageMailCanvas({
const mail = useMailCanvasSend(client, documentId, editorSaved);
const { refresh } = mail;
const editorId = useId();
+ const t = useT();
if (!mail.mail) return fallback;
const { subject, to } = mail.mail;
return (
- <CardBox label="Email">
+ <CardBox label={t(chatMessages.email)}>
<h3 className="-mx-2 flex min-h-9 w-[calc(100%+1rem)] items-center gap-1 rounded-lg pr-1 transition-colors duration-150 hover:bg-accent motion-reduce:transition-none">
<button
aria-controls={editorId}
@@ -79,14 +82,14 @@ export function MessageMailCanvas({
size={16}
/>
<span className="min-w-0 flex-1 text-sm font-semibold text-app-ink [overflow-wrap:anywhere]">
- {subject.trim() || "No subject"}
+ {subject.trim() || t(chatMessages.emailNoSubject)}
</span>
</button>
<button
- aria-label="Open in side panel"
+ aria-label={t(chatMessages.openInSidePanel)}
className={iconButton}
onClick={onOpen}
- title="Open in side panel"
+ title={t(chatMessages.openInSidePanel)}
type="button"
>
<Icon icon={ArrowExpand01Icon} size={14} />
@@ -94,7 +97,9 @@ export function MessageMailCanvas({
<button
aria-controls={editorId}
aria-expanded={open}
- aria-label={open ? "Collapse email" : "Expand email"}
+ aria-label={
+ open ? t(chatMessages.collapseEmail) : t(chatMessages.expandEmail)
+ }
className={iconButton}
onClick={() => setOpen((current) => !current)}
type="button"
@@ -111,7 +116,9 @@ export function MessageMailCanvas({
</h3>
<AutoHeight open={!open}>
<p className="pt-1 text-sm text-app-muted [overflow-wrap:anywhere]">
- {to ? `To ${to}` : "No recipients"}
+ {to
+ ? t(chatMessages.emailTo, { recipients: to })
+ : t(chatMessages.emailNoRecipients)}
</p>
</AutoHeight>
<div id={editorId}>
@@ -207,17 +214,30 @@ function MailCardFooter({
}: {
mail: ReturnType<typeof useMailCanvasSend>;
}) {
+ const t = useT();
const { status } = mail;
const error = mail.mail?.error;
if (status === "sent")
- return <CardDone icon={Tick02Icon} text="Sent" tone="success" />;
+ return (
+ <CardDone
+ icon={Tick02Icon}
+ text={t(chatMessages.emailSent)}
+ tone="success"
+ />
+ );
if (status === "declined")
- return <CardDone icon={Cancel01Icon} text="Not sent" tone="muted" />;
+ return (
+ <CardDone
+ icon={Cancel01Icon}
+ text={t(chatMessages.notSent)}
+ tone="muted"
+ />
+ );
if (mail.busy)
return (
<CardDone
icon={Loading03Icon}
- text={progressLabel[status ?? "queued"] ?? "Sending…"}
+ text={progressLabel[status ?? "queued"] ?? t(chatMessages.emailSending)}
tone="muted"
/>
);
@@ -225,13 +245,21 @@ function MailCardFooter({
status === "unknown" ? (
<CardDone
icon={HelpCircleIcon}
- text={error ? `Result unknown: ${error}` : "Result unknown"}
+ text={
+ error
+ ? t(chatMessages.emailResultUnknownWithError, { error })
+ : t(chatMessages.emailResultUnknown)
+ }
tone="warning"
/>
) : status === "failed" ? (
<CardDone
icon={AlertCircleIcon}
- text={error ? `Failed: ${error}` : "Failed"}
+ text={
+ error
+ ? t(chatMessages.emailFailedWithError, { error })
+ : t(chatMessages.emailFailed)
+ }
tone="danger"
/>
) : null;
@@ -241,34 +269,42 @@ function MailCardFooter({
<>
{receipt}
<CardActions>
- <div aria-label="Approval actions" className="flex gap-2" role="group">
+ <div
+ aria-label={t(chatMessages.approvalActions)}
+ className="flex gap-2"
+ role="group"
+ >
<Button
+ data-voice-risk="never"
disabled={!mail.canSend || mail.declining}
onClick={mail.send}
size="large"
tone="primary"
>
- {status === "unknown" ? "Send again" : "Send"}
+ {status === "unknown"
+ ? t(chatMessages.emailSendAgain)
+ : t(chatMessages.emailSend)}
</Button>
<Button
+ data-voice-risk="never"
disabled={mail.declining}
onClick={mail.decline}
size="large"
tone="ghost"
>
- Don&apos;t send
+ {t(chatMessages.emailDontSend)}
</Button>
</div>
{mail.accounts.length > 1 && mail.account ? (
<Select
- aria-label="Send from"
+ aria-label={t(chatMessages.emailSendFrom)}
onValueChange={mail.choose}
value={mail.account.id}
variant="pill"
>
{mail.accounts.map((account) => (
<SelectItem key={account.id} value={account.id}>
- {account.identity_label || "Gmail account"}
+ {account.identity_label || t(chatMessages.gmailAccount)}
</SelectItem>
))}
</Select>
diff --git a/apps/web/src/features/rooms/chat/message-markdown.tsx b/apps/web/src/features/rooms/chat/message-markdown.tsx
index 93929ab6..2a562d71 100644
--- a/apps/web/src/features/rooms/chat/message-markdown.tsx
+++ b/apps/web/src/features/rooms/chat/message-markdown.tsx
@@ -20,6 +20,8 @@ import remarkGfm from "remark-gfm";
import "./message-markdown.css";
import { Icon } from "@/components/ui/icon";
+import { commonMessages } from "@/i18n/common.messages";
+import { useT } from "@/i18n/use-translation";
import { ActorAvatar } from "@/features/rooms/members/actor-avatar";
import type {
@@ -30,6 +32,7 @@ import type {
import { teamHubMentionTokenAliases } from "@/features/teamhub/teamhub-message-content";
import { useAgentMentionStyle } from "./agent-mention-style";
+import { chatMessages } from "./chat.messages";
import { followChatExternalLink } from "./chat-external-link";
const mentionUrlPrefix = "linger-actor:";
@@ -136,6 +139,7 @@ const MemoizedMarkdownContent = memo(function MarkdownContent({
MessageMarkdownProps,
"documentTitles" | "onOpenActor" | "onOpenDocument" | "readOnlyReferences"
>) {
+ const t = useT();
const mentionContent = prepareMentionContent(body, segments, mentions);
const markdownBody =
authorKind === "agent"
@@ -170,7 +174,13 @@ const MemoizedMarkdownContent = memo(function MarkdownContent({
// (U+FF1A) right before the closing ** that CJK text follows directly.
remarkCjkFriendly,
...(authorKind === "agent" ? [remarkGfm] : []),
- ...(authorKind === "agent" ? [unavailableCitationPlugin] : []),
+ ...(authorKind === "agent"
+ ? [
+ unavailableCitationPlugin(
+ t(chatMessages.sourceLinkUnavailable),
+ ),
+ ]
+ : []),
structuredMentionPlugin(mentionContent.tokens),
...(documentReferences.length
? [structuredDocumentPlugin(documentReferences)]
@@ -270,6 +280,7 @@ function MarkdownLink({
onOpenDocument,
readOnlyReferences,
} = useContext(MarkdownActionsContext);
+ const t = useT();
const document = href ? documentsByUrl.get(href) : undefined;
if (document) {
@@ -278,7 +289,9 @@ function MarkdownLink({
return (
<Reference
{...(!readOnlyReferences && {
- "aria-label": `Open ${title ?? document.content.slice(1)}`,
+ "aria-label": t(chatMessages.openFile, {
+ name: title ?? document.content.slice(1),
+ }),
onClick: () => onOpenDocument?.(document),
type: "button" as const,
})}
@@ -422,8 +435,8 @@ interface MarkdownNode {
// Source IDs have no URL mapping in historical messages. Preserve the raw
// message and code examples; replace only rendered prose citations.
-function unavailableCitationPlugin() {
- return (tree: MarkdownNode) => {
+function unavailableCitationPlugin(label: string) {
+ return () => (tree: MarkdownNode) => {
const replace = (parent: MarkdownNode): void => {
if (
!parent.children ||
@@ -446,9 +459,7 @@ function unavailableCitationPlugin() {
hName: "span",
hProperties: { className: "text-app-muted" },
},
- children: [
- { type: "text", value: "Source link unavailable" },
- ],
+ children: [{ type: "text", value: label }],
}
: { type: "text", value: part },
);
@@ -656,6 +667,10 @@ function escapeRegularExpression(value: string) {
function MarkdownCodeBlock({ children }: { children: ReactNode }) {
const preRef = useRef<HTMLPreElement>(null);
const [copied, setCopied] = useState(false);
+ const t = useT();
+ const copyLabel = copied
+ ? t(commonMessages.copied)
+ : t(chatMessages.copyCode);
useEffect(() => {
if (!copied) return;
const timer = setTimeout(() => setCopied(false), 1500);
@@ -665,14 +680,14 @@ function MarkdownCodeBlock({ children }: { children: ReactNode }) {
<div className="message-code-block">
<pre ref={preRef}>{children}</pre>
<button
- aria-label={copied ? "Copied" : "Copy code"}
+ aria-label={copyLabel}
className="message-code-copy"
onClick={() => {
void navigator.clipboard
?.writeText(preRef.current?.textContent ?? "")
.then(() => setCopied(true));
}}
- title={copied ? "Copied" : "Copy code"}
+ title={copyLabel}
type="button"
>
<Icon icon={copied ? Tick02Icon : Copy01Icon} size={14} />
diff --git a/apps/web/src/features/rooms/chat/message-meeting-notes.tsx b/apps/web/src/features/rooms/chat/message-meeting-notes.tsx
index 5b3dd7e9..2750d4c1 100644
--- a/apps/web/src/features/rooms/chat/message-meeting-notes.tsx
+++ b/apps/web/src/features/rooms/chat/message-meeting-notes.tsx
@@ -9,6 +9,8 @@ import { useState } from "react";
import { Link } from "react-router";
import { Icon } from "@/components/ui/icon";
+import { commonMessages } from "@/i18n/common.messages";
+import { RichMessage, useT } from "@/i18n/use-translation";
import { meetingPath, useMeetings } from "@/features/memory/memory-queries";
import { teamHubData } from "@/features/teamhub/teamhub-api";
import { useTeamHubRuntime } from "@/features/teamhub/teamhub-runtime";
@@ -17,6 +19,8 @@ import type {
TeamHubMessageMeetingNotesSegment,
} from "@/features/teamhub/teamhub-types";
+import { chatMessages } from "./chat.messages";
+
/** The recording whose quick notes a completion Message shows. */
export function captureQuickNotesQueryKey(captureId: string) {
return ["teamhub", "voice-capture", captureId, "quick-notes"] as const;
@@ -43,6 +47,7 @@ export function MessageMeetingNotes({
segment: TeamHubMessageMeetingNotesSegment;
tenantId: string;
}) {
+ const t = useT();
const { client } = useTeamHubRuntime();
const [shownAt] = useState(() => Date.now());
const capture = useQuery({
@@ -68,7 +73,7 @@ export function MessageMeetingNotes({
if (notes?.state === "failed" || gaveUp || capture.isError) {
return (
<section
- aria-label="Meeting notes"
+ aria-label={t(chatMessages.meetingNotes)}
className="w-full max-w-[var(--chat-card-width)] rounded-xl border border-app-border bg-app-surface"
>
<FullNotesStatus captureId={segment.capture_id} tenantId={tenantId} />
@@ -77,14 +82,14 @@ export function MessageMeetingNotes({
}
return (
<section
- aria-label="Meeting summary"
+ aria-label={t(chatMessages.meetingSummary)}
className="w-full max-w-[var(--chat-card-width)] overflow-hidden rounded-xl border border-app-border bg-app-surface shadow-[var(--chat-card-shadow)]"
>
{notes?.state === "ready" && notes.title && notes.sections ? (
<div className="px-4 pt-3 pb-1">
<p className="flex items-center gap-1 text-[11.5px] font-semibold uppercase tracking-wide text-app-muted">
<Icon icon={SparklesIcon} size={12} />
- Meeting summary
+ {t(chatMessages.meetingSummary)}
</p>
<h3 className="mt-1 text-[16px] font-semibold leading-6 text-app-ink [overflow-wrap:anywhere]">
{notes.title}
@@ -120,7 +125,7 @@ export function MessageMeetingNotes({
</div>
<p className="mt-2 flex items-center gap-2 text-[13px] text-app-muted">
<Icon className="animate-spin" icon={Loading03Icon} size={14} />
- Pulling the key points out of the transcript…
+ {t(chatMessages.pullingKeyPoints)}
</p>
</div>
)}
@@ -144,6 +149,7 @@ function FullNotesStatus({
);
const meeting = meetings.data && findMeeting(meetings.data, captureId);
const ready = Boolean(meeting?.meeting?.summary_ready);
+ const t = useT();
return (
<div className="flex items-center gap-2.5 px-4 py-2.5 text-[13px] leading-[18px] text-app-muted">
{ready && meeting ? (
@@ -153,14 +159,14 @@ function FullNotesStatus({
</span>
<span className="min-w-0 flex-1">
<strong className="font-semibold text-app-ink">
- Full meeting notes are ready
+ {t(chatMessages.fullNotesReady)}
</strong>
</span>
<Link
className="inline-flex shrink-0 items-center gap-1.5 rounded-lg bg-app-action px-3 py-1.5 text-[13px] font-medium text-app-action-foreground hover:bg-app-action-hover"
to={meetingPath(tenantId, meeting.id)}
>
- Open
+ {t(commonMessages.open)}
<Icon icon={ArrowRight01Icon} size={14} />
</Link>
</>
@@ -172,13 +178,19 @@ function FullNotesStatus({
size={14}
/>
<span className="min-w-0 flex-1">
- Full meeting notes in a few minutes, in{" "}
- <Link
- className="text-app-ink underline decoration-app-border-strong underline-offset-[3px]"
- to={`/t/${encodeURIComponent(tenantId)}/library/meetings`}
- >
- Library › Meetings
- </Link>
+ <RichMessage
+ message={chatMessages.fullNotesSoon}
+ tags={{
+ link: (text) => (
+ <Link
+ className="text-app-ink underline decoration-app-border-strong underline-offset-[3px]"
+ to={`/t/${encodeURIComponent(tenantId)}/library/meetings`}
+ >
+ {text}
+ </Link>
+ ),
+ }}
+ />
</span>
</>
)}
diff --git a/apps/web/src/features/rooms/chat/message-reactions/message-reaction-bar.tsx b/apps/web/src/features/rooms/chat/message-reactions/message-reaction-bar.tsx
index ea6b0c29..b163bdfb 100644
--- a/apps/web/src/features/rooms/chat/message-reactions/message-reaction-bar.tsx
+++ b/apps/web/src/features/rooms/chat/message-reactions/message-reaction-bar.tsx
@@ -5,6 +5,10 @@ import type {
TeamHubMessage,
TeamHubMessageReactionId,
} from "@/features/teamhub/teamhub-types";
+import { commonMessages } from "@/i18n/common.messages";
+import { useT } from "@/i18n/use-translation";
+
+import { chatMessages } from "../chat.messages";
import { useReactionCatalog } from "./reaction-catalog";
import { animateTransform, animationsEnabled } from "./reaction-motion";
@@ -31,6 +35,7 @@ export function MessageReactionBar({
message: TeamHubMessage;
onToggle?: (reactionId: TeamHubMessageReactionId) => void;
}) {
+ const t = useT();
const catalog = useReactionCatalog();
const reactions = catalog ? (message.reactions ?? []) : [];
const rowRef = useRef<HTMLDivElement>(null);
@@ -92,7 +97,7 @@ export function MessageReactionBar({
{reactions.length ? (
<div
ref={rowRef}
- aria-label="Reactions"
+ aria-label={t(chatMessages.reactions)}
className="flex flex-wrap justify-start gap-1"
role="group"
>
@@ -106,18 +111,23 @@ export function MessageReactionBar({
.map((actorId) => {
const name =
actorId === currentActorId
- ? "You"
- : (actorDisplayNames[actorId] ?? "Former member");
+ ? t(commonMessages.you)
+ : (actorDisplayNames[actorId] ??
+ t(chatMessages.formerMember));
return actorKinds[actorId] === "agent"
- ? `${name} (Agent)`
+ ? t(chatMessages.agentReactor, { name })
: name;
})
- .join(", ");
+ .join(t(chatMessages.listSeparator));
const count = reaction.actor_ids.length;
return (
<span className="relative inline-flex" key={reaction.reaction_id}>
<button
- aria-label={`${entry.name} ${count}: ${reactors}`}
+ aria-label={t(chatMessages.reactionSummary, {
+ count,
+ emoji: entry.name,
+ names: reactors,
+ })}
aria-pressed={own}
className="message-reaction-chip flex h-6 items-center gap-1 rounded-full border border-app-border bg-app-surface px-2 text-xs leading-none text-app-ink tabular-nums focus-visible:outline-2 focus-visible:outline-app-focus disabled:cursor-default"
data-own-reaction={own || undefined}
@@ -141,7 +151,7 @@ export function MessageReactionBar({
) : null}
{error ? (
<p className="text-xs text-app-danger" role="alert">
- Reaction was not saved. Try again.
+ {t(chatMessages.reactionNotSaved)}
</p>
) : null}
</div>
diff --git a/apps/web/src/features/rooms/chat/message-reactions/message-reaction-picker.tsx b/apps/web/src/features/rooms/chat/message-reactions/message-reaction-picker.tsx
index 39ff9acc..77ac83e4 100644
--- a/apps/web/src/features/rooms/chat/message-reactions/message-reaction-picker.tsx
+++ b/apps/web/src/features/rooms/chat/message-reactions/message-reaction-picker.tsx
@@ -24,8 +24,12 @@ import { createPortal } from "react-dom";
import { Icon, type IconSvgElement } from "@/components/ui/icon";
import { Spinner } from "@/components/ui/spinner";
import type { TeamHubMessageReactionId } from "@/features/teamhub/teamhub-types";
+import { useT } from "@/i18n/use-translation";
+
+import { chatMessages } from "../chat.messages";
import {
+ reactionCategoryLabel,
type ReactionCatalogEntry,
searchReactionCatalog,
useReactionCatalog,
@@ -90,6 +94,7 @@ export function MessageReactionPicker({
onClose: () => void;
onSelect: (id: TeamHubMessageReactionId) => void;
}) {
+ const t = useT();
const catalog = useReactionCatalog();
const [expanded, setExpanded] = useState(false);
const [query, setQuery] = useState("");
@@ -111,16 +116,23 @@ export function MessageReactionPicker({
return [
{
id: "search",
- label: "Search results",
+ label: t(chatMessages.searchResults),
entries: searchReactionCatalog(catalog, query),
},
];
}
return [
- { id: "recommended", label: "Recommended", entries: catalog.recommended },
- ...catalog.categories,
+ {
+ id: "recommended",
+ label: t(chatMessages.recommended),
+ entries: catalog.recommended,
+ },
+ ...catalog.categories.map((category) => ({
+ ...category,
+ label: reactionCategoryLabel(category.id, t),
+ })),
];
- }, [catalog, query]);
+ }, [catalog, query, t]);
const visible = useMemo(
() => sections.flatMap((section) => section.entries),
[sections],
@@ -148,8 +160,7 @@ export function MessageReactionPicker({
// Above the Add reaction button, left aligned with it.
useLayoutEffect(() => {
const button =
- anchor.querySelector<HTMLElement>('button[aria-label="Add reaction"]') ??
- anchor;
+ anchor.querySelector<HTMLElement>("button[aria-pressed]") ?? anchor;
const buttonRect = button.getBoundingClientRect();
// offsetHeight ignores the entrance scale.
const height = panelRef.current?.offsetHeight ?? 0;
@@ -328,7 +339,7 @@ export function MessageReactionPicker({
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions -- Escape closes this dialog; its controls are keyboard-accessible buttons
<div
ref={panelRef}
- aria-label="Add reaction"
+ aria-label={t(chatMessages.addReaction)}
className="app-floating-enter fixed z-[110] flex origin-left items-center rounded-lg bg-popover p-1.5 shadow-lg"
onKeyDown={(event) => {
if (event.key !== "Escape") return;
@@ -354,14 +365,14 @@ export function MessageReactionPicker({
</button>
))}
<button
- aria-label="Search all emoji"
+ aria-label={t(chatMessages.searchAllEmoji)}
className="flex size-9 items-center justify-center rounded-full text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:outline-2 focus-visible:outline-app-focus"
onClick={() => {
expandFromRef.current =
panelRef.current?.getBoundingClientRect() ?? null;
setExpanded(true);
}}
- title="Search all emoji"
+ title={t(chatMessages.searchAllEmoji)}
type="button"
>
<Icon icon={Search01Icon} size={20} />
@@ -380,7 +391,7 @@ export function MessageReactionPicker({
return createPortal(
<div
ref={panelRef}
- aria-label="Add reaction"
+ aria-label={t(chatMessages.addReaction)}
className="fixed z-[110] origin-top-left rounded-xl bg-popover p-2 font-(family-name:--app-room-font) shadow-lg"
role="dialog"
style={{ ...position, width: PANEL_WIDTH }}
@@ -391,27 +402,30 @@ export function MessageReactionPicker({
aria-autocomplete="list"
aria-controls={listId}
aria-expanded="true"
- aria-label="Search emoji"
+ aria-label={t(chatMessages.searchEmoji)}
className="h-8 w-full rounded-md border border-input bg-card px-2 text-sm text-foreground outline-none placeholder:text-app-placeholder hover:border-border-hover focus-visible:border-foreground/40"
onChange={(event) => {
setQuery(event.target.value);
setActiveIndex(0);
}}
onKeyDown={onKeyDown}
- placeholder="Search emoji"
+ placeholder={t(chatMessages.searchEmoji)}
role="combobox"
type="text"
value={query}
/>
<div
- aria-label="Emoji categories"
+ aria-label={t(chatMessages.emojiCategories)}
className="my-1.5 flex items-center justify-between px-0.5"
role="toolbar"
>
{catalog
? [
- { id: "recommended", label: "Recommended" },
- ...catalog.categories,
+ { id: "recommended", label: t(chatMessages.recommended) },
+ ...catalog.categories.map((category) => ({
+ id: category.id,
+ label: reactionCategoryLabel(category.id, t),
+ })),
].map((section) => {
const sectionIcon = SECTION_ICONS[section.id] ?? SmileIcon;
return (
@@ -432,7 +446,7 @@ export function MessageReactionPicker({
</div>
<div
ref={gridRef}
- aria-label="Emoji"
+ aria-label={t(chatMessages.emoji)}
className="workspace-scrollbar h-72 overflow-y-auto"
id={listId}
role="listbox"
@@ -440,11 +454,11 @@ export function MessageReactionPicker({
{!catalog ? (
<p className="flex items-center justify-center gap-2 px-1 py-6 text-center text-xs text-app-muted">
<Spinner size={14} />
- Loading emoji…
+ {t(chatMessages.loadingEmoji)}
</p>
) : visible.length === 0 ? (
<p className="px-1 py-6 text-center text-xs text-app-muted">
- No matching emoji
+ {t(chatMessages.noMatchingEmoji)}
</p>
) : (
sections.map((section, sectionIndex) =>
diff --git a/apps/web/src/features/rooms/chat/message-reactions/message-reactions.test.tsx b/apps/web/src/features/rooms/chat/message-reactions/message-reactions.test.tsx
index 12d92875..bcc5a00f 100644
--- a/apps/web/src/features/rooms/chat/message-reactions/message-reactions.test.tsx
+++ b/apps/web/src/features/rooms/chat/message-reactions/message-reactions.test.tsx
@@ -15,6 +15,7 @@ import {
import type { ComponentProps, ReactNode } from "react";
import { MemoryRouter } from "react-router";
import { describe, expect, it, vi } from "vitest";
+import { translate } from "@/i18n/language";
import { defineGlobalProperty } from "@/test/global-properties";
import {
@@ -41,6 +42,7 @@ import emojiData from "@emoji-mart/data/sets/15/native.json";
import {
buildReactionCatalog,
+ reactionCategoryLabel,
searchReactionCatalog,
} from "./reaction-catalog";
import {
@@ -145,7 +147,11 @@ describe("Reaction state", () => {
{ hexcode: "1F44C", label: "d’accord", tags: ["parfait"] },
]);
expect(catalog.byId.size).toBe(1870);
- expect(catalog.categories.map((category) => category.label)).toEqual([
+ expect(
+ catalog.categories.map((category) =>
+ reactionCategoryLabel(category.id, translate),
+ ),
+ ).toEqual([
"Smileys & People",
"Animals & Nature",
"Food & Drink",
diff --git a/apps/web/src/features/rooms/chat/message-reactions/reaction-catalog.ts b/apps/web/src/features/rooms/chat/message-reactions/reaction-catalog.ts
index 80c7cbeb..e2d06f7f 100644
--- a/apps/web/src/features/rooms/chat/message-reactions/reaction-catalog.ts
+++ b/apps/web/src/features/rooms/chat/message-reactions/reaction-catalog.ts
@@ -1,5 +1,10 @@
import { useEffect, useState } from "react";
+import type { Translate } from "@/i18n/language";
+import type { Message } from "@/i18n/messages";
+
+import { chatMessages } from "../chat.messages";
+
interface EmojiMartData {
categories: readonly { id: string; emojis: readonly string[] }[];
emojis: Readonly<
@@ -31,7 +36,6 @@ export interface ReactionCatalogEntry {
export interface ReactionCatalogCategory {
readonly id: string;
- readonly label: string;
readonly entries: readonly ReactionCatalogEntry[];
}
@@ -54,17 +58,23 @@ export const RECOMMENDED_REACTION_IDS = [
"joy",
] as const;
-const CATEGORY_LABELS: Readonly<Record<string, string>> = {
- people: "Smileys & People",
- nature: "Animals & Nature",
- foods: "Food & Drink",
- activity: "Activity",
- places: "Travel & Places",
- objects: "Objects",
- symbols: "Symbols",
- flags: "Flags",
+const CATEGORY_LABELS: Readonly<Record<string, Message<string>>> = {
+ people: chatMessages.emojiPeople,
+ nature: chatMessages.emojiNature,
+ foods: chatMessages.emojiFoods,
+ activity: chatMessages.emojiActivity,
+ places: chatMessages.emojiPlaces,
+ objects: chatMessages.emojiObjects,
+ symbols: chatMessages.emojiSymbols,
+ flags: chatMessages.emojiFlags,
};
+/** A category's name; one this client does not know shows its id. */
+export function reactionCategoryLabel(categoryId: string, t: Translate) {
+ const label = CATEGORY_LABELS[categoryId];
+ return label ? t(label) : categoryId;
+}
+
// The emoji-mart dataset is English-only; CLDR Chinese annotations let
// Chinese-speaking users search Reactions too. The path stays a literal so the
// bundler emits one lazy chunk instead of one per emojibase locale.
@@ -94,7 +104,6 @@ export function buildReactionCatalog(
const byId = new Map<string, ReactionCatalogEntry>();
const categories = data.categories.map((category) => ({
id: category.id,
- label: CATEGORY_LABELS[category.id] ?? category.id,
entries: category.emojis.flatMap((id) => {
const emoji = data.emojis[id];
const skin = emoji?.skins[0];
diff --git a/apps/web/src/features/rooms/chat/message-row.tsx b/apps/web/src/features/rooms/chat/message-row.tsx
index ed6486a1..ce64b09e 100644
--- a/apps/web/src/features/rooms/chat/message-row.tsx
+++ b/apps/web/src/features/rooms/chat/message-row.tsx
@@ -33,6 +33,9 @@ import type {
TeamHubMessageReactionId,
} from "@/features/teamhub/teamhub-types";
+import { commonMessages } from "@/i18n/common.messages";
+import { useT } from "@/i18n/use-translation";
+
import type { RoomCardDecision } from "../cards/room-message-card-contract";
import {
knownRoomMessageCard,
@@ -61,6 +64,7 @@ import {
messageBodyRuns,
type MessageTextBlock,
} from "./message-body-blocks";
+import { chatMessages } from "./chat.messages";
import { MessageCard } from "./message-card";
import { MessageHtmlFragment } from "./message-html-fragment";
import { MessageMeetingNotes } from "./message-meeting-notes";
@@ -242,6 +246,7 @@ function ConversationMessageRow({
focusHighlight,
workspaceAgentIds,
}: MessageRowProps) {
+ const t = useT();
const rowRef = useRef<HTMLElement>(null);
useEffect(() => {
if (!focused || !focusHighlight) return;
@@ -412,7 +417,7 @@ function ConversationMessageRow({
const attachment = attachmentByDocument.get(documentId);
return {
...(metadata
- ? documentCardPresentation(metadata)
+ ? documentCardPresentation(metadata, t)
: { filename: attachedName }),
disabled: attachment ? !attachment.available : false,
documentId,
@@ -431,7 +436,7 @@ function ConversationMessageRow({
return (
<MessageFileItem
actionLabel="Preview"
- detail={artifactTreeDetail(block.segment)}
+ detail={artifactTreeDetail(block.segment, t)}
key={block.segment.publication_group_id}
name={block.segment.root_path}
onOpen={
@@ -605,10 +610,12 @@ function ConversationMessageRow({
disabled={!onMentionAuthor || !canMentionAuthor}
title={
canMentionAuthor
- ? `Mention ${authorName}`
+ ? t(chatMessages.mentionAuthor, { name: authorName })
: isAuthorMember
- ? `${authorName} is unavailable right now`
- : `${authorName} is no longer in this Room`
+ ? t(chatMessages.authorUnavailable, {
+ name: authorName,
+ })
+ : t(chatMessages.authorNotInRoom, { name: authorName })
}
type="button"
>
@@ -627,7 +634,9 @@ function ConversationMessageRow({
) : null}
{isAgent && message.routine_name ? (
<div
- aria-label={`Scheduled task: ${message.routine_name}`}
+ aria-label={t(chatMessages.scheduledTask, {
+ name: message.routine_name,
+ })}
className="mt-2 flex min-w-0 items-center gap-1 text-xs font-normal leading-[18px] text-app-muted"
data-testid="message-routine-label"
>
@@ -638,7 +647,7 @@ function ConversationMessageRow({
) : null}
{message.context_messages?.length ? (
<ReplyContext
- label="Reply context"
+ label={t(chatMessages.replyContext)}
messages={message.context_messages.map((contextMessage) => ({
author: contextMessage.author,
key: contextMessage.message_id,
@@ -802,6 +811,7 @@ function ConversationMessageActions({
hasCardPayload: boolean;
onToggleReaction?: (reactionId: TeamHubMessageReactionId) => void;
}) {
+ const t = useT();
const [copied, setCopied] = useState(false);
const [reactionPickerOpen, setReactionPickerOpen] = useState(false);
const actionsRef = useRef<HTMLDivElement>(null);
@@ -810,21 +820,21 @@ function ConversationMessageActions({
if (onForwardMessage) {
overflowItems.push({
icon: <Icon icon={SentIcon} size={14} />,
- label: "Forward message",
+ label: t(chatMessages.forwardMessage),
onSelect: () => onForwardMessage(message),
});
}
if (onReply) {
overflowItems.push({
icon: <Icon icon={MailReply01Icon} size={14} />,
- label: "Reply to message",
+ label: t(chatMessages.replyToMessage),
onSelect: () => onReply(message),
});
}
if (onOpenThread && !hasCardPayload) {
overflowItems.push({
icon: <Icon icon={Message01Icon} size={14} />,
- label: "Reply to thread",
+ label: t(chatMessages.replyToThread),
onSelect: () => {
// The sidebar must restore focus to the persistent trigger, not the removed menu item.
actionsRef.current
@@ -843,10 +853,10 @@ function ConversationMessageActions({
>
{onToggleReaction ? (
<MessageActionButton
- aria-label="Add reaction"
+ aria-label={t(chatMessages.addReaction)}
aria-pressed={reactionPickerOpen}
onClick={() => setReactionPickerOpen((open) => !open)}
- tooltip="Add reaction"
+ tooltip={t(chatMessages.addReaction)}
>
<Icon icon={SmilePlusIcon} size={16} />
</MessageActionButton>
@@ -867,7 +877,7 @@ function ConversationMessageActions({
/>
) : null}
<MessageActionButton
- aria-label="Copy message"
+ aria-label={t(chatMessages.copyMessage)}
onClick={() => {
void import("@/lib/clipboard")
.then(({ writeClipboardText }) =>
@@ -879,7 +889,9 @@ function ConversationMessageActions({
})
.catch(() => setCopied(false));
}}
- tooltip={copied ? "Copied" : "Copy message"}
+ tooltip={
+ copied ? t(commonMessages.copied) : t(chatMessages.copyMessage)
+ }
>
{copied ? (
<Icon icon={Tick02Icon} size={16} />
@@ -893,7 +905,7 @@ function ConversationMessageActions({
iconClassName="flex size-3.5 shrink-0 items-center justify-center"
itemClassName="flex min-h-8 w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left font-(family-name:--app-room-font) text-sm text-foreground outline-none hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground disabled:pointer-events-none disabled:opacity-50"
items={overflowItems}
- label="More message actions"
+ label={t(chatMessages.moreMessageActions)}
menuClassName="fixed z-[100] w-48 rounded-md bg-popover p-1 font-(family-name:--app-room-font) text-sm shadow-md"
trigger={<Icon icon={MoreHorizontalIcon} size={16} />}
/>
@@ -956,6 +968,7 @@ export function PendingMessageRow({
onOpenUrl?: (url: string) => void;
onRetry: (clientId: string) => void;
}) {
+ const t = useT();
// A send that commits quickly never shows a status line, so the committed
// row replaces it at the same height.
const [slow, setSlow] = useState(false);
@@ -985,7 +998,7 @@ export function PendingMessageRow({
<div className="room-message-content min-w-0">
{message.contextMessages.length ? (
<ReplyContext
- label="Pending reply context"
+ label={t(chatMessages.pendingReplyContext)}
messages={message.contextMessages.map((contextMessage) => ({
author: contextMessage.author,
key: contextMessage.id,
@@ -1023,7 +1036,7 @@ export function PendingMessageRow({
) : (
<MessageFileItem
detail={fileItemDetail(
- artifactFileTypeLabel(attachment.filename),
+ artifactFileTypeLabel(attachment.filename, undefined, t),
attachment.sizeBytes,
)}
name={attachment.filename}
@@ -1036,17 +1049,17 @@ export function PendingMessageRow({
<div className="mt-1 flex items-center justify-end gap-2 leading-[18px]">
<span className="text-xs text-muted-foreground">
{message.status === "sending"
- ? "Sending..."
+ ? t(chatMessages.sending)
: message.status === "unknown"
- ? "Delivery status unknown"
- : "Not sent"}
+ ? t(chatMessages.deliveryUnknown)
+ : t(chatMessages.notSent)}
</span>
</div>
) : null}
{message.status === "failed" || message.status === "unknown" ? (
<div className="mt-2 flex flex-col items-end gap-2">
<span className="text-right text-sm text-destructive" role="alert">
- {message.error ?? "Failed to connect to the server..."}
+ {message.error ?? t(chatMessages.connectFailed)}
</span>
<div className="flex flex-wrap items-center gap-2">
<button
@@ -1059,7 +1072,7 @@ export function PendingMessageRow({
className="size-4 text-muted-foreground"
size={16}
/>
- <span className="px-1">Retry</span>
+ <span className="px-1">{t(commonMessages.retry)}</span>
</button>
<button
className="inline-flex h-6 items-center gap-1 rounded-full px-1.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground"
@@ -1071,7 +1084,7 @@ export function PendingMessageRow({
className="size-4 text-muted-foreground"
size={16}
/>
- <span className="px-1">Cancel</span>
+ <span className="px-1">{t(commonMessages.cancel)}</span>
</button>
</div>
</div>
diff --git a/apps/web/src/features/rooms/chat/message-timeline-card.test.tsx b/apps/web/src/features/rooms/chat/message-timeline-card.test.tsx
index 7fe5ccfb..85e652a5 100644
--- a/apps/web/src/features/rooms/chat/message-timeline-card.test.tsx
+++ b/apps/web/src/features/rooms/chat/message-timeline-card.test.tsx
@@ -16,6 +16,7 @@ import type {
TeamHubRunStatus,
TeamHubRuntimePresentationEventRecord,
} from "@/features/teamhub/teamhub-types";
+import { translate } from "@/i18n/language";
import {
AgentStreamingStatusDock,
@@ -3222,6 +3223,7 @@ describe("Runtime timeline projection reuse", () => {
"run-status-1": firstEvents,
"run-status-2": secondEvents,
},
+ t: translate,
});
const next = buildRuntimeTimelineViews({
@@ -3234,6 +3236,7 @@ describe("Runtime timeline projection reuse", () => {
runtimeStatusRecord("2", "working", "Writing"),
],
},
+ t: translate,
});
expect(next).toHaveLength(2);
expect(next[0]).toBe(firstView);
@@ -3243,6 +3246,7 @@ describe("Runtime timeline projection reuse", () => {
cache,
runStatuses: [{ ...first, revision: 2 }],
runtimePresentationEventsByRunStatusId: { "run-status-1": firstEvents },
+ t: translate,
});
expect(revised[0]).not.toBe(firstView);
// A Run that leaves the list leaves the cache too.
diff --git a/apps/web/src/features/rooms/chat/message-timeline-placeholders.tsx b/apps/web/src/features/rooms/chat/message-timeline-placeholders.tsx
index ad94a6d1..0f567b0a 100644
--- a/apps/web/src/features/rooms/chat/message-timeline-placeholders.tsx
+++ b/apps/web/src/features/rooms/chat/message-timeline-placeholders.tsx
@@ -2,26 +2,33 @@ import { Message01Icon } from "@hugeicons/core-free-icons";
import { Icon } from "@/components/ui/icon";
import { Spinner } from "@/components/ui/spinner";
+import { useT } from "@/i18n/use-translation";
+
+import { chatMessages } from "./chat.messages";
/** Invites the first Message in a Room that has none. */
export function MessageTimelineEmptyState() {
+ const t = useT();
return (
<div className="text-center">
<span className="mx-auto flex size-11 items-center justify-center rounded-lg bg-app-rail text-app-muted">
<Icon icon={Message01Icon} size={20} />
</span>
- <h2 className="mt-4 text-base font-semibold">Start the conversation</h2>
+ <h2 className="mt-4 text-base font-semibold">
+ {t(chatMessages.emptyTimelineTitle)}
+ </h2>
<p className="mt-1 text-sm text-app-muted">
- Messages are shared with every current Room member.
+ {t(chatMessages.emptyTimelineBody)}
</p>
</div>
);
}
export function LoadingOlderMessages() {
+ const t = useT();
return (
<div
- aria-label="Loading earlier Messages"
+ aria-label={t(chatMessages.loadingEarlierMessages)}
className="mb-5 flex justify-center text-app-muted"
role="status"
>
diff --git a/apps/web/src/features/rooms/chat/message-timeline.tsx b/apps/web/src/features/rooms/chat/message-timeline.tsx
index 22978069..9b51c24c 100644
--- a/apps/web/src/features/rooms/chat/message-timeline.tsx
+++ b/apps/web/src/features/rooms/chat/message-timeline.tsx
@@ -12,6 +12,7 @@ import {
toolPresentation,
toolInputFromEntries,
} from "../runtime-status/runtime-tool-presentation";
+import { runtimeStatusMessages as m } from "../runtime-status/runtime-status.messages";
import {
AgentAvatarStatusContext,
type AgentAvatarStatus,
@@ -19,10 +20,15 @@ import {
import {
isRunInterruption,
runtimeFailureMessage,
+ runtimeFailureReason,
} from "../runtime-status/runtime-failure-message";
import type { RuntimeExecutionFailure } from "../runtime-status/runtime-presentation-events";
import { Fragment, type ReactNode, useMemo, useRef, useState } from "react";
import { cn } from "@/lib/cn";
+import { commonMessages } from "@/i18n/common.messages";
+import type { Translate } from "@/i18n/language";
+import type { Message } from "@/i18n/messages";
+import { useT, useTranslation } from "@/i18n/use-translation";
import { Button } from "@/components/ui/button";
import { Skeleton } from "@/components/ui/skeleton";
@@ -189,6 +195,8 @@ export function MessageTimeline({
focusedMessageHighlight,
workspaceAgentIds = EMPTY_STATIC_AGENT_ACTOR_IDS,
}: MessageTimelineProps) {
+ const translation = useTranslation();
+ const { t } = translation;
const { filePreviewError, previewMessageFile } =
useMessageFilePreview(onOpenMessageFile);
const referenceTitles = useMemo(
@@ -212,8 +220,9 @@ export function MessageTimeline({
cache: runtimeViewCache.current,
runStatuses,
runtimePresentationEventsByRunStatusId,
+ t,
}),
- [runStatuses, runtimePresentationEventsByRunStatusId],
+ [runStatuses, runtimePresentationEventsByRunStatusId, t],
);
const hasTimelineContent = Boolean(
candidateMessages.length || pendingMessages.length || voiceLiveDraft,
@@ -223,7 +232,7 @@ export function MessageTimeline({
statuses: new Map(
runtimeStatusViews.flatMap((row) =>
isLiveAgentRunStatus(row)
- ? [[row.runStatus.agent.id, avatarStatus(row)] as const]
+ ? [[row.runStatus.agent.id, avatarStatus(row, t)] as const]
: [],
),
),
@@ -240,7 +249,7 @@ export function MessageTimeline({
);
},
}),
- [onOpenProfile, onOpenAgentActivity, runtimeStatusViews],
+ [onOpenProfile, onOpenAgentActivity, runtimeStatusViews, t],
);
const renderMessage = (message: TeamHubMessage, index: number) => {
const previous = candidateMessages[index - 1];
@@ -250,7 +259,7 @@ export function MessageTimeline({
{startsConversation ? (
<div className="room-conversation-time text-center text-xs text-app-subtle">
<time dateTime={message.created_at}>
- {formatMessageTime(message.created_at)}
+ {formatMessageTime(message.created_at, translation)}
</time>
</div>
) : null}
@@ -352,13 +361,17 @@ export function MessageTimeline({
>
{formatMessageTime(
new Date(message.createdAt).toISOString(),
+ translation,
)}
</time>
</div>
) : null}
<PendingMessageRow
actorId={currentActorId}
- actorName={actorDisplayNames[currentActorId ?? ""] ?? "You"}
+ actorName={
+ actorDisplayNames[currentActorId ?? ""] ??
+ t(commonMessages.you)
+ }
startsGroup={
startsConversation || (index === 0 && startsOwnGroup)
}
@@ -393,13 +406,15 @@ export function MessageTimeline({
/**
* Each Run's last view, kept while the Run stays listed. A Run is projected
* again only when its status or its event list is a new object, so one Run's
- * runtime event does not re-project every other Run.
+ * runtime event does not re-project every other Run. A view holds the words
+ * of the language it was projected in, so a language switch projects again.
*/
type RuntimeTimelineViewCache = Map<
string,
{
records: readonly TeamHubRuntimePresentationEventRecord[] | undefined;
runStatus: TeamHubRunStatus;
+ t: Translate;
view: AgentRunStatusView | undefined;
}
>;
@@ -408,6 +423,7 @@ export function buildRuntimeTimelineViews({
cache,
runStatuses,
runtimePresentationEventsByRunStatusId,
+ t,
}: {
/** Reused and pruned to the given Runs on every pass. */
cache?: RuntimeTimelineViewCache;
@@ -415,6 +431,7 @@ export function buildRuntimeTimelineViews({
runtimePresentationEventsByRunStatusId: Readonly<
Record<string, readonly TeamHubRuntimePresentationEventRecord[]>
>;
+ t: Translate;
}) {
const runtimeStatusViews: AgentRunStatusView[] = [];
const listed = new Set<string>();
@@ -422,11 +439,13 @@ export function buildRuntimeTimelineViews({
const records = runtimePresentationEventsByRunStatusId[runStatus.id];
const cached = cache?.get(runStatus.id);
const view =
- cached?.runStatus === runStatus && cached.records === records
+ cached?.runStatus === runStatus &&
+ cached.records === records &&
+ cached.t === t
? cached.view
- : runtimeTimelineView(runStatus, records);
+ : runtimeTimelineView(runStatus, records, t);
listed.add(runStatus.id);
- cache?.set(runStatus.id, { records, runStatus, view });
+ cache?.set(runStatus.id, { records, runStatus, t, view });
if (view) runtimeStatusViews.push(view);
}
for (const runStatusId of cache?.keys() ?? []) {
@@ -438,11 +457,12 @@ export function buildRuntimeTimelineViews({
function runtimeTimelineView(
runStatus: TeamHubRunStatus,
records: readonly TeamHubRuntimePresentationEventRecord[] | undefined,
+ t: Translate,
) {
const presentation = records
? projectRuntimeChatPresentation(records)
: undefined;
- const history = resolveAgentRunStatusHistory({ runStatus, presentation });
+ const history = resolveAgentRunStatusHistory({ runStatus, presentation, t });
if (history.length === 0) return undefined;
return createAgentRunStatusView(runStatus, history, history.at(-1)!.key);
}
@@ -457,6 +477,7 @@ function TypingDots({ className = "" }: { className?: string }) {
);
}
+// Compared in code; `stateLabels` holds the words shown for each.
type AgentRuntimeState =
| "Canceled"
| "Completed"
@@ -469,6 +490,20 @@ type AgentRuntimeState =
| "Waiting for your input"
| "Working";
+const stateLabels: Record<AgentRuntimeState, Message<string>> = {
+ Canceled: m.stateCanceled,
+ Completed: m.stateCompleted,
+ Failed: m.stateFailed,
+ "Needs attention": m.stateNeedsAttention,
+ Recovering: m.stateRecovering,
+ // An Agent writing its reply reads as typing, like a person.
+ Responding: m.stateTyping,
+ Stopped: m.stateStopped,
+ Thinking: m.stateThinking,
+ "Waiting for your input": m.stateWaitingForInput,
+ Working: m.stateWorking,
+};
+
interface AgentRuntimeStatusSegment {
activities: readonly RuntimeActivityPresentation[];
key: string;
@@ -479,7 +514,6 @@ interface AgentRuntimeStatusSegment {
outputs: readonly RuntimeOutputPresentation[];
plan?: RuntimePlanPresentation;
state: AgentRuntimeState;
- summary: string;
/** The Run ended with follow-ups whose delivery is unconfirmed. */
unconfirmedFollowUps?: true;
}
@@ -504,9 +538,11 @@ function isLiveAgentRunStatus(runtimeStatus: AgentRunStatusView) {
function resolveAgentRunStatusHistory({
runStatus,
presentation,
+ t,
}: {
runStatus: Pick<TeamHubRunStatus, "status">;
presentation?: RuntimeChatPresentation;
+ t: Translate;
}): readonly AgentRuntimeStatusSegment[] {
if (presentation) {
const history = presentation.items
@@ -520,6 +556,7 @@ function resolveAgentRunStatusHistory({
outputs: item.outputs,
plan: item.plan,
status: item.status,
+ t,
terminalOutcome: item.terminalOutcome,
failure: item.failure,
title: item.title,
@@ -529,9 +566,9 @@ function resolveAgentRunStatusHistory({
if (history.length > 0) return history;
if (!presentation.currentStatus) {
return runStatus.status === "active"
- ? [fallbackAgentRuntimeStatusSegment()]
+ ? [fallbackAgentRuntimeStatusSegment(t)]
: runStatus.status === "aborted"
- ? [stoppedAgentRuntimeStatusSegment()]
+ ? [stoppedAgentRuntimeStatusSegment(t)]
: [];
}
return [
@@ -539,36 +576,41 @@ function resolveAgentRunStatusHistory({
first: true,
key: "snapshot",
status: presentation.currentStatus,
+ t,
title: presentation.currentTitle,
}),
];
}
return runStatus.status === "active"
- ? [fallbackAgentRuntimeStatusSegment()]
+ ? [fallbackAgentRuntimeStatusSegment(t)]
: runStatus.status === "aborted"
- ? [stoppedAgentRuntimeStatusSegment()]
+ ? [stoppedAgentRuntimeStatusSegment(t)]
: [];
}
-function fallbackAgentRuntimeStatusSegment(): AgentRuntimeStatusSegment {
+function fallbackAgentRuntimeStatusSegment(
+ t: Translate,
+): AgentRuntimeStatusSegment {
return resolveAgentRuntimeStatusSegment({
first: true,
key: "snapshot",
status: "working",
+ t,
});
}
// An aborted Run status covers both failed and canceled Runs; until its
// presentation events arrive, the outcome and its cause are not known.
-function stoppedAgentRuntimeStatusSegment(): AgentRuntimeStatusSegment {
+function stoppedAgentRuntimeStatusSegment(
+ t: Translate,
+): AgentRuntimeStatusSegment {
return {
activities: [],
key: "stopped",
- line: { tone: "warn", text: "Run stopped" },
+ line: { tone: "warn", text: t(m.runStopped) },
outputs: [],
state: "Stopped",
- summary: "Run stopped",
};
}
@@ -580,6 +622,7 @@ function resolveAgentRuntimeStatusSegment({
outputs = [],
plan,
status,
+ t,
terminalOutcome,
title,
unconfirmedInputIds,
@@ -594,6 +637,7 @@ function resolveAgentRuntimeStatusSegment({
outputs?: readonly RuntimeOutputPresentation[];
plan?: RuntimePlanPresentation;
status: "queued" | "working" | "thinking";
+ t: Translate;
terminalOutcome?: "canceled" | "completed" | "failed";
failure?: RuntimeExecutionFailure;
/** The thinking summary while the status is thinking. */
@@ -608,30 +652,8 @@ function resolveAgentRuntimeStatusSegment({
const activeActivity =
activeActivities.find((activity) => activity.kind === "recovery") ??
activeActivities[0];
- const terminalSummary =
- terminalOutcome === "completed"
- ? "Run completed"
- : terminalOutcome === "canceled"
- ? "Run canceled"
- : terminalOutcome === "failed"
- ? runtimeFailureMessage(failure)
- : undefined;
const unconfirmed = Boolean(terminalOutcome && unconfirmedInputIds?.length);
- const summary =
- (unconfirmed
- ? `${terminalOutcome === "failed" ? `${terminalSummary}. ` : ""}Follow-up delivery unconfirmed. Resend it if the Agent did not answer.`
- : undefined) ??
- terminalSummary ??
- (activeActivity?.kind === "interaction"
- ? "Waiting for your input"
- : undefined) ??
- (activeActivity ? activitySummary(activeActivity) : undefined) ??
- (status === "queued"
- ? "Thinking"
- : status === "thinking"
- ? "Planning the next step"
- : "Working on your request");
- const state =
+ const state: AgentRuntimeState =
unconfirmed && terminalOutcome !== "failed"
? "Needs attention"
: terminalOutcome === "completed"
@@ -655,7 +677,7 @@ function resolveAgentRuntimeStatusSegment({
// the entries of its current group in order (see statusLineQueue). Dots
// wait for the Agent's first Activity or thinking, and Working follows a
// message once it has gone out (an output closes its Segment).
- const queue = statusLineQueue(marks, activities);
+ const queue = statusLineQueue(marks, activities, t);
const lineRunning = activities
.filter(
(activity) =>
@@ -666,36 +688,46 @@ function resolveAgentRuntimeStatusSegment({
const stateActivity =
lineRunning.find((activity) => activity.kind === "recovery") ??
lineRunning.find((activity) => activity.kind === "interaction");
+ const failureReason =
+ state === "Failed" ? runtimeFailureReason(t, failure) : undefined;
+ // An interrupted Run says why it stopped, and that a follow-up may be lost.
+ const stoppedText = unconfirmed
+ ? t(m.stoppedFollowUpUnconfirmed, {
+ reason: runtimeFailureMessage(t, failure),
+ })
+ : runtimeFailureMessage(t, failure);
const line: AgentStatusLineContent =
state === "Failed"
? {
tone: "danger",
- text:
- terminalSummary === "Run failed"
- ? terminalSummary
- : `Run failed: ${terminalSummary}`,
+ text: failureReason
+ ? t(m.runFailedWith, { reason: failureReason })
+ : t(m.runFailed),
}
: state === "Stopped"
- ? { tone: "warn", text: summary }
+ ? { tone: "warn", text: stoppedText }
: state === "Needs attention"
- ? { tone: "warn", text: "Follow-up delivery unconfirmed" }
+ ? { tone: "warn", text: t(m.followUpUnconfirmed) }
: stateActivity
? {
tone: "live",
- text: activityStatusLine(stateActivity.kind).steps[0]!,
+ text: activityStatusLine(t, stateActivity.kind).steps[0]!,
runningActivityId: stateActivity.activityId,
}
: status === "queued"
? { tone: "wait" }
: outputs.length > 0 && lineRunning.length === 0
- ? { tone: "live", text: "Working" }
+ ? { tone: "live", text: t(m.stateWorking) }
: queue.length > 0
? queue.at(-1)!.content
: status === "thinking"
- ? { tone: "live", text: title?.trim() || "Thinking" }
+ ? {
+ tone: "live",
+ text: title?.trim() || t(m.stateThinking),
+ }
: first && activities.length === 0
? { tone: "wait" }
- : { tone: "live", text: "Working" };
+ : { tone: "live", text: t(m.stateWorking) };
const lineQueue =
queue.length > 0 && line === queue.at(-1)!.content ? queue : undefined;
return {
@@ -706,7 +738,6 @@ function resolveAgentRuntimeStatusSegment({
outputs,
plan,
state,
- summary,
...(unconfirmed ? { unconfirmedFollowUps: true as const } : {}),
};
}
@@ -721,6 +752,7 @@ function resolveAgentRuntimeStatusSegment({
function statusLineQueue(
marks: readonly RuntimeStatusMark[],
activities: readonly RuntimeActivityPresentation[],
+ t: Translate,
): AgentStatusLineItem[] {
const byId = new Map(
activities.map((activity) => [activity.activityId, activity]),
@@ -728,7 +760,9 @@ function statusLineQueue(
let items: { key: string; text: string; runningActivityId?: string }[] = [];
for (const mark of marks) {
if (mark.type === "thinking") {
- items = [{ key: mark.key, text: mark.title?.trim() || "Thinking" }];
+ items = [
+ { key: mark.key, text: mark.title?.trim() || t(m.stateThinking) },
+ ];
continue;
}
const activity = byId.get(mark.activityId);
@@ -744,6 +778,7 @@ function statusLineQueue(
? { runningActivityId: activity.activityId }
: {};
const named = activityStatusLine(
+ t,
activity.kind,
toolInputFromEntries(activity.entries),
);
@@ -778,10 +813,10 @@ function statusLineQueue(
}));
}
-function activitySummary(activity: RuntimeActivityPresentation) {
- if (activity.kind === "interaction") return "Waiting for your input";
- if (activity.kind === "response") return "Preparing a reply";
- return toolPresentation(activity.kind).summary;
+function activitySummary(activity: RuntimeActivityPresentation, t: Translate) {
+ if (activity.kind === "interaction") return t(m.stateWaitingForInput);
+ if (activity.kind === "response") return t(m.preparingReply);
+ return toolPresentation(t, activity.kind).summary;
}
function createAgentRunStatusView(
@@ -800,13 +835,16 @@ function createAgentRunStatusView(
};
}
-function avatarStatus(row: AgentRunStatusView): AgentAvatarStatus {
+function avatarStatus(
+ row: AgentRunStatusView,
+ t: Translate,
+): AgentAvatarStatus {
return {
- status: runtimeStatusDisplayState(row.state),
+ status: t(stateLabels[row.state]),
activities: row.activities.flatMap((activity) =>
activity.outcome
? []
- : [{ id: activity.activityId, label: activitySummary(activity) }],
+ : [{ id: activity.activityId, label: activitySummary(activity, t) }],
),
};
}
@@ -864,6 +902,7 @@ export function AgentStreamingStatusDock({
/** Shown only while that Agent has no Run status; it offers no Stop. */
typingAgent?: AgentStreamingTypingAgent;
}) {
+ const t = useT();
const runtimeViewCache = useRef<RuntimeTimelineViewCache>(new Map());
const runtimeStatuses = useMemo(
() =>
@@ -871,8 +910,9 @@ export function AgentStreamingStatusDock({
runStatuses,
runtimePresentationEventsByRunStatusId,
runtimeViewCache.current,
+ t,
),
- [runStatuses, runtimePresentationEventsByRunStatusId],
+ [runStatuses, runtimePresentationEventsByRunStatusId, t],
);
const entries = useMemo<AgentStreamingDockEntry[]>(() => {
const next: AgentStreamingDockEntry[] = runtimeStatuses.map(
@@ -934,8 +974,10 @@ export function AgentStreamingStatusDock({
const attentionCount = entries.filter(
(entry) => entry.runtimeStatus?.state === "Needs attention",
).length;
- const statusLabel =
- failedCount || attentionCount ? "Agent status" : "Agents working";
+ const openActivityLabel =
+ failedCount || attentionCount
+ ? t(m.openAgentStatusActivity)
+ : t(m.openAgentsWorkingActivity);
const shownEntry = entries.find((entry) => entry.key === line.current?.id);
const shownActivity = shownEntry?.runtimeStatus
? {
@@ -961,7 +1003,7 @@ export function AgentStreamingStatusDock({
>
<div className="flex min-h-7 max-w-full items-center gap-1">
<button
- aria-label={`Open ${statusLabel} activity`}
+ aria-label={openActivityLabel}
className="flex min-h-7 min-w-0 flex-1 items-center gap-2 rounded-md px-1 text-left text-xs text-app-muted transition-colors hover:bg-app-hover focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-app-focus disabled:hover:bg-transparent"
disabled={!shownActivity}
onClick={() => {
@@ -978,7 +1020,10 @@ export function AgentStreamingStatusDock({
}}
title={
shownEntry && line.current
- ? `${shownEntry.agent.display_name}: ${statusLineText(line.current.content)}`
+ ? t(m.labeled, {
+ label: shownEntry.agent.display_name,
+ value: statusLineText(line.current.content, t),
+ })
: undefined
}
type="button"
@@ -1097,6 +1142,7 @@ function dockRuntimeStatuses(
Record<string, readonly TeamHubRuntimePresentationEventRecord[]>
>,
cache: RuntimeTimelineViewCache,
+ t: Translate,
) {
const latestByAgent = new Map<string, TeamHubRunStatus>();
for (const runStatus of runStatuses) {
@@ -1121,6 +1167,7 @@ function dockRuntimeStatuses(
cache,
runStatuses: [...latestByAgent.values()],
runtimePresentationEventsByRunStatusId,
+ t,
}).filter(
(row) =>
isLiveAgentRunStatus(row) ||
@@ -1135,8 +1182,8 @@ function dockEntryLine(entry: AgentStreamingDockEntry): AgentStatusLineContent {
return { tone: "wait" };
}
-function statusLineText(content: AgentStatusLineContent) {
- return content.tone === "wait" ? "Starting" : content.text;
+function statusLineText(content: AgentStatusLineContent, t: Translate) {
+ return content.tone === "wait" ? t(m.starting) : content.text;
}
/** The line's text; a long-running Activity's minutes follow it directly. */
@@ -1147,6 +1194,7 @@ function StatusLineText({
content: AgentStatusLineContent;
minutes?: number;
}) {
+ const t = useT();
if (content.tone === "wait")
return <TypingDots className="text-app-subtle" />;
const text = (
@@ -1167,7 +1215,7 @@ function StatusLineText({
<span className="flex min-w-0 items-center gap-1">
{text}
<span className="shrink-0 leading-4 text-app-subtle tabular-nums">
- · {minutes}m
+ · {t(m.elapsedMinutes, { minutes })}
</span>
</span>
);
@@ -1211,10 +1259,6 @@ function StatusLineRoll({
);
}
-function runtimeStatusDisplayState(state: AgentRuntimeState) {
- return state === "Responding" ? "Typing" : state;
-}
-
function LinkedSourceMessagePanel({
actorDisplayNames,
currentActorId,
@@ -1266,21 +1310,23 @@ function LinkedSourceMessagePanel({
tenantId: string;
workspaceAgentIds: ReadonlySet<string>;
}) {
+ const t = useT();
return (
<section
- aria-label="Linked source Message"
+ aria-label={t(m.linkedSourceMessage)}
className="border-b border-app-border bg-app-surface-soft"
>
<div className="room-readable px-4 py-3 md:px-0">
<div className="mb-2 flex min-h-8 items-center justify-between gap-3">
<p className="text-xs font-semibold text-app-muted">
- Linked source Message
+ {t(m.linkedSourceMessage)}
</p>
<Button
- aria-label="Close linked source Message"
+ data-voice-close
+ aria-label={t(m.closeLinkedSourceMessage)}
onClick={onClose}
size="compactIcon"
- title="Close linked source Message"
+ title={t(m.closeLinkedSourceMessage)}
tone="ghost"
>
<Icon icon={Cancel01Icon} size={14} />
@@ -1288,7 +1334,7 @@ function LinkedSourceMessagePanel({
</div>
{linkedSource.kind === "loading" ? (
<div className="flex gap-2.5 py-3" role="status">
- <span className="sr-only">Loading source Message…</span>
+ <span className="sr-only">{t(m.loadingSourceMessage)}</span>
<Skeleton className="size-9 shrink-0 rounded-full" />
<div className="min-w-0 flex-1 pt-1">
<div className="flex items-center gap-2">
@@ -1305,10 +1351,10 @@ function LinkedSourceMessagePanel({
role="alert"
>
<p className="text-sm text-app-muted">
- Source Message is unavailable.
+ {t(m.sourceMessageUnavailable)}
</p>
<Button onClick={linkedSource.retry} size="compact">
- Retry
+ {t(commonMessages.retry)}
</Button>
</div>
) : (
diff --git a/apps/web/src/features/rooms/chat/profile-card-content.tsx b/apps/web/src/features/rooms/chat/profile-card-content.tsx
index 6bc98495..5b71a78c 100644
--- a/apps/web/src/features/rooms/chat/profile-card-content.tsx
+++ b/apps/web/src/features/rooms/chat/profile-card-content.tsx
@@ -11,6 +11,9 @@ import { anotherMeQueryKey } from "@/features/rooms/room-queries";
import { teamHubData } from "@/features/teamhub/teamhub-api";
import { useOptionalTeamHubRuntime } from "@/features/teamhub/teamhub-runtime";
import type { TeamHubPersonalProfileDocument } from "@/features/teamhub/teamhub-types";
+import { useT } from "@/i18n/use-translation";
+
+import { chatMessages } from "./chat.messages";
/** Select a short paragraph from the published Profile's fields. */
export function profilePreview(
@@ -46,6 +49,7 @@ export function useProfileCardContent({
roomId?: string;
authorId?: string;
}) {
+ const t = useT();
const runtime = useOptionalTeamHubRuntime();
const anotherMe = useQuery({
queryKey: anotherMeQueryKey(tenantId ?? ""),
@@ -107,7 +111,7 @@ export function useProfileCardContent({
),
sources: apps.length ? (
<ul
- aria-label="Profile sources"
+ aria-label={t(chatMessages.profileSources)}
className="flex flex-wrap items-center gap-1.5"
>
{apps.map((app) => (
diff --git a/apps/web/src/features/rooms/chat/room-chat-timeline-section.tsx b/apps/web/src/features/rooms/chat/room-chat-timeline-section.tsx
index 490c8982..dee0e98a 100644
--- a/apps/web/src/features/rooms/chat/room-chat-timeline-section.tsx
+++ b/apps/web/src/features/rooms/chat/room-chat-timeline-section.tsx
@@ -1,6 +1,9 @@
import type { ComponentProps } from "react";
import { isRunWorking } from "@/features/teamhub/run-status";
+import { useT } from "@/i18n/use-translation";
+
+import { chatMessages } from "./chat.messages";
import { JumpToLatestButton } from "./jump-to-latest-button";
import { MessageTimeline } from "./message-timeline";
@@ -145,10 +148,11 @@ function RoomTimelineViewport({
viewportRef,
...timelineProps
}: RoomTimelineViewportProps) {
+ const t = useT();
return (
<div className="relative flex min-h-0 flex-1 flex-col">
<div
- aria-label="Room timeline"
+ aria-label={t(chatMessages.roomTimeline)}
data-voice-scroll="main"
className={`room-timeline workspace-scrollbar flex flex-1 flex-col overflow-y-scroll [overflow-anchor:none] ${
initialScrollReady ? "" : "invisible"
diff --git a/apps/web/src/features/rooms/chat/room-notice-row.tsx b/apps/web/src/features/rooms/chat/room-notice-row.tsx
index d37f43e1..bf145c3d 100644
--- a/apps/web/src/features/rooms/chat/room-notice-row.tsx
+++ b/apps/web/src/features/rooms/chat/room-notice-row.tsx
@@ -6,12 +6,22 @@ import type {
TeamHubActorRef,
TeamHubMessage,
} from "@/features/teamhub/teamhub-types";
+import type { Message } from "@/i18n/messages";
+import { RichMessage, useT } from "@/i18n/use-translation";
import { AgentChangeFields } from "../cards/agent-change-fields";
import { ActorAvatar } from "../members/actor-avatar";
+import { chatMessages } from "./chat.messages";
type RoomNotice = NonNullable<TeamHubMessage["notice"]>;
+const fieldNames: Record<string, Message<string>> = {
+ description: chatMessages.noticeFieldDescription,
+ instructions: chatMessages.noticeFieldInstructions,
+ name: chatMessages.noticeFieldName,
+ prompt: chatMessages.noticeFieldPrompt,
+};
+
const linkClass =
"text-app-info hover:text-app-info-hover hover:underline focus-visible:rounded-sm focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-app-info";
@@ -76,9 +86,10 @@ function NoticeLine({
onOpenDirectChat?: (actorId: string) => void;
onOpenProfile: (actorId: string) => void;
}) {
+ const t = useT();
const [expanded, setExpanded] = useState(false);
const detailsId = useId();
- const profileLink = (actorId: string, label = "View profile") => (
+ const profileLink = (actorId: string) => (
<>
<Separator />
<button
@@ -86,27 +97,44 @@ function NoticeLine({
onClick={() => onOpenProfile(actorId)}
type="button"
>
- {label}
+ {t(chatMessages.viewProfile)}
</button>
</>
);
+ // The sentence of a notice names its actors; the translation places them.
+ const authorName = () => <ActorName actor={author} />;
switch (notice.type) {
case "agent_created": {
const approver = notice.approved_by;
+ const tags = {
+ agent: () => <ActorName actor={notice.agent} />,
+ author: authorName,
+ };
+ const names = {
+ agent: notice.agent.display_name,
+ author: author.display_name,
+ };
return (
<Pill icon={UserAdd01Icon}>
- <ActorName actor={author} />
- <Words>created</Words>
- <ActorName actor={notice.agent} />
- {approver ? (
- <Words>
- {approver.id === currentActorId
- ? "after your approval"
- : `after ${approver.display_name}'s approval`}
- </Words>
+ {!approver ? (
+ <RichMessage
+ message={chatMessages.noticeAgentCreated}
+ tags={tags}
+ values={names}
+ />
+ ) : approver.id === currentActorId ? (
+ <RichMessage
+ message={chatMessages.noticeAgentCreatedAfterYourApproval}
+ tags={tags}
+ values={names}
+ />
) : (
- <Words>and added it to this Room</Words>
+ <RichMessage
+ message={chatMessages.noticeAgentCreatedAfterApproval}
+ tags={tags}
+ values={{ ...names, approver: approver.display_name }}
+ />
)}
{approver && onOpenDirectChat ? (
<>
@@ -116,7 +144,7 @@ function NoticeLine({
onClick={() => onOpenDirectChat(notice.agent.id)}
type="button"
>
- Open direct chat
+ {t(chatMessages.openDirectChat)}
</button>
</>
) : (
@@ -128,28 +156,44 @@ function NoticeLine({
case "member_added":
return (
<Pill icon={UserAdd01Icon}>
- <ActorName actor={author} />
- <Words>added</Words>
- <ActorName actor={notice.member} />
- <Words>to this Room</Words>
+ <RichMessage
+ message={chatMessages.noticeMemberAdded}
+ tags={{
+ author: authorName,
+ member: () => <ActorName actor={notice.member} />,
+ }}
+ values={{
+ author: author.display_name,
+ member: notice.member.display_name,
+ }}
+ />
</Pill>
);
case "agent_profile_changed": {
const before =
notice.changes.find((change) => change.field === "name")?.before ??
notice.agent.display_name;
+ const agentName = () => <ActorName actor={notice.agent} />;
if (notice.initialized) {
return (
<Pill icon={UserEdit01Icon}>
{author.id === notice.agent.id ? (
- <Words>{before} set up its identity as</Words>
+ <RichMessage
+ message={chatMessages.noticeAgentSetUpOwnIdentity}
+ tags={{ agent: agentName }}
+ values={{ agent: notice.agent.display_name, before }}
+ />
) : (
- <>
- <ActorName actor={author} />
- <Words>set up {before} as</Words>
- </>
+ <RichMessage
+ message={chatMessages.noticeAgentSetUpBy}
+ tags={{ agent: agentName, author: authorName }}
+ values={{
+ agent: notice.agent.display_name,
+ author: author.display_name,
+ before,
+ }}
+ />
)}
- <ActorName actor={notice.agent} />
{profileLink(notice.agent.id)}
</Pill>
);
@@ -161,11 +205,23 @@ function NoticeLine({
return (
<>
<Pill icon={UserEdit01Icon}>
- <ActorName actor={author} />
- <Words>updated</Words>
- <ActorName actor={notice.agent} />
+ <RichMessage
+ message={chatMessages.noticeAgentUpdated}
+ tags={{ agent: agentName, author: authorName }}
+ values={{
+ agent: notice.agent.display_name,
+ author: author.display_name,
+ }}
+ />
<Separator />
- <Words>{fields.join(", ")}</Words>
+ <Words>
+ {fields
+ .map((field) => {
+ const name = fieldNames[field];
+ return name ? t(name) : field;
+ })
+ .join(t(chatMessages.listSeparator))}
+ </Words>
<Separator />
<button
aria-controls={detailsId}
@@ -174,7 +230,9 @@ function NoticeLine({
onClick={() => setExpanded((open) => !open)}
type="button"
>
- {expanded ? "Hide changes" : "Show changes"}
+ {expanded
+ ? t(chatMessages.hideChanges)
+ : t(chatMessages.showChanges)}
</button>
</Pill>
{expanded ? (
@@ -187,14 +245,14 @@ function NoticeLine({
) : null}
{notice.instructions_changed ? (
<p className="m-0 text-app-muted">
- Instructions updated
+ {t(chatMessages.instructionsUpdated)}
<Separator />
<button
className={linkClass}
onClick={() => onOpenProfile(notice.agent.id)}
type="button"
>
- View in Agent Info
+ {t(chatMessages.viewInAgentInfo)}
</button>
</p>
) : null}
diff --git a/apps/web/src/features/rooms/chat/room-realtime-sync.tsx b/apps/web/src/features/rooms/chat/room-realtime-sync.tsx
index 0796f5aa..f5582631 100644
--- a/apps/web/src/features/rooms/chat/room-realtime-sync.tsx
+++ b/apps/web/src/features/rooms/chat/room-realtime-sync.tsx
@@ -10,8 +10,11 @@ import type {
TeamHubMessage,
TeamHubRoomPage,
} from "@/features/teamhub/teamhub-types";
+import { translate } from "@/i18n/language";
+import { useT } from "@/i18n/use-translation";
import { roomQueryKey, tenantRoomsQueryKey } from "../room-queries";
+import { roomSurfaceMessages } from "../room-surface.messages";
import { createRoomProjection } from "./room-projection";
/** How long joining or catching up may take before the header says so. */
@@ -49,6 +52,7 @@ export function RoomRealtimeSync({
return () => window.clearTimeout(timer);
}, [settled]);
const [error, setError] = useState<string | null>(null);
+ const t = useT();
// UI callbacks; read through refs so they never recreate the subscription.
const onMessageCreatedRef = useRef(onMessageCreated);
const onTeamMdPublishedRef = useRef(onTeamMdPublished);
@@ -78,7 +82,7 @@ export function RoomRealtimeSync({
client.api.GET("/v0/rooms/{roomId}", { params: { path: { roomId } } }),
);
if (room.id !== roomId || room.tenant_id !== tenantId) {
- throw new Error("TeamHub returned a Room outside the active scope.");
+ throw new Error(translate(roomSurfaceMessages.roomOutsideScope));
}
queryClient.setQueryData(roomQueryKey(tenantId, roomId), room);
} catch (error) {
@@ -128,7 +132,7 @@ export function RoomRealtimeSync({
setError(
realtimeError instanceof Error
? realtimeError.message
- : "Room refresh failed.",
+ : translate(roomSurfaceMessages.roomRefreshFailed),
),
);
},
@@ -162,10 +166,10 @@ export function RoomRealtimeSync({
const label =
status === "offline"
- ? "Offline"
+ ? t(roomSurfaceMessages.offline)
: status === "catching-up"
- ? "Syncing Room"
- : "Reconnecting";
+ ? t(roomSurfaceMessages.syncingRoom)
+ : t(roomSurfaceMessages.reconnecting);
return (
<div
diff --git a/apps/web/src/features/rooms/chat/room-run-controls.tsx b/apps/web/src/features/rooms/chat/room-run-controls.tsx
index bb03c74a..2257ee42 100644
--- a/apps/web/src/features/rooms/chat/room-run-controls.tsx
+++ b/apps/web/src/features/rooms/chat/room-run-controls.tsx
@@ -6,6 +6,9 @@ import type {
TeamHubRoomRunCancelResult,
TeamHubRoomRunRedeliverResult,
} from "@/features/teamhub/teamhub-types";
+import { useT } from "@/i18n/use-translation";
+
+import { runtimeStatusMessages as m } from "../runtime-status/runtime-status.messages";
interface StopVariables {
requestId: string;
@@ -30,6 +33,7 @@ export function AgentRunStopButton({
/** The Room or Thread whose Stop state this button shares. */
scopeKey: readonly string[];
}) {
+ const t = useT();
const [requestId] = useState(createTeamHubIdempotencyKey);
const mutationKey = ["room-stop", ...scopeKey, controlKey];
const previous = useMutationState({
@@ -70,16 +74,16 @@ export function AgentRunStopButton({
runId,
})
}
- aria-label={`Stop ${name}'s task`}
+ aria-label={t(m.stopAgentTask, { name })}
>
- {stopping ? "Stopping" : stopped ? "Stopped" : "Stop"}
+ {stopping ? t(m.stopping) : stopped ? t(m.stopped) : t(m.stop)}
</Button>
{state.status === "error" ? (
<span
role="alert"
className="max-w-28 truncate text-[12px] text-app-danger"
>
- Stop not confirmed. Check the task status, then retry.
+ {t(m.stopNotConfirmed)}
</span>
) : null}
</span>
@@ -106,6 +110,7 @@ export function AgentRunResendButton({
/** The Room or Thread whose Resend state this button shares. */
scopeKey: readonly string[];
}) {
+ const t = useT();
const mutationKey = ["room-resend", ...scopeKey, controlKey];
const previous = useMutationState({
filters: {
@@ -127,28 +132,29 @@ export function AgentRunResendButton({
if (result)
return (
<span className="shrink-0 px-1.5 text-[12px] font-medium text-app-subtle">
- {result.status === "redelivered" ? "Resent" : "Nothing to resend"}
+ {result.status === "redelivered" ? t(m.resent) : t(m.nothingToResend)}
</span>
);
return (
<span className="inline-flex min-w-0 shrink-0 items-center gap-1">
<Button
+ data-voice-risk="never"
type="button"
tone="ghost"
size="compact"
className="h-7 px-1.5 text-[12px] font-medium text-app-muted hover:bg-transparent hover:text-app-ink"
disabled={state.status === "pending"}
onClick={() => mutation.mutate(runId)}
- aria-label={`Resend unconfirmed follow-up to ${name}`}
+ aria-label={t(m.resendFollowUp, { name })}
>
- Resend
+ {t(m.resend)}
</Button>
{state.status === "error" ? (
<span
role="alert"
className="max-w-28 truncate text-[12px] text-app-danger"
>
- Resend failed. Try again.
+ {t(m.resendFailed)}
</span>
) : null}
</span>
diff --git a/apps/web/src/features/rooms/chat/thread-panel.tsx b/apps/web/src/features/rooms/chat/thread-panel.tsx
index 7e88fea4..09b15721 100644
--- a/apps/web/src/features/rooms/chat/thread-panel.tsx
+++ b/apps/web/src/features/rooms/chat/thread-panel.tsx
@@ -24,6 +24,9 @@ import type {
TeamHubMessageFileSegment,
TeamHubRoom,
} from "@/features/teamhub/teamhub-types";
+import { commonMessages } from "@/i18n/common.messages";
+import { translate } from "@/i18n/language";
+import { useT } from "@/i18n/use-translation";
import { AgentAvatarStatusContext } from "../members/agent-avatar-status-context";
@@ -38,6 +41,7 @@ import {
createDirectRoomMessagePresenter,
withDirectRoomWireBody,
} from "./direct-room-message";
+import { chatMessages } from "./chat.messages";
import { isTimelineMessage } from "./message-grouping";
import {
MessageRow,
@@ -106,6 +110,7 @@ function ThreadPanelContent({
rootMessage,
tenantId,
}: ThreadPanelProps) {
+ const t = useT();
const { client } = useTeamHubRuntime();
const composition = roomMessageSender(client);
const parentRoomId = rootMessage.room_id;
@@ -319,11 +324,11 @@ function ThreadPanelContent({
return (
<aside
- aria-label="Message Thread"
+ aria-label={t(chatMessages.messageThread)}
className="flex h-full min-h-0 w-full min-w-0 flex-1 flex-col app-work-surface"
>
<h2 className="sr-only" ref={headingRef} tabIndex={-1}>
- Thread
+ {t(chatMessages.thread)}
</h2>
<ThreadTimeline
agentWorking={conversation.streamingRunStatuses.some(isRunWorking)}
@@ -340,7 +345,8 @@ function ThreadPanelContent({
<ThreadPendingReplies
actorId={currentActorId}
actorName={
- rowContext.actorDisplayNames[currentActorId ?? ""] ?? "You"
+ rowContext.actorDisplayNames[currentActorId ?? ""] ??
+ t(commonMessages.you)
}
lastAuthorId={replies.at(-1)?.author.id}
messages={conversation.pendingMessages}
@@ -355,7 +361,7 @@ function ThreadPanelContent({
parentRoom={parentRoom.data}
>
<MessageComposer
- ariaLabel="Reply in Thread"
+ ariaLabel={t(chatMessages.replyInThread)}
disabled={!threadRoomId}
initialMentions={initialDraft.mentions}
initialValue={initialDraft.body}
@@ -365,7 +371,9 @@ function ThreadPanelContent({
}
onSend={sendReply}
placeholder={
- threadRoomId ? "Reply in this Thread" : "Opening Thread…"
+ threadRoomId
+ ? t(chatMessages.replyInThisThread)
+ : t(chatMessages.openingThread)
}
ref={composerRef}
/>
@@ -492,7 +500,8 @@ function useThreadCardDecision(
);
return async (decision: RoomCardDecision) => {
- if (!controller) throw new Error("Thread is still opening.");
+ if (!controller)
+ throw new Error(translate(chatMessages.threadStillOpening));
await controller.decide(decision);
};
}
diff --git a/apps/web/src/features/rooms/chat/thread-reply-preview.tsx b/apps/web/src/features/rooms/chat/thread-reply-preview.tsx
index 6c420ded..faffd407 100644
--- a/apps/web/src/features/rooms/chat/thread-reply-preview.tsx
+++ b/apps/web/src/features/rooms/chat/thread-reply-preview.tsx
@@ -7,8 +7,10 @@ import { markdownPlainText } from "@/features/teamhub/markdown-plain-text";
import { teamHubData } from "@/features/teamhub/teamhub-api";
import { useOptionalTeamHubRuntime } from "@/features/teamhub/teamhub-runtime";
import type { TeamHubMessage } from "@/features/teamhub/teamhub-types";
+import { useT } from "@/i18n/use-translation";
import { roomMessagesQueryKey } from "../room-queries";
+import { chatMessages } from "./chat.messages";
export const MAX_THREAD_PREVIEW_REPLIES = 3;
const PREVIEW_BODY_CHARS = 140;
@@ -20,6 +22,7 @@ export function ThreadReplyPreview({
message: TeamHubMessage;
onOpen: () => void;
}) {
+ const t = useT();
const thread = message.thread;
const runtime = useOptionalTeamHubRuntime();
const replyCount = thread?.reply_count ?? 0;
@@ -49,11 +52,11 @@ export function ThreadReplyPreview({
if (!thread || replyCount <= 0) return null;
const previews = repliesQuery.data ?? [];
- const repliesLabel = `${replyCount} ${replyCount === 1 ? "reply" : "replies"}`;
+ const repliesLabel = t(chatMessages.replyCount, { count: replyCount });
return (
<button
- aria-label={`Open thread, ${repliesLabel}`}
+ aria-label={t(chatMessages.openThread, { replies: repliesLabel })}
className="mt-2 inline-flex h-6 items-center justify-center rounded-full bg-muted px-1.5 font-(family-name:--app-room-font) text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-app-focus"
onClick={onOpen}
type="button"
diff --git a/apps/web/src/features/rooms/chat/thread-timeline.tsx b/apps/web/src/features/rooms/chat/thread-timeline.tsx
index fd385758..47e516c4 100644
--- a/apps/web/src/features/rooms/chat/thread-timeline.tsx
+++ b/apps/web/src/features/rooms/chat/thread-timeline.tsx
@@ -2,6 +2,9 @@ import { Fragment, type PropsWithChildren, type ReactNode } from "react";
import { Button } from "@/components/ui/button";
import type { TeamHubMessage } from "@/features/teamhub/teamhub-types";
+import { useT, useTranslation } from "@/i18n/use-translation";
+
+import { chatMessages } from "./chat.messages";
import {
formatMessageTime,
@@ -41,11 +44,12 @@ export function ThreadTimeline({
rootMessage: TeamHubMessage;
timeline: ReturnType<typeof useRoomTimelineScroll>;
}>) {
+ const t = useT();
return (
<div className="relative flex min-h-0 flex-1 flex-col">
<div
aria-busy={opening || undefined}
- aria-label="Thread timeline"
+ aria-label={t(chatMessages.threadTimeline)}
data-voice-scroll="thread"
className="workspace-scrollbar min-h-0 flex-1 overflow-y-auto px-3 pt-3 pb-10 [overflow-anchor:none]"
data-initial-scroll-ready={timeline.initialScrollReady}
@@ -58,7 +62,7 @@ export function ThreadTimeline({
{opening ? (
<div className="mt-4 space-y-3" data-testid="thread-panel-loading">
<p className="text-[12px] font-medium text-app-muted">
- Opening Thread…
+ {t(chatMessages.openingThread)}
</p>
<div className="h-16 animate-pulse rounded-lg bg-app-hover" />
<div className="h-16 animate-pulse rounded-lg bg-app-hover" />
@@ -67,14 +71,14 @@ export function ThreadTimeline({
{replies.length || hasPending ? (
<div className="my-4 flex items-center gap-2 text-[12px] text-app-subtle">
<span className="h-px flex-1 bg-app-border" />
- Replies
+ {t(chatMessages.replies)}
<span className="h-px flex-1 bg-app-border" />
</div>
) : null}
{canLoadEarlier ? (
<div className="mb-3 text-center">
<Button loading={loadingEarlier} onClick={onLoadEarlier}>
- Load earlier replies
+ {t(chatMessages.loadEarlierReplies)}
</Button>
</div>
) : null}
@@ -114,9 +118,10 @@ export function ThreadTimeline({
}
function ConversationTime({ at }: { at: string }) {
+ const translation = useTranslation();
return (
<div className="room-conversation-time text-center text-xs text-app-subtle">
- <time dateTime={at}>{formatMessageTime(at)}</time>
+ <time dateTime={at}>{formatMessageTime(at, translation)}</time>
</div>
);
}
diff --git a/apps/web/src/features/rooms/chat/use-message-file-preview.ts b/apps/web/src/features/rooms/chat/use-message-file-preview.ts
index b9a97da6..504ac6fb 100644
--- a/apps/web/src/features/rooms/chat/use-message-file-preview.ts
+++ b/apps/web/src/features/rooms/chat/use-message-file-preview.ts
@@ -4,6 +4,9 @@ import type {
TeamHubMessageDocumentSegment,
TeamHubMessageFileSegment,
} from "@/features/teamhub/teamhub-types";
+import { translate } from "@/i18n/language";
+
+import { chatMessages } from "./chat.messages";
/** Opens a Message file and reports only the latest request's failure. */
export function useMessageFilePreview(
@@ -25,7 +28,7 @@ export function useMessageFilePreview(
}
} catch {
if (filePreviewRequestRef.current === requestId) {
- setFilePreviewError("File preview is unavailable");
+ setFilePreviewError(translate(chatMessages.filePreviewUnavailable));
}
}
})();
diff --git a/apps/web/src/features/rooms/chat/use-room-chat-navigation.ts b/apps/web/src/features/rooms/chat/use-room-chat-navigation.ts
index 9c54ffa2..5922fc4e 100644
--- a/apps/web/src/features/rooms/chat/use-room-chat-navigation.ts
+++ b/apps/web/src/features/rooms/chat/use-room-chat-navigation.ts
@@ -17,12 +17,14 @@ import type {
TeamHubMessageDocumentSegment,
TeamHubMessageFileSegment,
} from "@/features/teamhub/teamhub-types";
+import { translate } from "@/i18n/language";
import { useRoomOutletContext } from "../room-connectivity";
import { artifactPreviewCache } from "../files/artifact-preview-cache";
import { prefetchArtifactPreview } from "../files/artifact-preview-loader";
import { documentCardVersionQueryKey } from "../files/use-document-card-metadata";
import type { RoomComposerDocumentContext } from "../room-drafts";
+import { runtimeStatusMessages } from "../runtime-status/runtime-status.messages";
import type { MessageDocumentOption } from "./message-composer-references";
import { patchRoomMessageThread } from "./room-projection";
@@ -133,7 +135,9 @@ export function useRoomChatNavigation(
activityRoomId,
anchorMessageId: sourceMessageId,
actorId: agent.id,
- title: `Activity · ${agent.display_name}`,
+ title: translate(runtimeStatusMessages.activityTabTitle, {
+ name: agent.display_name,
+ }),
});
clearProfileParam();
},
@@ -145,7 +149,9 @@ export function useRoomChatNavigation(
kind: "agentActivity",
actorId: agent.id,
activityRoomId,
- title: `Activity · ${agent.display_name}`,
+ title: translate(runtimeStatusMessages.activityTabTitle, {
+ name: agent.display_name,
+ }),
});
clearProfileParam();
},
@@ -153,7 +159,9 @@ export function useRoomChatNavigation(
openPanelTab({
kind: "agentInfo",
actorId: actor.id,
- title: `Agent · ${actor.display_name}`,
+ title: translate(runtimeStatusMessages.agentTabTitle, {
+ name: actor.display_name,
+ }),
});
clearProfileParam();
},
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 f3f37d7e..7f829ec9 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
@@ -33,6 +33,8 @@ for (const exports of Object.values(messageModules))
* `file: namespace.name`, with the reason.
*/
const notActions: Record<string, string> = {
+ "/src/features/rooms/chat/room-notice-row.tsx: chat.hideChanges":
+ "folds the change list in place; it closes nothing",
"/src/features/rooms/room-secondary-navigation.tsx: roomList.deletedChat":
"says the Agent of a direct chat was deleted; the link only opens the chat",
"/src/features/rooms/room-secondary-navigation.tsx: roomList.deleted":
diff --git a/apps/web/src/features/rooms/files/artifact-file-kind.test.ts b/apps/web/src/features/rooms/files/artifact-file-kind.test.ts
index 5365024b..17bae8bd 100644
--- a/apps/web/src/features/rooms/files/artifact-file-kind.test.ts
+++ b/apps/web/src/features/rooms/files/artifact-file-kind.test.ts
@@ -1,5 +1,7 @@
import { describe, expect, it } from "vitest";
+import { translate } from "@/i18n/language";
+
import { artifactFileKind, artifactFileTypeLabel } from "./artifact-file-kind";
describe("artifactFileKind", () => {
@@ -53,6 +55,8 @@ describe("artifactFileKind", () => {
["MP4 sample", "Video"],
["Excel XLSX sample", "Excel"],
] as const)("labels %s as %s", (filename, expected) => {
- expect(artifactFileTypeLabel(filename)).toBe(expected);
+ expect(artifactFileTypeLabel(filename, undefined, translate)).toBe(
+ expected,
+ );
});
});
diff --git a/apps/web/src/features/rooms/files/artifact-file-kind.ts b/apps/web/src/features/rooms/files/artifact-file-kind.ts
index 03fd0e62..ad366853 100644
--- a/apps/web/src/features/rooms/files/artifact-file-kind.ts
+++ b/apps/web/src/features/rooms/files/artifact-file-kind.ts
@@ -1,3 +1,8 @@
+import type { Translate } from "@/i18n/language";
+import type { Message } from "@/i18n/messages";
+
+import { chatMessages } from "../chat/chat.messages";
+
const archiveExtensions = new Set([
"7z",
"bz2",
@@ -95,19 +100,20 @@ export type ArtifactFileKind =
| "video"
| "workflow";
-const fileKindLabels: Record<ArtifactFileKind, string> = {
- archive: "Archive",
- audio: "Audio",
- code: "Code",
- document: "Document",
+// A format or app name is the same in every language; a kind is a message.
+const fileKindLabels: Record<ArtifactFileKind, Message | string> = {
+ archive: chatMessages.fileTypeArchive,
+ audio: chatMessages.fileTypeAudio,
+ code: chatMessages.fileTypeCode,
+ document: chatMessages.fileTypeDocument,
html: "HTML",
- image: "Image",
+ image: chatMessages.fileTypeImage,
markdown: "Markdown",
pdf: "PDF",
presentation: "PowerPoint",
spreadsheet: "Excel",
- video: "Video",
- workflow: "Workflow",
+ video: chatMessages.fileTypeVideo,
+ workflow: chatMessages.fileTypeWorkflow,
};
export function artifactFileKind(
@@ -137,12 +143,17 @@ export function artifactFileKind(
return kindFromMediaType(mediaType) ?? "document";
}
-export function artifactFileTypeLabel(filename: string, mediaType?: string) {
+export function artifactFileTypeLabel(
+ filename: string,
+ mediaType: string | undefined,
+ t: Translate,
+) {
const extension = fileExtension(filename);
if (extension === "doc" || extension === "docx") return "Word";
if (extension === "csv" || extension === "tsv") return "CSV";
- if (textExtensions.has(extension)) return "Text";
- return fileKindLabels[artifactFileKind(filename, mediaType)];
+ if (textExtensions.has(extension)) return t(chatMessages.fileTypeText);
+ const label = fileKindLabels[artifactFileKind(filename, mediaType)];
+ return typeof label === "string" ? label : t(label);
}
function fileExtension(filename: string) {
diff --git a/apps/web/src/features/rooms/files/document-card-metadata.test.ts b/apps/web/src/features/rooms/files/document-card-metadata.test.ts
index cfe86e5d..b2d34b40 100644
--- a/apps/web/src/features/rooms/files/document-card-metadata.test.ts
+++ b/apps/web/src/features/rooms/files/document-card-metadata.test.ts
@@ -1,19 +1,24 @@
import { describe, expect, it } from "vitest";
+import { translate } from "@/i18n/language";
+
import { documentCardPresentation } from "./document-card-metadata";
describe("Document card metadata", () => {
it("uses current Version metadata for binary uploads instead of a renamed title", () => {
expect(
- documentCardPresentation({
- title: "Report.md",
- format: "binary",
- representation_format: "binary",
- version: {
- filename: "budget.xlsx",
- media_type:
- "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
+ documentCardPresentation(
+ {
+ title: "Report.md",
+ format: "binary",
+ representation_format: "binary",
+ version: {
+ filename: "budget.xlsx",
+ media_type:
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
+ },
},
- }),
+ translate,
+ ),
).toEqual({
filename: "Report.md",
iconKind: "spreadsheet",
@@ -22,11 +27,14 @@ describe("Document card metadata", () => {
});
it("does not turn a native Document into Markdown because its title ends in md", () => {
expect(
- documentCardPresentation({
- title: "Report.md",
- format: "blocknote",
- representation_format: "markdown",
- }),
+ documentCardPresentation(
+ {
+ title: "Report.md",
+ format: "blocknote",
+ representation_format: "markdown",
+ },
+ translate,
+ ),
).toEqual({
filename: "Report.md",
iconKind: "document",
@@ -42,16 +50,19 @@ describe("Document card metadata", () => {
"uses the authoritative %s format even when the title claims another format",
(format, iconKind, typeLabel) => {
expect(
- documentCardPresentation({
- title: "Misleading.pdf.md",
- format,
- representation_format: format,
- }),
+ documentCardPresentation(
+ {
+ title: "Misleading.pdf.md",
+ format,
+ representation_format: format,
+ },
+ translate,
+ ),
).toEqual({ filename: "Misleading.pdf.md", iconKind, typeLabel });
},
);
it("uses a neutral card while authorized metadata is unavailable", () => {
- expect(documentCardPresentation()).toEqual({
+ expect(documentCardPresentation(undefined, translate)).toEqual({
filename: "Document",
iconKind: "document",
typeLabel: "Document",
diff --git a/apps/web/src/features/rooms/files/document-card-metadata.ts b/apps/web/src/features/rooms/files/document-card-metadata.ts
index 61a072d9..ff2feba4 100644
--- a/apps/web/src/features/rooms/files/document-card-metadata.ts
+++ b/apps/web/src/features/rooms/files/document-card-metadata.ts
@@ -2,6 +2,9 @@ import type {
TeamHubDocument,
TeamHubDocumentVersion,
} from "@/features/teamhub/teamhub-types";
+import type { Translate } from "@/i18n/language";
+
+import { chatMessages } from "../chat/chat.messages";
import {
artifactFileKind,
artifactFileTypeLabel,
@@ -16,23 +19,26 @@ export type DocumentCardMetadata = Pick<
version?: Pick<TeamHubDocumentVersion, "filename" | "media_type">;
};
-export function documentCardPresentation(document?: DocumentCardMetadata): {
+export function documentCardPresentation(
+ document: DocumentCardMetadata | undefined,
+ t: Translate,
+): {
filename: string;
iconKind: ArtifactFileKind;
typeLabel: string;
} {
if (!document) {
return {
- filename: "Document",
+ filename: t(chatMessages.untitledDocument),
iconKind: "document",
- typeLabel: "Document",
+ typeLabel: t(chatMessages.fileTypeDocument),
};
}
if (document.format === "blocknote") {
return {
filename: document.title,
iconKind: "document",
- typeLabel: "Online document",
+ typeLabel: t(chatMessages.fileTypeOnlineDocument),
};
}
// The representation comes from TeamHub; titles and message labels are not formats.
@@ -47,6 +53,7 @@ export function documentCardPresentation(document?: DocumentCardMetadata): {
typeLabel: artifactFileTypeLabel(
document.version.filename,
document.version.media_type,
+ t,
),
};
}
@@ -54,6 +61,6 @@ export function documentCardPresentation(document?: DocumentCardMetadata): {
return {
filename: document.title,
iconKind: artifactFileKind(typeFilename),
- typeLabel: artifactFileTypeLabel(typeFilename),
+ typeLabel: artifactFileTypeLabel(typeFilename, undefined, t),
};
}
diff --git a/apps/web/src/features/rooms/files/message-file-attachment.tsx b/apps/web/src/features/rooms/files/message-file-attachment.tsx
index 84503d13..abba7da0 100644
--- a/apps/web/src/features/rooms/files/message-file-attachment.tsx
+++ b/apps/web/src/features/rooms/files/message-file-attachment.tsx
@@ -2,6 +2,7 @@ import { useEffect, useRef, useState, type ReactNode } from "react";
import { FileTypeIcon } from "@/features/library/workspace-file-icon";
import { useTeamHubRuntime } from "@/features/teamhub/teamhub-runtime";
+import { useT } from "@/i18n/use-translation";
import { loadArtifactPreview } from "./artifact-preview-loader";
import {
@@ -18,6 +19,7 @@ import {
type ArtifactFileKind,
} from "./artifact-file-kind";
import { fileItemDetail, MessageFileItem } from "./message-file-item";
+import { chatMessages } from "../chat/chat.messages";
import { FileVoiceMaterialButton } from "../chat/voice-mode/file-voice-material-button";
/**
@@ -57,6 +59,7 @@ export function MessageFileAttachment({
typeLabel?: string;
versionId?: string;
}) {
+ const t = useT();
const renderer = selectArtifactRenderer({
filename: sourceFilename,
mediaType: mediaType ?? "",
@@ -89,7 +92,7 @@ export function MessageFileAttachment({
actionLabel ?? (renderer === "download" ? "Open" : "Preview")
}
detail={fileItemDetail(
- typeLabel ?? artifactFileTypeLabel(sourceFilename, mediaType),
+ typeLabel ?? artifactFileTypeLabel(sourceFilename, mediaType, t),
sizeBytes,
)}
disabled={disabled}
@@ -202,6 +205,7 @@ function MessageImage({
versionId: string;
}) {
const { client } = useTeamHubRuntime();
+ const t = useT();
const container = useRef<HTMLDivElement>(null);
const localFile = localMessageImage(documentId);
const local = useDecodedImage(localFile);
@@ -277,7 +281,7 @@ function MessageImage({
fallback
) : local || objectUrl ? (
<button
- aria-label={`Preview ${filename}`}
+ aria-label={t(chatMessages.previewFile, { name: filename })}
className="block w-fit max-w-[28rem] overflow-hidden rounded-xl transition-opacity hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
onClick={onOpen}
type="button"
@@ -293,11 +297,11 @@ function MessageImage({
</button>
) : (
<div
- aria-label={`Loading ${filename}`}
+ aria-label={t(chatMessages.loadingFile, { name: filename })}
className="flex h-40 w-80 max-w-full items-center justify-center rounded-xl bg-app-surface-soft text-sm text-app-muted"
role="status"
>
- Loading image...
+ {t(chatMessages.loadingImage)}
</div>
)}
</div>
diff --git a/apps/web/src/features/rooms/files/message-file-item.tsx b/apps/web/src/features/rooms/files/message-file-item.tsx
index d5f2ce08..3b11703f 100644
--- a/apps/web/src/features/rooms/files/message-file-item.tsx
+++ b/apps/web/src/features/rooms/files/message-file-item.tsx
@@ -1,8 +1,12 @@
import type { ReactNode } from "react";
import type { TeamHubMessageArtifactTreeSegment } from "@/features/teamhub/teamhub-types";
+import type { Translate } from "@/i18n/language";
+import { useT } from "@/i18n/use-translation";
import { cn } from "@/lib/cn";
+import { chatMessages } from "../chat/chat.messages";
+
/**
* One file in a chat Message, whatever attached it: an uploaded or delivered
* file, a shared Document, or a published folder. It sits in a small white box
@@ -26,6 +30,7 @@ export function MessageFileItem({
/** The icon or thumbnail shown beside the name. */
visual: ReactNode;
}) {
+ const t = useT();
const row = "flex w-full min-w-0 items-center gap-3 rounded-xl p-4 text-left";
const content = (
<>
@@ -50,7 +55,7 @@ export function MessageFileItem({
>
{disabled ? (
<button
- aria-label={`${name} is unavailable`}
+ aria-label={t(chatMessages.fileUnavailable, { name })}
className={cn(row, "cursor-not-allowed")}
disabled
type="button"
@@ -59,7 +64,12 @@ export function MessageFileItem({
</button>
) : onOpen ? (
<button
- aria-label={`${actionLabel} ${name}`}
+ aria-label={t(
+ actionLabel === "Open"
+ ? chatMessages.openFile
+ : chatMessages.previewFile,
+ { name },
+ )}
className={cn(
row,
"group/item transition-colors duration-150 hover:bg-muted/50 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary/40 motion-reduce:transition-none",
@@ -84,12 +94,15 @@ export function fileItemDetail(typeLabel: string, sizeBytes?: number) {
}
/** "7 files · 3 folders · 80 KB" for a published folder. */
-export function artifactTreeDetail(segment: TeamHubMessageArtifactTreeSegment) {
- return `${countLabel(segment.file_count, "file")} · ${countLabel(segment.directory_count, "folder")} · ${formatBytes(segment.total_bytes)}`;
-}
-
-function countLabel(count: number, noun: string) {
- return `${count} ${noun}${count === 1 ? "" : "s"}`;
+export function artifactTreeDetail(
+ segment: TeamHubMessageArtifactTreeSegment,
+ t: Translate,
+) {
+ return [
+ t(chatMessages.fileCount, { count: segment.file_count }),
+ t(chatMessages.folderCount, { count: segment.directory_count }),
+ formatBytes(segment.total_bytes),
+ ].join(" · ");
}
function formatBytes(size: number) {
diff --git a/apps/web/src/features/rooms/room-empty-page.tsx b/apps/web/src/features/rooms/room-empty-page.tsx
index ec122046..5d99070e 100644
--- a/apps/web/src/features/rooms/room-empty-page.tsx
+++ b/apps/web/src/features/rooms/room-empty-page.tsx
@@ -4,8 +4,10 @@ import { useParams } from "react-router";
import { Button } from "@/components/ui/button";
import { Icon } from "@/components/ui/icon";
+import { useT } from "@/i18n/use-translation";
import { requireRoomRouteParam } from "./room-route-params";
+import { roomSurfaceMessages } from "./room-surface.messages";
// Opened on demand, so it stays off the initial JavaScript graph.
const RoomCreateDialog = lazy(async () => ({
@@ -15,6 +17,7 @@ const RoomCreateDialog = lazy(async () => ({
export function RoomEmptyPage() {
const tenantId = requireRoomRouteParam(useParams().tenantId, "Tenant");
const [createOpen, setCreateOpen] = useState(false);
+ const t = useT();
return (
<main className="flex flex-1 items-center justify-center bg-app-surface p-6 text-center">
@@ -22,10 +25,11 @@ export function RoomEmptyPage() {
<span className="mx-auto flex size-11 items-center justify-center rounded-xl bg-muted text-muted-foreground">
<Icon icon={HashtagIcon} size={20} />
</span>
- <h1 className="mt-4 text-lg">Create the first Room</h1>
+ <h1 className="mt-4 text-lg">
+ {t(roomSurfaceMessages.createFirstRoom)}
+ </h1>
<p className="mt-2 text-sm leading-6 text-muted-foreground">
- Rooms keep Human and Agent members, Messages, and shared files in one
- collaboration context.
+ {t(roomSurfaceMessages.firstRoomBody)}
</p>
<Button
className="mt-5"
@@ -33,7 +37,7 @@ export function RoomEmptyPage() {
tone="primary"
>
<Icon icon={PlusSignIcon} size={16} />
- Create Room
+ {t(roomSurfaceMessages.createRoom)}
</Button>
</div>
{createOpen ? (
diff --git a/apps/web/src/features/rooms/room-participation.tsx b/apps/web/src/features/rooms/room-participation.tsx
index c6093242..ad387f9f 100644
--- a/apps/web/src/features/rooms/room-participation.tsx
+++ b/apps/web/src/features/rooms/room-participation.tsx
@@ -5,6 +5,8 @@ import { Button } from "@/components/ui/button";
import { teamHubData } from "@/features/teamhub/teamhub-api";
import { useTeamHubRuntime } from "@/features/teamhub/teamhub-runtime";
import type { TeamHubRoom } from "@/features/teamhub/teamhub-types";
+import { useT } from "@/i18n/use-translation";
+import { chatMessages } from "./chat/chat.messages";
import {
roomQueryKey,
roomQueryOptions,
@@ -51,12 +53,11 @@ export function RoomRejoinBanner({ room }: { room: TeamHubRoom }) {
enabled: Boolean(room.parent_room_id),
});
const join = useRoomParticipation(room);
+ const t = useT();
const roomName = parent.data?.name ?? room.name;
return (
<div className="shrink-0 border-t border-app-border bg-app-surface p-4 text-center">
- <p className="mb-2 text-sm text-app-muted">
- You left this room. Rejoin to send and receive messages.
- </p>
+ <p className="mb-2 text-sm text-app-muted">{t(chatMessages.leftRoom)}</p>
<Button
tone="primary"
className="w-full"
@@ -64,7 +65,9 @@ export function RoomRejoinBanner({ room }: { room: TeamHubRoom }) {
onClick={() => join.mutate("joined")}
>
<Icon icon={Login01Icon} size={16} />
- {join.isPending ? "Joining..." : `Join ${roomName}`}
+ {join.isPending
+ ? t(chatMessages.joining)
+ : t(chatMessages.joinRoom, { name: roomName })}
</Button>
{join.error ? (
<p role="alert" className="mt-2 text-sm text-app-danger">
diff --git a/apps/web/src/features/rooms/room-shell.tsx b/apps/web/src/features/rooms/room-shell.tsx
index d032af57..209904f0 100644
--- a/apps/web/src/features/rooms/room-shell.tsx
+++ b/apps/web/src/features/rooms/room-shell.tsx
@@ -47,6 +47,7 @@ import {
import { registerVoiceShell } from "./chat/voice-mode/voice-ui-bridge";
import { RoomNavigation } from "./room-navigation";
import { navigationMessages } from "./room-navigation.messages";
+import { roomSurfaceMessages } from "./room-surface.messages";
import {
AuthenticatedRouteLoading,
RoomNavigationLoading,
@@ -392,11 +393,14 @@ function RoomShellContent({
>
<span>{LOGOUT_ERROR_MESSAGE}</span>
<Button
+ data-voice-risk="never"
loading={logout.isPending}
onClick={logout.mutate}
tone="ghost"
>
- {logout.isPending ? "Logging out" : "Retry logout"}
+ {logout.isPending
+ ? t(roomSurfaceMessages.loggingOut)
+ : t(roomSurfaceMessages.retryLogout)}
</Button>
</div>
) : null}
diff --git a/apps/web/src/features/rooms/room-surface.messages.ts b/apps/web/src/features/rooms/room-surface.messages.ts
new file mode 100644
index 00000000..8fa7cd21
--- /dev/null
+++ b/apps/web/src/features/rooms/room-surface.messages.ts
@@ -0,0 +1,48 @@
+import { defineMessages } from "@/i18n/messages";
+
+/**
+ * The Room frame that is on screen before the chat module loads: the header,
+ * the sidebar toggles, the connection status and the loading surfaces. It
+ * shares the `chat` namespace and is declared apart so the chat's own text
+ * stays out of the first download.
+ */
+export const roomSurfaceMessages = defineMessages("chat", {
+ roomRegion: "Room {name}",
+ roomSettings: "Room settings",
+ openSettingsFromAvatar: "Open {name} settings from avatar",
+ roomDeleted: "Deleted",
+ deleteRoom: "Delete Room",
+ sidebar: "Sidebar",
+ showSidebar: "Show sidebar",
+ hideSidebar: "Hide sidebar",
+ loadingPanelSidebar: "Loading panel sidebar",
+ loadingSidebar: "Loading sidebar...",
+ loggingOut: "Logging out",
+ retryLogout: "Retry logout",
+ // Connection status in the Room header.
+ offline: "Offline",
+ syncingRoom: "Syncing Room",
+ reconnecting: "Reconnecting",
+ roomOutsideScope: "TeamHub returned a Room outside the active scope.",
+ roomRefreshFailed: "Room refresh failed.",
+ // Loading surfaces.
+ loadingConversation: "Loading conversation",
+ loadingConversationStatus: "Loading conversation…",
+ loadingRoute: "Loading {name}",
+ loadingRouteStatus: "Loading {name}...",
+ loadingDocumentBody: "Loading Document body",
+ routeDocument: "Document",
+ routeRoom: "Room",
+ routeRooms: "Rooms",
+ routeLocalComputers: "Local computers",
+ routeApps: "Apps",
+ routeDashboard: "Dashboard",
+ libraryOverview: "Overview",
+ libraryMyPages: "My pages",
+ librarySharedWithMe: "Shared with me",
+ // The page of a space without Rooms.
+ createFirstRoom: "Create the first Room",
+ firstRoomBody:
+ "Rooms keep Human and Agent members, Messages, and shared files in one collaboration context.",
+ createRoom: "Create Room",
+});
diff --git a/apps/web/src/features/rooms/room-surface.tsx b/apps/web/src/features/rooms/room-surface.tsx
index f65c9ada..2620fdf0 100644
--- a/apps/web/src/features/rooms/room-surface.tsx
+++ b/apps/web/src/features/rooms/room-surface.tsx
@@ -32,6 +32,7 @@ import { RouteContentBoundary } from "@/features/rooms/route-content-boundary";
import { Button } from "@/components/ui/button";
import { Icon } from "@/components/ui/icon";
import { useTeamHubRuntime } from "@/features/teamhub/teamhub-runtime";
+import { useT } from "@/i18n/use-translation";
import type { TeamHubMessagePresentation } from "@/features/teamhub/teamhub-runtime";
import type { RoomRealtimeStatus } from "@/features/teamhub/event-transport";
import type {
@@ -83,6 +84,7 @@ import { AuthenticatedRouteLoading } from "./route-loading-surface";
import { RoomPresentationBoundary } from "./room-presentation-boundary";
import { GENERAL_AGENT_DEFAULT_NAME } from "./general-agent-defaults";
import { MobileNavigationButton } from "./mobile-navigation";
+import { roomSurfaceMessages } from "./room-surface.messages";
// Share the after-chat warmup and immediate-open import. A warmed module renders
// directly, avoiding React.lazy's first-render Suspense delay.
@@ -275,6 +277,7 @@ function RoomSurfaceContent({
tenantId,
}: RoomSurfaceContentProps) {
const { client } = useTeamHubRuntime();
+ const t = useT();
const [searchParams, setSearchParams] = useSearchParams();
const isChatView = Boolean(useMatch("/t/:tenantId/rooms/:roomId/chat"));
const { data: room } = useSuspenseQuery(
@@ -464,7 +467,9 @@ function RoomSurfaceContent({
>
<div className="flex h-full min-h-0 w-full min-w-0">
<section
- aria-label={`Room ${roomTitle}`}
+ aria-label={t(roomSurfaceMessages.roomRegion, {
+ name: roomTitle,
+ })}
className="app-room-surface relative flex min-h-0 min-w-0 flex-1 flex-col border-r border-border/60 bg-app-surface focus:outline-none"
ref={roomSurfaceRef}
tabIndex={-1}
@@ -483,7 +488,10 @@ function RoomSurfaceContent({
onOpenAgent={openProfile}
onOpenDelete={() => setDeleteOpen(true)}
onOpenSettings={() =>
- openPanelTab({ kind: "roomSettings", title: "Room settings" })
+ openPanelTab({
+ kind: "roomSettings",
+ title: t(roomSurfaceMessages.roomSettings),
+ })
}
onTogglePanel={togglePanel}
onStatusChange={setRealtimeStatus}
@@ -541,7 +549,7 @@ function RoomSurfaceContent({
? () =>
openPanelTab({
kind: "roomSettings",
- title: "Room settings",
+ title: t(roomSurfaceMessages.roomSettings),
})
: undefined
}
@@ -688,11 +696,12 @@ function RoomPanelSidebarFallback({
onClose: () => void;
onReveal: () => void;
}) {
+ const t = useT();
useLayoutEffect(onReveal, [onReveal]);
return (
<aside
aria-busy="true"
- aria-label="Loading panel sidebar"
+ aria-label={t(roomSurfaceMessages.loadingPanelSidebar)}
className="panel-sidebar relative h-full min-h-0 shrink-0 bg-app-sidebar px-1 pb-1"
data-open="true"
style={
@@ -703,9 +712,12 @@ function RoomPanelSidebarFallback({
>
<div className="flex h-full min-h-0 w-full min-w-0 flex-col overflow-hidden">
<div className="flex h-11 shrink-0 items-center gap-2 px-1">
- <span className="text-xs text-app-muted">Sidebar</span>
+ <span className="text-xs text-app-muted">
+ {t(roomSurfaceMessages.sidebar)}
+ </span>
<Button
- aria-label="Hide sidebar"
+ data-voice-close
+ aria-label={t(roomSurfaceMessages.hideSidebar)}
className="ml-auto !rounded-lg border-0 text-app-muted"
onClick={onClose}
size="compactIcon"
@@ -718,7 +730,7 @@ function RoomPanelSidebarFallback({
className="flex min-h-0 flex-1 items-center justify-center rounded-xl bg-card/60 text-sm text-app-muted"
role="status"
>
- Loading sidebar...
+ {t(roomSurfaceMessages.loadingSidebar)}
</div>
</div>
</aside>
@@ -768,6 +780,7 @@ function RoomHeader({
roomId: string;
tenantId: string;
}) {
+ const t = useT();
const isDirectRoom = room.kind === "direct";
const headerPeer =
room.direct_peer?.kind === "agent" ? room.direct_peer : undefined;
@@ -792,7 +805,9 @@ function RoomHeader({
<button
type="button"
aria-expanded={panelOpen}
- aria-label={`Open ${headerName} settings from avatar`}
+ aria-label={t(roomSurfaceMessages.openSettingsFromAvatar, {
+ name: headerName,
+ })}
className="flex shrink-0 items-center justify-center rounded-full after:absolute after:inset-0 after:rounded-full after:content-[''] focus-visible:outline-none focus-visible:after:outline-2 focus-visible:after:outline-app-focus"
onClick={() => {
if (panelOpen) onTogglePanel();
@@ -831,7 +846,7 @@ function RoomHeader({
</div>
{isDirectRoom && room.direct_peer_active === false ? (
<span className="shrink-0 rounded-full bg-muted px-2 py-0.5 text-2xs font-medium text-muted-foreground">
- Deleted
+ {t(roomSurfaceMessages.roomDeleted)}
</span>
) : null}
</div>
@@ -857,11 +872,12 @@ function RoomHeader({
</Suspense>
{canDeleteDeletedAgentRoom ? (
<Button
- aria-label="Delete Room"
+ data-voice-risk="never"
+ aria-label={t(roomSurfaceMessages.deleteRoom)}
className="!rounded-lg border-0 text-app-muted"
onClick={onOpenDelete}
size="compactIcon"
- title="Delete Room"
+ title={t(roomSurfaceMessages.deleteRoom)}
tone="ghost"
>
<Icon icon={Delete02Icon} size={16} />
@@ -875,12 +891,12 @@ function RoomHeader({
/>
) : (
<Button
- aria-label="Show sidebar"
+ aria-label={t(roomSurfaceMessages.showSidebar)}
aria-pressed={false}
className="!rounded-lg border-0 text-app-muted"
onClick={onTogglePanel}
size="compactIcon"
- title="Show sidebar"
+ title={t(roomSurfaceMessages.showSidebar)}
tone="ghost"
>
<Icon className="shrink-0" icon={SidebarRightIcon} size={16} />
diff --git a/apps/web/src/features/rooms/route-loading-surface.tsx b/apps/web/src/features/rooms/route-loading-surface.tsx
index 23b2341a..2d3d8130 100644
--- a/apps/web/src/features/rooms/route-loading-surface.tsx
+++ b/apps/web/src/features/rooms/route-loading-surface.tsx
@@ -1,5 +1,11 @@
import { Skeleton } from "@/components/ui/skeleton";
import type { TeamHubRoomListItem } from "@/features/teamhub/teamhub-types";
+import { commonMessages } from "@/i18n/common.messages";
+import type { Translate } from "@/i18n/language";
+import { useT } from "@/i18n/use-translation";
+
+import { navigationMessages } from "./room-navigation.messages";
+import { roomSurfaceMessages } from "./room-surface.messages";
/**
* The Room list inside the secondary navigation while it first loads. Mirrors
@@ -34,17 +40,20 @@ export function RoomNavigationLoading() {
* reads as pending with message skeletons instead of a bare line of text.
*/
export function RoomChatLoading() {
+ const t = useT();
// Covers the whole Room surface, header included, so the real header does
// not show its title and actions while the conversation is still loading;
// everything appears together once the chat is ready.
return (
<div
aria-busy="true"
- aria-label="Loading conversation"
+ aria-label={t(roomSurfaceMessages.loadingConversation)}
className="absolute inset-0 z-[12] flex min-h-0 flex-col bg-app-surface"
role="status"
>
- <span className="sr-only">Loading conversation…</span>
+ <span className="sr-only">
+ {t(roomSurfaceMessages.loadingConversationStatus)}
+ </span>
<RoomHeaderLoading />
<ChatLoading />
</div>
@@ -58,17 +67,20 @@ export function AuthenticatedRouteLoading({
pathname: string;
rooms: TeamHubRoomListItem[];
}) {
- const route = classifyRoute(pathname, rooms);
+ const t = useT();
+ const route = classifyRoute(pathname, rooms, t);
return (
<div
aria-busy="true"
- aria-label={`Loading ${route.label}`}
+ aria-label={t(roomSurfaceMessages.loadingRoute, { name: route.label })}
className="route-loading-surface flex min-h-0 flex-1 overflow-hidden bg-app-surface"
data-loading-route={route.kind}
role="status"
>
- <span className="sr-only">Loading {route.label}...</span>
+ <span className="sr-only">
+ {t(roomSurfaceMessages.loadingRouteStatus, { name: route.label })}
+ </span>
{route.kind === "room" ? (
<RoomLoading />
) : route.kind === "dashboard" ? (
@@ -94,37 +106,43 @@ type LoadingRoute =
function classifyRoute(
pathname: string,
rooms: TeamHubRoomListItem[],
+ t: Translate,
): LoadingRoute {
const segments = pathname.split("/").filter(Boolean);
const roomsIndex = segments.indexOf("rooms");
const documentsIndex = segments.indexOf("documents");
if (documentsIndex >= 0 && segments[documentsIndex + 1]) {
- return { kind: "document", label: "Document" };
+ return { kind: "document", label: t(roomSurfaceMessages.routeDocument) };
}
if (roomsIndex >= 0 && segments[roomsIndex + 1]) {
const roomId = decodeURIComponent(segments[roomsIndex + 1]!);
const room = rooms.find((candidate) => candidate.id === roomId);
- return { kind: "room", label: room?.name ?? "Room" };
+ return {
+ kind: "room",
+ label: room?.name ?? t(roomSurfaceMessages.routeRoom),
+ };
}
if (roomsIndex >= 0) {
- return { kind: "page", label: "Rooms" };
+ return { kind: "page", label: t(roomSurfaceMessages.routeRooms) };
}
if (segments.includes("computers")) {
- return { kind: "page", label: "Local computers" };
+ return { kind: "page", label: t(roomSurfaceMessages.routeLocalComputers) };
}
if (segments.includes("apps")) {
- return { kind: "page", label: "Apps" };
+ return { kind: "page", label: t(roomSurfaceMessages.routeApps) };
}
if (segments.includes("dashboard")) {
- return { kind: "dashboard", label: "Dashboard" };
+ return { kind: "dashboard", label: t(roomSurfaceMessages.routeDashboard) };
}
if (segments.includes("library")) {
return {
kind: "library",
- label: segments.includes("wiki") ? "Wiki" : "Library",
+ label: segments.includes("wiki")
+ ? t(navigationMessages.wiki)
+ : t(navigationMessages.library),
};
}
- return { kind: "page", label: "Library" };
+ return { kind: "page", label: t(navigationMessages.library) };
}
/**
@@ -241,6 +259,7 @@ function DashboardLoading() {
* loads and only the content column reads as pending.
*/
function WorkspaceSidebarLoading() {
+ const t = useT();
return (
<>
<aside
@@ -248,15 +267,23 @@ function WorkspaceSidebarLoading() {
className="hidden w-[220px] shrink-0 bg-app-sidebar px-2 py-3 sm:block"
>
<div className="space-y-0.5 text-sm text-app-body">
- {["Overview", "Search", "Wiki"].map((item) => (
- <div className="flex h-9 items-center px-2" key={item}>
- {item}
+ {[
+ roomSurfaceMessages.libraryOverview,
+ commonMessages.search,
+ navigationMessages.wiki,
+ ].map((item) => (
+ <div className="flex h-9 items-center px-2" key={item.id}>
+ {t(item)}
</div>
))}
</div>
<div className="mt-4 space-y-0.5 text-sm font-medium text-app-body">
- <div className="flex h-9 items-center px-2">My pages</div>
- <div className="flex h-9 items-center px-2">Shared with me</div>
+ <div className="flex h-9 items-center px-2">
+ {t(roomSurfaceMessages.libraryMyPages)}
+ </div>
+ <div className="flex h-9 items-center px-2">
+ {t(roomSurfaceMessages.librarySharedWithMe)}
+ </div>
</div>
</aside>
<div className="hidden w-px shrink-0 bg-border/60 sm:block" />
@@ -285,6 +312,7 @@ function LibraryLoading() {
}
function DocumentLoading() {
+ const t = useT();
return (
<div className="flex min-h-0 flex-1 overflow-hidden">
<WorkspaceSidebarLoading />
@@ -293,10 +321,12 @@ function DocumentLoading() {
aria-hidden="true"
className="flex h-(--app-header-height) shrink-0 items-center gap-2 border-b border-border/60 px-3 sm:px-5"
>
- <span className="text-sm font-medium text-foreground">Document</span>
+ <span className="text-sm font-medium text-foreground">
+ {t(roomSurfaceMessages.routeDocument)}
+ </span>
</header>
<div
- aria-label="Loading Document body"
+ aria-label={t(roomSurfaceMessages.loadingDocumentBody)}
className="workspace-content px-5 py-12 sm:px-0"
role="status"
>
diff --git a/apps/web/src/features/rooms/runtime-status/runtime-activity-entries.tsx b/apps/web/src/features/rooms/runtime-status/runtime-activity-entries.tsx
index 3ce0d789..ad15f849 100644
--- a/apps/web/src/features/rooms/runtime-status/runtime-activity-entries.tsx
+++ b/apps/web/src/features/rooms/runtime-status/runtime-activity-entries.tsx
@@ -1,17 +1,21 @@
+import type { Message } from "@/i18n/messages";
+import { useT } from "@/i18n/use-translation";
+
import type {
RuntimeActivityContentBlock,
RuntimeActivityEntry,
RuntimeActivityPresentation,
} from "./runtime-presentation-events";
+import { runtimeStatusMessages as m } from "./runtime-status.messages";
const outcomeLabels: Record<
NonNullable<RuntimeActivityPresentation["outcome"]>,
- string
+ Message<string>
> = {
- canceled: "Canceled",
- declined: "Declined",
- failed: "Failed",
- succeeded: "Succeeded",
+ canceled: m.outcomeCanceled,
+ declined: m.outcomeDeclined,
+ failed: m.outcomeFailed,
+ succeeded: m.outcomeSucceeded,
};
/**
@@ -29,20 +33,24 @@ export function RuntimeActivityEntries({
title: string;
tool: string;
}) {
+ const t = useT();
return (
- <div aria-label={`${title} details`} className="mt-1.5 space-y-1.5">
+ <div
+ aria-label={t(m.stepDetails, { title })}
+ className="mt-1.5 space-y-1.5"
+ >
<dl className="grid grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-0.5 text-[12px] leading-4">
- <dt className="text-app-subtle">Tool</dt>
+ <dt className="text-app-subtle">{t(m.tool)}</dt>
<dd className="break-all font-mono text-app-body">{tool}</dd>
{outcome ? (
<>
- <dt className="text-app-subtle">Outcome</dt>
+ <dt className="text-app-subtle">{t(m.outcome)}</dt>
<dd
className={
outcome === "failed" ? "text-app-danger" : "text-app-body"
}
>
- {outcomeLabels[outcome]}
+ {t(outcomeLabels[outcome])}
</dd>
</>
) : null}
diff --git a/apps/web/src/features/rooms/runtime-status/runtime-activity-path-view.tsx b/apps/web/src/features/rooms/runtime-status/runtime-activity-path-view.tsx
index ef70f166..d5a654e3 100644
--- a/apps/web/src/features/rooms/runtime-status/runtime-activity-path-view.tsx
+++ b/apps/web/src/features/rooms/runtime-status/runtime-activity-path-view.tsx
@@ -13,6 +13,8 @@ import type {
TeamHubMessage,
TeamHubRuntimePresentationEventRecord,
} from "@/features/teamhub/teamhub-types";
+import type { Translate } from "@/i18n/language";
+import { useT } from "@/i18n/use-translation";
import { MessageMarkdown } from "../chat/message-markdown";
import {
@@ -22,8 +24,11 @@ import {
type RuntimeActivityPathToolCall,
} from "./runtime-activity-path";
import { RuntimeActivityEntries } from "./runtime-activity-entries";
+import { runtimeFailureMessage } from "./runtime-failure-message";
+import { runtimeStatusMessages as m } from "./runtime-status.messages";
import { TaskActivityBlock } from "./task-activity-block";
import {
+ toolAppearance,
toolGroupPresentation,
toolPresentation,
} from "./runtime-tool-presentation";
@@ -41,6 +46,7 @@ export function RuntimeActivityPath({
embedded?: boolean;
records: readonly TeamHubRuntimePresentationEventRecord[];
}) {
+ const t = useT();
const items = useMemo(
() =>
projectRuntimeActivityPath(records, replyTextById(messages), lifecycle),
@@ -50,7 +56,10 @@ export function RuntimeActivityPath({
const shouldFollowLatestRef = useRef(true);
const [showEarlier, setShowEarlier] = useState(false);
const latestKey = items.at(-1)?.key;
- const conciseItems = useMemo(() => compactActivityItems(items), [items]);
+ const conciseItems = useMemo(
+ () => compactActivityItems(items, t),
+ [items, t],
+ );
const recentItems = conciseItems.slice(-8);
const latestPlan = [...conciseItems]
.reverse()
@@ -89,7 +98,7 @@ export function RuntimeActivityPath({
return (
<ol
- aria-label="Activity log"
+ aria-label={t(m.activityLog)}
className={
embedded
? "space-y-2 bg-card px-4 py-3 text-xs leading-5 text-app-muted"
@@ -117,8 +126,8 @@ export function RuntimeActivityPath({
type="button"
>
{showEarlier
- ? "Show less activity"
- : `Show all activity (${earlierCount} more)`}
+ ? t(m.showLessActivity)
+ : t(m.showAllActivity, { count: earlierCount })}
</button>
</li>
) : null}
@@ -131,6 +140,7 @@ export function RuntimeActivityPath({
function compactActivityItems(
items: readonly RuntimeActivityPathItem[],
+ t: Translate,
): RuntimeActivityPathItem[] {
const lastReplyKey = [...items]
.reverse()
@@ -146,7 +156,7 @@ function compactActivityItems(
previous &&
isRepeatableActivityItem(item) &&
isRepeatableActivityItem(previous) &&
- activityItemLabel(previous) === activityItemLabel(item)
+ activityItemLabel(previous, t) === activityItemLabel(item, t)
) {
concise[concise.length - 1] = item;
continue;
@@ -162,9 +172,8 @@ function isSuccessfulMessageOnlyGroup(
return (
item.calls.length > 0 &&
item.calls.every((call) => {
- const presentation = toolPresentation(call.kind);
return (
- presentation.category === "message" &&
+ toolAppearance(call.kind).category === "message" &&
call.outcome !== "failed" &&
!call.unconfirmed
);
@@ -176,23 +185,28 @@ function isRepeatableActivityItem(item: RuntimeActivityPathItem) {
return ["command", "activity", "tool_calls", "reply"].includes(item.kind);
}
-function activityItemLabel(item: RuntimeActivityPathItem): string {
+function activityItemLabel(
+ item: RuntimeActivityPathItem,
+ t: Translate,
+): string {
if (item.kind === "command") {
- return toolPresentation("command").summary;
+ return toolPresentation(t, "command").summary;
}
if (item.kind === "activity") {
- return toolPresentation(item.activityKind).summary;
+ return toolPresentation(t, item.activityKind).summary;
}
if (item.kind === "tool_calls") {
return toolGroupPresentation(
- item.calls.map((call) => toolPresentation(call.kind, call.name)),
+ t,
+ item.calls.map((call) => toolPresentation(t, call.kind, call.name)),
).label;
}
- if (item.kind === "reply") return "Prepared a reply";
+ if (item.kind === "reply") return t(m.preparedReply);
return item.kind;
}
function RuntimeActivityPathRow({ item }: { item: RuntimeActivityPathItem }) {
+ const t = useT();
if (item.kind === "thinking") {
return (
<li className="runtime-activity-step flex min-h-8 items-start gap-2 py-1.5">
@@ -224,7 +238,7 @@ function RuntimeActivityPathRow({ item }: { item: RuntimeActivityPathItem }) {
);
}
if (item.kind === "command") {
- const presentation = toolPresentation("command");
+ const presentation = toolPresentation(t, "command");
return (
<ActivitySummaryRow
active={item.active}
@@ -238,7 +252,7 @@ function RuntimeActivityPathRow({ item }: { item: RuntimeActivityPathItem }) {
);
}
if (item.kind === "activity") {
- const presentation = toolPresentation(item.activityKind);
+ const presentation = toolPresentation(t, item.activityKind);
return (
<ActivitySummaryRow
active={item.active}
@@ -263,7 +277,10 @@ function RuntimeActivityPathRow({ item }: { item: RuntimeActivityPathItem }) {
return (
<li className="runtime-activity-step py-1.5">
<p className={item.tone === "failed" ? "text-app-danger" : undefined}>
- {item.text}
+ {/* An interrupted Run says why it stopped, without the error colour. */}
+ {item.tone === "failed" || item.failure
+ ? runtimeFailureMessage(t, item.failure)
+ : t(m.runCanceled)}
</p>
</li>
);
@@ -286,6 +303,7 @@ function ActivitySummaryRow({
summary: string;
tool: string;
}) {
+ const t = useT();
return (
<li className="runtime-activity-step">
<details className="group">
@@ -299,7 +317,9 @@ function ActivitySummaryRow({
</span>
{active ? <ActiveMark /> : null}
{unconfirmed ? (
- <span className="text-[10px] text-app-muted">Unconfirmed</span>
+ <span className="text-[10px] text-app-muted">
+ {t(m.unconfirmed)}
+ </span>
) : null}
<Icon
icon={ArrowRight01Icon}
@@ -325,14 +345,15 @@ function ToolCallsRow({
}: {
calls: readonly RuntimeActivityPathToolCall[];
}) {
+ const t = useT();
const active = calls.some((call) => call.active);
const presentedCalls = calls.map((call) => {
return {
...call,
- ...toolPresentation(call.kind, call.name),
+ ...toolPresentation(t, call.kind, call.name),
};
});
- const { glyph: groupGlyph, label } = toolGroupPresentation(presentedCalls);
+ const { glyph: groupGlyph, label } = toolGroupPresentation(t, presentedCalls);
return (
<li className="runtime-activity-step">
<details className="group">
@@ -360,6 +381,7 @@ function ToolCallsRow({
<ul className="space-y-1 pb-2 pl-[1.45rem]">
{presentedCalls.map((call) => {
const { glyph, label } = call;
+ const labeledName = t(m.labeled, { label, value: call.name });
const name = (
<>
<span
@@ -369,16 +391,13 @@ function ToolCallsRow({
>
<Icon icon={glyph} size={14} />
</span>
- <span
- className="min-w-0 flex-1 truncate"
- title={`${label}: ${call.name}`}
- >
+ <span className="min-w-0 flex-1 truncate" title={labeledName}>
{call.summary}
</span>
{call.active ? <ActiveMark /> : null}
{call.unconfirmed ? (
<span className="text-[10px] text-app-muted">
- Unconfirmed
+ {t(m.unconfirmed)}
</span>
) : null}
</>
@@ -392,7 +411,7 @@ function ToolCallsRow({
<RuntimeActivityEntries
entries={call.entries}
outcome={call.outcome}
- title={`${label}: ${call.name}`}
+ title={labeledName}
tool={call.name}
/>
</details>
@@ -406,12 +425,13 @@ function ToolCallsRow({
}
function ReplyRow({ text }: { text: string }) {
+ const t = useT();
return (
<li className="runtime-activity-step py-1.5">
<details className="group/reply">
<summary className="flex min-h-8 cursor-pointer list-none items-center gap-2 hover:text-app-body focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-app-focus [&::-webkit-details-marker]:hidden">
<Icon icon={BubbleChatIcon} className="shrink-0" size={14} />
- <span className="min-w-0 flex-1 truncate">Prepared a reply</span>
+ <span className="min-w-0 flex-1 truncate">{t(m.preparedReply)}</span>
<Icon
icon={ArrowRight01Icon}
className="shrink-0 transition-transform group-open/reply:rotate-90 motion-reduce:transition-none"
@@ -431,18 +451,19 @@ function PlanRow({
}: {
item: Extract<RuntimeActivityPathItem, { kind: "plan" }>;
}) {
+ const t = useT();
return (
<li className="runtime-activity-step py-1.5">
<div className="flex min-h-8 items-center gap-2">
<Icon icon={CheckListIcon} className="shrink-0" size={14} />
- <span className="min-w-0 flex-1 truncate">Plan</span>
+ <span className="min-w-0 flex-1 truncate">{t(m.plan)}</span>
</div>
{item.explanation ? (
<p className="whitespace-pre-wrap break-words pb-1 pl-[1.45rem]">
{item.explanation}
</p>
) : null}
- <ol aria-label="Run plan" className="space-y-1 pb-1 pl-[1.45rem]">
+ <ol aria-label={t(m.runPlan)} className="space-y-1 pb-1 pl-[1.45rem]">
{item.steps.map((step) => (
<li
className="flex min-w-0 items-start gap-2"
@@ -482,6 +503,7 @@ function PlanMark({
// Spoiler owns measurement, resize updates, disclosure state and ARIA wiring.
// Headless mode keeps the existing app styles and avoids global Mantine CSS.
function ThinkingText({ children }: { children: ReactNode }) {
+ const t = useT();
return (
<HeadlessMantineProvider>
<Spoiler
@@ -491,9 +513,9 @@ function ThinkingText({ children }: { children: ReactNode }) {
control:
"mt-1 inline-flex min-h-7 items-center rounded-md px-1 text-xs font-medium text-app-muted hover:bg-app-hover hover:text-app-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-app-focus",
}}
- hideLabel="Show less"
+ hideLabel={t(m.showLess)}
maxHeight={40}
- showLabel="Show more"
+ showLabel={t(m.showMore)}
>
{children}
</Spoiler>
@@ -508,9 +530,10 @@ function replyTextById(messages: readonly TeamHubMessage[]) {
}
function ActiveMark() {
+ const t = useT();
return (
<span
- aria-label="In progress"
+ aria-label={t(m.inProgress)}
className="town-dots shrink-0 text-app-muted"
role="img"
>
diff --git a/apps/web/src/features/rooms/runtime-status/runtime-activity-path.ts b/apps/web/src/features/rooms/runtime-status/runtime-activity-path.ts
index d61e4635..9eeb3bf7 100644
--- a/apps/web/src/features/rooms/runtime-status/runtime-activity-path.ts
+++ b/apps/web/src/features/rooms/runtime-status/runtime-activity-path.ts
@@ -1,13 +1,11 @@
import type { TeamHubRuntimePresentationEventRecord } from "@/features/teamhub/teamhub-types";
-import {
- isRunInterruption,
- runtimeFailureMessage,
-} from "./runtime-failure-message";
+import { isRunInterruption } from "./runtime-failure-message";
import {
projectRuntimeChatPresentation,
type RuntimeActivityEntry,
type RuntimeActivityPresentation,
+ type RuntimeExecutionFailure,
type RuntimePlanPresentation,
} from "./runtime-presentation-events";
import {
@@ -78,7 +76,8 @@ export type RuntimeActivityPathItem =
| {
kind: "outcome";
key: string;
- text: string;
+ /** Why the Run failed, for the words the view shows. */
+ failure?: RuntimeExecutionFailure;
tone: "canceled" | "failed";
};
@@ -160,10 +159,9 @@ export function projectRuntimeActivityPath(
items.push({
kind: "outcome",
key: `outcome:${record.segment_id}:${record.event_ordinal}`,
- text:
- event.outcome === "failed"
- ? runtimeFailureMessage(event.failure)
- : "Run canceled",
+ ...(event.outcome === "failed" && event.failure
+ ? { failure: event.failure }
+ : {}),
tone:
event.outcome === "failed" && !isRunInterruption(event.failure)
? "failed"
diff --git a/apps/web/src/features/rooms/runtime-status/runtime-failure-message.test.ts b/apps/web/src/features/rooms/runtime-status/runtime-failure-message.test.ts
index c1f8acba..6e26e61a 100644
--- a/apps/web/src/features/rooms/runtime-status/runtime-failure-message.test.ts
+++ b/apps/web/src/features/rooms/runtime-status/runtime-failure-message.test.ts
@@ -1,11 +1,14 @@
import { describe, expect, it } from "vitest";
+
+import { translate } from "@/i18n/language";
+
import { runtimeFailureMessage } from "./runtime-failure-message";
describe("Runtime failure messages", () => {
it.each(["claude", "codex"] as const)(
"describes the classified outcome for %s without infrastructure details",
(runtime_type) => {
- const message = runtimeFailureMessage({
+ const message = runtimeFailureMessage(translate, {
code: "execution_outcome_unknown",
runtime_type,
});
@@ -19,7 +22,7 @@ describe("Runtime failure messages", () => {
);
it("tells people to choose another model when the account cannot use it", () => {
- const message = runtimeFailureMessage({
+ const message = runtimeFailureMessage(translate, {
code: "model_unavailable",
runtime_type: "codex",
runtime_version: "0.153.4",
@@ -30,7 +33,7 @@ describe("Runtime failure messages", () => {
});
it("points to the Agent's settings when its Computer does not offer the model", () => {
- const message = runtimeFailureMessage({
+ const message = runtimeFailureMessage(translate, {
code: "model_not_offered",
runtime_type: "codex",
});
@@ -40,7 +43,7 @@ describe("Runtime failure messages", () => {
});
it("says the Agent finished but its reply did not reach the Room", () => {
- const message = runtimeFailureMessage({
+ const message = runtimeFailureMessage(translate, {
code: "reply_undelivered",
runtime_type: "pi",
});
@@ -50,7 +53,7 @@ describe("Runtime failure messages", () => {
});
it("says the Agent finished without sending its reply", () => {
- const message = runtimeFailureMessage({
+ const message = runtimeFailureMessage(translate, {
code: "reply_not_sent",
runtime_type: "pi",
});
@@ -60,12 +63,12 @@ describe("Runtime failure messages", () => {
});
it("names a failure the Agent Service observed without a Runtime prefix", () => {
- expect(runtimeFailureMessage({ code: "interrupted" })).toMatch(
+ expect(runtimeFailureMessage(translate, { code: "interrupted" })).toMatch(
/^The Run stopped before it finished because its Computer restarted/,
);
- expect(runtimeFailureMessage({ code: "computer_unavailable" })).toContain(
- "Make sure the Computer is online",
- );
+ expect(
+ runtimeFailureMessage(translate, { code: "computer_unavailable" }),
+ ).toContain("Make sure the Computer is online");
});
it.each([
@@ -76,14 +79,17 @@ describe("Runtime failure messages", () => {
["cleanup_unconfirmed", "could not be confirmed stopped"],
["unclassified", "could not identify"],
] as const)("gives %s its own cause", (code, cause) => {
- const message = runtimeFailureMessage({ code, runtime_type: "claude" });
+ const message = runtimeFailureMessage(translate, {
+ code,
+ runtime_type: "claude",
+ });
expect(message).toMatch(/^Claude: /);
expect(message).toContain(cause);
});
it("only describes protocol errors as incompatible", () => {
expect(
- runtimeFailureMessage({
+ runtimeFailureMessage(translate, {
code: "protocol_incompatible",
runtime_type: "codex",
runtime_version: "0.153.4",
@@ -96,18 +102,18 @@ describe("Runtime failure messages", () => {
"execution_failed",
] as const) {
expect(
- runtimeFailureMessage({ code, runtime_type: "codex" }),
+ runtimeFailureMessage(translate, { code, runtime_type: "codex" }),
).not.toContain("incompatible");
}
});
it("does not render raw version data or invent a version for legacy failures", () => {
expect(
- runtimeFailureMessage({
+ runtimeFailureMessage(translate, {
code: "execution_failed",
runtime_type: "codex",
runtime_version: "/private/token",
}),
).not.toContain("private");
- expect(runtimeFailureMessage()).toBe("Run failed");
+ expect(runtimeFailureMessage(translate)).toBe("Run failed");
});
});
diff --git a/apps/web/src/features/rooms/runtime-status/runtime-failure-message.ts b/apps/web/src/features/rooms/runtime-status/runtime-failure-message.ts
index 787fc931..80ec291c 100644
--- a/apps/web/src/features/rooms/runtime-status/runtime-failure-message.ts
+++ b/apps/web/src/features/rooms/runtime-status/runtime-failure-message.ts
@@ -1,44 +1,29 @@
+import type { Translate } from "@/i18n/language";
+import type { Message } from "@/i18n/messages";
+
import type { RuntimeExecutionFailure } from "./runtime-presentation-events";
+import { runtimeStatusMessages as m } from "./runtime-status.messages";
-const messages: Record<RuntimeExecutionFailure["code"], string> = {
- session_not_found:
- "Session history could not be restored. Check the local session and Local Computer compatibility before retrying.",
- protocol_incompatible:
- "This Runtime protocol is incompatible with Local Computer. Update Local Computer or use a verified Runtime version.",
- authentication_required:
- "Runtime authentication failed. Sign in again or check your API credentials.",
- network_error:
- "The Runtime could not connect to the model service. Check your connection and service address.",
- rate_limited:
- "The model service rate limit or quota was reached. Check your quota before retrying.",
- model_unavailable:
- "The model service does not offer the selected model to this Runtime's account. Choose another model for the Agent, or sign the Runtime in with an account that can use it.",
- model_not_offered:
- "The Agent's Computer does not offer its selected model, or the model does not support its reasoning effort. Open the Agent's settings and choose a model and reasoning effort that the Computer offers.",
- context_too_long:
- "The conversation no longer fits the model's context window. Start a new chat with the Agent, or choose a model with a larger context window.",
- model_service_error:
- "The model service reported an internal error. Try again in a moment; if it keeps failing, check the model provider's status.",
- timeout:
- "The Runtime ran past its time limit without finishing. Try again, or split the request into smaller steps.",
- execution_failed:
- "The Runtime exited with an error it did not classify. Check Local Computer diagnostics before retrying.",
- execution_outcome_unknown:
- "A command was dispatched, but its result could not be confirmed. It was not automatically replayed. Check its effects before retrying.",
- reply_undelivered:
- "The Agent finished, but its reply did not reach the Room because every TeamHub message it tried to send failed. Check the Agent's connection to TeamHub, then ask again.",
- reply_not_sent:
- "The Agent finished without sending its reply to the Room. Its model may have answered without using the message command. Ask again, or choose a stronger model for the Agent.",
- interrupted:
- "The Run stopped before it finished because its Computer restarted, for example to apply a system permission, or the Agent was stopped there. Part of its work may have taken effect; check the result before asking again.",
- computer_unavailable:
- "The Agent's Computer could not run it. Make sure the Computer is online, the Agent is not stopped there, and its Runtime is enabled.",
- cleanup_unconfirmed:
- "The Runtime process could not be confirmed stopped. Check Local Computer before starting another Run.",
- response_too_large:
- "The Agent's reply was larger than a Room message can hold. Ask for a shorter answer, or for the result as a file.",
- unclassified:
- "The Run stopped because of an error the system could not identify. Try again; if it repeats, tell your administrator when it happened.",
+const messages: Record<RuntimeExecutionFailure["code"], Message<string>> = {
+ session_not_found: m.failureSessionNotFound,
+ protocol_incompatible: m.failureProtocolIncompatible,
+ authentication_required: m.failureAuthenticationRequired,
+ network_error: m.failureNetworkError,
+ rate_limited: m.failureRateLimited,
+ model_unavailable: m.failureModelUnavailable,
+ model_not_offered: m.failureModelNotOffered,
+ context_too_long: m.failureContextTooLong,
+ model_service_error: m.failureModelServiceError,
+ timeout: m.failureTimeout,
+ execution_failed: m.failureExecutionFailed,
+ execution_outcome_unknown: m.failureExecutionOutcomeUnknown,
+ reply_undelivered: m.failureReplyUndelivered,
+ reply_not_sent: m.failureReplyNotSent,
+ interrupted: m.failureInterrupted,
+ computer_unavailable: m.failureComputerUnavailable,
+ cleanup_unconfirmed: m.failureCleanupUnconfirmed,
+ response_too_large: m.failureResponseTooLarge,
+ unclassified: m.failureUnclassified,
};
/**
@@ -50,19 +35,30 @@ export function isRunInterruption(failure?: RuntimeExecutionFailure): boolean {
return failure?.code === "interrupted";
}
+/** Why a Run failed, or "Run failed" alone when its cause is not known. */
export function runtimeFailureMessage(
+ t: Translate,
failure?: RuntimeExecutionFailure,
): string {
- if (!failure || !Object.hasOwn(messages, failure.code)) return "Run failed";
+ return runtimeFailureReason(t, failure) ?? t(m.runFailed);
+}
+
+/** The cause of a failed Run in words, when the client knows its code. */
+export function runtimeFailureReason(
+ t: Translate,
+ failure?: RuntimeExecutionFailure,
+): string | undefined {
+ if (!failure || !Object.hasOwn(messages, failure.code)) return undefined;
+ const reason = t(messages[failure.code]);
// Failures the Agent Service or TeamHub observed name no Runtime.
- if (!failure.runtime_type) return messages[failure.code];
+ if (!failure.runtime_type) return reason;
const runtime = {
codex: "Codex",
claude: "Claude",
pi: "Pi",
antigravity: "Antigravity",
}[failure.runtime_type];
- if (!runtime) return "Run failed";
+ if (!runtime) return undefined;
const version =
failure.runtime_version &&
/^[0-9]+\.[0-9]+\.[0-9]+(?:[-+][A-Za-z0-9.-]+)?$/.test(
@@ -70,5 +66,5 @@ export function runtimeFailureMessage(
)
? ` ${failure.runtime_version}`
: "";
- return `${runtime}${version}: ${messages[failure.code]}`;
+ return t(m.labeled, { label: `${runtime}${version}`, value: reason });
}
diff --git a/apps/web/src/features/rooms/runtime-status/runtime-status.messages.ts b/apps/web/src/features/rooms/runtime-status/runtime-status.messages.ts
new file mode 100644
index 00000000..6531cd4e
--- /dev/null
+++ b/apps/web/src/features/rooms/runtime-status/runtime-status.messages.ts
@@ -0,0 +1,173 @@
+import { defineMessages } from "@/i18n/messages";
+
+/**
+ * What an Agent's Run is doing: the status line above the composer, the
+ * Activity log, the Run controls and the background Tasks.
+ */
+export const runtimeStatusMessages = defineMessages("runtimeStatus", {
+ // The state of a Run, as an Agent's avatar and the status line name it.
+ stateCanceled: "Canceled",
+ stateCompleted: "Completed",
+ stateFailed: "Failed",
+ stateNeedsAttention: "Needs attention",
+ stateRecovering: "Recovering",
+ stateStopped: "Stopped",
+ stateThinking: "Thinking",
+ stateTyping: "Typing",
+ stateWaitingForInput: "Waiting for your input",
+ stateWorking: "Working",
+ starting: "Starting",
+ preparingReply: "Preparing a reply",
+ runStopped: "Run stopped",
+ runCanceled: "Run canceled",
+ runFailed: "Run failed",
+ runFailedWith: "Run failed: {reason}",
+ followUpUnconfirmed: "Follow-up delivery unconfirmed",
+ // An interrupted Run whose follow-ups may not have arrived.
+ stoppedFollowUpUnconfirmed:
+ "{reason}. Follow-up delivery unconfirmed. Resend it if the Agent did not answer.",
+ elapsedMinutes: "{minutes}m",
+ labeled: "{label}: {value}",
+ openAgentStatusActivity: "Open Agent status activity",
+ openAgentsWorkingActivity: "Open Agents working activity",
+ // Stop and Resend beside the status line.
+ stopAgentTask: "Stop {name}'s task",
+ stop: "Stop",
+ stopping: "Stopping",
+ stopped: "Stopped",
+ stopNotConfirmed: "Stop not confirmed. Check the task status, then retry.",
+ resendFollowUp: "Resend unconfirmed follow-up to {name}",
+ resend: "Resend",
+ resent: "Resent",
+ nothingToResend: "Nothing to resend",
+ resendFailed: "Resend failed. Try again.",
+ // Background Tasks of the Room's Meta.
+ backgroundTasks: "Background tasks",
+ backgroundTasksRunning: {
+ one: "{count} task running in the background",
+ other: "{count} tasks running in the background",
+ },
+ openTask: "Open task {title}",
+ cancelTask: "Cancel {title}",
+ cancelTaskNotConfirmed: "Cancel of {title} was not confirmed; retry",
+ cancelTaskAction: "Cancel task",
+ canceling: "Canceling",
+ runningMinutes: "{minutes} min",
+ runningHours: "{hours} h",
+ runningDays: "{days} d",
+ // Panel tabs opened from the chat.
+ activityTabTitle: "Activity · {name}",
+ agentTabTitle: "Agent · {name}",
+ // The Message a link pointed at, shown above the timeline.
+ linkedSourceMessage: "Linked source Message",
+ closeLinkedSourceMessage: "Close linked source Message",
+ loadingSourceMessage: "Loading source Message…",
+ sourceMessageUnavailable: "Source Message is unavailable.",
+ // The Activity log.
+ activityLog: "Activity log",
+ showLessActivity: "Show less activity",
+ showAllActivity: "Show all activity ({count} more)",
+ showLess: "Show less",
+ showMore: "Show more",
+ preparedReply: "Prepared a reply",
+ unconfirmed: "Unconfirmed",
+ plan: "Plan",
+ runPlan: "Run plan",
+ inProgress: "In progress",
+ stepDetails: "{title} details",
+ outcome: "Outcome",
+ outcomeCanceled: "Canceled",
+ outcomeDeclined: "Declined",
+ outcomeFailed: "Failed",
+ outcomeSucceeded: "Succeeded",
+ // A `teamhub task` step and the state of its Task.
+ taskStarted: "Started",
+ taskSentTo: "Sent to",
+ taskStopped: "Stopped",
+ tasksChecked: "Checked on tasks",
+ taskRunning: "Task running",
+ taskStatusRunning: "Running",
+ taskStatusNeedsApproval: "Needs approval",
+ taskStatusFinished: "Finished",
+ taskStatusFailed: "Failed",
+ taskStatusStopped: "Stopped",
+ // The kinds of tool call.
+ toolCommand: "Command",
+ toolRead: "Read file",
+ toolEdit: "Edit files",
+ toolSearch: "Search",
+ toolBrowser: "Web browsing",
+ toolMessage: "Message",
+ toolMessageRead: "Read messages",
+ toolDelegation: "Agent collaboration",
+ toolImage: "Image",
+ toolInteraction: "User input",
+ toolRecovery: "Recovery",
+ toolReview: "Review",
+ tool: "Tool",
+ // What a step of each kind is doing, in the Activity log.
+ summaryCommand: "Running a command",
+ summaryRead: "Reviewing files",
+ summaryEdit: "Updating files",
+ summarySearch: "Searching for information",
+ summaryBrowser: "Reviewing online information",
+ summaryMessage: "Sending an update",
+ summaryDelegation: "Coordinating with another agent",
+ summaryTool: "Working on the task",
+ readingMessages: "Reading messages",
+ workingWithImages: "Working with images",
+ recoveringTask: "Recovering the task",
+ reviewingResults: "Reviewing the results",
+ workingThroughSteps: {
+ one: "Working through {count} step",
+ other: "Working through {count} steps",
+ },
+ workingThroughTask: "Working through the task",
+ // The status line's words for a step the Runtime does not describe.
+ phraseRead: "Reading files",
+ phraseEdit: "Editing files",
+ phraseSearch: "Searching",
+ phraseBrowser: "Browsing the web",
+ phraseMessage: "Sending a message",
+ phraseDelegation: "Working with another agent",
+ phraseTool: "Using tools",
+ // Why a Run failed, by the failure code the Computer or TeamHub reports.
+ failureSessionNotFound:
+ "Session history could not be restored. Check the local session and Local Computer compatibility before retrying.",
+ failureProtocolIncompatible:
+ "This Runtime protocol is incompatible with Local Computer. Update Local Computer or use a verified Runtime version.",
+ failureAuthenticationRequired:
+ "Runtime authentication failed. Sign in again or check your API credentials.",
+ failureNetworkError:
+ "The Runtime could not connect to the model service. Check your connection and service address.",
+ failureRateLimited:
+ "The model service rate limit or quota was reached. Check your quota before retrying.",
+ failureModelUnavailable:
+ "The model service does not offer the selected model to this Runtime's account. Choose another model for the Agent, or sign the Runtime in with an account that can use it.",
+ failureModelNotOffered:
+ "The Agent's Computer does not offer its selected model, or the model does not support its reasoning effort. Open the Agent's settings and choose a model and reasoning effort that the Computer offers.",
+ failureContextTooLong:
+ "The conversation no longer fits the model's context window. Start a new chat with the Agent, or choose a model with a larger context window.",
+ failureModelServiceError:
+ "The model service reported an internal error. Try again in a moment; if it keeps failing, check the model provider's status.",
+ failureTimeout:
+ "The Runtime ran past its time limit without finishing. Try again, or split the request into smaller steps.",
+ failureExecutionFailed:
+ "The Runtime exited with an error it did not classify. Check Local Computer diagnostics before retrying.",
+ failureExecutionOutcomeUnknown:
+ "A command was dispatched, but its result could not be confirmed. It was not automatically replayed. Check its effects before retrying.",
+ failureReplyUndelivered:
+ "The Agent finished, but its reply did not reach the Room because every TeamHub message it tried to send failed. Check the Agent's connection to TeamHub, then ask again.",
+ failureReplyNotSent:
+ "The Agent finished without sending its reply to the Room. Its model may have answered without using the message command. Ask again, or choose a stronger model for the Agent.",
+ failureInterrupted:
+ "The Run stopped before it finished because its Computer restarted, for example to apply a system permission, or the Agent was stopped there. Part of its work may have taken effect; check the result before asking again.",
+ failureComputerUnavailable:
+ "The Agent's Computer could not run it. Make sure the Computer is online, the Agent is not stopped there, and its Runtime is enabled.",
+ failureCleanupUnconfirmed:
+ "The Runtime process could not be confirmed stopped. Check Local Computer before starting another Run.",
+ failureResponseTooLarge:
+ "The Agent's reply was larger than a Room message can hold. Ask for a shorter answer, or for the result as a file.",
+ failureUnclassified:
+ "The Run stopped because of an error the system could not identify. Try again; if it repeats, tell your administrator when it happened.",
+});
diff --git a/apps/web/src/features/rooms/runtime-status/runtime-tool-presentation.test.ts b/apps/web/src/features/rooms/runtime-status/runtime-tool-presentation.test.ts
index 0ffdd919..d97f5185 100644
--- a/apps/web/src/features/rooms/runtime-status/runtime-tool-presentation.test.ts
+++ b/apps/web/src/features/rooms/runtime-status/runtime-tool-presentation.test.ts
@@ -1,4 +1,7 @@
import { describe, expect, it } from "vitest";
+
+import { translate } from "@/i18n/language";
+
import {
activityStatusLine,
toolGroupPresentation,
@@ -20,47 +23,58 @@ describe("toolPresentation", () => {
["tool", "tool"],
["unknown_kind", "tool"],
])("presents the %s kind as %s", (kind, category) => {
- expect(toolPresentation(kind).category).toBe(category);
+ expect(toolPresentation(translate, kind).category).toBe(category);
});
it("does not expose tool input in activity path summaries", () => {
- expect(toolPresentation("read").summary).toBe("Reviewing files");
- expect(toolPresentation("message").summary).toBe("Sending an update");
- expect(toolPresentation("tool").summary).toBe("Working on the task");
+ expect(toolPresentation(translate, "read").summary).toBe("Reviewing files");
+ expect(toolPresentation(translate, "message").summary).toBe(
+ "Sending an update",
+ );
+ expect(toolPresentation(translate, "tool").summary).toBe(
+ "Working on the task",
+ );
});
it("labels a generic tool call by its tool name", () => {
expect(
- toolPresentation("tool", "mcp__computer__get_window_state").summary,
+ toolPresentation(translate, "tool", "mcp__computer__get_window_state")
+ .summary,
).toBe("Get window state");
- expect(toolPresentation("tool", "Skill").summary).toBe("Skill");
- expect(toolPresentation("unknown_kind", "run_script").summary).toBe(
- "Run script",
- );
- expect(toolPresentation("read", "mcp__computer__read").summary).toBe(
- "Reviewing files",
- );
+ expect(toolPresentation(translate, "tool", "Skill").summary).toBe("Skill");
+ expect(
+ toolPresentation(translate, "unknown_kind", "run_script").summary,
+ ).toBe("Run script");
+ expect(
+ toolPresentation(translate, "read", "mcp__computer__read").summary,
+ ).toBe("Reviewing files");
expect(toolNameLabel("mcp__teamhub__send_message")).toBe("Send message");
expect(
- toolGroupPresentation([toolPresentation("tool", "Skill")]).label,
+ toolGroupPresentation(translate, [
+ toolPresentation(translate, "tool", "Skill"),
+ ]).label,
).toBe("Skill");
});
it("summarizes mixed or unknown operations as user-facing steps", () => {
expect(
toolGroupPresentation(
- ["read", "command", "search"].map((kind) => toolPresentation(kind)),
+ translate,
+ ["read", "command", "search"].map((kind) =>
+ toolPresentation(translate, kind),
+ ),
).label,
).toBe("Working through 3 steps");
expect(
- toolGroupPresentation([
- toolPresentation("tool"),
- toolPresentation("tool"),
+ toolGroupPresentation(translate, [
+ toolPresentation(translate, "tool"),
+ toolPresentation(translate, "tool"),
]).label,
).toBe("Working through 2 steps");
- expect(toolGroupPresentation([toolPresentation("search")]).label).toBe(
- "Searching for information",
- );
+ expect(
+ toolGroupPresentation(translate, [toolPresentation(translate, "search")])
+ .label,
+ ).toBe("Searching for information");
});
});
@@ -68,6 +82,7 @@ describe("activityStatusLine", () => {
it("takes the Runtime's description as a group title", () => {
expect(
activityStatusLine(
+ translate,
"command",
JSON.stringify({
command: "npm test",
@@ -80,7 +95,7 @@ describe("activityStatusLine", () => {
it("plays the steps the Computer read from the call", () => {
expect(
- activityStatusLine("search", {
+ activityStatusLine(translate, "search", {
status_steps: ['Searching for "fares"', "", 3, "Reading notes.md"],
}),
).toEqual({ steps: ['Searching for "fares"', "Reading notes.md"] });
@@ -103,6 +118,7 @@ describe("activityStatusLine", () => {
])("names an unnamed %s call by its kind", (kind, input, steps) => {
expect(
activityStatusLine(
+ translate,
kind,
typeof input === "string" ? input : JSON.stringify(input),
),
diff --git a/apps/web/src/features/rooms/runtime-status/runtime-tool-presentation.ts b/apps/web/src/features/rooms/runtime-status/runtime-tool-presentation.ts
index 89d46662..cafb93ae 100644
--- a/apps/web/src/features/rooms/runtime-status/runtime-tool-presentation.ts
+++ b/apps/web/src/features/rooms/runtime-status/runtime-tool-presentation.ts
@@ -29,31 +29,39 @@ import {
Wrench,
} from "lucide-react";
+import type { Translate } from "@/i18n/language";
+import type { Message } from "@/i18n/messages";
+
import type { RuntimeActivityEntry } from "./runtime-presentation-events";
+import { runtimeStatusMessages as m } from "./runtime-status.messages";
// `icon` stays Lucide for the Runtime history view; other surfaces render `glyph`.
const presentations = {
- command: { icon: SquareTerminal, glyph: CommandLineIcon, label: "Command" },
- read: { icon: BookOpen, glyph: BookOpen01Icon, label: "Read file" },
- edit: { icon: FilePenLine, glyph: FileEditIcon, label: "Edit files" },
- search: { icon: Search, glyph: Search01Icon, label: "Search" },
- browser: { icon: Globe, glyph: Globe02Icon, label: "Web browsing" },
- message: { icon: MessageCircle, glyph: BubbleChatIcon, label: "Message" },
+ command: {
+ icon: SquareTerminal,
+ glyph: CommandLineIcon,
+ label: m.toolCommand,
+ },
+ read: { icon: BookOpen, glyph: BookOpen01Icon, label: m.toolRead },
+ edit: { icon: FilePenLine, glyph: FileEditIcon, label: m.toolEdit },
+ search: { icon: Search, glyph: Search01Icon, label: m.toolSearch },
+ browser: { icon: Globe, glyph: Globe02Icon, label: m.toolBrowser },
+ message: { icon: MessageCircle, glyph: BubbleChatIcon, label: m.toolMessage },
message_read: {
icon: MessageCircle,
glyph: BubbleChatIcon,
- label: "Read messages",
+ label: m.toolMessageRead,
},
delegation: {
icon: Users,
glyph: UserGroupIcon,
- label: "Agent collaboration",
+ label: m.toolDelegation,
},
- image: { icon: Image, glyph: Image01Icon, label: "Image" },
- interaction: { icon: UserRound, glyph: UserIcon, label: "User input" },
- recovery: { icon: RefreshCw, glyph: RefreshIcon, label: "Recovery" },
- review: { icon: ScanSearch, glyph: SearchVisualIcon, label: "Review" },
- tool: { icon: Wrench, glyph: Wrench01Icon, label: "Tool" },
+ image: { icon: Image, glyph: Image01Icon, label: m.toolImage },
+ interaction: { icon: UserRound, glyph: UserIcon, label: m.toolInteraction },
+ recovery: { icon: RefreshCw, glyph: RefreshIcon, label: m.toolRecovery },
+ review: { icon: ScanSearch, glyph: SearchVisualIcon, label: m.toolReview },
+ tool: { icon: Wrench, glyph: Wrench01Icon, label: m.tool },
};
type ToolCategory = keyof typeof presentations;
@@ -79,16 +87,27 @@ const kinds: Record<string, ToolCategory> = {
* How a tool call is shown. A call of the generic kind says nothing on its
* own, so its tool name labels it when one is known.
*/
-export function toolPresentation(kind: string, name?: string) {
+export function toolPresentation(t: Translate, kind: string, name?: string) {
const category = kinds[kind] ?? "tool";
+ const { glyph, icon } = presentations[category];
+ const label: Message<string> = presentations[category].label;
const named = category === "tool" && name ? toolNameLabel(name) : "";
return {
category,
- ...presentations[category],
- summary: named || summaries[category],
+ icon,
+ glyph,
+ label: t(label),
+ summary: named || t(summaries[category]),
};
}
+/** A tool call's kind and icons, which read the same in every language. */
+export function toolAppearance(kind: string) {
+ const category = kinds[kind] ?? "tool";
+ const { glyph, icon } = presentations[category];
+ return { category, glyph, icon };
+}
+
/**
* A tool name as words, without an MCP server prefix:
* `mcp__computer__get_window_state` reads "Get window state".
@@ -101,23 +120,24 @@ export function toolNameLabel(name: string) {
return words ? words.charAt(0).toUpperCase() + words.slice(1) : name;
}
-const summaries: Record<ToolCategory, string> = {
- command: "Running a command",
- read: "Reviewing files",
- edit: "Updating files",
- search: "Searching for information",
- browser: "Reviewing online information",
- message: "Sending an update",
- message_read: "Reading messages",
- delegation: "Coordinating with another agent",
- image: "Working with images",
- interaction: "Waiting for your input",
- recovery: "Recovering the task",
- review: "Reviewing the results",
- tool: "Working on the task",
+const summaries: Record<ToolCategory, Message<string>> = {
+ command: m.summaryCommand,
+ read: m.summaryRead,
+ edit: m.summaryEdit,
+ search: m.summarySearch,
+ browser: m.summaryBrowser,
+ message: m.summaryMessage,
+ message_read: m.readingMessages,
+ delegation: m.summaryDelegation,
+ image: m.workingWithImages,
+ interaction: m.stateWaitingForInput,
+ recovery: m.recoveringTask,
+ review: m.reviewingResults,
+ tool: m.summaryTool,
};
export function toolGroupPresentation(
+ t: Translate,
calls: readonly ReturnType<typeof toolPresentation>[],
) {
const single = calls.length === 1 ? calls[0] : undefined;
@@ -131,10 +151,10 @@ export function toolGroupPresentation(
glyph: calls[0]?.glyph ?? CheckListIcon,
label:
calls.length > 1 && (!category || category === "tool")
- ? `Working through ${calls.length} steps`
+ ? t(m.workingThroughSteps, { count: calls.length })
: category
- ? summaries[category]
- : "Working through the task",
+ ? t(summaries[category])
+ : t(m.workingThroughTask),
};
}
@@ -166,19 +186,22 @@ export function toolInputFromEntries(
// Phrases for Activities the Computer does not name itself, such as an MCP
// tool. An unnamed command has none: the status line keeps its last text.
-const statusPhrases: Record<Exclude<ToolCategory, "command">, string> = {
- read: "Reading files",
- edit: "Editing files",
- search: "Searching",
- browser: "Browsing the web",
- message: "Sending a message",
- message_read: "Reading messages",
- delegation: "Working with another agent",
- image: "Working with images",
- interaction: "Waiting for your input",
- recovery: "Recovering the task",
- review: "Reviewing the results",
- tool: "Using tools",
+const statusPhrases: Record<
+ Exclude<ToolCategory, "command">,
+ Message<string>
+> = {
+ read: m.phraseRead,
+ edit: m.phraseEdit,
+ search: m.phraseSearch,
+ browser: m.phraseBrowser,
+ message: m.phraseMessage,
+ message_read: m.readingMessages,
+ delegation: m.phraseDelegation,
+ image: m.workingWithImages,
+ interaction: m.stateWaitingForInput,
+ recovery: m.recoveringTask,
+ review: m.reviewingResults,
+ tool: m.phraseTool,
};
/** How the Room status line names an Activity. */
@@ -194,6 +217,7 @@ export interface ActivityStatusLine {
* the steps the Computer read from it, else its kind's phrase.
*/
export function activityStatusLine(
+ t: Translate,
kind: string,
input?: unknown,
): ActivityStatusLine {
@@ -208,8 +232,8 @@ export function activityStatusLine(
)
: [];
if (steps.length > 0) return { steps };
- const category = toolPresentation(kind).category;
- return { steps: category === "command" ? [] : [statusPhrases[category]] };
+ const category = toolAppearance(kind).category;
+ return { steps: category === "command" ? [] : [t(statusPhrases[category])] };
}
function inputFields(input: unknown): Record<string, unknown> {
diff --git a/apps/web/src/features/rooms/runtime-status/task-activity-block.tsx b/apps/web/src/features/rooms/runtime-status/task-activity-block.tsx
index 7625d4fa..33764ac6 100644
--- a/apps/web/src/features/rooms/runtime-status/task-activity-block.tsx
+++ b/apps/web/src/features/rooms/runtime-status/task-activity-block.tsx
@@ -13,8 +13,11 @@ import { teamHubData } from "@/features/teamhub/teamhub-api";
import { useTeamHubRuntime } from "@/features/teamhub/teamhub-runtime";
import type { TeamHubTaskExecution } from "@/features/teamhub/teamhub-types";
import { tenantWorkItemTargetQueryOptions } from "@/features/work-items/work-item-queries";
+import type { Message } from "@/i18n/messages";
+import { useT } from "@/i18n/use-translation";
import { RunningDots } from "../task-sidebar/running-dots";
+import { runtimeStatusMessages as m } from "./runtime-status.messages";
import type { TaskCommand } from "./task-command";
interface TaskActivityLinks {
@@ -38,11 +41,11 @@ export function TaskActivityLinksProvider({
);
}
-const VERBS: Record<TaskCommand["operation"], string> = {
- create: "Started",
- send: "Sent to",
- stop: "Stopped",
- check: "Checked on tasks",
+const VERBS: Record<TaskCommand["operation"], Message<string>> = {
+ create: m.taskStarted,
+ send: m.taskSentTo,
+ stop: m.taskStopped,
+ check: m.tasksChecked,
};
const GLYPHS = {
create: TaskAdd01Icon,
@@ -66,6 +69,7 @@ export function TaskActivityBlock({
failed?: boolean;
taskId?: string;
}) {
+ const t = useT();
const links = useContext(TaskActivityLinksContext);
const { client } = useTeamHubRuntime();
const tenantId = links?.tenantId ?? "";
@@ -103,11 +107,13 @@ export function TaskActivityBlock({
<>
<Icon className="shrink-0" icon={GLYPHS[command.operation]} size={15} />
<span className={`shrink-0 ${active ? "town-shimmer-text" : ""}`}>
- {VERBS[command.operation]}
+ {t(VERBS[command.operation])}
</span>
<span className="min-w-0 flex-1 truncate text-app-ink">{title}</span>
{failed ? (
- <span className="shrink-0 text-app-danger">Failed</span>
+ <span className="shrink-0 text-app-danger">
+ {t(m.taskStatusFailed)}
+ </span>
) : execution.data ? (
<TaskState execution={execution.data} />
) : null}
@@ -118,7 +124,7 @@ export function TaskActivityBlock({
<li className="runtime-activity-step text-app-muted">
{open ? (
<button
- aria-label={`Open task ${title}`}
+ aria-label={t(m.openTask, { title: title ?? "" })}
className={`${rowClass} rounded-md hover:text-app-body focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-app-focus`}
onClick={open}
type="button"
@@ -138,9 +144,10 @@ export function TaskActivityBlock({
}
function TaskState({ execution }: { execution: TeamHubTaskExecution }) {
+ const t = useT();
return execution.status === "running" ? (
<span
- aria-label="Task running"
+ aria-label={t(m.taskRunning)}
className="flex shrink-0 items-center text-app-info"
role="img"
>
@@ -157,16 +164,19 @@ export function TaskStatusPill({
}: {
status: TeamHubTaskExecution["status"];
}) {
+ const t = useT();
switch (status) {
case "running":
- return <StatusPill tone="neutral">Running</StatusPill>;
+ return <StatusPill tone="neutral">{t(m.taskStatusRunning)}</StatusPill>;
case "waiting_for_approval":
- return <StatusPill tone="warning">Needs approval</StatusPill>;
+ return (
+ <StatusPill tone="warning">{t(m.taskStatusNeedsApproval)}</StatusPill>
+ );
case "idle":
- return <StatusPill tone="success">Finished</StatusPill>;
+ return <StatusPill tone="success">{t(m.taskStatusFinished)}</StatusPill>;
case "failed":
- return <StatusPill tone="danger">Failed</StatusPill>;
+ return <StatusPill tone="danger">{t(m.taskStatusFailed)}</StatusPill>;
case "canceled":
- return <StatusPill>Stopped</StatusPill>;
+ return <StatusPill>{t(m.taskStatusStopped)}</StatusPill>;
}
}
diff --git a/apps/web/src/features/rooms/task-sidebar/adapters/runtime-history-view.tsx b/apps/web/src/features/rooms/task-sidebar/adapters/runtime-history-view.tsx
index c43a8b87..b75904d3 100644
--- a/apps/web/src/features/rooms/task-sidebar/adapters/runtime-history-view.tsx
+++ b/apps/web/src/features/rooms/task-sidebar/adapters/runtime-history-view.tsx
@@ -15,6 +15,7 @@ import {
type TaskCommand,
} from "@/features/rooms/runtime-status/task-command";
import type { TeamHubMessageActivityRecord } from "@/features/teamhub/teamhub-types";
+import { useT } from "@/i18n/use-translation";
import {
activityMessageText,
@@ -169,6 +170,7 @@ function activityTimelineItems(
}
function RuntimeToolCallsActivity({ calls }: { calls: ActivityToolCall[] }) {
+ const t = useT();
const presentedCalls = calls.map(({ pair, record }) => {
const name = record.tool_name ?? pair?.call?.tool_name ?? "Tool call";
const invocation = asObject(nativePayload(record)?.invocation);
@@ -177,11 +179,13 @@ function RuntimeToolCallsActivity({ calls }: { calls: ActivityToolCall[] }) {
return {
record,
name: shownName,
- ...toolPresentation("tool", shownName),
+ ...toolPresentation(t, "tool", shownName),
};
});
- const { icon: GroupIcon, label: groupLabel } =
- toolGroupPresentation(presentedCalls);
+ const { icon: GroupIcon, label: groupLabel } = toolGroupPresentation(
+ t,
+ presentedCalls,
+ );
return (
<li>
<details className="group">
diff --git a/apps/web/src/features/rooms/task-sidebar/adapters/runtime-trajectory-view.tsx b/apps/web/src/features/rooms/task-sidebar/adapters/runtime-trajectory-view.tsx
index e6c220b4..1a5f4ae9 100644
--- a/apps/web/src/features/rooms/task-sidebar/adapters/runtime-trajectory-view.tsx
+++ b/apps/web/src/features/rooms/task-sidebar/adapters/runtime-trajectory-view.tsx
@@ -4,8 +4,8 @@ import { useMemo } from "react";
import { Icon } from "@/components/ui/icon";
import { cn } from "@/lib/cn";
import {
+ toolAppearance,
toolNameLabel,
- toolPresentation,
} from "@/features/rooms/runtime-status/runtime-tool-presentation";
import type { TeamHubMessageActivityRecord } from "@/features/teamhub/teamhub-types";
@@ -88,7 +88,7 @@ export function RuntimeTrajectoryView({
}
function TrajectoryCallRow({ call }: { call: TrajectoryCall }) {
- const { glyph } = toolPresentation(call.kind);
+ const { glyph } = toolAppearance(call.kind);
const output = call.diff ?? call.output;
const label = (
<span
diff --git a/apps/web/src/i18n/common.messages.ts b/apps/web/src/i18n/common.messages.ts
index d6217b7c..d53069bf 100644
--- a/apps/web/src/i18n/common.messages.ts
+++ b/apps/web/src/i18n/common.messages.ts
@@ -10,4 +10,19 @@ export const commonMessages = defineMessages("common", {
tryAgain: "Try again",
avatar: "{name} avatar",
resizeHint: "Drag to resize; double-click to reset",
+ cancel: "Cancel",
+ retry: "Retry",
+ open: "Open",
+ copy: "Copy",
+ copied: "Copied",
+ search: "Search",
+ save: "Save",
+ delete: "Delete",
+ remove: "Remove",
+ edit: "Edit",
+ done: "Done",
+ back: "Back",
+ you: "You",
+ justNow: "just now",
+ loading: "Loading…",
});
diff --git a/apps/web/src/i18n/locales/zh-CN.glossary.md b/apps/web/src/i18n/locales/zh-CN.glossary.md
index 9a6c1f8c..ccffb384 100644
--- a/apps/web/src/i18n/locales/zh-CN.glossary.md
+++ b/apps/web/src/i18n/locales/zh-CN.glossary.md
@@ -16,36 +16,120 @@ elsewhere.
| Another Me, Wiki | Feature names. |
| CLI, PowerShell, npm, Node.js | Tools. |
| Claude Code, Codex, Pi, Antigravity | App names. |
+| API, URL, BYOK, PDF, Markdown | Abbreviations and formats. |
+| Base URL, tokens, Dense, MoE | Model terms people meet in provider documentation. |
| Local Computer | Only when it names the background program. |
| Reconnect This Computer | A desktop menu item, quoted until it is translated. |
## Translated
-| English | Chinese | Note |
-| -------------------------- | -------- | ------------------------------------------------- |
-| Computer | 电脑 | The machine an Agent runs on. |
-| Local Computer (a machine) | 本地电脑 | The field or the machine, not the program. |
-| Model | 模型 | |
-| Task | 任务 | |
-| Messages | 消息 | |
-| Chat | 对话 | |
-| Library | 资料库 | |
-| Connectors | 连接器 | |
-| Settings | 设置 | |
-| Profile | 个人资料 | |
-| Security | 安全 | |
-| Language | 语言 | |
-| Space | 空间 | |
-| Meetings | 会议 | |
-| Pocket Notes | 随手记 | Proposed; the product owner has not confirmed it. |
-| Create (a menu entry) | 新建 | Opens a choice of what to create. |
-| Create (a confirm button) | 创建 | Carries the action out. |
-| Pin | 置顶 | |
-| Log out | 退出登录 | |
-| Thinking effort | 思考强度 | |
-| Token | 令牌 | |
-| Workspace | 工作区 | |
-| Server | 服务器 | |
+| English | Chinese | Note |
+| ----------------------------- | -------------------------- | ------------------------------------------------- |
+| Computer | 电脑 | The machine an Agent runs on. |
+| Local Computer (a machine) | 本地电脑 | The field or the machine, not the program. |
+| Model | 模型 | |
+| Task | 任务 | |
+| Messages | 消息 | |
+| Chat | 对话 | |
+| Library | 资料库 | |
+| Connectors | 连接器 | |
+| Settings | 设置 | |
+| Profile | 个人资料 | |
+| Security | 安全 | |
+| Language | 语言 | |
+| Space | 空间 | |
+| Meetings | 会议 | |
+| Pocket Notes | 随手记 | Proposed; the product owner has not confirmed it. |
+| Create (a menu entry) | 新建 | Opens a choice of what to create. |
+| Create (a confirm button) | 创建 | Carries the action out. |
+| Pin | 置顶 | |
+| Log out | 退出登录 | |
+| Thinking effort | 思考强度 | |
+| Token | 令牌 | |
+| Workspace | 工作区 | |
+| Server | 服务器 | |
+| Thread | 话题 | Replies under one Message. |
+| Reply | 回复 | |
+| Reaction | 表情回应 | |
+| Forward | 转发 | |
+| Mention | 提及 | `@` stays as it is. |
+| Member | 成员 | |
+| Owner | 所有者 | |
+| Document | 文档 | |
+| File | 文件 | |
+| Attachment | 附件 | |
+| Run (an Agent's work) | 运行 | Noun: `运行已停止`. |
+| Activity | 活动 | What an Agent is doing or did. |
+| Scheduled task | 定时任务 | |
+| Follow-up | 后续消息 | A Message sent while the Agent is working. |
+| Instructions | 指令 | An Agent's instructions. |
+| Template | 模板 | |
+| Permission | 权限 | |
+| Allow / Deny | 允许 / 拒绝 | Answers to a permission request. |
+| Approve / Decline | 批准 / 拒绝 | Answers to an approval. |
+| Meeting notes | 会议纪要 | |
+| Meeting summary | 会议摘要 | |
+| Voice Mode | 语音模式 | |
+| Draft | 草稿 | |
+| Local model | 本地模型 | |
+| Subscription | 订阅 | A model source. |
+| API key | API 密钥 | A model provider's key; `Token` stays `令牌`. |
+| Load / Unload (a model) | 加载 / 卸载 | |
+| Download | 下载 | |
+| Memory (of a Computer) | 内存 | |
+| Memory (of an Agent) | 记忆 | |
+| Online / Offline | 在线 / 离线 | |
+| Connect / Disconnect | 连接 / 断开连接 | |
+| Sign in | 登录 | |
+| Password | 密码 | |
+| Browser | 浏览器 | |
+| Send / Stop | 发送 / 停止 | |
+| Emoji | 表情 | |
+| Direct chat | 私聊 | A chat with one person or Agent. |
+| Sidebar | 侧边栏 | |
+| Widget | 小组件 | |
+| Dashboard / Overview | 仪表盘 / 概览 | |
+| My pages / Shared with me | 我的页面 / 与我共享 | |
+| Former member | 已离开的成员 | |
+| Transcript | 转写内容 | |
+| Prompt | 提示词 | |
+| Email / Recipients | 邮件 / 收件人 | |
+| Cc / Bcc | 抄送 / 密送 | |
+| Activity log | 活动记录 | |
+| Background tasks | 后台任务 | |
+| Source Message | 原消息 | The Message a run answers. |
+| Needs attention | 需要处理 | |
+| Needs approval | 待批准 | |
+| Typing | 正在输入 | |
+| Resend | 重新发送 | |
+| Context window | 上下文窗口 | |
+| Rate limit / Quota | 速率限制 / 配额 | |
+| Computer use | 电脑操作 | An Agent operating the screen. |
+| Accessibility | 辅助功能 | The macOS permission. |
+| Screen Recording | 屏幕录制 | The macOS permission. |
+| Diff / Script | 差异 / 脚本 | |
+| Granted / Declined | 已授权 / 已拒绝 | |
+| Not now / Skip for now | 以后再说 / 暂时跳过 | |
+| Apply | 应用 | Verb on a card; `应用` is also App. |
+| Artifact directory | 产出目录 | |
+| Account | 账号 | `系统账号` for an operating system user. |
+| Insight | 洞察 | |
+| Bio | 简介 | |
+| Organization | 组织 | |
+| Repository / Channel | 仓库 / 频道 | |
+| AI app | AI 应用 | Claude Code, Codex and the like. |
+| Coding agent | 编程 Agent | |
+| Extension | 扩展程序 | A browser extension. |
+| Ready | 就绪 | |
+| Cloud Computer | 云端电脑 | |
+| Troubleshoot | 排查问题 | |
+| GPU / Unified / System memory | 显存 / 统一内存 / 系统内存 | |
+| Disk | 磁盘 | |
+| Endpoint / Gateway | 端点 / 网关 | |
+| Context / Capabilities | 上下文 / 能力 | Of a model. |
+| Publisher / License | 发布者 / 许可证 | |
+| Parameters | 参数量 | Of a model. |
+| Model source | 模型来源 | |
## Style
@@ -58,5 +142,7 @@ elsewhere.
- Address the Human as `你`, not `您`.
- Prefer the short everyday word a native app would use over a literal
rendering of the English.
+- Name a place in the interface by its label on screen, in Chinese quotation
+ marks or as a path: `“消息”`, `设置 › 模型`.
- Keep every `{placeholder}` and `<tag>` of the English source; move them to
where the Chinese sentence needs them.
diff --git a/apps/web/src/i18n/locales/zh-CN.json b/apps/web/src/i18n/locales/zh-CN.json
index 31f64254..06a23ec5 100644
--- a/apps/web/src/i18n/locales/zh-CN.json
+++ b/apps/web/src/i18n/locales/zh-CN.json
@@ -7,7 +7,22 @@
"unavailableBody": "应用未能完成加载。",
"tryAgain": "重试",
"avatar": "{name} 的头像",
- "resizeHint": "拖动调整宽度,双击恢复默认"
+ "resizeHint": "拖动调整宽度,双击恢复默认",
+ "cancel": "取消",
+ "retry": "重试",
+ "open": "打开",
+ "copy": "复制",
+ "copied": "已复制",
+ "search": "搜索",
+ "save": "保存",
+ "delete": "删除",
+ "remove": "移除",
+ "edit": "编辑",
+ "done": "完成",
+ "back": "返回",
+ "you": "你",
+ "justNow": "刚刚",
+ "loading": "加载中…"
},
"settings": {
"navigation": "设置导航",
@@ -55,8 +70,12 @@
"noMessages": "暂无消息",
"deleted": "已删除",
"deletedChat": "{name},已删除",
- "unreadMentions": { "other": "{count} 条未读提及" },
- "unreadMessages": { "other": "{count} 条未读消息" },
+ "unreadMentions": {
+ "other": "{count} 条未读提及"
+ },
+ "unreadMessages": {
+ "other": "{count} 条未读消息"
+ },
"pinned": "已置顶",
"pin": "置顶",
"unpin": "取消置顶",
@@ -206,5 +225,545 @@
"desktopUpgradeRequired": "请先更新 Linger 应用,再连接这台电脑。",
"desktopDisconnected": "Linger 后台服务没有运行,请退出并重新打开应用。",
"desktopRuntimeCrashed": "本地 Runtime 已停止,无法检查 Codex 和 Claude Code。Linger 正在重启它。"
+ },
+ "chat": {
+ "messageTime": "{date} {time}",
+ "mentionAuthor": "提及 {name}",
+ "authorUnavailable": "{name} 暂时不可用",
+ "authorNotInRoom": "{name} 已不在这个 Room 中",
+ "scheduledTask": "定时任务:{name}",
+ "replyContext": "回复的消息",
+ "pendingReplyContext": "待发送回复的消息",
+ "forwardMessage": "转发消息",
+ "replyToMessage": "回复消息",
+ "replyToThread": "在话题中回复",
+ "addReaction": "添加表情回应",
+ "copyMessage": "复制消息",
+ "moreMessageActions": "更多消息操作",
+ "sending": "发送中…",
+ "deliveryUnknown": "发送状态未知",
+ "notSent": "未发送",
+ "connectFailed": "无法连接服务器…",
+ "openFile": "打开 {name}",
+ "previewFile": "预览 {name}",
+ "fileUnavailable": "{name} 不可用",
+ "loadingFile": "正在加载 {name}",
+ "loadingImage": "正在加载图片…",
+ "fileCount": {
+ "other": "{count} 个文件"
+ },
+ "folderCount": {
+ "other": "{count} 个文件夹"
+ },
+ "fileTypeArchive": "压缩包",
+ "fileTypeAudio": "音频",
+ "fileTypeCode": "代码",
+ "fileTypeDocument": "文档",
+ "fileTypeImage": "图片",
+ "fileTypeVideo": "视频",
+ "fileTypeWorkflow": "工作流",
+ "fileTypeText": "文本",
+ "fileTypeOnlineDocument": "在线文档",
+ "untitledDocument": "文档",
+ "emptyTimelineTitle": "开始对话",
+ "emptyTimelineBody": "消息对 Room 的所有现有成员可见。",
+ "loadingEarlierMessages": "正在加载更早的消息",
+ "jumpToLatest": "跳到最新消息",
+ "roomTimeline": "Room 消息列表",
+ "noticeAgentCreated": "<author>{author}</author> 创建了 <agent>{agent}</agent> 并加入了这个 Room",
+ "noticeAgentCreatedAfterYourApproval": "<author>{author}</author> 在你批准后创建了 <agent>{agent}</agent>",
+ "noticeAgentCreatedAfterApproval": "<author>{author}</author> 在 {approver} 批准后创建了 <agent>{agent}</agent>",
+ "noticeMemberAdded": "<author>{author}</author> 将 <member>{member}</member> 加入了这个 Room",
+ "noticeAgentSetUpOwnIdentity": "{before} 将自己的身份设置为 <agent>{agent}</agent>",
+ "noticeAgentSetUpBy": "<author>{author}</author> 将 {before} 设置为 <agent>{agent}</agent>",
+ "noticeAgentUpdated": "<author>{author}</author> 更新了 <agent>{agent}</agent>",
+ "noticeFieldName": "名称",
+ "noticeFieldDescription": "描述",
+ "noticeFieldPrompt": "提示词",
+ "noticeFieldInstructions": "指令",
+ "listSeparator": "、",
+ "viewProfile": "查看个人资料",
+ "openDirectChat": "打开私聊",
+ "hideChanges": "隐藏更改",
+ "showChanges": "显示更改",
+ "instructionsUpdated": "指令已更新",
+ "viewInAgentInfo": "在 Agent 信息中查看",
+ "replyCount": {
+ "other": "{count} 条回复"
+ },
+ "openThread": "打开话题,{replies}",
+ "messageThread": "消息话题",
+ "thread": "话题",
+ "replyInThread": "在话题中回复",
+ "replyInThisThread": "在这个话题中回复",
+ "openingThread": "正在打开话题…",
+ "threadStillOpening": "话题还在打开中。",
+ "threadTimeline": "话题消息列表",
+ "replies": "回复",
+ "loadEarlierReplies": "加载更早的回复",
+ "roomRegion": "Room {name}",
+ "roomSettings": "Room 设置",
+ "openSettingsFromAvatar": "通过头像打开 {name} 的设置",
+ "roomDeleted": "已删除",
+ "deleteRoom": "删除 Room",
+ "sidebar": "侧边栏",
+ "showSidebar": "显示侧边栏",
+ "hideSidebar": "隐藏侧边栏",
+ "loadingPanelSidebar": "正在加载侧边栏",
+ "loadingSidebar": "正在加载侧边栏…",
+ "loggingOut": "正在退出",
+ "retryLogout": "重试退出登录",
+ "offline": "离线",
+ "syncingRoom": "正在同步 Room",
+ "reconnecting": "正在重新连接",
+ "roomOutsideScope": "TeamHub 返回的 Room 不在当前空间内。",
+ "roomRefreshFailed": "Room 刷新失败。",
+ "loadingConversation": "正在加载对话",
+ "loadingConversationStatus": "正在加载对话…",
+ "loadingRoute": "正在加载 {name}",
+ "loadingRouteStatus": "正在加载 {name}…",
+ "loadingDocumentBody": "正在加载文档正文",
+ "routeDocument": "文档",
+ "routeRoom": "Room",
+ "routeRooms": "Room 列表",
+ "routeLocalComputers": "本地电脑",
+ "routeApps": "连接器",
+ "routeDashboard": "仪表盘",
+ "libraryOverview": "概览",
+ "libraryMyPages": "我的页面",
+ "librarySharedWithMe": "与我共享",
+ "createFirstRoom": "创建第一个 Room",
+ "firstRoomBody": "Room 把成员(人和 Agent)、消息和共享文件放在同一个协作环境中。",
+ "createRoom": "新建 Room",
+ "leftRoom": "你已离开这个 Room。重新加入后才能收发消息。",
+ "joining": "正在加入…",
+ "joinRoom": "加入 {name}",
+ "reactions": "表情回应",
+ "formerMember": "已离开的成员",
+ "agentReactor": "{name}(Agent)",
+ "reactionSummary": "{emoji} {count}:{names}",
+ "reactionNotSaved": "表情回应未保存,请重试。",
+ "searchResults": "搜索结果",
+ "recommended": "推荐",
+ "searchAllEmoji": "搜索全部表情",
+ "searchEmoji": "搜索表情",
+ "emojiCategories": "表情分类",
+ "emoji": "表情",
+ "loadingEmoji": "正在加载表情…",
+ "noMatchingEmoji": "没有匹配的表情",
+ "emojiPeople": "笑脸与人物",
+ "emojiNature": "动物与自然",
+ "emojiFoods": "食物与饮料",
+ "emojiActivity": "活动",
+ "emojiPlaces": "旅行与地点",
+ "emojiObjects": "物品",
+ "emojiSymbols": "符号",
+ "emojiFlags": "旗帜",
+ "sourceLinkUnavailable": "来源链接不可用",
+ "copyCode": "复制代码",
+ "widgetActions": "小组件操作",
+ "copyToClipboard": "复制到剪贴板",
+ "downloadFile": "下载文件",
+ "filePreviewUnavailable": "文件预览不可用",
+ "profileSources": "个人资料来源",
+ "introGreeting": "你好",
+ "introGreetingNamed": "你好,{name}",
+ "introSelf": "我是 {name}。",
+ "meetingNotes": "会议纪要",
+ "meetingSummary": "会议摘要",
+ "pullingKeyPoints": "正在从转写内容中提炼要点…",
+ "fullNotesReady": "完整会议纪要已生成",
+ "fullNotesSoon": "完整会议纪要将在几分钟后生成,可在<link>资料库 › 会议</link>中查看",
+ "forwardTargetChanged": "转发过程中目标发生了变化,请刷新后重试。",
+ "forwardFailed": "消息转发失败。你可能没有权限分享其中的某个文档。",
+ "forwardTo": "转发给",
+ "forward": "转发",
+ "searchForwardTargets": "搜索转发对象",
+ "forwardAgents": "Agent",
+ "forwardRooms": "Room",
+ "selectedForwardTargets": "已选的转发对象",
+ "removeSelectedTarget": "移除已选对象",
+ "targetSelected": "已选",
+ "selectTarget": "选择",
+ "email": "邮件",
+ "emailNoSubject": "无主题",
+ "openInSidePanel": "在侧边栏中打开",
+ "collapseEmail": "收起邮件",
+ "expandEmail": "展开邮件",
+ "emailTo": "收件人:{recipients}",
+ "emailNoRecipients": "无收件人",
+ "emailSent": "已发送",
+ "emailSending": "发送中…",
+ "emailResultUnknown": "结果未知",
+ "emailResultUnknownWithError": "结果未知:{error}",
+ "emailFailed": "发送失败",
+ "emailFailedWithError": "发送失败:{error}",
+ "approvalActions": "审批操作",
+ "emailSend": "发送",
+ "emailSendAgain": "再次发送",
+ "emailDontSend": "不发送",
+ "emailSendFrom": "发件账号",
+ "gmailAccount": "Gmail 账号"
+ },
+ "cards": {
+ "cardDecisionFailed": "卡片操作失败。",
+ "cardUpdateFailed": "无法更新卡片。",
+ "decisionMismatch": "卡片操作的返回结果与当前 Room 的请求不一致。",
+ "expired": "已过期",
+ "connected": "已连接",
+ "notConnected": "未连接",
+ "connect": "连接",
+ "connectApp": "连接 {name}",
+ "notNow": "以后再说",
+ "none": "无",
+ "listSeparator": "、",
+ "granted": "已授权",
+ "dontAllow": "不允许",
+ "notAllowed": "未允许",
+ "instructions": "指令",
+ "send": "发送",
+ "approve": "批准",
+ "deny": "拒绝",
+ "approvalActions": "审批操作",
+ "closeReason": "收起理由",
+ "denyWithoutReason": "不填理由直接拒绝",
+ "continueReason": "继续填写理由",
+ "addReason": "填写理由",
+ "denyReasonLabel": "拒绝理由",
+ "denyReasonPlaceholder": "填写理由后按 Enter",
+ "denyWithReason": "按此理由拒绝",
+ "fullCall": "完整调用 · {tool}",
+ "labelPermissionRequest": "权限请求",
+ "labelRoomCreation": "创建 Room",
+ "labelConfirmationRequest": "确认请求",
+ "createRoom": "创建 Room",
+ "create": "创建",
+ "created": "已创建",
+ "dontCreate": "不创建",
+ "notCreated": "未创建",
+ "creating": "正在创建…",
+ "apply": "应用",
+ "applied": "已应用",
+ "dontApply": "不应用",
+ "notApplied": "未应用",
+ "applying": "正在应用…",
+ "allowOnce": "允许一次",
+ "allowedOnce": "已允许一次",
+ "running": "正在运行…",
+ "sent": "已发送",
+ "dontSend": "不发送",
+ "notSent": "未发送",
+ "sending": "正在发送…",
+ "done": "已完成",
+ "denied": "已拒绝",
+ "approvedUntil": "{approved},有效期至 {time}",
+ "approvedUsed": "{approved} · 已使用",
+ "failed": "失败",
+ "failedWithOutcome": "失败:{outcome}",
+ "resultUnknown": "结果未知",
+ "resultUnknownWithOutcome": "结果未知:{outcome}",
+ "deniedWithReason": "{denied} · “{reason}”",
+ "agentFieldDescription": "描述",
+ "agentFieldName": "名称",
+ "agentFieldInstructions": "指令",
+ "newAgent": "新建 Agent {name}",
+ "changeAgent": "修改 {name}",
+ "newRoom": "新建 Room {name}",
+ "memberCount": {
+ "other": "{count} 位成员"
+ },
+ "memberCountWithNames": {
+ "other": "{count} 位成员 · {names}"
+ },
+ "fieldDescription": "描述",
+ "fieldName": "名称",
+ "newInstructions": "新指令",
+ "currentInstructions": "当前指令",
+ "showLess": "收起",
+ "showFullInstructions": "显示完整指令",
+ "membersLine": "<label>成员:</label>{names}",
+ "openRoom": "打开 Room",
+ "initialTaskInput": "初始任务内容",
+ "referenceTarget": "引用对象:{name}({type})",
+ "spaceMember": "空间成员",
+ "fileSegment": "文件:{name}",
+ "meetingSummary": "会议摘要",
+ "documentSegment": "文档:{name}",
+ "artifactDirectory": "产出目录:{path}",
+ "skillSegment": "Skill:{name}",
+ "screenshotUnavailable": "截图已无法查看。",
+ "screenshotOwnerOnly": "只有 {name} 可以查看截图。",
+ "screenshotAlt": "操作前的屏幕,已标出操作目标",
+ "screenshotCaption": "操作前 · 已标出操作目标",
+ "diffLabel": "差异 · +{added} −{removed}",
+ "scriptLabel": "脚本 · {path}",
+ "scriptLabelWithHash": "脚本 · {path} · sha256 {hash}",
+ "pageElement": "页面元素",
+ "pageUrl": "页面",
+ "pageTitle": "标题",
+ "pageTarget": "元素",
+ "noSubject": "无主题",
+ "emailToLine": "收件人:{recipients}",
+ "emailFrom": "发件人",
+ "emailTo": "收件人",
+ "emailCc": "抄送",
+ "emailBcc": "密送",
+ "emailSubject": "主题",
+ "messageWhere": "发送到",
+ "messagePreview": "消息预览",
+ "noMessageText": "没有消息正文。",
+ "attachments": "附件",
+ "messageBody": "消息正文",
+ "labelHumanInteraction": "请求人工回答",
+ "previousQuestion": "上一题",
+ "nextQuestion": "下一题",
+ "chooseAny": "可多选",
+ "next": "下一题",
+ "other": "其他…",
+ "ownAnswerTo": "填写你对“{question}”的回答",
+ "ownAnswer": "填写你的回答",
+ "labelAnotherMeSetup": "Another Me 设置",
+ "linkCount": {
+ "other": "{count} 个链接"
+ },
+ "fileCount": {
+ "other": "{count} 个文件"
+ },
+ "sharedItems": "已分享 {items}",
+ "sharedLinksAndFiles": "已分享 {links}和 {files}",
+ "nothingShared": "没有分享内容",
+ "skipped": "已跳过",
+ "sharedSources": "已分享的资料",
+ "fileNoLongerAvailable": "有个文件已失效,请移除后重新上传。",
+ "replyConnected": "连接好了",
+ "skipForNow": "暂时跳过",
+ "connectYourApps": "连接你的应用",
+ "more": "更多",
+ "verifyingConnection": "正在验证连接…",
+ "continueConnecting": "继续",
+ "notAvailableYet": "暂不支持",
+ "linkInvalid": "请输入以 http:// 或 https:// 开头的完整链接。",
+ "linkAlreadyAdded": "这个链接已经添加过了。",
+ "linkLimit": "最多可添加 {max} 个链接。",
+ "uploadFailed": "上传失败。",
+ "fileLimit": "最多可上传 {max} 个文件。",
+ "thatsAll": "就这些",
+ "skip": "跳过",
+ "websiteOrFiles": "网站或文件",
+ "uploadedSize": "已上传 · {size}",
+ "removeItem": "移除 {name}",
+ "pasteLink": "粘贴链接",
+ "addLink": "添加链接",
+ "uploadFiles": "上传文件",
+ "sourcesAddedHint": "已添加到这里。选择“就这些”即可分享给 Another Me。",
+ "sourcesEmptyHint": "添加链接或上传文件,然后选择“就这些”即可分享。",
+ "added": "已添加",
+ "labelAppAuthorization": "请求应用授权",
+ "requestedAccount": "请求的账号:{account}",
+ "authorizing": "正在授权…",
+ "signInFailed": "失败:登录未完成",
+ "appUnavailableForAgents": "这个应用不支持 Agent 访问。",
+ "authorizationNotStarted": "无法开始授权。",
+ "authorizationNotCancelled": "无法取消授权。",
+ "openAuthorizationWindow": "打开授权窗口",
+ "popupBlocked": "浏览器拦截了授权弹窗,请允许弹出窗口后重试。",
+ "allowAgent": "允许 {name}",
+ "allow": "允许",
+ "accountsNotLoaded": "无法加载账号。",
+ "appAccount": "{app} 账号",
+ "accountPending": "{account}(待完成)",
+ "accountNeedsReconnecting": "{account}(需要重新连接)",
+ "connectNewAccount": "连接新账号",
+ "labelComposioKey": "请求 Composio API 密钥",
+ "neededToConnect": "连接 {app} 时需要",
+ "everyAppNeedsIt": "连接任何应用都需要它",
+ "composioApiKey": "Composio API 密钥",
+ "addKey": "添加密钥",
+ "continuesOnceKeySaved": "密钥保存后,{agent} 会继续。",
+ "addComposioKeyTitle": "添加 Composio API 密钥",
+ "keyAdded": "已添加密钥",
+ "noKeyAdded": "未添加密钥",
+ "notCompleted": "未完成",
+ "labelBrowserConnection": "请求连接浏览器",
+ "everydayChrome": "日常使用的 Chrome",
+ "continuesOnceConnected": "连接后,{agent} 会继续。",
+ "browserConnectionFailed": "失败:连接未完成",
+ "labelSystemPermission": "请求系统权限",
+ "subjectComputerUse": "电脑操作(CuaDriver)",
+ "permissionAccessibility": "辅助功能",
+ "permissionScreenRecording": "屏幕录制",
+ "stateNotRequested": "尚未请求",
+ "stateUnknown": "未知",
+ "declined": "已拒绝",
+ "relaunchLinger": "重新启动 Linger",
+ "request": "请求",
+ "openSettings": "打开设置",
+ "stepDidNotRun": "这一步没有执行。",
+ "permissionsUnreadable": "无法读取这台 Mac 的权限。",
+ "relaunchToApply": "重新启动 Linger 后生效",
+ "openLingerOnThatMac": "请在那台 Mac 上打开 Linger 来授予这些权限。",
+ "opensOn": "将在 {name} 上打开",
+ "opensOnThatMac": "将在那台 Mac 上打开",
+ "noticeActor": "{name} ",
+ "noticeSomeone": "有人",
+ "noAnswer": "未作答",
+ "noticeUnanswered": "没有人及时回答“{title}”",
+ "noticeAnswered": "{who}回答了“{question}”:“{answer}”",
+ "noticeAddedNote": "{who}补充了“{note}”",
+ "noticeExpired": "“{title}”已过期",
+ "noticeDeclined": "{who}拒绝了“{title}”",
+ "noticeDeclinedWithReason": "{who}拒绝了“{title}”:“{reason}”",
+ "noticeAllowedOnce": "{who}允许了一次“{title}”",
+ "noticeAllowedOnceRan": "{who}允许了一次“{title}”,已执行",
+ "noticeConnectedChrome": "{who}连接了 Chrome",
+ "noticeAddedComposioKey": "{who}添加了 Composio API 密钥",
+ "noticeAddedSearchKey": "{who}添加了 {backend} 密钥",
+ "noticeAddedSearchKeyInstead": "{who}添加了 {backend} 密钥(而非 {requested})",
+ "noticeConnectedApp": "{who}连接了 <link>{app}</link>",
+ "noticeDidNotFinish": "“{title}”未完成",
+ "noticeDidNotFinishWithOutcome": "“{title}”未完成:{outcome}",
+ "noticeGranted": "{who}授权了“{title}”",
+ "noticeSkipped": "{who}跳过了“{title}”",
+ "noticeCompleted": "{who}完成了“{title}”",
+ "noticeCreatedRoom": "{who}创建了 Room <link>{room}</link>",
+ "noticeApproved": "{who}批准了“{title}”",
+ "noticeApprovedFailed": "{who}批准了“{title}”,但执行失败",
+ "noticeApprovedFailedWithOutcome": "{who}批准了“{title}”,但执行失败:{outcome}",
+ "noticeApprovedUnknown": "{who}批准了“{title}”,结果未知",
+ "noticeApprovedUnknownWithOutcome": "{who}批准了“{title}”,结果未知:{outcome}",
+ "noticeEnded": "“{title}”已结束"
+ },
+ "runtimeStatus": {
+ "stateCanceled": "已取消",
+ "stateCompleted": "已完成",
+ "stateFailed": "失败",
+ "stateNeedsAttention": "需要处理",
+ "stateRecovering": "恢复中",
+ "stateStopped": "已停止",
+ "stateThinking": "思考中",
+ "stateTyping": "正在输入",
+ "stateWaitingForInput": "等待你的输入",
+ "stateWorking": "工作中",
+ "starting": "正在启动",
+ "preparingReply": "正在准备回复",
+ "runStopped": "运行已停止",
+ "runCanceled": "运行已取消",
+ "runFailed": "运行失败",
+ "runFailedWith": "运行失败:{reason}",
+ "followUpUnconfirmed": "后续消息未确认送达",
+ "stoppedFollowUpUnconfirmed": "{reason}后续消息未确认送达。如果 Agent 没有回复,请重新发送。",
+ "elapsedMinutes": "{minutes} 分钟",
+ "labeled": "{label}:{value}",
+ "openAgentStatusActivity": "打开 Agent 状态的活动",
+ "openAgentsWorkingActivity": "打开工作中 Agent 的活动",
+ "stopAgentTask": "停止 {name} 的任务",
+ "stop": "停止",
+ "stopping": "正在停止",
+ "stopped": "已停止",
+ "stopNotConfirmed": "停止未确认。请查看任务状态后重试。",
+ "resendFollowUp": "向 {name} 重新发送未确认的后续消息",
+ "resend": "重新发送",
+ "resent": "已重新发送",
+ "nothingToResend": "没有需要重新发送的消息",
+ "resendFailed": "重新发送失败,请重试。",
+ "backgroundTasks": "后台任务",
+ "backgroundTasksRunning": {
+ "other": "{count} 个任务正在后台运行"
+ },
+ "openTask": "打开任务 {title}",
+ "cancelTask": "取消 {title}",
+ "cancelTaskNotConfirmed": "取消 {title} 未确认,点击重试",
+ "cancelTaskAction": "取消任务",
+ "canceling": "正在取消",
+ "runningMinutes": "{minutes} 分钟",
+ "runningHours": "{hours} 小时",
+ "runningDays": "{days} 天",
+ "activityTabTitle": "活动 · {name}",
+ "agentTabTitle": "Agent · {name}",
+ "linkedSourceMessage": "链接的原消息",
+ "closeLinkedSourceMessage": "关闭链接的原消息",
+ "loadingSourceMessage": "正在加载原消息…",
+ "sourceMessageUnavailable": "原消息不可用。",
+ "activityLog": "活动记录",
+ "showLessActivity": "收起活动",
+ "showAllActivity": "显示全部活动(还有 {count} 条)",
+ "showLess": "收起",
+ "showMore": "展开",
+ "preparedReply": "已准备回复",
+ "unconfirmed": "未确认",
+ "plan": "计划",
+ "runPlan": "运行计划",
+ "inProgress": "进行中",
+ "stepDetails": "{title} 详情",
+ "outcome": "结果",
+ "outcomeCanceled": "已取消",
+ "outcomeDeclined": "已拒绝",
+ "outcomeFailed": "失败",
+ "outcomeSucceeded": "成功",
+ "taskStarted": "已启动",
+ "taskSentTo": "已发送给",
+ "taskStopped": "已停止",
+ "tasksChecked": "已查看任务",
+ "taskRunning": "任务运行中",
+ "taskStatusRunning": "运行中",
+ "taskStatusNeedsApproval": "待批准",
+ "taskStatusFinished": "已完成",
+ "taskStatusFailed": "失败",
+ "taskStatusStopped": "已停止",
+ "toolCommand": "命令",
+ "toolRead": "读取文件",
+ "toolEdit": "编辑文件",
+ "toolSearch": "搜索",
+ "toolBrowser": "网页浏览",
+ "toolMessage": "消息",
+ "toolMessageRead": "读取消息",
+ "toolDelegation": "Agent 协作",
+ "toolImage": "图片",
+ "toolInteraction": "用户输入",
+ "toolRecovery": "恢复",
+ "toolReview": "检查",
+ "tool": "工具",
+ "summaryCommand": "正在运行命令",
+ "summaryRead": "正在查看文件",
+ "summaryEdit": "正在更新文件",
+ "summarySearch": "正在搜索信息",
+ "summaryBrowser": "正在查看网上信息",
+ "summaryMessage": "正在发送进展",
+ "summaryDelegation": "正在与其他 Agent 协调",
+ "summaryTool": "正在处理任务",
+ "readingMessages": "正在读取消息",
+ "workingWithImages": "正在处理图片",
+ "recoveringTask": "正在恢复任务",
+ "reviewingResults": "正在检查结果",
+ "workingThroughSteps": {
+ "other": "正在完成 {count} 个步骤"
+ },
+ "workingThroughTask": "正在逐步完成任务",
+ "phraseRead": "正在读取文件",
+ "phraseEdit": "正在编辑文件",
+ "phraseSearch": "正在搜索",
+ "phraseBrowser": "正在浏览网页",
+ "phraseMessage": "正在发送消息",
+ "phraseDelegation": "正在与其他 Agent 协作",
+ "phraseTool": "正在使用工具",
+ "failureSessionNotFound": "无法恢复会话历史。请检查本地会话以及与 Local Computer 的兼容性后再重试。",
+ "failureProtocolIncompatible": "这个 Runtime 的协议与 Local Computer 不兼容。请更新 Local Computer,或改用经过验证的 Runtime 版本。",
+ "failureAuthenticationRequired": "Runtime 身份验证失败。请重新登录,或检查你的 API 凭据。",
+ "failureNetworkError": "Runtime 无法连接模型服务。请检查网络连接和服务地址。",
+ "failureRateLimited": "已达到模型服务的速率限制或配额上限。请检查配额后再重试。",
+ "failureModelUnavailable": "模型服务没有向这个 Runtime 的账号提供所选模型。请为 Agent 换一个模型,或让 Runtime 登录一个可以使用该模型的账号。",
+ "failureModelNotOffered": "Agent 的电脑不提供所选模型,或该模型不支持当前的思考强度。请打开 Agent 的设置,选择这台电脑提供的模型和思考强度。",
+ "failureContextTooLong": "对话内容已超出模型的上下文窗口。请与 Agent 开始新对话,或换一个上下文窗口更大的模型。",
+ "failureModelServiceError": "模型服务报告了内部错误。请稍后重试;如果一直失败,请查看模型提供商的服务状态。",
+ "failureTimeout": "Runtime 运行超过时间限制仍未完成。请重试,或把请求拆成更小的步骤。",
+ "failureExecutionFailed": "Runtime 因未归类的错误退出。请先查看 Local Computer 的诊断信息再重试。",
+ "failureExecutionOutcomeUnknown": "命令已发出,但无法确认执行结果,也没有自动重新执行。请先检查它造成的影响再重试。",
+ "failureReplyUndelivered": "Agent 已完成,但它尝试发送的 TeamHub 消息全部失败,回复没有送达 Room。请检查 Agent 与 TeamHub 的连接,然后再问一次。",
+ "failureReplyNotSent": "Agent 已完成,但没有把回复发送到 Room。它的模型可能没有使用消息命令就直接作答了。请再问一次,或为 Agent 换一个更强的模型。",
+ "failureInterrupted": "运行在完成前停止了,因为它的电脑重新启动(例如为了让一项系统权限生效),或者 Agent 在那台电脑上被停止。部分工作可能已经生效,请先检查结果再重新提问。",
+ "failureComputerUnavailable": "Agent 的电脑无法运行它。请确认电脑在线、Agent 没有在那台电脑上被停止,并且它的 Runtime 已启用。",
+ "failureCleanupUnconfirmed": "无法确认 Runtime 进程已停止。请先检查 Local Computer,再开始新的运行。",
+ "failureResponseTooLarge": "Agent 的回复超出了一条 Room 消息的容量。请让它回答得短一些,或把结果做成文件。",
+ "failureUnclassified": "运行因系统无法识别的错误而停止。请重试;如果再次出现,请把发生时间告诉管理员。"
}
}
diff --git a/apps/web/src/lib/date-format.ts b/apps/web/src/lib/date-format.ts
index fe6ffc40..e821b251 100644
--- a/apps/web/src/lib/date-format.ts
+++ b/apps/web/src/lib/date-format.ts
@@ -1,3 +1,6 @@
+import { commonMessages } from "@/i18n/common.messages";
+import { formatLocale, type Translation } from "@/i18n/language";
+
export const APP_LOCALE = "en-US";
/**
@@ -36,9 +39,17 @@ export function dayKey(value: Date): string {
return `${part("year")}-${part("month")}-${part("day")}`;
}
-const relativeFormatter = new Intl.RelativeTimeFormat(APP_LOCALE, {
- numeric: "auto",
-});
+const relativeFormatters = new Map<string, Intl.RelativeTimeFormat>();
+
+function relativeFormatter(locale: string) {
+ let formatter = relativeFormatters.get(locale);
+ if (!formatter) {
+ formatter = new Intl.RelativeTimeFormat(locale, { numeric: "auto" });
+ relativeFormatters.set(locale, formatter);
+ }
+ return formatter;
+}
+
const relativeUnits = [
["day", 86_400_000],
["hour", 3_600_000],
@@ -49,23 +60,31 @@ const RELATIVE_WINDOW_MS = 7 * 86_400_000;
/**
* When something last changed, the one way lists and cards say it: "2 hours
* ago" within a week, then "Nov 7", with the year only when it is not this one.
+ * A translated surface passes its `translation`; without it the text is
+ * English.
*/
export function formatUpdatedAt(
value: Date | string | number,
now = Date.now(),
+ translation?: Translation,
): string {
const time = new Date(value).getTime();
if (!Number.isFinite(time)) return "—";
+ const locale = translation ? formatLocale(translation.language) : APP_LOCALE;
const elapsed = Math.max(0, now - time);
- if (elapsed < 60_000) return "just now";
+ if (elapsed < 60_000)
+ return translation ? translation.t(commonMessages.justNow) : "just now";
if (elapsed < RELATIVE_WINDOW_MS) {
const [unit, size] = relativeUnits.find(([, size]) => elapsed >= size)!;
- return relativeFormatter.format(-Math.floor(elapsed / size), unit);
+ return relativeFormatter(locale).format(-Math.floor(elapsed / size), unit);
}
const sameYear = new Date(time).getFullYear() === new Date(now).getFullYear();
- return dateTimeFormat({
- day: "numeric",
- month: "short",
- ...(sameYear ? {} : { year: "numeric" }),
- }).format(time);
+ return dateTimeFormat(
+ {
+ day: "numeric",
+ month: "short",
+ ...(sameYear ? {} : { year: "numeric" }),
+ },
+ locale,
+ ).format(time);
}