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 Voice Mode and recording windows

Kilyn63873b5c65d9
diff --git a/apps/web/src/features/rooms/chat/voice-mode/file-voice-material-button.tsx b/apps/web/src/features/rooms/chat/voice-mode/file-voice-material-button.tsx
index bad021de..8cd96c4b 100644
--- a/apps/web/src/features/rooms/chat/voice-mode/file-voice-material-button.tsx
+++ b/apps/web/src/features/rooms/chat/voice-mode/file-voice-material-button.tsx
@@ -2,6 +2,8 @@ import { QuoteDownIcon, Tick02Icon } from "@hugeicons/core-free-icons";
import { Button } from "@/components/ui/button";
import { Icon } from "@/components/ui/icon";
import { useOptionalVoiceMaterials } from "./voice-materials-context";
+import { useT } from "@/i18n/use-translation";
+import { voiceChatMessages as m } from "./voice-chat.messages";
/**
* Offers a whole chat file as voice material while Voice Mode is on. Like the
@@ -20,6 +22,7 @@ export function FileVoiceMaterialButton({
filename: string;
versionId?: string;
}) {
+ const t = useT();
const materials = useOptionalVoiceMaterials();
// Files need a Document grant, which only their own Room's composer gives.
if (!materials?.voiceModeEntered || !materials.acceptsDocuments) return null;
@@ -32,9 +35,7 @@ export function FileVoiceMaterialButton({
data-file-voice-material
>
<Button
- aria-label={
- added ? `${filename} added to voice` : `Add ${filename} to voice`
- }
+ aria-label={t(added ? m.fileAdded : m.addFile, { filename })}
className="shadow-md"
disabled={added}
onClick={() =>
@@ -54,7 +55,7 @@ export function FileVoiceMaterialButton({
) : (
<Icon icon={QuoteDownIcon} size={14} />
)}
- {added ? "Added to voice" : "Add to voice"}
+ {t(added ? m.addedToVoice : m.addToVoice)}
</Button>
</span>
);
diff --git a/apps/web/src/features/rooms/chat/voice-mode/live/voice-live-transport.ts b/apps/web/src/features/rooms/chat/voice-mode/live/voice-live-transport.ts
index 7d6bd977..6335f2ab 100644
--- a/apps/web/src/features/rooms/chat/voice-mode/live/voice-live-transport.ts
+++ b/apps/web/src/features/rooms/chat/voice-mode/live/voice-live-transport.ts
@@ -31,6 +31,8 @@ import {
voiceMicrophoneOptions,
} from "../voice-media-room";
import { VoiceModeDisconnectedError } from "../voice-mode-errors";
+import { translate } from "@/i18n/language";
+import { voiceSessionMessages as m } from "../voice-session.messages";
export const voiceLiveTopic = "linger.voice.live";
export const voiceLiveReplyTrack = "linger-live-reply";
@@ -152,7 +154,9 @@ export async function openVoiceLive(input: {
endOffsetMs: turns * 2,
});
} else if (event.type === "session_failure")
- failed(new Error(`Live voice stopped (${event.code ?? "unknown"}).`));
+ failed(
+ new Error(translate(m.liveStopped, { code: event.code ?? "unknown" })),
+ );
else input.runtime(event);
};
const play = (remote: RemoteTrack) => {
@@ -195,7 +199,7 @@ export async function openVoiceLive(input: {
);
session = await bounded(creating, 10_000, signal);
if (session.purpose !== "chat_live")
- throw new Error("The server did not confirm a live voice session.");
+ throw new Error(translate(m.liveNotConfirmed));
const sessionId = session.id;
const credential = await bounded(
teamHubData(
@@ -237,12 +241,12 @@ export async function openVoiceLive(input: {
});
media.on(RoomEvent.DataReceived, receiveData);
media.on(RoomEvent.Disconnected, () =>
- failed(new VoiceModeDisconnectedError("Live voice connection was lost.")),
+ failed(new VoiceModeDisconnectedError(translate(m.liveConnectionLost))),
);
media.on(RoomEvent.MediaDevicesError, failed);
media.on(RoomEvent.ParticipantDisconnected, (participant) => {
if (participant.identity === runtimeIdentity)
- failed(new Error("Live voice runtime disconnected."));
+ failed(new Error(translate(m.liveRuntimeDisconnected)));
});
const [, createdTrack] = await Promise.all([
bounded(
@@ -260,7 +264,9 @@ export async function openVoiceLive(input: {
for (const publication of participant.trackPublications.values())
subscribe(publication, participant);
track.mediaStreamTrack.addEventListener("ended", () =>
- failed(new VoiceModeDisconnectedError("Microphone disconnected.")),
+ failed(
+ new VoiceModeDisconnectedError(translate(m.microphoneDisconnected)),
+ ),
);
await bounded(
media.localParticipant.publishTrack(track, {
@@ -373,16 +379,16 @@ export async function openVoiceLive(input: {
]);
if (!current) break;
if (current.purpose !== "chat_live")
- throw new Error("Voice Mode authorization changed.");
+ throw new Error(translate(m.authorizationChanged));
if (current.last_failure_code)
throw new Error(
- `Live voice is unavailable (${current.last_failure_code}).`,
+ translate(m.liveUnavailable, { code: current.last_failure_code }),
);
// An event from the runtime proves it is listening, like readiness.
if (current.input_ready_generation === credential.generation || activity)
break;
if (Date.now() >= readyDeadline)
- throw new Error("Live voice did not become ready within 15 seconds.");
+ throw new Error(translate(m.liveNotReady, { seconds: 15 }));
await waitForVoiceDelay(200, signal);
signal.throwIfAborted();
}
diff --git a/apps/web/src/features/rooms/chat/voice-mode/live/voice-page-reader.test.ts b/apps/web/src/features/rooms/chat/voice-mode/live/voice-page-reader.test.ts
index 2c98a785..69304c57 100644
--- a/apps/web/src/features/rooms/chat/voice-mode/live/voice-page-reader.test.ts
+++ b/apps/web/src/features/rooms/chat/voice-mode/live/voice-page-reader.test.ts
@@ -31,7 +31,7 @@ beforeEach(() => {
<p>The release plan is still in review.</p>
<textarea aria-label="Message Room" data-chat-composer>Unsent draft</textarea>
</main>
- <section aria-label="Voice Mode window"><p>Text in the voice window</p></section>`;
+ <section aria-label="Voice Mode window" data-voice-window><p>Text in the voice window</p></section>`;
});
afterEach(() => {
vi.restoreAllMocks();
diff --git a/apps/web/src/features/rooms/chat/voice-mode/live/voice-page-reader.ts b/apps/web/src/features/rooms/chat/voice-mode/live/voice-page-reader.ts
index 64ebbd1b..9a20e464 100644
--- a/apps/web/src/features/rooms/chat/voice-mode/live/voice-page-reader.ts
+++ b/apps/web/src/features/rooms/chat/voice-mode/live/voice-page-reader.ts
@@ -4,7 +4,8 @@
* the numbered visible content is read when it asks or after a command.
*/
-const voiceWindow = '[aria-label="Voice Mode window"]';
+import { voiceWindowSelector as voiceWindow } from "../voice-window-selector";
+
const outsideContent = `${voiceWindow}, [data-voice-area], aside[aria-label$=" sidebar"], [aria-hidden="true"], [inert]`;
// The Human's unsent draft and secrets are never read.
const privateInput = `input, textarea, select, [data-chat-composer]`;
diff --git a/apps/web/src/features/rooms/chat/voice-mode/message-voice-selection-control.tsx b/apps/web/src/features/rooms/chat/voice-mode/message-voice-selection-control.tsx
index 7d680066..ba0559db 100644
--- a/apps/web/src/features/rooms/chat/voice-mode/message-voice-selection-control.tsx
+++ b/apps/web/src/features/rooms/chat/voice-mode/message-voice-selection-control.tsx
@@ -6,6 +6,8 @@ import { createPortal } from "react-dom";
import { Button } from "@/components/ui/button";
import { readVisibleQuote } from "../../documents/document-voice-selection-control";
import { useOptionalVoiceMaterials } from "./voice-materials-context";
+import { useT } from "@/i18n/use-translation";
+import { voiceChatMessages as m } from "./voice-chat.messages";
const controlSelector = "[data-message-voice-selection-control]";
// Mentions and Document links are part of a Message body and may be quoted.
@@ -33,6 +35,7 @@ export function MessageVoiceSelectionControl({
}: {
root: HTMLElement | null;
}) {
+ const t = useT();
const materials = useOptionalVoiceMaterials();
const enabled = materials?.voiceModeEntered === true;
const [selection, setSelection] = useState<SelectedMessageQuote | null>(null);
@@ -150,7 +153,7 @@ export function MessageVoiceSelectionControl({
className="fixed z-50 flex flex-col items-start gap-1"
data-message-voice-selection-control
role="group"
- aria-label="Selected message voice context"
+ aria-label={t(m.messageSelection)}
style={{ top: placement.top, left: placement.left }}
>
<Button
@@ -162,15 +165,14 @@ export function MessageVoiceSelectionControl({
type="button"
>
<Icon icon={QuoteDownIcon} size={14} />
- Add to voice
+ {t(m.addToVoice)}
</Button>
{failed ? (
<p
className="max-w-64 rounded bg-app-surface px-2 py-1 text-xs text-app-danger shadow"
role="alert"
>
- {materials.error ||
- "This selection could not be added. Please try again."}
+ {materials.error || t(m.addFailed)}
</p>
) : null}
</div>,
diff --git a/apps/web/src/features/rooms/chat/voice-mode/voice-chat.messages.ts b/apps/web/src/features/rooms/chat/voice-mode/voice-chat.messages.ts
new file mode 100644
index 00000000..e0af2229
--- /dev/null
+++ b/apps/web/src/features/rooms/chat/voice-mode/voice-chat.messages.ts
@@ -0,0 +1,24 @@
+import { defineMessages } from "@/i18n/messages";
+
+/** Voice Mode in the chat: selections added to voice, and the live draft. */
+export const voiceChatMessages = defineMessages("voiceChat", {
+ addToVoice: "Add to voice",
+ addedToVoice: "Added to voice",
+ addFile: "Add {filename} to voice",
+ fileAdded: "{filename} added to voice",
+ messageSelection: "Selected message voice context",
+ documentSelection: "Selected document voice context",
+ selections: "Selected voice materials",
+ removeSelection: "Remove selection from {title}",
+ liveDraft: "Live voice draft",
+
+ // Why a selection was not added or sent.
+ addFailed: "This selection could not be added. Please try again.",
+ onlyMessageText: "Only message text can be added from another Room.",
+ selectionTooLong:
+ "Select up to {characters} characters from an available document or message.",
+ tooManySelections:
+ "Use up to {selections} selections and {characters} characters. Remove a selection first.",
+ messageTooLong:
+ "Your voice message and references exceed {characters} characters. Remove a selection or shorten the draft.",
+});
diff --git a/apps/web/src/features/rooms/chat/voice-mode/voice-live-draft.tsx b/apps/web/src/features/rooms/chat/voice-mode/voice-live-draft.tsx
index 61167aaa..24210071 100644
--- a/apps/web/src/features/rooms/chat/voice-mode/voice-live-draft.tsx
+++ b/apps/web/src/features/rooms/chat/voice-mode/voice-live-draft.tsx
@@ -1,5 +1,7 @@
import type { TeamHubActorRef } from "@/features/teamhub/teamhub-types";
import { ActorAvatar } from "../../members/actor-avatar";
+import { useT } from "@/i18n/use-translation";
+import { voiceChatMessages as m } from "./voice-chat.messages";
export interface VoiceLiveDraft {
actor: TeamHubActorRef;
@@ -15,10 +17,11 @@ export function VoiceLiveDraftRow({
draft: VoiceLiveDraft;
startsGroup?: boolean;
}) {
+ const t = useT();
if (!draft.text && !draft.error) return null;
return (
<article
- aria-label="Live voice draft"
+ aria-label={t(m.liveDraft)}
className="room-message-card message-row"
data-author-kind="human"
data-current-actor="true"
diff --git a/apps/web/src/features/rooms/chat/voice-mode/voice-material-composition.ts b/apps/web/src/features/rooms/chat/voice-mode/voice-material-composition.ts
index 7a9232bc..fc0acf0c 100644
--- a/apps/web/src/features/rooms/chat/voice-mode/voice-material-composition.ts
+++ b/apps/web/src/features/rooms/chat/voice-mode/voice-material-composition.ts
@@ -5,6 +5,8 @@ import {
} from "../message-composer-references";
import type { VoiceDocumentSelection } from "../../room-drafts";
import { formatMentionToken } from "../message-mentions";
+import { translate } from "@/i18n/language";
+import { voiceChatMessages as m } from "./voice-chat.messages";
/** Build a normal Message: visible excerpt text plus existing Document segments. */
export function withVoiceMaterials(
@@ -66,9 +68,7 @@ export function withVoiceMaterials(
// Quoted material first, then what the user said about it.
const body = [...excerpts, composition.body].filter(Boolean).join("\n\n");
if (body.length > 50_000)
- throw new Error(
- "Your voice message and references exceed 50,000 characters. Remove a selection or shorten the draft.",
- );
+ throw new Error(translate(m.messageTooLong, { characters: 50_000 }));
return {
...composition,
body,
diff --git a/apps/web/src/features/rooms/chat/voice-mode/voice-materials-context.tsx b/apps/web/src/features/rooms/chat/voice-mode/voice-materials-context.tsx
index 4e9f52c5..d9555552 100644
--- a/apps/web/src/features/rooms/chat/voice-mode/voice-materials-context.tsx
+++ b/apps/web/src/features/rooms/chat/voice-mode/voice-materials-context.tsx
@@ -13,6 +13,8 @@ import {
type VoiceDocumentSelection,
} from "../../room-drafts";
import type { TeamHubRoom } from "@/features/teamhub/teamhub-types";
+import { translate } from "@/i18n/language";
+import { voiceChatMessages as m } from "./voice-chat.messages";
export interface VoiceMaterials {
/** Room whose next voice turn receives these materials. */
@@ -97,7 +99,7 @@ function ScopedVoiceMaterialsProvider({
addSelection(input) {
if (!enabled) return false;
if (remote && input.documentId) {
- setError("Only message text can be added from another Room.");
+ setError(translate(m.onlyMessageText));
return false;
}
const selection = {
@@ -108,9 +110,7 @@ function ScopedVoiceMaterialsProvider({
`voice-material-${Date.now()}-${Math.random().toString(16).slice(2)}`,
};
if (!isVoiceDocumentSelection(selection)) {
- setError(
- "Select up to 10,000 characters from an available document or message.",
- );
+ setError(translate(m.selectionTooLong, { characters: 10_000 }));
return false;
}
const existing = current();
@@ -132,7 +132,7 @@ function ScopedVoiceMaterialsProvider({
) > 20_000
) {
setError(
- "Use up to 5 selections and 20,000 characters. Remove a selection first.",
+ translate(m.tooManySelections, { characters: 20_000, selections: 5 }),
);
return false;
}
diff --git a/apps/web/src/features/rooms/chat/voice-mode/voice-materials-preview.tsx b/apps/web/src/features/rooms/chat/voice-mode/voice-materials-preview.tsx
index 7c1df010..dc8f035b 100644
--- a/apps/web/src/features/rooms/chat/voice-mode/voice-materials-preview.tsx
+++ b/apps/web/src/features/rooms/chat/voice-mode/voice-materials-preview.tsx
@@ -6,13 +6,16 @@ import {
import { Button } from "@/components/ui/button";
import { Icon } from "@/components/ui/icon";
import { useOptionalVoiceMaterials } from "./voice-materials-context";
+import { useT } from "@/i18n/use-translation";
+import { voiceChatMessages as m } from "./voice-chat.messages";
/** Compact chips for material waiting to go out with the next message. */
export function VoiceMaterialsPreview() {
+ const t = useT();
const context = useOptionalVoiceMaterials();
if (!context || (!context.materials.length && !context.error)) return null;
return (
- <div aria-label="Selected voice materials" className="mb-1.5 px-1">
+ <div aria-label={t(m.selections)} className="mb-1.5 px-1">
<div className="flex flex-wrap gap-1.5">
{context.materials.map((material) => {
const materialIcon = material.messageId ? Message01Icon : File01Icon;
@@ -27,7 +30,8 @@ export function VoiceMaterialsPreview() {
{material.quote || material.title}
</span>
<Button
- aria-label={`Remove selection from ${material.title}`}
+ aria-label={t(m.removeSelection, { title: material.title })}
+ data-voice-risk="never"
onClick={() => context.remove(material.id)}
size="compactIcon"
tone="ghost"
diff --git a/apps/web/src/features/rooms/chat/voice-mode/voice-mode-controller.ts b/apps/web/src/features/rooms/chat/voice-mode/voice-mode-controller.ts
index be9fac87..b8e037ff 100644
--- a/apps/web/src/features/rooms/chat/voice-mode/voice-mode-controller.ts
+++ b/apps/web/src/features/rooms/chat/voice-mode/voice-mode-controller.ts
@@ -1,4 +1,6 @@
import { VoiceModeDisconnectedError } from "./voice-mode-errors";
+import { translate } from "@/i18n/language";
+import { voiceSessionMessages as m } from "./voice-session.messages";
export type VoiceModeEvent =
| { kind: "partial"; text: string; endOffsetMs: number }
@@ -238,11 +240,7 @@ export class VoiceModeController {
if (this.seen.has(event.id)) return;
// IDs are bounded by the lifetime of this explicitly opened session.
if (this.seen.size >= 4_000) {
- this.fail(
- new Error(
- "Voice Mode reached its session limit. Exit and start again.",
- ),
- );
+ this.fail(new Error(translate(m.sessionLimit)));
return;
}
this.seen.add(event.id);
@@ -281,11 +279,7 @@ export class VoiceModeController {
this.queue.length >= maximumQueuedTurns ||
this.state.text.length > maximumTextLength
) {
- this.fail(
- new Error(
- "Voice input is ahead of message delivery. Your draft is kept; retry or exit to review it.",
- ),
- );
+ this.fail(new Error(translate(m.inputAhead)));
return;
}
// Transcript events may arrive while the transport is still completing its
@@ -420,7 +414,5 @@ function isRecoverableVoiceError(error: unknown) {
}
function describe(error: unknown) {
- return error instanceof Error
- ? error.message
- : "Voice Mode could not continue. Your text has been kept.";
+ return error instanceof Error ? error.message : translate(m.couldNotContinue);
}
diff --git a/apps/web/src/features/rooms/chat/voice-mode/voice-mode-mini-window.tsx b/apps/web/src/features/rooms/chat/voice-mode/voice-mode-mini-window.tsx
index 8681ed67..10a85fb6 100644
--- a/apps/web/src/features/rooms/chat/voice-mode/voice-mode-mini-window.tsx
+++ b/apps/web/src/features/rooms/chat/voice-mode/voice-mode-mini-window.tsx
@@ -27,6 +27,9 @@ import { createPortal } from "react-dom";
import { useMatch, useNavigate } from "react-router";
import { Button } from "@/components/ui/button";
+import { commonMessages } from "@/i18n/common.messages";
+import { translate } from "@/i18n/language";
+import { useT } from "@/i18n/use-translation";
import { isRunWorking } from "@/features/teamhub/run-status";
import { useTeamHubRuntime } from "@/features/teamhub/teamhub-runtime";
import type { TeamHubMessage } from "@/features/teamhub/teamhub-types";
@@ -55,6 +58,7 @@ import {
type VoiceWindowBounds,
} from "./voice-window-resize";
import { showVoiceNotice, useVoiceNotice } from "./voice-notice";
+import { voiceWindowMessages as m } from "./voice-window.messages";
import {
useOptionalVoiceModeSession,
useVoiceModeLevel,
@@ -132,6 +136,7 @@ function MiniWindow({
onSoundOff: (soundOff: boolean) => void;
session: VoiceModeSession;
}) {
+ const t = useT();
const { client } = useTeamHubRuntime();
const navigate = useNavigate();
const { roomId, roomName, tenantId } = session.target;
@@ -236,8 +241,7 @@ function MiniWindow({
if (action === "mute" || action === "unmute")
void onMute(action === "mute");
// The desktop places a picture-in-picture window; only a drag moves it.
- else if (pip)
- showVoiceNotice("Drag the floating window to move or resize it.");
+ else if (pip) showVoiceNotice(translate(m.dragHint));
else if (action === "expand" || action === "shrink")
choosePreset(action === "expand" ? "expanded" : "compact");
else place(action === "move_left" ? "left" : "right");
@@ -263,7 +267,7 @@ function MiniWindow({
if (leavingPip) return null;
return createPortal(
<section
- aria-label="Voice Mode window"
+ aria-label={t(m.window)}
className={
pip
? "flex h-dvh w-full flex-col bg-app-canvas"
@@ -276,6 +280,8 @@ function MiniWindow({
}
data-pip={pip ? true : undefined}
data-size={resized ? "custom" : size}
+ // Voice Mode finds its own window by this, whatever the language.
+ data-voice-window=""
ref={frameRef}
style={
pip
@@ -293,7 +299,7 @@ function MiniWindow({
className="voice-window-title flex h-9 shrink-0 cursor-grab touch-none select-none items-center px-3 active:cursor-grabbing"
{...dragHandlers}
>
- Voice Mode
+ {t(m.title)}
</div>
)}
<header
@@ -318,14 +324,14 @@ function MiniWindow({
if (!consumeDrag())
void navigate(`/t/${tenantId}/rooms/${roomId}/chat`);
}}
- title="Open this conversation"
+ title={t(m.openConversation)}
type="button"
>
<span className="block truncate text-[14px] font-medium leading-5 text-app-ink">
- {roomName || "Voice Mode"}
+ {roomName || t(m.title)}
</span>
<span className="block truncate text-[12px] leading-4 text-app-muted">
- {voiceModeStatusLabel({ ...state, entered: session.entered })}
+ {voiceModeStatusLabel({ ...state, entered: session.entered }, t)}
</span>
</button>
<span
@@ -336,7 +342,7 @@ function MiniWindow({
<Button
// Names differ from the Room composer's controls so both can
// be on screen without two identically named buttons.
- aria-label="Retry voice message from the voice window"
+ aria-label={t(m.retry)}
disabled={state.sending}
onClick={onRetry}
size="compactIcon"
@@ -346,7 +352,7 @@ function MiniWindow({
</Button>
) : null}
<Button
- aria-label={muted ? "Unmute Voice Mode" : "Mute Voice Mode"}
+ aria-label={t(muted ? m.unmute : m.mute)}
aria-pressed={muted}
disabled={!state.microphoneActive}
onClick={() => void onMute(!muted)}
@@ -361,11 +367,7 @@ function MiniWindow({
</Button>
{soundOff === undefined ? null : (
<Button
- aria-label={
- soundOff
- ? "Turn reply sound on from the voice window"
- : "Turn reply sound off from the voice window"
- }
+ aria-label={t(soundOff ? m.replySoundOn : m.replySoundOff)}
aria-pressed={soundOff}
onClick={() => onSoundOff(!soundOff)}
size="compactIcon"
@@ -382,10 +384,10 @@ function MiniWindow({
the desktop app's main window or this browser tab. */}
{pip ? (
<Button
- aria-label="Return Voice Mode to Linger"
+ aria-label={t(m.returnToLinger)}
onClick={() => returnVoicePipToPage("voice-mode")}
size="compactIcon"
- title="Back to Linger; Voice Mode continues"
+ title={t(m.returnHint)}
tone="ghost"
>
<Icon icon={PictureInPictureExitIcon} size={16} />
@@ -395,10 +397,10 @@ function MiniWindow({
opens that window only from a click in the page. */}
{pip || !voicePipSupported() ? null : (
<Button
- aria-label="Float Voice Mode window"
+ aria-label={t(m.float)}
onClick={() => void openVoicePip("voice-mode")}
size="compactIcon"
- title="Float over other tabs and apps"
+ title={t(m.floatHint)}
tone="ghost"
>
<Icon icon={PictureInPictureOnIcon} size={16} />
@@ -406,11 +408,7 @@ function MiniWindow({
)}
{pip ? null : (
<Button
- aria-label={
- large
- ? "Shrink Voice Mode window"
- : "Expand Voice Mode window"
- }
+ aria-label={t(large ? m.shrink : m.expand)}
onClick={() => choosePreset(large ? "compact" : "expanded")}
size="compactIcon"
tone="ghost"
@@ -424,8 +422,10 @@ function MiniWindow({
)}
{/* The floating window's own close button ends Voice Mode there. */}
{pip ? null : (
+ // Not marked risky: ending Voice Mode from its window is never
+ // confirmed, as its English name never was.
<Button
- aria-label="End Voice Mode"
+ aria-label={t(m.end)}
onClick={onExit}
size="compactIcon"
tone="ghost"
@@ -436,7 +436,7 @@ function MiniWindow({
</span>
</header>
<div
- aria-label="Voice Mode conversation"
+ aria-label={t(m.conversation)}
aria-live="polite"
className="workspace-scrollbar min-h-24 flex-1 space-y-2 overflow-y-auto px-3 py-3"
onScroll={(event) => {
@@ -451,7 +451,7 @@ function MiniWindow({
{(transcript ? transcript.length : turns.length || replying.length) ||
live ? null : (
<p className="py-4 text-center text-xs text-app-muted">
- Start speaking. Your words and replies appear here.
+ {t(m.empty)}
</p>
)}
{transcript ? (
@@ -460,8 +460,8 @@ function MiniWindow({
agent={line.speaker !== "you"}
author={
line.speaker === "you"
- ? "You"
- : session.target.recipient?.display_name || "Reply"
+ ? t(commonMessages.you)
+ : session.target.recipient?.display_name || t(m.reply)
}
key={line.id}
own={line.speaker === "you"}
@@ -491,13 +491,22 @@ function MiniWindow({
key={run.id}
own={false}
pending
- text="Working…"
+ text={t(m.working)}
/>
))}
- {heard ? <Bubble author="You" own pending text={heard} /> : null}
+ {heard ? (
+ <Bubble
+ author={t(commonMessages.you)}
+ own
+ pending
+ text={heard}
+ />
+ ) : null}
</>
)}
- {saying ? <Bubble author="You" own pending text={saying} /> : null}
+ {saying ? (
+ <Bubble author={t(commonMessages.you)} own pending text={saying} />
+ ) : null}
</div>
{notice ? (
<p
@@ -509,15 +518,14 @@ function MiniWindow({
) : null}
{pendingMaterials ? (
<p className="shrink-0 truncate border-t border-app-border px-3 py-1.5 text-[12px] text-app-muted">
- Next turn includes {pendingMaterials} selection
- {pendingMaterials === 1 ? "" : "s"}
+ {t(m.pendingSelections, { count: pendingMaterials })}
</p>
) : null}
</div>
{pip ? null : (
<VoiceWindowResizeHandles
bounds={viewportBounds}
- label="Resize Voice Mode window"
+ label={t(m.resize)}
min={minWindowSize}
onResize={({ left, top, ...next }) => {
setResized(next);
diff --git a/apps/web/src/features/rooms/chat/voice-mode/voice-mode-session-engine.ts b/apps/web/src/features/rooms/chat/voice-mode/voice-mode-session-engine.ts
index f8e52f87..10859fbb 100644
--- a/apps/web/src/features/rooms/chat/voice-mode/voice-mode-session-engine.ts
+++ b/apps/web/src/features/rooms/chat/voice-mode/voice-mode-session-engine.ts
@@ -35,6 +35,8 @@ import {
} from "./live/voice-live-transport";
import { closeVoicePip } from "./voice-pip";
import { roomMessageSender } from "../room-message-sender";
+import { translate } from "@/i18n/language";
+import { voiceSessionMessages as m } from "./voice-session.messages";
interface LiveView {
connection?: VoiceLiveConnection;
@@ -138,7 +140,7 @@ export function runVoiceModeSession({
resumeListening: false,
});
const release = await tryAcquireVoicePublisherLease(tenantId);
- if (!release) throw new Error("The microphone is active in another tab.");
+ if (!release) throw new Error(translate(m.microphoneOtherTab));
return async () => release();
};
const openLive = (
@@ -174,7 +176,11 @@ export function runVoiceModeSession({
fallBack();
fail(
new VoiceModeReopen(
- `Live voice stopped; continuing as dictation. ${error instanceof Error ? error.message : ""}`.trim(),
+ error instanceof Error && error.message.trim()
+ ? translate(m.continuingAsDictationWithReason, {
+ reason: error.message.trim(),
+ })
+ : translate(m.continuingAsDictation),
),
);
},
diff --git a/apps/web/src/features/rooms/chat/voice-mode/voice-mode-transport.ts b/apps/web/src/features/rooms/chat/voice-mode/voice-mode-transport.ts
index 3a6ee2bd..8231a220 100644
--- a/apps/web/src/features/rooms/chat/voice-mode/voice-mode-transport.ts
+++ b/apps/web/src/features/rooms/chat/voice-mode/voice-mode-transport.ts
@@ -32,6 +32,8 @@ import {
} from "./voice-media-room";
import { asError } from "@linger/service-kit";
import { VoiceModeDisconnectedError } from "./voice-mode-errors";
+import { translate } from "@/i18n/language";
+import { voiceSessionMessages as m } from "./voice-session.messages";
export async function openVoiceMode(input: {
client: TeamHubClient;
@@ -90,7 +92,7 @@ export async function openVoiceMode(input: {
try {
signal.throwIfAborted();
const events = input.events;
- if (!events) throw new Error("Voice transcription is unavailable.");
+ if (!events) throw new Error(translate(m.transcriptionUnavailable));
const creating = teamHubData(
client.api.POST("/v0/rooms/{roomId}/voice-sessions", {
params: { path: { roomId: input.roomId } },
@@ -117,7 +119,7 @@ export async function openVoiceMode(input: {
session = await bounded(creating, 5_000, signal);
signal.throwIfAborted();
if (session.purpose !== "chat_dictation")
- throw new Error("The server did not confirm a chat-only voice session.");
+ throw new Error(translate(m.dictationNotConfirmed));
const sessionId = session.id;
const media = await publishVoiceMicrophone({
livekit,
@@ -130,9 +132,7 @@ export async function openVoiceMode(input: {
created.on(RoomEvent.Disconnected, () => {
if (!closed && !stopping)
input.fail(
- new VoiceModeDisconnectedError(
- "Voice connection was lost. Your unsent text is kept.",
- ),
+ new VoiceModeDisconnectedError(translate(m.connectionLost)),
);
});
created.on(RoomEvent.MediaDevicesError, (error) => {
@@ -164,9 +164,7 @@ export async function openVoiceMode(input: {
runtimeIdentity = participant.identity;
if (participant.identity !== runtimeIdentity) return;
if (!closed && !stopping && failureForCurrentGeneration) {
- readinessFailure = new Error(
- "Voice Runtime stopped before readiness. Check the configured ASR provider and try again.",
- );
+ readinessFailure = new Error(translate(m.runtimeStopped));
input.fail(readinessFailure);
}
},
@@ -175,7 +173,7 @@ export async function openVoiceMode(input: {
if (!closed && !stopping && runtimeIdentity === participant.identity)
input.fail(
new VoiceModeDisconnectedError(
- "Voice recognition disconnected. Your unsent text is kept.",
+ translate(m.recognitionDisconnected),
),
);
});
@@ -184,7 +182,7 @@ export async function openVoiceMode(input: {
if (!closed && !stopping)
input.fail(
new VoiceModeDisconnectedError(
- "Microphone disconnected. Your unsent text is kept.",
+ translate(m.microphoneDisconnectedKept),
),
);
},
@@ -258,9 +256,7 @@ export async function openVoiceMode(input: {
onMode() {},
onAccessLost() {
if (!closed && !stopping)
- input.fail(
- new Error("Voice access was lost. Your unsent text is kept."),
- );
+ input.fail(new Error(translate(m.accessLost)));
},
});
const readyDeadline = Date.now() + 15_000;
@@ -277,11 +273,11 @@ export async function openVoiceMode(input: {
signal,
);
if (current.purpose !== "chat_dictation")
- throw new Error("Voice Mode authorization changed.");
+ throw new Error(translate(m.authorizationChanged));
inputStartedOffsetMs = current.input_started_offset_ms;
if (current.last_failure_code)
throw new Error(
- `Voice Runtime is unavailable (${current.last_failure_code}). Check the ASR provider and try again.`,
+ translate(m.runtimeUnavailable, { code: current.last_failure_code }),
);
if (current.input_ready_generation === credential.generation) {
for (const participant of media.room.remoteParticipants.values())
@@ -300,9 +296,7 @@ export async function openVoiceMode(input: {
}
if (feedActivity) break;
if (Date.now() >= readyDeadline)
- throw new Error(
- "Voice Runtime did not become ready within 15 seconds. Check that the Voice Runtime and ASR provider are running, then try again.",
- );
+ throw new Error(translate(m.runtimeNotReady, { seconds: 15 }));
await waitForVoiceDelay(200, signal);
signal.throwIfAborted();
}
@@ -312,7 +306,7 @@ export async function openVoiceMode(input: {
`voice-commit-${Date.now()}-${Math.random().toString(16).slice(2)}`;
const accepted = acknowledgement(
15_000,
- "Final voice text did not arrive. Your draft is kept; try again.",
+ translate(m.finalTextMissing),
feedAbort.signal,
);
// Register before POST: a fast Runtime may publish its final before the
@@ -351,11 +345,7 @@ export async function openVoiceMode(input: {
let failure: unknown;
const drain = new AbortController();
const drainTimer = setTimeout(() => {
- drain.abort(
- new Error(
- "Voice shutdown could not confirm the last words. Your draft is kept.",
- ),
- );
+ drain.abort(new Error(translate(m.shutdownUnconfirmed)));
}, 15_000);
const drainSignal = AbortSignal.any([feedAbort.signal, drain.signal]);
try {
@@ -376,9 +366,7 @@ export async function openVoiceMode(input: {
current.purpose !== "chat_dictation" ||
current.credential_generation !== credential.generation
)
- throw new Error(
- "Voice input identity changed during shutdown. Your draft is kept.",
- );
+ throw new Error(translate(m.identityChanged));
const started = current.input_started_offset_ms;
const ended = current.input_ended_offset_ms;
if (
@@ -389,9 +377,7 @@ export async function openVoiceMode(input: {
)
break;
if (current.last_failure_code || current.status === "closed")
- throw new Error(
- "Voice shutdown could not confirm the last words. Your draft is kept.",
- );
+ throw new Error(translate(m.shutdownUnconfirmed));
await waitForVoiceDelay(200, drainSignal);
drainSignal.throwIfAborted();
}
diff --git a/apps/web/src/features/rooms/chat/voice-mode/voice-pip.ts b/apps/web/src/features/rooms/chat/voice-mode/voice-pip.ts
index 2fb1fa42..f692623c 100644
--- a/apps/web/src/features/rooms/chat/voice-mode/voice-pip.ts
+++ b/apps/web/src/features/rooms/chat/voice-mode/voice-pip.ts
@@ -1,6 +1,9 @@
import { useSyncExternalStore } from "react";
import { isDesktopShell } from "@/app/desktop-shell";
+import { translate } from "@/i18n/language";
+import type { Message } from "@/i18n/messages";
+import { voiceWindowMessages } from "./voice-window.messages";
/** Chrome and Edge 116+ only; TypeScript's DOM library does not declare it yet. */
interface DocumentPictureInPicture {
@@ -44,9 +47,9 @@ const pipSizes = {
// What the desktop shows as the window's name; browsers show the site instead.
const pipTitles = {
- "voice-mode": "Voice Mode",
- recording: "Meeting",
-} satisfies Record<VoicePipOwner, string>;
+ "voice-mode": voiceWindowMessages.title,
+ recording: voiceWindowMessages.meetingTitle,
+} satisfies Record<VoicePipOwner, Message<string>>;
let pip: { owner: VoicePipOwner; window: Window } | undefined;
const listeners = new Set<() => void>();
@@ -143,7 +146,7 @@ export async function openVoicePip(
if (!opened) return undefined;
returning = false;
returnedByButton = undefined;
- opened.document.title = pipTitles[owner];
+ opened.document.title = translate(pipTitles[owner]);
const stopMirroring = mirrorStyles(opened.document);
opened.addEventListener("pagehide", () => {
stopMirroring();
diff --git a/apps/web/src/features/rooms/chat/voice-mode/voice-session.messages.ts b/apps/web/src/features/rooms/chat/voice-mode/voice-session.messages.ts
new file mode 100644
index 00000000..e1b7a2fd
--- /dev/null
+++ b/apps/web/src/features/rooms/chat/voice-mode/voice-session.messages.ts
@@ -0,0 +1,47 @@
+import { defineMessages } from "@/i18n/messages";
+
+/** Why a Voice Mode session stopped or could not start, as shown to the person. */
+export const voiceSessionMessages = defineMessages("voiceSession", {
+ // The session as a whole.
+ sessionLimit: "Voice Mode reached its session limit. Exit and start again.",
+ inputAhead:
+ "Voice input is ahead of message delivery. Your draft is kept; retry or exit to review it.",
+ couldNotContinue: "Voice Mode could not continue. Your text has been kept.",
+ microphoneOtherTab: "The microphone is active in another tab.",
+ authorizationChanged: "Voice Mode authorization changed.",
+
+ // Dictation.
+ transcriptionUnavailable: "Voice transcription is unavailable.",
+ dictationNotConfirmed:
+ "The server did not confirm a chat-only voice session.",
+ connectionLost: "Voice connection was lost. Your unsent text is kept.",
+ runtimeStopped:
+ "Voice Runtime stopped before readiness. Check the configured ASR provider and try again.",
+ recognitionDisconnected:
+ "Voice recognition disconnected. Your unsent text is kept.",
+ microphoneDisconnectedKept:
+ "Microphone disconnected. Your unsent text is kept.",
+ accessLost: "Voice access was lost. Your unsent text is kept.",
+ runtimeUnavailable:
+ "Voice Runtime is unavailable ({code}). Check the ASR provider and try again.",
+ runtimeNotReady:
+ "Voice Runtime did not become ready within {seconds} seconds. Check that the Voice Runtime and ASR provider are running, then try again.",
+ finalTextMissing:
+ "Final voice text did not arrive. Your draft is kept; try again.",
+ shutdownUnconfirmed:
+ "Voice shutdown could not confirm the last words. Your draft is kept.",
+ identityChanged:
+ "Voice input identity changed during shutdown. Your draft is kept.",
+
+ // Live voice.
+ liveStopped: "Live voice stopped ({code}).",
+ liveNotConfirmed: "The server did not confirm a live voice session.",
+ liveConnectionLost: "Live voice connection was lost.",
+ liveRuntimeDisconnected: "Live voice runtime disconnected.",
+ microphoneDisconnected: "Microphone disconnected.",
+ liveUnavailable: "Live voice is unavailable ({code}).",
+ liveNotReady: "Live voice did not become ready within {seconds} seconds.",
+ continuingAsDictation: "Live voice stopped; continuing as dictation.",
+ continuingAsDictationWithReason:
+ "Live voice stopped; continuing as dictation. {reason}",
+});
diff --git a/apps/web/src/features/rooms/chat/voice-mode/voice-ui-bridge.test.ts b/apps/web/src/features/rooms/chat/voice-mode/voice-ui-bridge.test.ts
index 2948e6df..66630543 100644
--- a/apps/web/src/features/rooms/chat/voice-mode/voice-ui-bridge.test.ts
+++ b/apps/web/src/features/rooms/chat/voice-mode/voice-ui-bridge.test.ts
@@ -350,7 +350,7 @@ describe("Voice Mode screen actions", () => {
<button disabled>Share</button>
<button style="display:none">Hidden</button>
</main>
- <section aria-label="Voice Mode window"><button>End Voice Mode</button></section>
+ <section aria-label="Voice Mode window" data-voice-window><button>End Voice Mode</button></section>
<div role="dialog"><div role="option">Launch plan</div></div>`;
const place: Record<string, [number, number]> = {
Workspace: [10, 100],
@@ -445,7 +445,7 @@ describe("Voice Mode screen actions", () => {
<input type="password" aria-label="Password" />
<input aria-label="Read only" readonly />
</main>
- <section aria-label="Voice Mode window"><input aria-label="Box in the voice window" /></section>`;
+ <section aria-label="Voice Mode window" data-voice-window><input aria-label="Box in the voice window" /></section>`;
for (const element of document.querySelectorAll<HTMLElement>(
"input, textarea",
))
diff --git a/apps/web/src/features/rooms/chat/voice-mode/voice-ui-bridge.ts b/apps/web/src/features/rooms/chat/voice-mode/voice-ui-bridge.ts
index b023db92..f6bae06f 100644
--- a/apps/web/src/features/rooms/chat/voice-mode/voice-ui-bridge.ts
+++ b/apps/web/src/features/rooms/chat/voice-mode/voice-ui-bridge.ts
@@ -4,6 +4,8 @@
* register what they offer while they are mounted; nothing else is reachable.
*/
+import { voiceWindowSelector } from "./voice-window-selector";
+
export interface VoiceSearchResult {
id: string;
name: string;
@@ -358,7 +360,7 @@ export function collectVoiceElements(
.filter(
(element) =>
element.getClientRects().length > 0 &&
- !element.closest('[aria-label="Voice Mode window"]'),
+ !element.closest(voiceWindowSelector),
)
.at(-1);
for (const element of (dialog ?? document).querySelectorAll<HTMLElement>(
@@ -366,7 +368,7 @@ export function collectVoiceElements(
)) {
if (
element.closest(
- '[aria-label="Voice Mode window"], [aria-hidden="true"], [inert]',
+ `${voiceWindowSelector}, [aria-hidden="true"], [inert]`,
) ||
element.matches(":disabled, [aria-disabled='true']")
)
@@ -514,7 +516,7 @@ export function voiceTextFields(): VoiceTextField[] {
.filter(
(element) =>
element.getClientRects().length > 0 &&
- !element.closest('[aria-label="Voice Mode window"]'),
+ !element.closest(voiceWindowSelector),
)
.at(-1);
const fields: VoiceTextField[] = [];
@@ -523,7 +525,7 @@ export function voiceTextFields(): VoiceTextField[] {
>(textField)) {
if (
element.closest(
- '[aria-label="Voice Mode window"], [aria-hidden="true"], [inert]',
+ `${voiceWindowSelector}, [aria-hidden="true"], [inert]`,
) ||
element.disabled ||
element.readOnly ||
@@ -647,7 +649,7 @@ function scroller(
element: HTMLElement,
horizontal: boolean,
): Scroller | undefined {
- if (element.closest('[aria-label="Voice Mode window"]')) return undefined;
+ if (element.closest(voiceWindowSelector)) return undefined;
const rect = element.getBoundingClientRect();
if (!onScreen(rect)) return undefined;
const area = rect.width * rect.height;
@@ -771,7 +773,7 @@ function findScroller(horizontal: boolean, regionId?: string) {
window.innerWidth * 0.6,
window.innerHeight * 0.5,
) ?? []
- ).filter((element) => !element.closest('[aria-label="Voice Mode window"]'));
+ ).filter((element) => !element.closest(voiceWindowSelector));
for (const point of points) {
const inner = candidates
.filter((item) => item.element !== page && item.element.contains(point))
@@ -843,7 +845,7 @@ function openOverlays() {
document.querySelectorAll<HTMLElement>(regionSelector),
).filter(
(overlay) =>
- !overlay.closest('[aria-label="Voice Mode window"]') &&
+ !overlay.closest(voiceWindowSelector) &&
onScreen(overlay.getBoundingClientRect()) &&
// A docked side panel marks itself closable; it neither floats nor is a dialog.
(isInDialog(overlay) ||
diff --git a/apps/web/src/features/rooms/chat/voice-mode/voice-window-language.test.tsx b/apps/web/src/features/rooms/chat/voice-mode/voice-window-language.test.tsx
new file mode 100644
index 00000000..fffc55fc
--- /dev/null
+++ b/apps/web/src/features/rooms/chat/voice-mode/voice-window-language.test.tsx
@@ -0,0 +1,226 @@
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { act, cleanup, render, screen, within } from "@testing-library/react";
+import { MemoryRouter } from "react-router";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+
+import { TeamHubRuntimeProvider } from "@/features/teamhub/teamhub-runtime";
+import { resetLanguageForTest, setLanguage } from "@/i18n/language";
+import zhCN from "@/i18n/locales/zh-CN.json";
+import { createTestTeamHubRuntime } from "@/test/teamhub-test-runtime";
+import { writeRoomComposerDraft } from "../../room-drafts";
+import { FileVoiceMaterialButton } from "./file-voice-material-button";
+import {
+ VoiceMaterialsContext,
+ type VoiceMaterials,
+} from "./voice-materials-context";
+import { VoiceMaterialsPreview } from "./voice-materials-preview";
+import VoiceModeMiniWindow from "./voice-mode-mini-window";
+import type { VoiceModeSession } from "./voice-mode-session";
+import { openVoicePip, resetVoicePipForTest } from "./voice-pip";
+import { voiceWindowSelector } from "./voice-window-selector";
+
+const zh = zhCN.voiceWindow;
+const chat = zhCN.voiceChat;
+
+vi.mock("../../room-queries", async (importOriginal) => ({
+ ...(await importOriginal<object>()),
+ roomMessagesInfiniteQueryOptions: () => ({
+ getNextPageParam: () => undefined,
+ initialPageParam: undefined,
+ queryFn: async () => ({ items: [] }),
+ queryKey: ["voice-window-language-test", "messages"],
+ }),
+}));
+vi.mock("../../runtime-status/use-room-run-statuses", () => ({
+ useRoomRunStatusCollection: () => ({
+ items: [
+ {
+ agent: { display_name: "Codex", id: "agent-codex", kind: "agent" },
+ id: "run-1",
+ run_id: "run-1",
+ status: "active",
+ },
+ ],
+ }),
+}));
+const voice = vi.hoisted(() => ({
+ exit: vi.fn(),
+ retry: vi.fn(),
+ session: undefined as VoiceModeSession | undefined,
+ setMuted: vi.fn(async () => undefined),
+ setSoundOff: vi.fn(),
+}));
+vi.mock("./voice-mode-session", () => ({
+ useOptionalVoiceModeSession: () => voice,
+ useVoiceModeLevel: () => 0,
+}));
+
+const target = {
+ accountId: "account-1",
+ roomId: "room-voice",
+ roomName: "",
+ tenantId: "tenant-northstar",
+};
+
+beforeEach(() => {
+ voice.session = {
+ closing: false,
+ entered: true,
+ muted: false,
+ prefix: { body: "", documentReferences: [], mentions: [] },
+ sourceId: "source-1",
+ startedAt: "2026-10-02T03:00:00.000Z",
+ state: {
+ flushing: false,
+ microphoneActive: true,
+ sending: false,
+ status: "listening",
+ text: "",
+ },
+ target,
+ };
+});
+
+afterEach(() => {
+ cleanup();
+ Reflect.deleteProperty(window, "documentPictureInPicture");
+ resetVoicePipForTest();
+ document.querySelectorAll("iframe").forEach((frame) => frame.remove());
+ localStorage.clear();
+ resetLanguageForTest();
+});
+
+function renderWindow() {
+ return render(
+ <QueryClientProvider client={new QueryClient()}>
+ <TeamHubRuntimeProvider runtime={createTestTeamHubRuntime()}>
+ <MemoryRouter
+ initialEntries={["/t/tenant-northstar/rooms/room-other/chat"]}
+ >
+ <VoiceModeMiniWindow currentActorId="actor-me" />
+ </MemoryRouter>
+ </TeamHubRuntimeProvider>
+ </QueryClientProvider>,
+ );
+}
+
+/** A stand-in for the browser's picture-in-picture window. */
+function installFakeVoicePip() {
+ const frame = window.document.createElement("iframe");
+ window.document.body.append(frame);
+ const document = frame.contentDocument!;
+ const pipWindow = {
+ addEventListener: () => undefined,
+ close: vi.fn(),
+ document,
+ };
+ Object.defineProperty(window, "documentPictureInPicture", {
+ configurable: true,
+ value: { requestWindow: vi.fn(async () => pipWindow as unknown as Window) },
+ });
+ return { document };
+}
+
+describe("Voice Mode window in the language on screen", () => {
+ it("words the window in Chinese and stays Voice Mode's own window", async () => {
+ await setLanguage("zh-CN");
+ writeRoomComposerDraft(target, {
+ body: "",
+ documentContexts: [],
+ documentReferences: [],
+ mentions: [],
+ skillReferences: [],
+ voiceMaterials: [
+ { id: "m1", messageId: "message-1", quote: "One", title: "Jenny" },
+ { id: "m2", messageId: "message-2", quote: "Two", title: "Jenny" },
+ ],
+ });
+ renderWindow();
+
+ const frame = screen.getByRole("region", { name: zh.window });
+ // Voice Mode keeps away from its own controls by this marker.
+ expect(frame).toHaveAttribute("data-voice-window");
+ expect(frame.matches(voiceWindowSelector)).toBe(true);
+ expect(within(frame).getAllByText(zh.title).length).toBeGreaterThan(0);
+ expect(within(frame).getByTitle(zh.openConversation)).toHaveTextContent(
+ zh.title,
+ );
+ expect(
+ within(frame).getByText(zhCN.voiceMode.statusListening),
+ ).toBeInTheDocument();
+
+ expect(screen.getByRole("button", { name: zh.mute })).toBeInTheDocument();
+ expect(screen.getByRole("button", { name: zh.expand })).toBeInTheDocument();
+ // Ending Voice Mode from its window is never confirmed, as in English.
+ const end = screen.getByRole("button", { name: zh.end });
+ expect(end).not.toHaveAttribute("data-voice-risk");
+ expect(screen.getByRole("button", { name: zh.resize })).toHaveAttribute(
+ "title",
+ zh.resizeHint,
+ );
+
+ const log = screen.getByRole("log", { name: zh.conversation });
+ expect(await within(log).findByText(zh.working)).toBeInTheDocument();
+ expect(
+ screen.getByText(zh.pendingSelections.other.replace("{count}", "2")),
+ ).toBeInTheDocument();
+ });
+
+ it("names the floating window and its way back in Chinese", async () => {
+ await setLanguage("zh-CN");
+ const fake = installFakeVoicePip();
+ renderWindow();
+ await act(() => openVoicePip("voice-mode"));
+ expect(fake.document.title).toBe(zh.title);
+ const floating = within(fake.document.body);
+ await floating.findByRole("region", { name: zh.window });
+ expect(
+ floating.getByRole("button", { name: zh.returnToLinger }),
+ ).toHaveAttribute("title", zh.returnHint);
+ });
+
+ it("words voice selections in Chinese and marks removing one", async () => {
+ await setLanguage("zh-CN");
+ const materials: VoiceMaterials = {
+ acceptsDocuments: true,
+ addSelection: () => true,
+ error: undefined,
+ materials: [
+ {
+ documentId: "document-1",
+ id: "material-1",
+ quote: "",
+ title: "Plan.md",
+ },
+ ],
+ remove: () => undefined,
+ roomId: "room-voice",
+ setVoiceModeEntered: () => undefined,
+ voiceModeEntered: true,
+ };
+ render(
+ <VoiceMaterialsContext value={materials}>
+ <VoiceMaterialsPreview />
+ <FileVoiceMaterialButton documentId="document-1" filename="Plan.md" />
+ <FileVoiceMaterialButton documentId="document-2" filename="Notes.md" />
+ </VoiceMaterialsContext>,
+ );
+
+ expect(screen.getByLabelText(chat.selections)).toBeInTheDocument();
+ expect(
+ screen.getByRole("button", {
+ name: chat.removeSelection.replace("{title}", "Plan.md"),
+ }),
+ ).toHaveAttribute("data-voice-risk", "never");
+ expect(
+ screen.getByRole("button", {
+ name: chat.fileAdded.replace("{filename}", "Plan.md"),
+ }),
+ ).toHaveTextContent(chat.addedToVoice);
+ expect(
+ screen.getByRole("button", {
+ name: chat.addFile.replace("{filename}", "Notes.md"),
+ }),
+ ).toHaveTextContent(chat.addToVoice);
+ });
+});
diff --git a/apps/web/src/features/rooms/chat/voice-mode/voice-window-resize.tsx b/apps/web/src/features/rooms/chat/voice-mode/voice-window-resize.tsx
index 12c065b6..0bf41e0f 100644
--- a/apps/web/src/features/rooms/chat/voice-mode/voice-window-resize.tsx
+++ b/apps/web/src/features/rooms/chat/voice-mode/voice-window-resize.tsx
@@ -5,6 +5,9 @@ import {
type RefObject,
} from "react";
+import { useT } from "@/i18n/use-translation";
+import { voiceWindowMessages as m } from "./voice-window.messages";
+
/** A voice window inside the page, in viewport pixels. */
export interface VoiceWindowRect {
height: number;
@@ -185,6 +188,7 @@ export function VoiceWindowResizeHandles({
/** The window as it is on screen now. */
rect: () => VoiceWindowRect | undefined;
}) {
+ const t = useT();
const drag = useRef<{
bounds: VoiceWindowBounds;
edge: VoiceWindowEdge;
@@ -257,7 +261,7 @@ export function VoiceWindowResizeHandles({
);
onResizeEnd?.();
}}
- title="Drag to resize, or use the arrow keys"
+ title={t(m.resizeHint)}
type="button"
{...handlers(edge)}
>
diff --git a/apps/web/src/features/rooms/chat/voice-mode/voice-window-selector.ts b/apps/web/src/features/rooms/chat/voice-mode/voice-window-selector.ts
new file mode 100644
index 00000000..3feb16f7
--- /dev/null
+++ b/apps/web/src/features/rooms/chat/voice-mode/voice-window-selector.ts
@@ -0,0 +1,5 @@
+/**
+ * The Voice Mode window, whose own controls are never acted on from the page.
+ * It is found by its marker, as its name follows the language.
+ */
+export const voiceWindowSelector = "[data-voice-window]";
diff --git a/apps/web/src/features/rooms/chat/voice-mode/voice-window.messages.ts b/apps/web/src/features/rooms/chat/voice-mode/voice-window.messages.ts
new file mode 100644
index 00000000..09c02b0c
--- /dev/null
+++ b/apps/web/src/features/rooms/chat/voice-mode/voice-window.messages.ts
@@ -0,0 +1,39 @@
+import { defineMessages } from "@/i18n/messages";
+
+/** The floating Voice Mode window, and what the floating windows share. */
+export const voiceWindowMessages = defineMessages("voiceWindow", {
+ window: "Voice Mode window",
+ title: "Voice Mode",
+ openConversation: "Open this conversation",
+
+ // The window's controls; named apart from the composer's own.
+ retry: "Retry voice message from the voice window",
+ mute: "Mute Voice Mode",
+ unmute: "Unmute Voice Mode",
+ replySoundOn: "Turn reply sound on from the voice window",
+ replySoundOff: "Turn reply sound off from the voice window",
+ returnToLinger: "Return Voice Mode to Linger",
+ returnHint: "Back to Linger; Voice Mode continues",
+ float: "Float Voice Mode window",
+ floatHint: "Float over other tabs and apps",
+ shrink: "Shrink Voice Mode window",
+ expand: "Expand Voice Mode window",
+ end: "End Voice Mode",
+ resize: "Resize Voice Mode window",
+ dragHint: "Drag the floating window to move or resize it.",
+
+ // The conversation in the window.
+ conversation: "Voice Mode conversation",
+ empty: "Start speaking. Your words and replies appear here.",
+ reply: "Reply",
+ working: "Working…",
+ pendingSelections: {
+ one: "Next turn includes {count} selection",
+ other: "Next turn includes {count} selections",
+ },
+
+ // Shared by the Voice Mode and recording windows.
+ resizeHint: "Drag to resize, or use the arrow keys",
+ /** The floating recording window's name on the desktop. */
+ meetingTitle: "Meeting",
+});
diff --git a/apps/web/src/features/rooms/documents/document-voice-selection-control.test.tsx b/apps/web/src/features/rooms/documents/document-voice-selection-control.test.tsx
index a3e708e4..958c5055 100644
--- a/apps/web/src/features/rooms/documents/document-voice-selection-control.test.tsx
+++ b/apps/web/src/features/rooms/documents/document-voice-selection-control.test.tsx
@@ -82,7 +82,10 @@ function createSurface({
const content = children ?? (
<>
<h1>Document title</h1>
- <section aria-label="Room Document editor">
+ <section
+ aria-label="Room Document editor"
+ className="room-document-blocknote"
+ >
<div className="bn-editor">
<p>Review this sentence</p>
<p>And the next paragraph</p>
@@ -213,7 +216,10 @@ describe("Document voice material selection", () => {
it("rejects a range with either endpoint outside its panel or in another document", () => {
const first = createSurface();
render(
- <section aria-label="Room Document editor">
+ <section
+ aria-label="Room Document editor"
+ className="room-document-blocknote"
+ >
<div className="bn-editor">
<p>Other document</p>
</div>
@@ -226,6 +232,7 @@ describe("Document voice material selection", () => {
expect(screen.queryByRole("button", { name: actionName })).toBeNull();
const secondBody = document.createElement("section");
secondBody.setAttribute("aria-label", "Room Document editor");
+ secondBody.className = "room-document-blocknote";
const editor = document.createElement("div");
editor.className = "bn-editor";
editor.textContent = "Nested other document";
@@ -252,7 +259,10 @@ describe("Document voice material selection", () => {
it("rejects selections crossing hidden content or a control inside the body", () => {
createSurface({
children: (
- <section aria-label="Room Document editor">
+ <section
+ aria-label="Room Document editor"
+ className="room-document-blocknote"
+ >
<div className="bn-editor">
<p>Start here</p>
<span hidden>Hidden data</span>
@@ -272,7 +282,10 @@ describe("Document voice material selection", () => {
const text = "a".repeat(length);
createSurface({
children: (
- <section aria-label="Room Document editor">
+ <section
+ aria-label="Room Document editor"
+ className="room-document-blocknote"
+ >
<div className="bn-editor">
<p>{text}</p>
</div>
diff --git a/apps/web/src/features/rooms/documents/document-voice-selection-control.tsx b/apps/web/src/features/rooms/documents/document-voice-selection-control.tsx
index d2f137a5..952a9ef4 100644
--- a/apps/web/src/features/rooms/documents/document-voice-selection-control.tsx
+++ b/apps/web/src/features/rooms/documents/document-voice-selection-control.tsx
@@ -4,6 +4,8 @@ import { useEffect, useState, type RefObject } from "react";
import { Button } from "@/components/ui/button";
import { useOptionalVoiceMaterials } from "../chat/voice-mode/voice-materials-context";
+import { useT } from "@/i18n/use-translation";
+import { voiceChatMessages as m } from "../chat/voice-mode/voice-chat.messages";
const maximumQuoteLength = 10_000;
const controlSelector = "[data-document-voice-selection-control]";
@@ -39,6 +41,7 @@ export function DocumentVoiceSelectionControl({
versionId?: string;
rootRef: RefObject<HTMLElement | null>;
}) {
+ const t = useT();
const materials = useOptionalVoiceMaterials();
// Document excerpts need a grant only their own Room's composer can give.
const enabled =
@@ -118,7 +121,7 @@ export function DocumentVoiceSelectionControl({
className="shrink-0 border-t border-app-border bg-app-surface px-3 py-2"
data-document-voice-selection-control
role="group"
- aria-label="Selected document voice context"
+ aria-label={t(m.documentSelection)}
>
<blockquote className="mb-2 line-clamp-2 break-words text-xs text-app-muted">
{selection.quote}
@@ -132,12 +135,11 @@ export function DocumentVoiceSelectionControl({
type="button"
>
<Icon icon={QuoteDownIcon} size={14} />
- Add to voice
+ {t(m.addToVoice)}
</Button>
{failed ? (
<p className="mt-2 text-xs text-app-danger" role="alert">
- {materials.error ||
- "This selection could not be added. Please try again."}
+ {materials.error || t(m.addFailed)}
</p>
) : null}
</div>
@@ -185,9 +187,8 @@ function documentBody(
element: Element,
root: HTMLElement,
): Element | undefined {
- const nativeBody = element.closest(
- '[aria-label="Room Document editor"] .bn-editor',
- );
+ // The editor's name follows the language, so its class finds it.
+ const nativeBody = element.closest(".room-document-blocknote .bn-editor");
if (nativeBody && root.contains(nativeBody)) return nativeBody;
const previewBody = element.closest(
'[data-content-renderer="blocknote"] .bn-editor, [data-content-renderer="text"], .textLayer',
diff --git a/apps/web/src/features/rooms/task-sidebar/adapters/file-panel-tab.test.tsx b/apps/web/src/features/rooms/task-sidebar/adapters/file-panel-tab.test.tsx
index 46f733b9..f3b6042f 100644
--- a/apps/web/src/features/rooms/task-sidebar/adapters/file-panel-tab.test.tsx
+++ b/apps/web/src/features/rooms/task-sidebar/adapters/file-panel-tab.test.tsx
@@ -56,7 +56,10 @@ vi.mock(
"@/features/rooms/documents/room-document-blocknote-editor-loader",
() => ({
RoomDocumentBlockNoteEditor: ({ editable }: { editable: boolean }) => (
- <section aria-label="Room Document editor">
+ <section
+ aria-label="Room Document editor"
+ className="room-document-blocknote"
+ >
<div className="bn-editor" data-editable={String(editable)}>
Room BlockNote editor
</div>
diff --git a/apps/web/src/features/rooms/voice-control/microphone-devices.test.ts b/apps/web/src/features/rooms/voice-control/microphone-devices.test.ts
index 25d9bc99..c576bb44 100644
--- a/apps/web/src/features/rooms/voice-control/microphone-devices.test.ts
+++ b/apps/web/src/features/rooms/voice-control/microphone-devices.test.ts
@@ -1,4 +1,7 @@
-import { describe, expect, it, vi } from "vitest";
+import { afterEach, describe, expect, it, vi } from "vitest";
+
+import { resetLanguageForTest, setLanguage } from "@/i18n/language";
+import zhCN from "@/i18n/locales/zh-CN.json";
import {
describeVoiceMediaError,
@@ -7,6 +10,7 @@ import {
matchBoundVoiceMicrophone,
requestVoiceMicrophones,
retryOnVoiceMediaAbort,
+ VoiceMicrophoneError,
} from "./microphone-devices";
describe("requestVoiceMicrophones", () => {
@@ -296,3 +300,25 @@ function device(
label,
} as MediaDeviceInfo;
}
+
+describe("VoiceMicrophoneError", () => {
+ afterEach(() => resetLanguageForTest());
+
+ it("is told apart by its code and worded in the language on screen", async () => {
+ const unbound = new VoiceMicrophoneError("no-binding");
+ const timedOut = new VoiceMicrophoneError("timeout");
+ expect(unbound.code).toBe("no-binding");
+ expect(describeVoiceMediaError(unbound)).toBe(
+ "Connect a microphone before enabling voice",
+ );
+
+ await setLanguage("zh-CN");
+
+ expect(describeVoiceMediaError(unbound)).toBe(
+ zhCN.recording.connectMicrophone,
+ );
+ expect(describeVoiceMediaError(timedOut)).toBe(
+ zhCN.recording.microphoneTimedOut,
+ );
+ });
+});
diff --git a/apps/web/src/features/rooms/voice-control/microphone-devices.ts b/apps/web/src/features/rooms/voice-control/microphone-devices.ts
index 5f8aee8b..73ce2310 100644
--- a/apps/web/src/features/rooms/voice-control/microphone-devices.ts
+++ b/apps/web/src/features/rooms/voice-control/microphone-devices.ts
@@ -1,4 +1,8 @@
import { displayText } from "@linger/service-kit";
+
+import { translate } from "@/i18n/language";
+import { recordingMessages as m } from "./recording.messages";
+
export interface VoiceMicrophoneDevice {
deviceId: string;
groupId: string;
@@ -7,6 +11,27 @@ export interface VoiceMicrophoneDevice {
export type VoiceMicrophoneBinding = VoiceMicrophoneDevice;
+export type VoiceMicrophoneErrorCode = "no-binding" | "timeout";
+
+const microphoneErrorText = {
+ "no-binding": m.connectMicrophone,
+ timeout: m.microphoneTimedOut,
+} as const;
+
+/**
+ * A microphone that is not bound or did not connect in time. Code tells it
+ * apart by its code; people see it worded from the code.
+ */
+export class VoiceMicrophoneError extends Error {
+ readonly code: VoiceMicrophoneErrorCode;
+
+ constructor(code: VoiceMicrophoneErrorCode) {
+ super(microphoneErrorText[code].source);
+ this.name = "VoiceMicrophoneError";
+ this.code = code;
+ }
+}
+
const voiceMediaAbortRetryDelaysMs = [0, 120, 240] as const;
/** The one set of audio constraints every voice input opens with. */
@@ -41,11 +66,14 @@ export function isVoiceAbortError(error: unknown) {
}
export function describeVoiceMediaError(error: unknown) {
+ if (error instanceof VoiceMicrophoneError) {
+ return translate(microphoneErrorText[error.code]);
+ }
if (errorName(error) === "NotAllowedError") {
- return "Microphone permission was denied";
+ return translate(m.microphoneDenied);
}
if (isVoiceAbortError(error)) {
- return "Microphone connection was interrupted";
+ return translate(m.microphoneInterrupted);
}
const message = errorMessage(error);
return message || String(error);
@@ -85,7 +113,7 @@ export async function discoverVoiceMicrophones(
} = {},
) {
const mediaDevices = input.mediaDevices ?? navigator.mediaDevices;
- if (!mediaDevices) throw new Error("Microphone access is unavailable");
+ if (!mediaDevices) throw new Error(translate(m.microphoneUnavailable));
const enumerated = await mediaDevices.enumerateDevices();
// Without a remembered device, ask the browser which microphone it grants:
// that is the one the person chose in its prompt or site settings.
@@ -175,10 +203,7 @@ function selectVoiceMicrophones(
grantedDeviceId?: string,
) {
if (devices.length === 0) {
- throw new DOMException(
- "No audio input device is available",
- "NotFoundError",
- );
+ throw new DOMException(translate(m.noAudioInput), "NotFoundError");
}
const selectedDeviceId =
devices.find((device) => device.deviceId === preferredDeviceId)?.deviceId ??
@@ -206,7 +231,7 @@ function getUserMediaAttempt(input: {
return new Promise<MediaStream>((resolve, reject) => {
const timeout = globalThis.setTimeout(() => {
expired = true;
- reject(new Error("Microphone connection timed out"));
+ reject(new VoiceMicrophoneError("timeout"));
}, timeoutMs);
void pending.then(
(stream) => {
diff --git a/apps/web/src/features/rooms/voice-control/recording-questions.tsx b/apps/web/src/features/rooms/voice-control/recording-questions.tsx
index e915c3ca..89101d00 100644
--- a/apps/web/src/features/rooms/voice-control/recording-questions.tsx
+++ b/apps/web/src/features/rooms/voice-control/recording-questions.tsx
@@ -17,6 +17,9 @@ import { Icon } from "@/components/ui/icon";
import { teamHubData } from "@/features/teamhub/teamhub-api";
import { useTeamHubRuntime } from "@/features/teamhub/teamhub-runtime";
import type { TeamHubVoiceCaptureQuestion } from "@/features/teamhub/teamhub-types";
+import { commonMessages } from "@/i18n/common.messages";
+import { useT } from "@/i18n/use-translation";
+import { recordingMessages as m } from "./recording.messages";
import { formatRecordingTime } from "./recording-time";
import styles from "./voice-focus.module.css";
@@ -146,6 +149,7 @@ export function RecordingAskBox({
busy: boolean;
onAsk: (question: string) => void;
}) {
+ const t = useT();
const [question, setQuestion] = useState("");
const send = () => {
const text = question.trim();
@@ -167,17 +171,18 @@ export function RecordingAskBox({
// Shares the window's gutter with the answers above.
<div className="mx-4 mt-2 mb-4 flex shrink-0 items-end gap-2 rounded-2xl bg-app-surface py-1 pr-1 pl-3 shadow-(--composer-shadow) transition-shadow focus-within:shadow-(--composer-shadow-focus)">
<textarea
- aria-label="Ask about this recording"
+ aria-label={t(m.askLabel)}
className="max-h-24 min-h-7 flex-1 resize-none self-center bg-transparent py-1 text-sm leading-5 text-app-ink [field-sizing:content] placeholder:text-app-placeholder focus:outline-none"
onChange={(event) => setQuestion(event.target.value)}
onKeyDown={onKey}
- placeholder="Ask something or ask to do something"
+ placeholder={t(m.askPlaceholder)}
rows={1}
value={question}
/>
<Button
- aria-label="Send question"
+ aria-label={t(m.sendQuestion)}
className="!size-7 !rounded-full"
+ data-voice-risk="never"
disabled={busy || !question.trim()}
onClick={send}
size="compactIcon"
@@ -208,6 +213,7 @@ export function RecordingAnswers({
recordingStartMs: number;
taskState: (item: TeamHubVoiceCaptureQuestion) => AskTaskState | undefined;
}) {
+ const t = useT();
const listRef = useRef<HTMLOListElement>(null);
const followingRef = useRef(true);
const previousQuestionRef = useRef<string | undefined>(undefined);
@@ -226,7 +232,7 @@ export function RecordingAnswers({
formatRecordingTime(offsetMs - recordingStartMs);
return (
<ol
- aria-label="Answers about this recording"
+ aria-label={t(m.answers)}
aria-live="polite"
className="workspace-scrollbar flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-4 py-3"
ref={listRef}
@@ -238,8 +244,7 @@ export function RecordingAnswers({
>
{items.length || pending ? null : (
<li className="m-auto max-w-[32ch] py-6 text-center text-[12px] leading-[18px] text-app-muted">
- Ask what was said, decided, or left open, or ask Another Me to do
- something, like drafting a follow-up email.
+ {t(m.askEmpty)}
</li>
)}
{items.map((item) => {
@@ -262,7 +267,9 @@ export function RecordingAnswers({
{item.answer}
</p>
<p className="text-[12px] leading-[18px] text-app-muted">
- Based on the recording up to {at(item.cutoff_offset_ms)}
+ {t(m.basedOnRecording, {
+ time: at(item.cutoff_offset_ms),
+ })}
</p>
</>
)}
@@ -277,15 +284,15 @@ export function RecordingAnswers({
className="flex items-center gap-2 text-[12px] leading-[18px] text-app-danger"
role="alert"
>
- The answer could not be generated.
+ {t(m.answerFailed)}
<Button onClick={onRetry} size="compact" tone="ghost">
- Retry
+ {t(commonMessages.retry)}
</Button>
</p>
) : (
<p className="flex items-center gap-2 text-[12px] leading-[18px] text-app-muted">
<Icon icon={Loading03Icon} className="animate-spin" size={14} />
- Answering…
+ {t(m.answering)}
</p>
)}
</li>
@@ -302,6 +309,7 @@ function AskTaskStatus({
onRetry: () => void;
state: AskTaskState;
}) {
+ const t = useT();
return (
<div className="flex items-center gap-2" data-task-state={state}>
<TaskNode state={state} />
@@ -310,20 +318,21 @@ function AskTaskStatus({
className="text-[12px] leading-[18px] text-app-muted"
role="status"
>
- Sending to Another Me…
+ {t(m.sendingToAnotherMe)}
</span>
) : state === "failed" ? (
<span
className="flex items-center gap-1 text-[12px] leading-[18px] text-app-danger"
role="status"
>
- {"Not sent · "}
+ {t(m.notSent)}
+ {" · "}
<button
className="font-medium underline-offset-2 hover:underline"
onClick={onRetry}
type="button"
>
- Retry
+ {t(commonMessages.retry)}
</button>
</span>
) : (
@@ -331,7 +340,7 @@ function AskTaskStatus({
className="text-[12px] leading-[18px] text-app-muted"
role="status"
>
- Sent to Another Me
+ {t(m.sentToAnotherMe)}
</span>
)}
</div>
diff --git a/apps/web/src/features/rooms/voice-control/recording-window-language.test.tsx b/apps/web/src/features/rooms/voice-control/recording-window-language.test.tsx
new file mode 100644
index 00000000..38964400
--- /dev/null
+++ b/apps/web/src/features/rooms/voice-control/recording-window-language.test.tsx
@@ -0,0 +1,208 @@
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import {
+ cleanup,
+ fireEvent,
+ render,
+ screen,
+ within,
+} from "@testing-library/react";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+
+import { TeamHubRuntimeProvider } from "@/features/teamhub/teamhub-runtime";
+import type { TeamHubVoiceCaptureQuestion } from "@/features/teamhub/teamhub-types";
+import { resetLanguageForTest, setLanguage } from "@/i18n/language";
+import zhCN from "@/i18n/locales/zh-CN.json";
+import { createTestTeamHubRuntime } from "@/test/teamhub-test-runtime";
+import { resetVoicePipForTest } from "../chat/voice-mode/voice-pip";
+import RecordingWindow from "./recording-window";
+import {
+ openRecordingWindow,
+ resetRecordingWindowForTest,
+} from "./recording-window-store";
+import {
+ VoiceControlContext,
+ type VoiceControlContextValue,
+} from "./voice-control-context";
+
+const zh = zhCN.recording;
+const common = zhCN.common;
+
+const capture = {
+ created_at: "2026-10-12T02:00:00Z",
+ gap_count: 2,
+ gap_duration_ms: 4_000,
+ id: "capture-1",
+ requested_start_offset_ms: 60_000,
+ room_id: "room-1",
+ status: "recording" as const,
+ updated_at: "2026-10-12T02:00:00Z",
+ voice_session_id: "voice-session-1",
+};
+
+function voiceValue(
+ overrides: Partial<VoiceControlContextValue> = {},
+): VoiceControlContextValue {
+ return {
+ acquireComposerMicrophone: vi.fn(async () => async () => undefined),
+ boundDevice: { deviceId: "mic", groupId: "group", label: "Mic" },
+ captureSyncStatus: "live",
+ captureState: { status: "recording", capture },
+ composerMicrophoneActive: false,
+ connectDevice: vi.fn(async () => undefined),
+ devices: [],
+ discoverDevices: vi.fn(async () => []),
+ disconnectDevice: vi.fn(async () => undefined),
+ disable: vi.fn(async () => undefined),
+ enable: vi.fn(async () => undefined),
+ leavePage: vi.fn(async () => undefined),
+ listenerStatus: "listening",
+ selectedDeviceId: "mic",
+ microphoneMuted: false,
+ setMicrophoneMuted: vi.fn(async () => undefined),
+ selectDevice: vi.fn(async () => undefined),
+ startCapture: vi.fn(async () => undefined),
+ startNewCapture: vi.fn(async () => undefined),
+ stopCapture: vi.fn(async () => undefined),
+ targetAgentName: "Another Me",
+ transcriptItems: [
+ {
+ createdAtMs: 1,
+ id: "speech",
+ speakerLabel: "Speaker 2",
+ text: "Budget set at 200k",
+ },
+ ],
+ transcriptStatus: "live",
+ ...overrides,
+ };
+}
+
+function renderWindow(voice: VoiceControlContextValue) {
+ const runtime = createTestTeamHubRuntime();
+ const asked: TeamHubVoiceCaptureQuestion[] = [];
+ runtime.server
+ .on("GET", "/v0/voice-captures/{captureSessionId}/questions", () => ({
+ items: structuredClone(asked),
+ }))
+ .on("POST", "/v0/voice-captures/{captureSessionId}/questions", () => {
+ const answer: TeamHubVoiceCaptureQuestion = {
+ answer: "Budget is 200k.",
+ answered: true,
+ created_at: "2026-10-12T02:03:00Z",
+ cutoff_offset_ms: 185_000,
+ id: "q1",
+ kind: "answer",
+ question: "How was the budget settled?",
+ sources: [],
+ };
+ asked.push(answer);
+ return answer;
+ });
+ render(
+ <QueryClientProvider client={new QueryClient()}>
+ <TeamHubRuntimeProvider runtime={runtime}>
+ <VoiceControlContext value={voice}>
+ <RecordingWindow />
+ </VoiceControlContext>
+ </TeamHubRuntimeProvider>
+ </QueryClientProvider>,
+ );
+}
+
+beforeEach(() => {
+ resetRecordingWindowForTest();
+ resetVoicePipForTest();
+ openRecordingWindow();
+});
+
+afterEach(() => {
+ cleanup();
+ resetLanguageForTest();
+});
+
+describe("Recording window in the language on screen", () => {
+ it("words a running recording in Chinese and keeps Stop unmarked", async () => {
+ await setLanguage("zh-CN");
+ renderWindow(voiceValue());
+
+ const frame = screen.getByRole("region", { name: zh.window });
+ expect(within(frame).getByText(zh.meeting)).toBeInTheDocument();
+ expect(
+ screen.getByRole("region", { name: zh.surface }),
+ ).toBeInTheDocument();
+ expect(screen.getByRole("button", { name: zh.minimize })).toHaveAttribute(
+ "title",
+ zh.minimizeHint,
+ );
+ expect(
+ screen.getByRole("button", { name: zh.pauseRecording }),
+ ).toHaveTextContent(zh.pause);
+ // Stopping asks first, so the button is no voice close and no risk.
+ const stop = screen.getByRole("button", { name: zh.stopRecording });
+ expect(stop).toHaveTextContent(zh.stop);
+ expect(stop).not.toHaveAttribute("data-voice-close");
+ expect(stop).not.toHaveAttribute("data-voice-risk");
+
+ expect(screen.getAllByRole("tab").map((tab) => tab.textContent)).toEqual([
+ zh.transcriptTab,
+ zh.askTab,
+ ]);
+ const transcript = screen.getByRole("log", { name: zh.transcript });
+ expect(
+ within(transcript).getByText(zh.speaker.replace("{number}", "2")),
+ ).toBeInTheDocument();
+ expect(
+ screen.getByText(
+ zh.inputMissed.other.replace("{count}", "2").replace("{seconds}", "4"),
+ ),
+ ).toBeInTheDocument();
+ expect(
+ screen.getByRole("button", { name: zh.resizeWindow }),
+ ).toHaveAttribute("title", zhCN.voiceWindow.resizeHint);
+
+ fireEvent.click(stop);
+ expect(
+ screen.getByRole("alertdialog", { name: zh.confirmStopTitle }),
+ ).toHaveTextContent(zh.confirmStopBody);
+ expect(
+ screen.getByRole("button", { name: zh.stopAndSave }),
+ ).toBeInTheDocument();
+ expect(
+ screen.getByRole("button", { name: zh.keepRecording }),
+ ).toBeInTheDocument();
+ });
+
+ it("marks Close as the window's close once the recording is over", async () => {
+ await setLanguage("zh-CN");
+ renderWindow(voiceValue({ captureState: { status: "idle" } }));
+
+ const close = screen.getByRole("button", { name: zh.closeRecording });
+ expect(close).toHaveTextContent(common.close);
+ expect(close).toHaveAttribute("data-voice-close");
+ expect(
+ screen.getByRole("button", { name: zh.startRecording }),
+ ).toBeInTheDocument();
+ });
+
+ it("asks in Chinese, marks sending a question, and times the answer", async () => {
+ await setLanguage("zh-CN");
+ renderWindow(voiceValue());
+
+ fireEvent.click(screen.getByRole("tab", { name: zh.askTab }));
+ expect(screen.getByRole("list", { name: zh.answers })).toHaveTextContent(
+ zh.askEmpty,
+ );
+ const box = screen.getByRole("textbox", { name: zh.askLabel });
+ expect(box).toHaveAttribute("placeholder", zh.askPlaceholder);
+ const send = screen.getByRole("button", { name: zh.sendQuestion });
+ expect(send).toHaveAttribute("data-voice-risk", "never");
+
+ fireEvent.change(box, { target: { value: "How was the budget settled?" } });
+ fireEvent.keyDown(box, { key: "Enter" });
+ const answers = screen.getByRole("list", { name: zh.answers });
+ expect(await within(answers).findByText("Budget is 200k.")).toBeVisible();
+ expect(
+ within(answers).getByText(zh.basedOnRecording.replace("{time}", "02:05")),
+ ).toBeVisible();
+ });
+});
diff --git a/apps/web/src/features/rooms/voice-control/recording-window.tsx b/apps/web/src/features/rooms/voice-control/recording-window.tsx
index 5264b395..3ae9fd2f 100644
--- a/apps/web/src/features/rooms/voice-control/recording-window.tsx
+++ b/apps/web/src/features/rooms/voice-control/recording-window.tsx
@@ -7,6 +7,8 @@ import {
} from "react";
import { createPortal } from "react-dom";
+import { useT } from "@/i18n/use-translation";
+
import {
closeVoicePip,
onVoicePipClosedByHuman,
@@ -35,6 +37,7 @@ import {
minimizeRecordingWindow,
useRecordingWindow,
} from "./recording-window-store";
+import { recordingMessages as m } from "./recording.messages";
import {
useOptionalVoiceControl,
type VoiceControlContextValue,
@@ -67,6 +70,7 @@ const pageTop = 36;
* tab button, keeps recording in the page window.
*/
export default function RecordingWindow() {
+ const t = useT();
const windowState = useRecordingWindow();
const livekit = useOptionalVoiceControl();
const voice = livekit;
@@ -253,7 +257,7 @@ export default function RecordingWindow() {
const fill = Boolean(!pip && view && sized?.height);
return createPortal(
<div
- aria-label="Recording window"
+ aria-label={t(m.window)}
className={
pip
? "flex h-dvh w-full flex-col bg-app-canvas"
@@ -298,7 +302,7 @@ export default function RecordingWindow() {
<VoiceWindowResizeHandles
bounds={pageBounds}
edges={view ? undefined : ["e", "w"]}
- label="Resize recording window"
+ label={t(m.resizeWindow)}
min={minPageSize}
onResize={({ height, left, top, width }) => {
// Resizing places the window by its own corner from then on.
diff --git a/apps/web/src/features/rooms/voice-control/recording.messages.ts b/apps/web/src/features/rooms/voice-control/recording.messages.ts
new file mode 100644
index 00000000..1e80b388
--- /dev/null
+++ b/apps/web/src/features/rooms/voice-control/recording.messages.ts
@@ -0,0 +1,148 @@
+import { defineMessages } from "@/i18n/messages";
+
+/** The Recording window of a meeting, and the microphone behind it. */
+export const recordingMessages = defineMessages("recording", {
+ // The window and its title bar.
+ window: "Recording window",
+ resizeWindow: "Resize recording window",
+ meeting: "Meeting",
+ minimize: "Minimize recording",
+ minimizeHint: "Minimize; recording continues",
+ open: "Open recording",
+ float: "Float recording window",
+ floatHint: "Float over other tabs and apps",
+ returnToLinger: "Return recording to Linger",
+ returnHint: "Back to Linger; recording continues",
+
+ // The row with the live duration and the controls.
+ surface: "Hardware voice focus",
+ duration: "Recording duration",
+ recording: "Recording",
+ recordingPaused: "Recording paused",
+ pauseRecording: "Pause recording",
+ resumeRecording: "Resume recording",
+ pause: "Pause",
+ resume: "Resume",
+ stopRecording: "Stop recording",
+ closeRecording: "Close recording",
+ stop: "Stop",
+ confirmStopTitle: "Stop recording?",
+ confirmStopBody:
+ "The recording is saved and summarized. You can find it in Meetings.",
+ stopAndSave: "Stop & save",
+ keepRecording: "Keep recording",
+
+ // The views under the row.
+ views: "Recording views",
+ transcriptTab: "Transcript",
+ askTab: "Ask",
+ transcript: "Voice focus transcript",
+ transcriptScrollArea: "Transcript scroll area",
+ followLatest: "Follow latest transcript",
+ transcriptPlaceholder:
+ "This recording’s transcript will appear here. View previous transcripts in the chat.",
+ noTranscript: "No transcript is available yet.",
+ listening: "Listening…",
+ startNewRecording: "Start new recording",
+ startRecording: "Start recording",
+ speaker: "Speaker {number}",
+ reconnectMicrophone: "Reconnect microphone",
+ inputMissed: {
+ one: "Input missed once ({seconds}s not recorded)",
+ other: "Input missed {count} times ({seconds}s not recorded)",
+ },
+
+ // What the recording is doing, as the window's title.
+ titleRecoveryPaused: "Recording saved. Transcript recovery paused",
+ titleInputInterrupted: "Recording input was interrupted",
+ titleOtherTab: "Recording is continuing in another tab",
+ titleListening: "I’m listening to the meeting...",
+ titleSaveFailed: "Recording save failed",
+ titleRecovering: "Recording saved; recovering transcript",
+ titleSaving: "Saving recording...",
+ titleStarting: "Starting recording…",
+ titleNotStarted: "Recording did not start",
+ titleReady: "Ready to start recording",
+
+ // The line under the title.
+ subtitleRecoveryPaused:
+ "Retry transcription or download the original recording.",
+ subtitleInputInterrupted: "Recorded content can still be saved.",
+ subtitleSaveFailed: "Received transcript segments remain available here.",
+ subtitleRecovering:
+ "The microphone can be disconnected; recovery will continue in the background.",
+ subtitleSaving: "Finishing the transcript and audio file.",
+ subtitleAllowMicrophone: "Allow microphone access in the browser to begin.",
+ subtitleConnecting: "Connecting the microphone…",
+ subtitleNotStarted: "Check the error below, then start recording again.",
+ subtitleReady: "Start recording to capture this meeting.",
+
+ // Progress notes while the recording runs or saves.
+ statusReconnectingMicrophone:
+ "Reconnecting microphone; audio delivery is not yet confirmed",
+ statusReconnectingTranscript:
+ "Reconnecting transcript updates; saved text will sync after reconnection",
+ statusReconnectingRecording:
+ "Reconnecting recording status; waiting for server confirmation",
+ statusUnconfirmedAfterStop:
+ "Some transcript segments are unconfirmed. Recovery will be attempted after stopping.",
+ statusUnconfirmed:
+ "Some transcript segments are unconfirmed. Recording continues; recovery will be attempted after stopping.",
+ statusGeneratingFiles: "Generating recording and transcript files",
+
+ // A recording whose transcript is being recovered.
+ recovery: "Recording transcript recovery",
+ recordingSaved: "Recording saved",
+ recoveryPausedBody:
+ "Transcript recovery is paused. Please retry. You can start a new recording.",
+ recoveringBody:
+ "Recovering transcript {progress}%. It will appear in this Room when complete. You can start a new recording.",
+ downloadOriginal: "Download original recording",
+ retryTranscription: "Retry transcription",
+ downloadUnavailable: "Original recording download is temporarily unavailable",
+ retryNotConfirmed:
+ "The retry request was not confirmed. Check progress or try again later.",
+
+ // Ask: questions about the recording and requests for Another Me.
+ askLabel: "Ask about this recording",
+ askPlaceholder: "Ask something or ask to do something",
+ sendQuestion: "Send question",
+ answers: "Answers about this recording",
+ askEmpty:
+ "Ask what was said, decided, or left open, or ask Another Me to do something, like drafting a follow-up email.",
+ basedOnRecording: "Based on the recording up to {time}",
+ answerFailed: "The answer could not be generated.",
+ answering: "Answering…",
+ sendingToAnotherMe: "Sending to Another Me…",
+ notSent: "Not sent",
+ sentToAnotherMe: "Sent to Another Me",
+
+ // Why the recording or the microphone did not work.
+ saveFailed: "The recording could not be saved.",
+ microphoneBlocked:
+ "Microphone access was blocked. Allow it in the browser, then start recording again.",
+ noMicrophone:
+ "No microphone is available. Connect one, then start recording again.",
+ microphoneBusy: "The microphone is in use by another application.",
+ microphoneDenied: "Microphone permission was denied",
+ microphoneInterrupted: "Microphone connection was interrupted",
+ microphoneUnavailable: "Microphone access is unavailable",
+ noAudioInput: "No audio input device is available",
+ microphoneTimedOut: "Microphone connection timed out",
+ connectMicrophone: "Connect a microphone before enabling voice",
+ selectedMicrophoneUnavailable: "The selected microphone is unavailable",
+ hardwareVoiceOtherTab: "Hardware voice is active in another tab",
+ composerUsesMicrophone: "Composer is using the microphone",
+ stopBeforeDisconnect:
+ "Stop the recording before disconnecting the microphone",
+ accessExpired:
+ "Voice session access has expired. Sign in again or check your access to the target Agent.",
+ inputNotReady: "Voice input did not become ready",
+ requestTimedOut: "Voice request timed out.",
+ selectTargetAgain:
+ "Select the recording target again in the Agent direct chat",
+ anotherMeNotReady: "Your AnotherMe is not ready for recording",
+ switchingTarget: "Switching recording target. Please wait",
+ stopBeforeSwitching: "Stop the current recording before switching targets",
+ startInDirectChat: "Start recording in the Agent direct chat",
+});
diff --git a/apps/web/src/features/rooms/voice-control/use-voice-devices.ts b/apps/web/src/features/rooms/voice-control/use-voice-devices.ts
index 8b546d42..d5f43f1e 100644
--- a/apps/web/src/features/rooms/voice-control/use-voice-devices.ts
+++ b/apps/web/src/features/rooms/voice-control/use-voice-devices.ts
@@ -13,6 +13,8 @@ import { describeError } from "./voice-control-helpers";
import { deviceStorageKey, writeStorage } from "./voice-control-storage";
import { setVoiceMicrophoneMuted } from "./voice-media-connection";
import type { VoiceControlState } from "./use-voice-control-state";
+import { translate } from "@/i18n/language";
+import { recordingMessages as m } from "./recording.messages";
/** Lists, binds, connects, mutes and disables the hardware microphone. */
export function useVoiceDevices(
@@ -56,7 +58,7 @@ export function useVoiceDevices(
const device = available.find(
(candidate) => candidate.deviceId === deviceId,
);
- if (!device) throw new Error("The selected microphone is unavailable");
+ if (!device) throw new Error(translate(m.selectedMicrophoneUnavailable));
refs.bindingRef.current = device;
setBoundDevice(device);
setSelectedDeviceId(device.deviceId);
diff --git a/apps/web/src/features/rooms/voice-control/use-voice-listener.ts b/apps/web/src/features/rooms/voice-control/use-voice-listener.ts
index 74684c3f..a862b402 100644
--- a/apps/web/src/features/rooms/voice-control/use-voice-listener.ts
+++ b/apps/web/src/features/rooms/voice-control/use-voice-listener.ts
@@ -4,7 +4,7 @@ import { useCallback, useEffect } from "react";
import type { TeamHubRuntime } from "@/features/teamhub/teamhub-runtime";
import type { TeamHubVoiceSession } from "@/features/teamhub/teamhub-types";
-import { isVoiceAbortError } from "./microphone-devices";
+import { isVoiceAbortError, VoiceMicrophoneError } from "./microphone-devices";
import { describeError, withTimeout } from "./voice-control-helpers";
import { connectVoiceListener } from "./voice-listener-connection";
import type { VoiceControlState, VoiceTarget } from "./use-voice-control-state";
@@ -78,7 +78,7 @@ export function useVoiceListener({
const operation = withTimeout(
pendingConnection,
voiceConnectTimeoutMs,
- "Microphone connection timed out",
+ () => new VoiceMicrophoneError("timeout"),
).catch(async (error: unknown) => {
if (refs.connectionControllerRef.current === controller) {
await cleanupMedia();
diff --git a/apps/web/src/features/rooms/voice-control/use-voice-session-events.ts b/apps/web/src/features/rooms/voice-control/use-voice-session-events.ts
index 83cb8cae..64ed7f19 100644
--- a/apps/web/src/features/rooms/voice-control/use-voice-session-events.ts
+++ b/apps/web/src/features/rooms/voice-control/use-voice-session-events.ts
@@ -8,6 +8,8 @@ import {
mergeVoiceTranscriptItems,
} from "./voice-control-helpers";
import type { VoiceControlState } from "./use-voice-control-state";
+import { translate } from "@/i18n/language";
+import { recordingMessages as m } from "./recording.messages";
const partialTranscriptStaleMs = 10_000;
@@ -95,9 +97,7 @@ export function useVoiceSessionEvents(
refs.eventStreamLiveRef.current = false;
refs.voiceAccessLostRef.current = true;
setTranscriptStatus("idle");
- setListenerError(
- "Voice session access has expired. Sign in again or check your access to the target Agent.",
- );
+ setListenerError(translate(m.accessExpired));
setListenerStatus("error");
void cleanupMedia();
refs.publisherLeaseRef.current?.();
diff --git a/apps/web/src/features/rooms/voice-control/use-voice-session-lifecycle.ts b/apps/web/src/features/rooms/voice-control/use-voice-session-lifecycle.ts
index f623eebe..a5b17ea5 100644
--- a/apps/web/src/features/rooms/voice-control/use-voice-session-lifecycle.ts
+++ b/apps/web/src/features/rooms/voice-control/use-voice-session-lifecycle.ts
@@ -11,6 +11,8 @@ import {
} from "./voice-control-storage";
import { releaseVoiceSession } from "./voice-session-release";
import type { VoiceControlState, VoiceTarget } from "./use-voice-control-state";
+import { translate } from "@/i18n/language";
+import { recordingMessages as m } from "./recording.messages";
/**
* Releases the VoiceSession when the page goes away and disconnects the bound
@@ -120,7 +122,7 @@ export function useVoiceSessionLifecycle(
const disconnectDevice = useCallback(async () => {
if (refs.captureRef.current && isActiveCapture(refs.captureRef.current)) {
- throw new Error("Stop the recording before disconnecting the microphone");
+ throw new Error(translate(m.stopBeforeDisconnect));
}
const session = refs.voiceSessionRef.current;
refs.startControllerRef.current?.abort();
diff --git a/apps/web/src/features/rooms/voice-control/use-voice-target.ts b/apps/web/src/features/rooms/voice-control/use-voice-target.ts
index 90b9a450..7a693101 100644
--- a/apps/web/src/features/rooms/voice-control/use-voice-target.ts
+++ b/apps/web/src/features/rooms/voice-control/use-voice-target.ts
@@ -10,6 +10,8 @@ import {
writeSelectedVoiceRoom,
} from "./voice-control-storage";
import type { VoiceControlState } from "./use-voice-control-state";
+import { translate } from "@/i18n/language";
+import { recordingMessages as m } from "./recording.messages";
/** Resolves the recording target Room and its hardware VoiceSession. */
export function useVoiceTarget(
@@ -38,9 +40,7 @@ export function useVoiceTarget(
}),
);
if (room.kind !== "direct" || room.direct_peer?.kind !== "agent")
- throw new Error(
- "Select the recording target again in the Agent direct chat",
- );
+ throw new Error(translate(m.selectTargetAgain));
if (refs.targetRef.current && !activeRoomOverride)
return refs.targetRef.current;
const resolved = {
@@ -59,7 +59,7 @@ export function useVoiceTarget(
}),
);
if (!target.agent_actor_id || !target.room_id) {
- throw new Error("Your AnotherMe is not ready for recording");
+ throw new Error(translate(m.anotherMeNotReady));
}
const actor = await teamHubData(
runtime.client.api.GET("/v0/tenants/{tenantId}/actors/{actorId}", {
@@ -133,9 +133,7 @@ export function useVoiceTargetSelection(
return useCallback(
(roomId: string) => {
if (refs.targetChangeRef.current)
- return Promise.reject(
- new Error("Switching recording target. Please wait"),
- );
+ return Promise.reject(new Error(translate(m.switchingTarget)));
const operation = (async () => {
if (refs.targetRef.current?.roomId === roomId) return;
if (
@@ -143,25 +141,21 @@ export function useVoiceTargetSelection(
refs.startPromiseRef.current ||
refs.enablePromiseRef.current
)
- throw new Error(
- "Stop the current recording before switching targets",
- );
+ throw new Error(translate(m.stopBeforeSwitching));
const room = await teamHubData(
runtime.client.api.GET("/v0/rooms/{roomId}", {
params: { path: { roomId } },
}),
);
if (room.kind !== "direct" || room.direct_peer?.kind !== "agent")
- throw new Error("Start recording in the Agent direct chat");
+ throw new Error(translate(m.startInDirectChat));
// Recheck after the authorization read: a recording may have started meanwhile.
if (
isActiveCapture(refs.captureRef.current) ||
refs.startPromiseRef.current ||
refs.enablePromiseRef.current
)
- throw new Error(
- "Stop the current recording before switching targets",
- );
+ throw new Error(translate(m.stopBeforeSwitching));
await disable();
const session = refs.voiceSessionRef.current;
if (session)
diff --git a/apps/web/src/features/rooms/voice-control/voice-control-helpers.ts b/apps/web/src/features/rooms/voice-control/voice-control-helpers.ts
index 3ec9c1af..1d15594b 100644
--- a/apps/web/src/features/rooms/voice-control/voice-control-helpers.ts
+++ b/apps/web/src/features/rooms/voice-control/voice-control-helpers.ts
@@ -101,17 +101,14 @@ export function elapsedSessionMS(startedAt: number) {
export async function withTimeout<T>(
operation: Promise<T>,
timeoutMs: number,
- message: string,
+ timeoutError: () => Error,
): Promise<T> {
let timeout: number | undefined;
try {
return await Promise.race([
operation,
new Promise<T>((_, reject) => {
- timeout = window.setTimeout(
- () => reject(new Error(message)),
- timeoutMs,
- );
+ timeout = window.setTimeout(() => reject(timeoutError()), timeoutMs);
}),
]);
} finally {
diff --git a/apps/web/src/features/rooms/voice-control/voice-focus-state.ts b/apps/web/src/features/rooms/voice-control/voice-focus-state.ts
index 5a96b429..ff5a384a 100644
--- a/apps/web/src/features/rooms/voice-control/voice-focus-state.ts
+++ b/apps/web/src/features/rooms/voice-control/voice-focus-state.ts
@@ -6,12 +6,19 @@ import {
useState,
} from "react";
+import { translate } from "@/i18n/language";
+
import {
isTranscriptRecoveryPaused,
type VoiceCaptureState,
type VoiceControlContextValue,
} from "./voice-control-context";
-import { matchBoundVoiceMicrophone } from "./microphone-devices";
+import {
+ describeVoiceMediaError,
+ matchBoundVoiceMicrophone,
+ VoiceMicrophoneError,
+} from "./microphone-devices";
+import { recordingMessages as m } from "./recording.messages";
export type ArmStatus = "pending" | "arming" | "armed" | "blocked";
type VoiceValue = VoiceControlContextValue;
@@ -176,9 +183,9 @@ export function useMicrophonePermission() {
}
export function armTitle(status: ArmStatus) {
- if (status === "arming") return "Starting recording…";
- if (status === "blocked") return "Recording did not start";
- return "Ready to start recording";
+ if (status === "arming") return m.titleStarting;
+ if (status === "blocked") return m.titleNotStarted;
+ return m.titleReady;
}
export function armSubtitle(
@@ -189,34 +196,28 @@ export function armSubtitle(
// device; only ask for access when the browser has not granted it yet.
if (status === "arming")
return permission === "prompt" || permission === "denied"
- ? "Allow microphone access in the browser to begin."
- : "Connecting the microphone…";
- if (status === "blocked")
- return "Check the error below, then start recording again.";
- return "Start recording to capture this meeting.";
+ ? m.subtitleAllowMicrophone
+ : m.subtitleConnecting;
+ if (status === "blocked") return m.subtitleNotStarted;
+ return m.subtitleReady;
}
function isMicrophoneFailure(error: unknown) {
- return (
- error instanceof DOMException ||
- (error instanceof Error &&
- [
- "Connect a microphone before enabling voice",
- "Microphone connection timed out",
- ].includes(error.message))
- );
+ return error instanceof DOMException || error instanceof VoiceMicrophoneError;
}
function describeArmFailure(error: unknown): string {
+ if (error instanceof VoiceMicrophoneError)
+ return describeVoiceMediaError(error);
const name = error instanceof DOMException ? error.name : undefined;
switch (name) {
case "NotAllowedError":
case "SecurityError":
- return "Microphone access was blocked. Allow it in the browser, then start recording again.";
+ return translate(m.microphoneBlocked);
case "NotFoundError":
- return "No microphone is available. Connect one, then start recording again.";
+ return translate(m.noMicrophone);
case "NotReadableError":
- return "The microphone is in use by another application.";
+ return translate(m.microphoneBusy);
default:
return error instanceof Error ? error.message : String(error);
}
diff --git a/apps/web/src/features/rooms/voice-control/voice-focus-surface.test.tsx b/apps/web/src/features/rooms/voice-control/voice-focus-surface.test.tsx
index 5e0eb6c5..f32cc28e 100644
--- a/apps/web/src/features/rooms/voice-control/voice-focus-surface.test.tsx
+++ b/apps/web/src/features/rooms/voice-control/voice-focus-surface.test.tsx
@@ -7,6 +7,7 @@ import {
VoiceControlContext,
type VoiceControlContextValue,
} from "./voice-control-context";
+import { VoiceMicrophoneError } from "./microphone-devices";
import { RecordingEntry } from "./recording-entry";
import { VoiceFocusSurface } from "./voice-focus-surface";
import { TeamHubRuntimeProvider } from "@/features/teamhub/teamhub-runtime";
@@ -265,6 +266,56 @@ describe("VoiceFocusSurface", () => {
await vi.waitFor(() => expect(startCapture).toHaveBeenCalledOnce());
});
+ it("asks the browser again when the remembered microphone does not connect", async () => {
+ const discoverDevices = vi.fn(async () => [microphone]);
+ const selectDevice = vi.fn(async () => undefined);
+ const startCapture = vi
+ .fn<() => Promise<undefined>>()
+ .mockRejectedValueOnce(new VoiceMicrophoneError("timeout"))
+ .mockResolvedValue(undefined);
+ render(
+ <VoiceControlContext.Provider
+ value={voiceValue({
+ captureState: { status: "idle" },
+ discoverDevices,
+ listenerStatus: "disabled",
+ selectDevice,
+ startCapture,
+ })}
+ >
+ <VoiceFocusSurface autoStart onExit={vi.fn()} />
+ </VoiceControlContext.Provider>,
+ );
+ await vi.waitFor(() => expect(startCapture).toHaveBeenCalledTimes(2));
+ expect(discoverDevices).toHaveBeenCalledOnce();
+ expect(selectDevice).toHaveBeenCalledWith(microphone.deviceId);
+ });
+
+ it("explains an unbound microphone from its code", async () => {
+ const startCapture = vi.fn(async () => {
+ throw new VoiceMicrophoneError("no-binding");
+ });
+ render(
+ <VoiceControlContext.Provider
+ value={voiceValue({
+ captureState: { status: "idle" },
+ discoverDevices: vi.fn(async () => [microphone]),
+ listenerStatus: "disabled",
+ startCapture,
+ })}
+ >
+ <VoiceFocusSurface autoStart onExit={vi.fn()} />
+ </VoiceControlContext.Provider>,
+ );
+ expect(
+ await screen.findByRole("heading", { name: "Recording did not start" }),
+ ).toBeVisible();
+ expect(screen.getByRole("alert")).toHaveTextContent(
+ "Connect a microphone before enabling voice",
+ );
+ expect(startCapture).toHaveBeenCalledTimes(2);
+ });
+
it("shows Pause then Stop in the top row and no separate Mute", () => {
render(
<VoiceControlContext.Provider value={voiceValue()}>
diff --git a/apps/web/src/features/rooms/voice-control/voice-focus-surface.tsx b/apps/web/src/features/rooms/voice-control/voice-focus-surface.tsx
index c37bf438..e3adedf5 100644
--- a/apps/web/src/features/rooms/voice-control/voice-focus-surface.tsx
+++ b/apps/web/src/features/rooms/voice-control/voice-focus-surface.tsx
@@ -14,6 +14,10 @@ import {
import { useState, type PointerEvent, type ReactNode } from "react";
import { Icon } from "@/components/ui/icon";
import { Button } from "@/components/ui/button";
+import { commonMessages } from "@/i18n/common.messages";
+import type { Translate } from "@/i18n/language";
+import type { Message } from "@/i18n/messages";
+import { useT } from "@/i18n/use-translation";
import {
isTranscriptRecoveryPaused,
useOptionalVoiceControl,
@@ -31,6 +35,7 @@ import {
useSurfaceAction,
useVoiceArming,
} from "./voice-focus-state";
+import { recordingMessages as m } from "./recording.messages";
export type RecordingView = "transcript" | "ask";
@@ -78,6 +83,7 @@ export function VoiceFocusSurface({
/** The open view; undefined minimizes the window to its top row. */
view?: RecordingView;
}) {
+ const t = useT();
const livekit = useOptionalVoiceControl();
const voice = livekit;
const { actionError, actionPending, run } = useSurfaceAction();
@@ -126,7 +132,7 @@ export function VoiceFocusSurface({
? livekit.captureState
: undefined;
const captureError = failedState
- ? captureFailureDescription(failedState.reason)
+ ? captureFailureDescription(failedState.reason, t)
: undefined;
const inputInterrupted =
captureActive &&
@@ -158,36 +164,38 @@ export function VoiceFocusSurface({
!voice.boundDevice);
const visibleItems = idle ? [] : voice.transcriptItems;
const partial = idle || captureError ? undefined : voice.partialTranscript;
- const title = recoveryFailed
- ? "Recording saved. Transcript recovery paused"
+ const titleMessage = recoveryFailed
+ ? m.titleRecoveryPaused
: inputInterrupted
- ? "Recording input was interrupted"
+ ? m.titleInputInterrupted
: standby
- ? "Recording is continuing in another tab"
+ ? m.titleOtherTab
: idle
? armTitle(armStatus)
: focusTitle(captureStatus);
- const subtitle = recoveryFailed
- ? "Retry transcription or download the original recording."
+ const title = t(titleMessage);
+ const subtitleMessage = recoveryFailed
+ ? m.subtitleRecoveryPaused
: inputInterrupted
- ? "Recorded content can still be saved."
+ ? m.subtitleInputInterrupted
: idle
? armSubtitle(armStatus, microphonePermission)
: focusSubtitle(captureStatus);
+ const subtitle = subtitleMessage && t(subtitleMessage);
const statusMessage =
!captureError &&
(inputReconnecting
- ? "Reconnecting microphone; audio delivery is not yet confirmed"
+ ? t(m.statusReconnectingMicrophone)
: livekit?.transcriptStatus === "recovering"
- ? "Reconnecting transcript updates; saved text will sync after reconnection"
+ ? t(m.statusReconnectingTranscript)
: livekit?.captureSyncStatus === "recovering"
- ? "Reconnecting recording status; waiting for server confirmation"
+ ? t(m.statusReconnectingRecording)
: transcriptIncomplete
? inputInterrupted
- ? "Some transcript segments are unconfirmed. Recovery will be attempted after stopping."
- : "Some transcript segments are unconfirmed. Recording continues; recovery will be attempted after stopping."
+ ? t(m.statusUnconfirmedAfterStop)
+ : t(m.statusUnconfirmed)
: finalizing
- ? "Generating recording and transcript files"
+ ? t(m.statusGeneratingFiles)
: undefined);
const surfaceError =
actionError ??
@@ -213,10 +221,11 @@ export function VoiceFocusSurface({
// window can sit at the bottom of the viewport; Stop asks inside that row.
const compactConfirmation = !shown;
// The listening title is the quiet default; anything else is news.
- const notice = captureActive && title !== listeningTitle ? title : undefined;
+ const notice =
+ captureActive && titleMessage !== m.titleListening ? title : undefined;
const tabs: { id: RecordingView; label: string }[] = [
- { id: "transcript", label: "Transcript" },
- { id: "ask", label: "Ask" },
+ { id: "transcript", label: t(m.transcriptTab) },
+ { id: "ask", label: t(m.askTab) },
];
const togglePause = () =>
run(async () => {
@@ -252,11 +261,11 @@ export function VoiceFocusSurface({
>
{panels ? (
<button
- aria-label={shown ? "Minimize recording" : "Open recording"}
+ aria-label={t(shown ? m.minimize : m.open)}
className={styles.windowButton}
disabled={confirmingStop}
onClick={() => onViewChange?.(shown ? undefined : "transcript")}
- title={shown ? "Minimize; recording continues" : "Open recording"}
+ title={t(shown ? m.minimizeHint : m.open)}
type="button"
>
{shown ? (
@@ -266,14 +275,14 @@ export function VoiceFocusSurface({
)}
</button>
) : null}
- <span className="flex-1">{pip ? null : "Meeting"}</span>
+ <span className="flex-1">{pip ? null : t(m.meeting)}</span>
{onFloat ? (
<button
- aria-label="Float recording window"
+ aria-label={t(m.float)}
className={styles.windowButton}
disabled={confirmingStop}
onClick={onFloat}
- title="Float over other tabs and apps"
+ title={t(m.floatHint)}
type="button"
>
<Icon icon={PictureInPictureOnIcon} />
@@ -281,10 +290,10 @@ export function VoiceFocusSurface({
) : null}
{onReturn ? (
<button
- aria-label="Return recording to Linger"
+ aria-label={t(m.returnToLinger)}
className={styles.windowButton}
onClick={onReturn}
- title="Back to Linger; recording continues"
+ title={t(m.returnHint)}
type="button"
>
<Icon icon={PictureInPictureExitIcon} />
@@ -296,7 +305,7 @@ export function VoiceFocusSurface({
<>
{titleBar}
<section
- aria-label="Hardware voice focus"
+ aria-label={t(m.surface)}
className={
pip
? "relative flex min-h-0 flex-1 flex-col bg-app-canvas text-app-ink"
@@ -318,11 +327,11 @@ export function VoiceFocusSurface({
<i />
</span>
<span
- aria-label="Recording duration"
+ aria-label={t(m.duration)}
className={`flex shrink-0 items-center gap-2 font-mono text-sm leading-5 tracking-normal tabular-nums ${paused ? "text-app-subtle" : "text-app-ink"}`}
>
<span className="sr-only">
- {paused ? "Recording paused" : "Recording"}
+ {t(paused ? m.recordingPaused : m.recording)}
</span>
<VoiceRecordingTime
pausedAt={pauseState.pausedAt}
@@ -345,13 +354,13 @@ export function VoiceFocusSurface({
<span className="flex-1" />
{captureActive ? (
<button
- aria-label={paused ? "Resume recording" : "Pause recording"}
+ aria-label={t(paused ? m.resumeRecording : m.pauseRecording)}
aria-pressed={paused}
className={styles.control}
data-active={paused || undefined}
disabled={standbyOrMic || actionPending}
onClick={() => void togglePause()}
- title={paused ? "Resume recording" : "Pause recording"}
+ title={t(paused ? m.resumeRecording : m.pauseRecording)}
type="button"
>
{paused ? (
@@ -360,16 +369,19 @@ export function VoiceFocusSurface({
<Icon icon={PauseIcon} size={14} />
)}
<span className="@max-[255px]:sr-only">
- {paused ? "Resume" : "Pause"}
+ {t(paused ? m.resume : m.pause)}
</span>
</button>
) : null}
<button
- aria-label={captureActive ? "Stop recording" : "Close recording"}
+ aria-label={t(captureActive ? m.stopRecording : m.closeRecording)}
className={styles.control}
+ // Only Close closes the window by voice; Stop ends the recording
+ // and asks first, as its English name never closed it.
+ data-voice-close={captureActive ? undefined : ""}
disabled={actionPending}
onClick={close}
- title={captureActive ? "Stop recording" : "Close recording"}
+ title={t(captureActive ? m.stopRecording : m.closeRecording)}
type="button"
>
{captureActive ? (
@@ -378,7 +390,7 @@ export function VoiceFocusSurface({
<Icon icon={Cancel01Icon} size={14} />
)}
<span className="@max-[255px]:sr-only">
- {captureActive ? "Stop" : "Close"}
+ {t(captureActive ? m.stop : commonMessages.close)}
</span>
</button>
</header>
@@ -401,7 +413,7 @@ export function VoiceFocusSurface({
}
id="recording-stop-title"
>
- Stop recording?
+ {t(m.confirmStopTitle)}
</h2>
<p
className={
@@ -409,8 +421,7 @@ export function VoiceFocusSurface({
}
id="recording-stop-description"
>
- The recording is saved and summarized. You can find it in
- Meetings.
+ {t(m.confirmStopBody)}
</p>
<div
className={
@@ -431,7 +442,7 @@ export function VoiceFocusSurface({
type="button"
>
<Icon icon={StopIcon} size={12} />
- Stop & save
+ {t(m.stopAndSave)}
</button>
<button
// eslint-disable-next-line jsx-a11y/no-autofocus -- the safe choice is focused on purpose because the user just asked to stop recording
@@ -446,7 +457,7 @@ export function VoiceFocusSurface({
}}
type="button"
>
- Keep recording
+ {t(m.keepRecording)}
</button>
</div>
</div>
@@ -456,7 +467,7 @@ export function VoiceFocusSurface({
<>
{panels ? (
<div
- aria-label="Recording views"
+ aria-label={t(m.views)}
className="flex shrink-0 items-center gap-1 border-b border-app-border px-4 py-2"
role="tablist"
>
@@ -508,7 +519,7 @@ export function VoiceFocusSurface({
>
<div className="flex w-full flex-col items-center gap-4 px-5 py-3">
<div
- aria-label="Voice focus transcript"
+ aria-label={t(m.transcript)}
aria-live="polite"
className="w-full space-y-1"
role="log"
@@ -528,20 +539,24 @@ export function VoiceFocusSurface({
) : null}
{visibleItems.length === 0 && !partial ? (
<p className="py-3 text-center text-[12px] leading-[18px] text-app-muted">
- {idle
- ? "This recording’s transcript will appear here. View previous transcripts in the chat."
- : captureError
- ? "No transcript is available yet."
- : "Listening…"}
+ {t(
+ idle
+ ? m.transcriptPlaceholder
+ : captureError
+ ? m.noTranscript
+ : m.listening,
+ )}
</p>
) : null}
{canStart ? (
<div className="flex justify-center pt-1">
<Button onClick={() => void arm()} tone="primary">
<Icon icon={Mic01Icon} size={16} />
- {captureFailed || recoveryFailed
- ? "Start new recording"
- : "Start recording"}
+ {t(
+ captureFailed || recoveryFailed
+ ? m.startNewRecording
+ : m.startRecording,
+ )}
</Button>
</div>
) : null}
@@ -561,8 +576,6 @@ export function VoiceFocusSurface({
);
}
-const listeningTitle = "I’m listening to the meeting...";
-
function VoiceFocusNotices({
finalizing,
gapCount,
@@ -584,6 +597,7 @@ function VoiceFocusNotices({
subtitle?: string;
surfaceError?: string;
}) {
+ const t = useT();
if (
!notice &&
!subtitle &&
@@ -622,8 +636,10 @@ function VoiceFocusNotices({
size={12}
/>
<span>
- Input missed {gapCount === 1 ? "once" : `${gapCount} times`} (
- {Math.max(1, Math.round(gapDurationMs / 1000))}s not recorded)
+ {t(m.inputMissed, {
+ count: gapCount,
+ seconds: Math.max(1, Math.round(gapDurationMs / 1000)),
+ })}
</span>
</p>
) : null}
@@ -646,7 +662,7 @@ function VoiceFocusNotices({
tone="ghost"
>
<Icon icon={Mic01Icon} size={14} />
- Reconnect microphone
+ {t(m.reconnectMicrophone)}
</Button>
</div>
) : null}
@@ -675,6 +691,10 @@ function speakerColor(label: string) {
}
function VoiceFocusTranscriptRow({ item }: { item: VoiceTranscriptItem }) {
+ const t = useT();
+ // The client names an unnamed speaker "Speaker N"; the number is kept.
+ const number = item.speakerLabel?.match(/^Speaker (\d+)$/)?.[1];
+ const speaker = number ? t(m.speaker, { number }) : item.speakerLabel;
// Town message rows: a 13px name line over 14px body text, starting
// straight with the speaker.
return (
@@ -683,7 +703,7 @@ function VoiceFocusTranscriptRow({ item }: { item: VoiceTranscriptItem }) {
<span
className={`text-[14px] leading-[18px] font-medium ${speakerColor(item.speakerLabel)}`}
>
- {item.speakerLabel}
+ {speaker}
</span>
) : null}
<p className="m-0 text-sm leading-5 text-app-body">{item.text}</p>
@@ -692,24 +712,24 @@ function VoiceFocusTranscriptRow({ item }: { item: VoiceTranscriptItem }) {
}
function focusTitle(captureStatus: VoiceCaptureState["status"]) {
- if (captureStatus === "failed") return "Recording save failed";
- if (captureStatus === "recovering")
- return "Recording saved; recovering transcript";
- if (captureStatus === "finalizing") return "Saving recording...";
- return listeningTitle;
+ if (captureStatus === "failed") return m.titleSaveFailed;
+ if (captureStatus === "recovering") return m.titleRecovering;
+ if (captureStatus === "finalizing") return m.titleSaving;
+ return m.titleListening;
}
-function focusSubtitle(captureStatus: VoiceCaptureState["status"]) {
- if (captureStatus === "failed")
- return "Received transcript segments remain available here.";
- if (captureStatus === "recovering")
- return "The microphone can be disconnected; recovery will continue in the background.";
- if (captureStatus === "finalizing")
- return "Finishing the transcript and audio file.";
+function focusSubtitle(
+ captureStatus: VoiceCaptureState["status"],
+): Message<string> | undefined {
+ if (captureStatus === "failed") return m.subtitleSaveFailed;
+ if (captureStatus === "recovering") return m.subtitleRecovering;
+ if (captureStatus === "finalizing") return m.subtitleSaving;
return undefined;
}
-function captureFailureDescription(reason: unknown): string {
+// The server's failure codes are worded here in English until they are
+// translated with the other server-sent text; the client's own fallback is not.
+function captureFailureDescription(reason: unknown, t: Translate): string {
const message =
reason instanceof Error
? reason.message
@@ -727,7 +747,7 @@ function captureFailureDescription(reason: unknown): string {
case "Voice Capture failed":
case undefined:
case "":
- return "The recording could not be saved.";
+ return t(m.saveFailed);
default:
return message;
}
diff --git a/apps/web/src/features/rooms/voice-control/voice-input-readiness.ts b/apps/web/src/features/rooms/voice-control/voice-input-readiness.ts
index cb961080..3d6dbef0 100644
--- a/apps/web/src/features/rooms/voice-control/voice-input-readiness.ts
+++ b/apps/web/src/features/rooms/voice-control/voice-input-readiness.ts
@@ -3,6 +3,8 @@ import {
TeamHubError,
TeamHubTransportError,
} from "@/features/teamhub/teamhub-error";
+import { translate } from "@/i18n/language";
+import { recordingMessages as m } from "./recording.messages";
export async function waitForVoiceInputReady(
read: (
@@ -47,5 +49,5 @@ export async function waitForVoiceInputReady(
setTimeout(resolve, Math.min(200, remaining)),
);
}
- throw new Error("Voice input did not become ready");
+ throw new Error(translate(m.inputNotReady));
}
diff --git a/apps/web/src/features/rooms/voice-control/voice-listener-connection.ts b/apps/web/src/features/rooms/voice-control/voice-listener-connection.ts
index bb381aa0..b6121d67 100644
--- a/apps/web/src/features/rooms/voice-control/voice-listener-connection.ts
+++ b/apps/web/src/features/rooms/voice-control/voice-listener-connection.ts
@@ -16,7 +16,10 @@ import {
type VoiceRequestScope,
waitForVoiceDelay as delay,
} from "@/features/teamhub/voice-request-scope";
+import { translate } from "@/i18n/language";
+import { VoiceMicrophoneError } from "./microphone-devices";
+import { recordingMessages as m } from "./recording.messages";
import type { VoiceListenerStatus } from "./voice-control-context";
import {
describeError,
@@ -76,12 +79,12 @@ export async function connectVoiceListener(
}
controller.signal.throwIfAborted();
const binding = refs.bindingRef.current;
- if (!binding) throw new Error("Connect a microphone before enabling voice");
+ if (!binding) throw new VoiceMicrophoneError("no-binding");
if (!refs.pageActiveRef.current && !refs.publisherLeaseRef.current) {
- throw new Error("Hardware voice is active in another tab");
+ throw new Error(translate(m.hardwareVoiceOtherTab));
}
if (refs.composerLeaseRef.current)
- throw new Error("Composer is using the microphone");
+ throw new Error(translate(m.composerUsesMicrophone));
refs.manuallyDisabledRef.current = false;
if (!connection.automatic) resumeVoiceListening(tenantId);
connection.setListenerError(undefined);
diff --git a/apps/web/src/features/rooms/voice-control/voice-media-connection.ts b/apps/web/src/features/rooms/voice-control/voice-media-connection.ts
index 360035e8..720ebc87 100644
--- a/apps/web/src/features/rooms/voice-control/voice-media-connection.ts
+++ b/apps/web/src/features/rooms/voice-control/voice-media-connection.ts
@@ -14,6 +14,8 @@ import {
retryOnVoiceMediaAbort,
voiceMicrophoneConstraints,
} from "./microphone-devices";
+import { translate } from "@/i18n/language";
+import { recordingMessages as m } from "./recording.messages";
/**
* The LiveKit steps the recording window and Voice Mode share. Each caller
@@ -155,7 +157,7 @@ export async function bounded<T>(
operation,
new Promise<never>((_, reject) => {
timer = setTimeout(
- () => reject(new Error("Voice request timed out.")),
+ () => reject(new Error(translate(m.requestTimedOut))),
milliseconds,
);
abort = () =>
diff --git a/apps/web/src/features/rooms/voice-control/voice-recovery-panel.tsx b/apps/web/src/features/rooms/voice-control/voice-recovery-panel.tsx
index cd9abdf3..80441d02 100644
--- a/apps/web/src/features/rooms/voice-control/voice-recovery-panel.tsx
+++ b/apps/web/src/features/rooms/voice-control/voice-recovery-panel.tsx
@@ -4,12 +4,16 @@ import { teamHubData } from "@/features/teamhub/teamhub-api";
import { useTeamHubRuntime } from "@/features/teamhub/teamhub-runtime";
import type { TeamHubVoiceCapture } from "@/features/teamhub/teamhub-types";
import { VoiceRequestScope } from "@/features/teamhub/voice-request-scope";
+import { translate } from "@/i18n/language";
+import { useT } from "@/i18n/use-translation";
+import { recordingMessages as m } from "./recording.messages";
export function VoiceRecoveryPanel({
capture,
}: {
capture: TeamHubVoiceCapture;
}) {
+ const t = useT();
const { client } = useTeamHubRuntime();
const [download, setDownload] = useState<string>();
const [error, setError] = useState<{ captureId: string; message: string }>();
@@ -43,7 +47,7 @@ export function VoiceRecoveryPanel({
if (active)
setError({
captureId: capture.id,
- message: "Original recording download is temporarily unavailable",
+ message: translate(m.downloadUnavailable),
});
});
return () => {
@@ -63,16 +67,13 @@ export function VoiceRecoveryPanel({
const pending = pendingCaptureId === capture.id;
return (
<section
- aria-label="Recording transcript recovery"
+ aria-label={t(m.recovery)}
className="w-full rounded-lg border border-app-border bg-app-rail/40 p-4 text-[14px] leading-5 text-app-ink"
role="status"
>
- <p className="font-medium">Recording saved</p>
+ <p className="font-medium">{t(m.recordingSaved)}</p>
<p className="mt-1 text-app-muted">
- {failed
- ? "Transcript recovery is paused. Please retry."
- : `Recovering transcript ${progress}%. It will appear in this Room when complete.`}
- You can start a new recording.
+ {failed ? t(m.recoveryPausedBody) : t(m.recoveringBody, { progress })}
</p>
<div className="mt-2 flex items-center gap-3">
{download ? (
@@ -81,7 +82,7 @@ export function VoiceRecoveryPanel({
href={download}
download="original-recording.m4a"
>
- Download original recording
+ {t(m.downloadOriginal)}
</a>
) : null}
{failed ? (
@@ -110,8 +111,7 @@ export function VoiceRecoveryPanel({
if (activeRetryRef.current === request)
setError({
captureId: capture.id,
- message:
- "The retry request was not confirmed. Check progress or try again later.",
+ message: translate(m.retryNotConfirmed),
});
})
.finally(() => {
@@ -121,7 +121,7 @@ export function VoiceRecoveryPanel({
});
}}
>
- Retry transcription
+ {t(m.retryTranscription)}
</Button>
) : null}
</div>
diff --git a/apps/web/src/features/rooms/voice-control/voice-transcript-viewport.tsx b/apps/web/src/features/rooms/voice-control/voice-transcript-viewport.tsx
index 36a1e590..54e02a34 100644
--- a/apps/web/src/features/rooms/voice-control/voice-transcript-viewport.tsx
+++ b/apps/web/src/features/rooms/voice-control/voice-transcript-viewport.tsx
@@ -2,6 +2,8 @@ import { ArrowDown02Icon } from "@hugeicons/core-free-icons";
import { useLayoutEffect, useRef, useState, type ReactNode } from "react";
import { Icon } from "@/components/ui/icon";
import { Button } from "@/components/ui/button";
+import { useT } from "@/i18n/use-translation";
+import { recordingMessages as m } from "./recording.messages";
/** Layout/scroll anchoring must not be mistaken for a request to read history. */
export function VoiceTranscriptViewport({
@@ -11,6 +13,7 @@ export function VoiceTranscriptViewport({
children: ReactNode;
revealLatestKey?: string;
}) {
+ const t = useT();
const viewportRef = useRef<HTMLDivElement>(null);
const contentRef = useRef<HTMLDivElement>(null);
const followingRef = useRef(true);
@@ -106,7 +109,7 @@ export function VoiceTranscriptViewport({
return (
<div className="relative flex min-h-0 flex-1 flex-col">
<div
- aria-label="Transcript scroll area"
+ aria-label={t(m.transcriptScrollArea)}
className="workspace-scrollbar min-h-0 flex-1 overflow-y-auto"
ref={viewportRef}
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex -- keyboard-focusable scroll region so keyboard users can scroll it
@@ -126,7 +129,7 @@ export function VoiceTranscriptViewport({
}}
>
<Icon icon={ArrowDown02Icon} size={14} />
- Follow latest transcript
+ {t(m.followLatest)}
</Button>
) : null}
</div>
diff --git a/apps/web/src/features/teamhub/voice-request-scope.ts b/apps/web/src/features/teamhub/voice-request-scope.ts
index e8896c02..86217fcb 100644
--- a/apps/web/src/features/teamhub/voice-request-scope.ts
+++ b/apps/web/src/features/teamhub/voice-request-scope.ts
@@ -1,4 +1,6 @@
import { TeamHubTransportError } from "@/features/teamhub/teamhub-error";
+import { translate } from "@/i18n/language";
+import { voiceRequestMessages as m } from "./voice-request.messages";
export function abortVoiceRequest(
controller: AbortController | undefined,
@@ -36,9 +38,9 @@ export class VoiceRequestScope {
return await operation(controller.signal);
} catch (cause) {
if (timedOut && !parent?.aborted)
- throw new TeamHubTransportError("Voice request timed out");
+ throw new TeamHubTransportError(translate(m.timedOut));
if (cause instanceof TypeError && !controller.signal.aborted)
- throw new TeamHubTransportError("Voice response could not be read");
+ throw new TeamHubTransportError(translate(m.unreadable));
throw cause;
} finally {
clearTimeout(timer);
diff --git a/apps/web/src/features/teamhub/voice-request.messages.ts b/apps/web/src/features/teamhub/voice-request.messages.ts
new file mode 100644
index 00000000..b7031a02
--- /dev/null
+++ b/apps/web/src/features/teamhub/voice-request.messages.ts
@@ -0,0 +1,7 @@
+import { defineMessages } from "@/i18n/messages";
+
+/** Why a voice control request to TeamHub failed, as shown to the person. */
+export const voiceRequestMessages = defineMessages("voiceRequest", {
+ timedOut: "Voice request timed out",
+ unreadable: "Voice response could not be read",
+});
diff --git a/apps/web/src/i18n/locales/zh-CN.json b/apps/web/src/i18n/locales/zh-CN.json
index c0efaa9a..5d8da967 100644
--- a/apps/web/src/i18n/locales/zh-CN.json
+++ b/apps/web/src/i18n/locales/zh-CN.json
@@ -3247,5 +3247,190 @@
"zoomDiagramIn": "放大图表",
"fitDiagram": "适应窗口",
"diagramCanvas": "图表画布"
+ },
+ "recording": {
+ "window": "录音窗口",
+ "resizeWindow": "调整录音窗口大小",
+ "meeting": "会议",
+ "minimize": "最小化录音",
+ "minimizeHint": "最小化,录音会继续",
+ "open": "打开录音",
+ "float": "悬浮录音窗口",
+ "floatHint": "悬浮在其他标签页和应用上方",
+ "returnToLinger": "将录音放回 Linger",
+ "returnHint": "回到 Linger,录音会继续",
+ "surface": "录音区域",
+ "duration": "录音时长",
+ "recording": "正在录音",
+ "recordingPaused": "录音已暂停",
+ "pauseRecording": "暂停录音",
+ "resumeRecording": "继续录音",
+ "pause": "暂停",
+ "resume": "继续",
+ "stopRecording": "停止录音",
+ "closeRecording": "关闭录音",
+ "stop": "停止",
+ "confirmStopTitle": "停止录音?",
+ "confirmStopBody": "录音会被保存并生成摘要。你可以在“会议”中找到它。",
+ "stopAndSave": "停止并保存",
+ "keepRecording": "继续录音",
+ "views": "录音视图",
+ "transcriptTab": "转写内容",
+ "askTab": "提问",
+ "transcript": "录音转写内容",
+ "transcriptScrollArea": "转写内容滚动区域",
+ "followLatest": "跟随最新转写内容",
+ "transcriptPlaceholder": "这次录音的转写内容会显示在这里。之前的转写内容可以在对话中查看。",
+ "noTranscript": "还没有转写内容。",
+ "listening": "正在聆听…",
+ "startNewRecording": "开始新录音",
+ "startRecording": "开始录音",
+ "speaker": "发言人 {number}",
+ "reconnectMicrophone": "重新连接麦克风",
+ "inputMissed": {
+ "other": "输入中断 {count} 次({seconds} 秒未录入)"
+ },
+ "titleRecoveryPaused": "录音已保存,转写内容恢复已暂停",
+ "titleInputInterrupted": "录音输入中断了",
+ "titleOtherTab": "录音正在另一个标签页中继续",
+ "titleListening": "我正在聆听会议…",
+ "titleSaveFailed": "录音保存失败",
+ "titleRecovering": "录音已保存,正在恢复转写内容",
+ "titleSaving": "正在保存录音…",
+ "titleStarting": "正在开始录音…",
+ "titleNotStarted": "录音没有开始",
+ "titleReady": "可以开始录音了",
+ "subtitleRecoveryPaused": "请重试转写,或下载原始录音。",
+ "subtitleInputInterrupted": "已录下的内容仍可保存。",
+ "subtitleSaveFailed": "已收到的转写片段仍可在这里查看。",
+ "subtitleRecovering": "可以断开麦克风,恢复会在后台继续。",
+ "subtitleSaving": "正在完成转写内容和音频文件。",
+ "subtitleAllowMicrophone": "请在浏览器中允许使用麦克风,然后开始。",
+ "subtitleConnecting": "正在连接麦克风…",
+ "subtitleNotStarted": "请查看下方的错误,然后重新开始录音。",
+ "subtitleReady": "开始录音,记录这场会议。",
+ "statusReconnectingMicrophone": "正在重新连接麦克风,音频尚未确认送达",
+ "statusReconnectingTranscript": "正在重新连接转写更新,已保存的文字会在重连后同步",
+ "statusReconnectingRecording": "正在重新连接录音状态,等待服务器确认",
+ "statusUnconfirmedAfterStop": "部分转写片段尚未确认。停止后会尝试恢复。",
+ "statusUnconfirmed": "部分转写片段尚未确认。录音仍在继续,停止后会尝试恢复。",
+ "statusGeneratingFiles": "正在生成录音和转写文件",
+ "recovery": "录音转写内容恢复",
+ "recordingSaved": "录音已保存",
+ "recoveryPausedBody": "转写内容恢复已暂停,请重试。你可以开始新的录音。",
+ "recoveringBody": "正在恢复转写内容 {progress}%。完成后会显示在这个 Room 中。你可以开始新的录音。",
+ "downloadOriginal": "下载原始录音",
+ "retryTranscription": "重试转写",
+ "downloadUnavailable": "原始录音暂时无法下载",
+ "retryNotConfirmed": "重试请求没有得到确认。请查看进度,或稍后再试。",
+ "askLabel": "就这次录音提问",
+ "askPlaceholder": "提个问题,或让它做点事",
+ "sendQuestion": "发送问题",
+ "answers": "关于这次录音的回答",
+ "askEmpty": "问问说了什么、定了什么、还有什么没定,或者让 Another Me 做点事,比如起草一封跟进邮件。",
+ "basedOnRecording": "基于截至 {time} 的录音",
+ "answerFailed": "无法生成回答。",
+ "answering": "正在回答…",
+ "sendingToAnotherMe": "正在发送给 Another Me…",
+ "notSent": "未发送",
+ "sentToAnotherMe": "已发送给 Another Me",
+ "saveFailed": "无法保存录音。",
+ "microphoneBlocked": "麦克风权限被阻止。请在浏览器中允许后重新开始录音。",
+ "noMicrophone": "没有可用的麦克风。请连接一个后重新开始录音。",
+ "microphoneBusy": "麦克风正被其他应用使用。",
+ "microphoneDenied": "麦克风权限被拒绝",
+ "microphoneInterrupted": "麦克风连接中断了",
+ "microphoneUnavailable": "无法使用麦克风",
+ "noAudioInput": "没有可用的音频输入设备",
+ "microphoneTimedOut": "麦克风连接超时",
+ "connectMicrophone": "请先连接麦克风再开启语音",
+ "selectedMicrophoneUnavailable": "所选麦克风不可用",
+ "hardwareVoiceOtherTab": "硬件语音正在另一个标签页中使用",
+ "composerUsesMicrophone": "输入框正在使用麦克风",
+ "stopBeforeDisconnect": "请先停止录音,再断开麦克风",
+ "accessExpired": "语音权限已过期。请重新登录,或检查你对目标 Agent 的访问权限。",
+ "inputNotReady": "语音输入没有准备就绪",
+ "requestTimedOut": "语音请求超时。",
+ "selectTargetAgain": "请在 Agent 私聊中重新选择录音对象",
+ "anotherMeNotReady": "你的 Another Me 还不能录音",
+ "switchingTarget": "正在切换录音对象,请稍候",
+ "stopBeforeSwitching": "请先停止当前录音,再切换对象",
+ "startInDirectChat": "请在 Agent 私聊中开始录音"
+ },
+ "voiceChat": {
+ "addToVoice": "添加到语音",
+ "addedToVoice": "已添加到语音",
+ "addFile": "将 {filename} 添加到语音",
+ "fileAdded": "{filename} 已添加到语音",
+ "messageSelection": "选中的消息语音上下文",
+ "documentSelection": "选中的文档语音上下文",
+ "selections": "选中的语音材料",
+ "removeSelection": "移除来自 {title} 的选中内容",
+ "liveDraft": "实时语音草稿",
+ "addFailed": "无法添加这段选中内容,请再试一次。",
+ "onlyMessageText": "从其他 Room 只能添加消息文字。",
+ "selectionTooLong": "请从可用的文档或消息中选择最多 {characters} 个字符。",
+ "tooManySelections": "最多可添加 {selections} 段选中内容、共 {characters} 个字符。请先移除一段。",
+ "messageTooLong": "你的语音消息和引用内容超过了 {characters} 个字符。请移除一段选中内容,或缩短草稿。"
+ },
+ "voiceRequest": {
+ "timedOut": "语音请求超时",
+ "unreadable": "无法读取语音响应"
+ },
+ "voiceSession": {
+ "sessionLimit": "语音模式已达到单次使用上限。请退出后重新开始。",
+ "inputAhead": "语音输入超前于消息发送。草稿已保留,请重试,或退出后检查草稿。",
+ "couldNotContinue": "语音模式无法继续。你的文字已保留。",
+ "microphoneOtherTab": "麦克风正在另一个标签页中使用。",
+ "authorizationChanged": "语音模式的授权已变更。",
+ "transcriptionUnavailable": "语音转写不可用。",
+ "dictationNotConfirmed": "服务器没有确认仅用于对话的语音连接。",
+ "connectionLost": "语音连接已断开。未发送的文字已保留。",
+ "runtimeStopped": "语音 Runtime 在就绪前停止了。请检查配置的 ASR 服务商,然后再试一次。",
+ "recognitionDisconnected": "语音识别已断开。未发送的文字已保留。",
+ "microphoneDisconnectedKept": "麦克风已断开。未发送的文字已保留。",
+ "accessLost": "语音权限已失效。未发送的文字已保留。",
+ "runtimeUnavailable": "语音 Runtime 不可用({code})。请检查 ASR 服务商,然后再试一次。",
+ "runtimeNotReady": "语音 Runtime 在 {seconds} 秒内没有就绪。请确认语音 Runtime 和 ASR 服务商正在运行,然后再试一次。",
+ "finalTextMissing": "最后的语音文字没有送达。草稿已保留,请再试一次。",
+ "shutdownUnconfirmed": "结束语音时无法确认最后几句话。草稿已保留。",
+ "identityChanged": "结束语音时语音输入的身份发生了变化。草稿已保留。",
+ "liveStopped": "实时语音已停止({code})。",
+ "liveNotConfirmed": "服务器没有确认实时语音连接。",
+ "liveConnectionLost": "实时语音连接已断开。",
+ "liveRuntimeDisconnected": "实时语音 Runtime 已断开。",
+ "microphoneDisconnected": "麦克风已断开。",
+ "liveUnavailable": "实时语音不可用({code})。",
+ "liveNotReady": "实时语音在 {seconds} 秒内没有就绪。",
+ "continuingAsDictation": "实时语音已停止,改为听写继续。",
+ "continuingAsDictationWithReason": "实时语音已停止,改为听写继续。{reason}"
+ },
+ "voiceWindow": {
+ "window": "语音模式窗口",
+ "title": "语音模式",
+ "openConversation": "打开这个对话",
+ "retry": "从语音窗口重试语音消息",
+ "mute": "将语音模式静音",
+ "unmute": "取消语音模式静音",
+ "replySoundOn": "从语音窗口取消回复声音静音",
+ "replySoundOff": "从语音窗口将回复声音静音",
+ "returnToLinger": "将语音模式放回 Linger",
+ "returnHint": "回到 Linger,语音模式会继续",
+ "float": "悬浮语音模式窗口",
+ "floatHint": "悬浮在其他标签页和应用上方",
+ "shrink": "缩小语音模式窗口",
+ "expand": "放大语音模式窗口",
+ "end": "结束语音模式",
+ "resize": "调整语音模式窗口大小",
+ "dragHint": "拖动悬浮窗口来移动它或调整大小。",
+ "conversation": "语音模式对话",
+ "empty": "开始说话吧。你说的话和回复会显示在这里。",
+ "reply": "回复",
+ "working": "正在处理…",
+ "pendingSelections": {
+ "other": "下一轮会附带 {count} 段选中内容"
+ },
+ "resizeHint": "拖动以调整大小,或使用方向键",
+ "meetingTitle": "会议"
}
}