Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

feat(spaces): extract sharing, Settings, viewer, error, teleport and agents strings to i18n (CUA-1928) (#5580)

Francesco Bonacci48d6fa8532c3
diff --git a/apps/cua-spaces/src/App.tsx b/apps/cua-spaces/src/App.tsx
index c8ff0c2d48..e116655845 100644
--- a/apps/cua-spaces/src/App.tsx
+++ b/apps/cua-spaces/src/App.tsx
@@ -46,6 +46,7 @@ import { FleetContext, useFleetSync, viewerRequestFor } from "./state/cloud";
import { useTrayMenu } from "./state/trayMenu";
import { NEW_SPACE_DROP_ID, NEW_TILE_INDEX, initialState, reduce, type PortalState } from "./state/portal";
import { readMenuBar, type SwitcherTheme } from "./state/settings";
+import { t as tl, useT } from "./i18n";
export interface AppProps {
bridge: NativeBridge;
@@ -87,6 +88,7 @@ function reportBridgeError(operation: string, error: unknown) {
}
export function App({ bridge, fleet, teleport, spacesList, windowDrag, teleportApps, host, tray, now = Date.now, collapseDelayMs = SWITCH_COLLAPSE_MS, initial }: AppProps) {
+ const t = useT(["settings", "teleport"]);
const [state, dispatch] = useReducer(reduce, initial, (preset) => preset ?? initialState());
const [env, setEnv] = useState<PortalEnvironment | null>(null);
// Menu-bar presentation: when on, the ambient "N Spaces" tab is hidden and a
@@ -326,7 +328,7 @@ export function App({ bridge, fleet, teleport, spacesList, windowDrag, teleportA
const createSpaceAndTeleport = useCallback(
async (app: LocalApp | null, entry: Record<string, unknown> | null = null) => {
try {
- dispatch({ type: "notify", text: "Creating a Space…" });
+ dispatch({ type: "notify", text: tl("spaces:spaces.create.creating") });
// No location: the shell creates it where the default location says,
// from the default image.
const id = await fleetSync.createSpace();
@@ -334,7 +336,7 @@ export function App({ bridge, fleet, teleport, spacesList, windowDrag, teleportA
beginTeleportRef.current(id, name, app, entry);
} catch (error) {
reportBridgeError("create Space", error);
- dispatch({ type: "notify", text: "Couldn’t create a Space" });
+ dispatch({ type: "notify", text: tl("errors:errors.spaces.create_failed") });
}
},
[fleetSync],
@@ -1032,7 +1034,7 @@ export function App({ bridge, fleet, teleport, spacesList, windowDrag, teleportA
footer={
axNeeded ? (
<button type="button" className="ax-prompt" data-owns-enter onClick={enableWindowDrag}>
- Enable window dragging in System Settings → Privacy → Accessibility
+ {t("settings.accessibility.enable_window_drag")}
</button>
) : null
}
@@ -1045,7 +1047,7 @@ export function App({ bridge, fleet, teleport, spacesList, windowDrag, teleportA
className="teleport-sheet"
role="dialog"
aria-modal="true"
- aria-label={`Teleport an app to ${teleportState.spaceName}`}
+ aria-label={t("teleport.sheet.label", { name: teleportState.spaceName })}
onClick={(event) => event.stopPropagation()}
>
<AppTeleportPicker
diff --git a/apps/cua-spaces/src/components/AppTeleportPicker.tsx b/apps/cua-spaces/src/components/AppTeleportPicker.tsx
index 342792a6a1..fc2130a211 100644
--- a/apps/cua-spaces/src/components/AppTeleportPicker.tsx
+++ b/apps/cua-spaces/src/components/AppTeleportPicker.tsx
@@ -24,6 +24,7 @@ import { hasTauri } from "../native/bridge";
import { useGridLoads } from "./pickerLoads";
import { PickerTileView } from "./PickerTile";
import { SearchGlyph } from "./SearchGlyph";
+import { useT } from "../i18n";
/**
* "Teleport an app…": every app on this machine, classified by the cua SDK
@@ -60,6 +61,7 @@ export function AppTeleportPicker({
/** The home folder, for `~/...` paths; read from the shell when omitted. */
home?: string | null;
}) {
+ const t = useT(["teleport", "common"]);
const home = useHome(homeProp);
const controller = useMemo(
() =>
@@ -121,7 +123,7 @@ export function AppTeleportPicker({
switch (s.step) {
case "loading":
return (
- <Status title="Looking for apps…" spinner />
+ <Status title={t("teleport.app_picker.loading")} spinner />
);
case "pick":
return (
@@ -149,8 +151,8 @@ export function AppTeleportPicker({
type="search"
value={s.query}
autoFocus
- placeholder="Search apps"
- aria-label="Search apps"
+ placeholder={t("teleport.app_picker.search_placeholder")}
+ aria-label={t("teleport.app_picker.search_label")}
onChange={(ev) => controller.dispatch({ type: "query", query: ev.target.value })}
/>
</div>
@@ -168,7 +170,7 @@ export function AppTeleportPicker({
<footer className="hp-footer">
<div className="hp-footer-right">
<button type="button" className="hp-cancel" onClick={onClose}>
- Cancel
+ {t("common.action.cancel")}
</button>
<button
type="button"
@@ -194,7 +196,7 @@ export function AppTeleportPicker({
)}
<h1 className="hp-status-title">{e.name}</h1>
</header>
- <div className="ta-choices" role="radiogroup" aria-label="What moves">
+ <div className="ta-choices" role="radiogroup" aria-label={t("teleport.app_picker.what_moves_label")}>
{e.moves.map((m) => (
<label key={m} className="ta-choice">
<input
@@ -208,7 +210,7 @@ export function AppTeleportPicker({
))}
</div>
{sensitiveOptions(s).length > 0 && (
- <div className="ta-choices" aria-label="Also send">
+ <div className="ta-choices" aria-label={t("teleport.app_picker.also_send_label")}>
{sensitiveOptions(s).map((o) => (
<label key={o.group} className="ta-choice ta-optin">
<input
@@ -230,13 +232,13 @@ export function AppTeleportPicker({
<div key={f} className="ta-file">
<span title={f}>{displayPath(f, home)}</span>
<button type="button" className="hp-cancel" onClick={() => controller.dispatch({ type: "remove-file", path: f })}>
- Remove
+ {t("teleport.app_picker.remove_file")}
</button>
</div>
))}
{host.chooseFiles ? (
<button type="button" className="hp-button" onClick={() => void controller.chooseFiles()}>
- Add files or folders…
+ {t("teleport.app_picker.add_files")}
</button>
) : null}
</div>
@@ -245,12 +247,12 @@ export function AppTeleportPicker({
<footer className="hp-footer">
{s.entries ? (
<button type="button" className="hp-cancel" onClick={() => controller.dispatch({ type: "back" })}>
- Back
+ {t("common.action.back")}
</button>
) : null}
<div className="hp-footer-right">
<button type="button" className="hp-cancel" onClick={onClose}>
- Cancel
+ {t("common.action.cancel")}
</button>
<button
type="button"
@@ -258,7 +260,7 @@ export function AppTeleportPicker({
disabled={!canPlan(s)}
onClick={() => void controller.plan()}
>
- Review
+ {t("teleport.app_picker.review")}
</button>
</div>
</footer>
@@ -266,23 +268,23 @@ export function AppTeleportPicker({
);
}
case "planning":
- return <Status title={`Preparing ${s.entry?.name ?? "the teleport"}…`} spinner />;
+ return <Status title={t("teleport.app_picker.preparing", { name: s.entry?.name ?? t("teleport.app_picker.preparing_fallback") })} spinner />;
case "consent": {
const p = s.plan!;
return (
<div className="hp-consent ta-consent">
<header className="hp-consent-head">
<h1 className="hp-consent-title">
- Teleport {p.app.name} to {spaceName}?
+ {t("teleport.app_picker.consent_title", { app: p.app.name, space: spaceName })}
</h1>
</header>
- <ul className="hp-items" role="list" aria-label="What moves">
+ <ul className="hp-items" role="list" aria-label={t("teleport.app_picker.what_moves_label")}>
{p.consent.map((c) => (
<li key={`${c.kind}:${c.key}`} className="hp-item" data-sensitive={c.sensitive} data-kind={c.kind}>
<span className="hp-item-label" title={displayPaths(c.detail, home)}>
{displayPaths(c.label, home)}
</span>
- {c.sensitive && <span className="hp-flag">Secret</span>}
+ {c.sensitive && <span className="hp-flag">{t("teleport.app_picker.secret_flag")}</span>}
<span className="hp-item-meta">{c.bytes ? formatBytes(c.bytes) : ""}</span>
</li>
))}
@@ -299,17 +301,17 @@ export function AppTeleportPicker({
checked={s.acknowledged}
onChange={(ev) => controller.dispatch({ type: "acknowledge", value: ev.target.checked })}
/>
- <span>Send the secrets above</span>
+ <span>{t("teleport.app_picker.send_secrets")}</span>
</label>
)}
{p.sensitive && (
- <label className="ta-choice ta-save-to-keyvault" title="Keep this signed-in session sealed in your Cua Keyvault so it can be delivered again without asking again.">
+ <label className="ta-choice ta-save-to-keyvault" title={t("teleport.app_picker.keyvault_hint")}>
<input
type="checkbox"
checked={s.saveToKeyvault}
onChange={(ev) => controller.dispatch({ type: "save-to-keyvault", value: ev.target.checked })}
/>
- <span>Save to Keyvault for reuse</span>
+ <span>{t("teleport.app_picker.save_to_keyvault")}</span>
</label>
)}
{p.relayUnsealed && (
@@ -321,19 +323,19 @@ export function AppTeleportPicker({
controller.dispatch({ type: "acknowledge-relay-plaintext", value: ev.target.checked })
}
/>
- <span>Send without end-to-end encryption</span>
+ <span>{t("teleport.app_picker.send_unencrypted")}</span>
</label>
)}
<footer className="hp-footer">
<button type="button" className="hp-cancel" onClick={() => controller.dispatch({ type: "back" })}>
- Back
+ {t("common.action.back")}
</button>
<span className="hp-footer-note">
- {p.totalBytes ? `${formatBytes(p.totalBytes)} leaves this Mac` : "Nothing leaves this Mac"}
+ {p.totalBytes ? t("teleport.app_picker.bytes_leave", { size: formatBytes(p.totalBytes) }) : t("teleport.app_picker.nothing_leaves")}
</span>
<div className="hp-footer-right">
<button type="button" className="hp-cancel" onClick={onClose}>
- Cancel
+ {t("common.action.cancel")}
</button>
<button
type="button"
@@ -341,7 +343,7 @@ export function AppTeleportPicker({
disabled={!canConfirm(s)}
onClick={() => void controller.confirm()}
>
- Teleport
+ {t("teleport.app_picker.confirm")}
</button>
</div>
</footer>
@@ -354,38 +356,38 @@ export function AppTeleportPicker({
return (
<div className="hp-status">
<h1 className="hp-status-title">
- Teleporting {s.plan?.app.name} to {spaceName}…
+ {t("teleport.app_picker.running_title", { app: s.plan?.app.name, space: spaceName })}
</h1>
<div className="ta-bar" role="progressbar" aria-valuenow={pct} aria-valuemin={0} aria-valuemax={100}>
<span style={{ width: `${pct}%` }} />
</div>
- <p className="hp-status-hint">{last ? `${last.kind}: ${last.detail}` : "Starting…"}</p>
+ <p className="hp-status-hint">{last ? t("teleport.app_picker.event_line", { kind: last.kind, detail: last.detail }) : t("teleport.app_picker.starting")}</p>
</div>
);
}
case "done": {
const r = s.report!;
const parts = [
- r.installed.length ? `Installed ${r.installed.join(", ")}.` : "",
- r.sent.length ? `Sent ${r.sent.length} item(s).` : "",
- r.imported.length ? `Imported ${r.imported.length} item(s).` : "",
- r.launched ? "Opened." : "",
+ r.installed.length ? t("teleport.app_picker.done_installed", { apps: r.installed.join(", ") }) : "",
+ r.sent.length ? t("teleport.app_picker.done_sent", { count: r.sent.length }) : "",
+ r.imported.length ? t("teleport.app_picker.done_imported", { count: r.imported.length }) : "",
+ r.launched ? t("teleport.app_picker.done_opened") : "",
].filter(Boolean);
return (
<Status
- title={`${s.plan?.app.name ?? "The app"} is in ${spaceName}`}
+ title={t("teleport.app_picker.done_title", { app: s.plan?.app.name ?? t("teleport.app_picker.done_title_fallback"), space: spaceName })}
hint={parts.join(" ")}
- primary={{ label: "Done", onClick: onClose }}
+ primary={{ label: t("common.action.done"), onClick: onClose }}
/>
);
}
case "error":
return (
<Status
- title={`Could not teleport${s.entry ? ` ${s.entry.name}` : ""}`}
+ title={s.entry ? t("teleport.app_picker.error_title_named", { name: s.entry.name }) : t("teleport.app_picker.error_title")}
error={s.error ?? ""}
- secondary={{ label: "Back", onClick: () => controller.dispatch({ type: "back" }) }}
- primary={{ label: "Close", onClick: onClose }}
+ secondary={{ label: t("common.action.back"), onClick: () => controller.dispatch({ type: "back" }) }}
+ primary={{ label: t("common.action.close"), onClick: onClose }}
/>
);
}
diff --git a/apps/cua-spaces/src/components/ConnectCloudSheet.tsx b/apps/cua-spaces/src/components/ConnectCloudSheet.tsx
index 3456ac5d22..7c862a2c33 100644
--- a/apps/cua-spaces/src/components/ConnectCloudSheet.tsx
+++ b/apps/cua-spaces/src/components/ConnectCloudSheet.tsx
@@ -13,6 +13,7 @@ import {
} from '../model/cloudConnect';
import { connectInput, type CloudBridge } from '../native/cloud';
import { SmallSheet } from './Devices';
+import { useT } from "../i18n";
function message(error: unknown): string {
return error instanceof Error ? error.message : String(error);
@@ -34,6 +35,7 @@ export function ConnectCloudSheet({
onConnected: () => void;
onClose: () => void;
}) {
+ const t = useT("settings");
const [input, setInput] = useState<CloudConnectInput>({ providers: [] });
const [state, setState] = useState<CloudConnectState>(cloudConnectInitial);
const v = cloudConnectView(input, state);
@@ -107,7 +109,7 @@ export function ConnectCloudSheet({
}}
>
<h2 className="dv-sheet-title">{v.title}</h2>
- <ul className="sh-rows" role="radiogroup" aria-label="Clouds">
+ <ul className="sh-rows" role="radiogroup" aria-label={t("settings.cloud.clouds_label")}>
{v.rows.map((r) => (
<li key={r.id} className="sh-row">
<label className="dw-check">
@@ -119,7 +121,7 @@ export function ConnectCloudSheet({
/>
<span className="sh-who">{r.title}</span>
<span className="dv-sheet-text">{r.detail}</span>
- {r.found && <span aria-label="Sign-in found" title="Sign-in found">{'✓'}</span>}
+ {r.found && <span aria-label={t("settings.cloud.sign_in_found")} title={t("settings.cloud.sign_in_found")}>{'✓'}</span>}
</label>
</li>
))}
@@ -137,7 +139,7 @@ export function ConnectCloudSheet({
</label>
)}
{v.touches.length > 0 && (
- <div aria-label="What Cua will touch">
+ <div aria-label={t("settings.cloud.touches_label")}>
{v.touches.map((line) => (
<p key={line} className="dv-sheet-text">
{line}
@@ -146,7 +148,7 @@ export function ConnectCloudSheet({
</div>
)}
{v.checks.length > 0 && (
- <ul className="sh-rows" aria-label="Checks">
+ <ul className="sh-rows" aria-label={t("settings.cloud.checks_label")}>
{v.checks.map((c) => (
<li key={c.text} className="sh-row">
<span className={`status-dot ${c.ok ? 'status-running' : 'status-error'}`} aria-hidden="true" />
diff --git a/apps/cua-spaces/src/components/Devices.tsx b/apps/cua-spaces/src/components/Devices.tsx
index 7945c70d6c..44dcdb1d93 100644
--- a/apps/cua-spaces/src/components/Devices.tsx
+++ b/apps/cua-spaces/src/components/Devices.tsx
@@ -25,6 +25,7 @@ import type { DevicesBridge } from "../native/devices";
import { enrollSignals } from "../model/telemetry";
import { telemetryBridge } from "../native/telemetry";
import { relativeTime } from "./ThisMachinePanel";
+import { useT } from "../i18n";
/** How often the page (and the approval watch) reads the relay. */
export const DEVICES_POLL_MS = 60_000;
@@ -97,10 +98,11 @@ export function useDevices(bridge: DevicesBridge, signedIn: boolean, nowMs: () =
/** The main window's slim banner (enrollment needed, re-verification soon). */
export function DevicesBanner({ view, onEnroll }: { view: DevicesView | null; onEnroll: () => void }) {
+ const t = useT("devices");
const banner = view?.banner;
if (!banner) return null;
return (
- <div className="dw-banner dv-banner" data-tone={banner.tone} role="status" aria-label="Device enrollment">
+ <div className="dw-banner dv-banner" data-tone={banner.tone} role="status" aria-label={t("devices.banner.label")}>
<span>{banner.text}</span>
{banner.action === "enroll" && banner.actionLabel && (
<button type="button" className="dw-btn" onClick={onEnroll}>
@@ -135,11 +137,12 @@ export function DevicesSection({
onRevoke: (row: DeviceRow) => void;
onConfirmMachine: (machine: UnconfirmedMachine) => void;
}) {
+ const tr = useT("devices");
if (!signedIn || !view) {
return (
- <section className="st-group dv" aria-label="Devices">
+ <section className="st-group dv" aria-label={tr("devices.section.label")}>
<div className="st-head">
- <h3 className="st-title">Devices</h3>
+ <h3 className="st-title">{tr("devices.section.title")}</h3>
</div>
<div className="st-rows">
<p className="st-note">{signedIn ? (error ?? "Loading…") : "Sign in to Cua to see the devices that can reach your computers."}</p>
@@ -246,7 +249,7 @@ export function DevicesSection({
view.recent.map((a, i) => (
<div className="st-row" key={`${a.ts}-${i}`} data-notable={a.notable || undefined}>
<span className="st-label" title={a.text}>
- {a.notable && <span className="dv-notable" aria-label="Not one of your devices" />}
+ {a.notable && <span className="dv-notable" aria-label={tr("devices.recent.not_yours_label")} />}
{a.text}
</span>
<span className="st-value">{relativeTime(a.ts * 1000, nowMs)}</span>
@@ -298,6 +301,7 @@ export function EnrollSheet({
onEnrolled: () => void;
pollMs?: number;
}) {
+ const t = useT("devices");
const [state, setState] = useState(enrollInitial);
const stateRef = useRef(state);
// Every step goes through here: the core's reducer, and the usage events
@@ -367,7 +371,7 @@ export function EnrollSheet({
</div>
)}
{v.code && (
- <p className="dv-code" aria-label="One-time code">
+ <p className="dv-code" aria-label={t("devices.enroll.code_label")}>
{v.code}
</p>
)}
@@ -415,6 +419,7 @@ export function ApproveSheet({
onClose: () => void;
onDone: () => void;
}) {
+ const t = useT("devices");
const [state, setState] = useState(() => approveOpen(prompt));
const send = useCallback(
(action: ApproveSheetAction) => setState((s) => reduceApprove(s, action, devices)),
@@ -480,7 +485,7 @@ export function ApproveSheet({
)}
{needsPassphrase && (
<label className="dw-field">
- <span>Keyvault passphrase</span>
+ <span>{t("devices.approve.passphrase_label")}</span>
<input
className="dw-input"
type="password"
diff --git a/apps/cua-spaces/src/components/SettingsPanel.tsx b/apps/cua-spaces/src/components/SettingsPanel.tsx
index 87f1fe3219..a865b332d0 100644
--- a/apps/cua-spaces/src/components/SettingsPanel.tsx
+++ b/apps/cua-spaces/src/components/SettingsPanel.tsx
@@ -37,6 +37,7 @@ import type { Location } from "../model/types";
import { settingsPage, type SettingsRow, type SettingsSection, type SignInPhase } from "../model/window";
import { experimentsPage, settingsWithStorage } from "../model/experiments";
import { chooseExperimentRow, useExperiments } from "../state/experiments";
+import { t } from "../i18n";
import { MiddleText } from "./MiddleText";
import { SfIcon } from "./SfIcon";
@@ -336,7 +337,7 @@ export function SettingsPanel({
} catch (error) {
setPhase({
kind: "failed",
- message: error instanceof Error ? error.message : "Could not start sign-in",
+ message: error instanceof Error ? error.message : t("errors:errors.settings.sign_in_start_failed"),
});
}
}, [auth, onOpenExternal]);
diff --git a/apps/cua-spaces/src/components/ShareSheet.tsx b/apps/cua-spaces/src/components/ShareSheet.tsx
index deddb044eb..432e9f8574 100644
--- a/apps/cua-spaces/src/components/ShareSheet.tsx
+++ b/apps/cua-spaces/src/components/ShareSheet.tsx
@@ -19,6 +19,7 @@ import type { ShareBridge } from '../native/share';
import { featureSignals, shareSignals } from '../model/telemetry';
import { telemetryBridge } from '../native/telemetry';
import { SmallSheet } from './Devices';
+import { useT } from "../i18n";
function message(error: unknown): string {
return error instanceof Error ? error.message : String(error);
@@ -46,6 +47,7 @@ export function ShareSheet({
/** Opens a link (See Teams) in the browser. */
onOpenExternal?: (url: string) => void;
}) {
+ const t = useT("sharing");
const [shares, setShares] = useState<ShareEntryInput[]>([]);
// In a team that can share; null until read, or when it cannot be said.
const [hasTeam, setHasTeam] = useState<boolean | null>(null);
@@ -152,13 +154,13 @@ export function ShareSheet({
disabled={v.busy || closed}
onChange={(event) => void run({ type: 'set-who', who: event.target.value })}
/>
- {roleSelect(v.role, (role) => void run({ type: 'set-role', role }), 'Role')}
+ {roleSelect(v.role, (role) => void run({ type: 'set-role', role }), t("sharing.sheet.role_label"))}
<button type="submit" className="dw-btn dw-btn-primary" disabled={!v.canShare || closed}>
{v.shareLabel}
</button>
</div>
{v.hint && <p className="dv-sheet-text">{v.hint}</p>}
- <ul className="sh-rows" aria-label="Shared with">
+ <ul className="sh-rows" aria-label={t("sharing.sheet.shared_with_label")}>
{v.rows.length === 0 && <li className="sh-empty">{v.emptyText}</li>}
{v.rows.map((r) => (
<li key={r.who} className="sh-row">
diff --git a/apps/cua-spaces/src/components/TeleportDropZone.tsx b/apps/cua-spaces/src/components/TeleportDropZone.tsx
index 20e0bac3d7..8a22391019 100644
--- a/apps/cua-spaces/src/components/TeleportDropZone.tsx
+++ b/apps/cua-spaces/src/components/TeleportDropZone.tsx
@@ -30,6 +30,7 @@ import { detailCopy } from "../model/window";
import { Sym } from "./desktop/Sym";
import type { FileSendBridge, SentFile } from "../native/fileSend";
import { screenToClient, type WindowDragBridge } from "../native/windowDrag";
+import { useT } from "../i18n";
export interface TeleportDropZoneProps {
spaceId: string;
@@ -79,6 +80,7 @@ export default function TeleportDropZone({
windowDrag,
appDrop,
}: TeleportDropZoneProps) {
+ const t = useT("teleport");
const copy = detailCopy();
const [status, setStatus] = useState<Status>({ kind: "idle" });
const [over, setOver] = useState(false);
@@ -206,7 +208,7 @@ export default function TeleportDropZone({
const line = statusLine(status);
return (
- <section className="swl-section sl-teleport" aria-label={`Teleport to ${spaceName}`}>
+ <section className="swl-section sl-teleport" aria-label={t("teleport.drop_zone.label", { name: spaceName })}>
{/* No label here: the page's section title names it (one label per thing). */}
<div
ref={zoneRef}
diff --git a/apps/cua-spaces/src/components/TeleportPicker.tsx b/apps/cua-spaces/src/components/TeleportPicker.tsx
index 121f19eb08..ebc64fe1b0 100644
--- a/apps/cua-spaces/src/components/TeleportPicker.tsx
+++ b/apps/cua-spaces/src/components/TeleportPicker.tsx
@@ -20,6 +20,7 @@ import { AppTeleportPicker } from "./AppTeleportPicker";
import { useGridLoads } from "./pickerLoads";
import { PickerTileView, tileIconKey, tileThumbnailKey } from "./PickerTile";
import { SearchGlyph } from "./SearchGlyph";
+import { useT } from "../i18n";
/** The picker's tabs: the app catalog (default), this Mac's open windows,
* and the Space's own windows (streamed here). */
@@ -37,6 +38,7 @@ export function TeleportPicker({
bridge,
apps,
}: { bridge?: TeleportBridge; apps?: TeleportAppsBridge } = {}) {
+ const t = useT(["teleport", "common"]);
const teleport = useMemo(() => bridge ?? createTeleportBridge(), [bridge]);
const appsBridge = useMemo(() => apps ?? createTeleportAppsBridge(), [apps]);
const [config, setConfig] = useState<TeleportPickerConfig | null>(null);
@@ -136,11 +138,11 @@ export function TeleportPicker({
return (
<div className="hp-window">
<section className="hp-panel hp-panel-status" role="dialog" aria-modal="true">
- <h1 className="hp-status-title">Could not open the teleport picker</h1>
+ <h1 className="hp-status-title">{t("teleport.picker.open_failed")}</h1>
<p className="hp-status-error">{fatal}</p>
<div className="hp-status-actions">
<button type="button" className="hp-button" onClick={close}>
- Close
+ {t("common.action.close")}
</button>
</div>
</section>
@@ -152,7 +154,7 @@ export function TeleportPicker({
return (
<div className="hp-window">
<section className="hp-panel hp-panel-status" role="dialog" aria-modal="true">
- <p className="hp-status-hint">Preparing…</p>
+ <p className="hp-status-hint">{t("teleport.picker.preparing")}</p>
</section>
</div>
);
@@ -168,7 +170,7 @@ export function TeleportPicker({
return (
<div className="hp-window">
<section className="hp-panel" role="dialog" aria-modal="true" data-tab={tab}>
- <div className="hp-tabs" role="tablist" aria-label="Teleport">
+ <div className="hp-tabs" role="tablist" aria-label={t("teleport.picker.tabs_label")}>
{tabs.map((t) => (
<button
key={t.id}
@@ -252,6 +254,7 @@ function PickView({
onChoose: (entry: CatalogEntry) => void;
onCancel: () => void;
}) {
+ const t = useT(["teleport", "common"]);
const gridTab: PickerGridTab = tab === "space" ? "windows" : "space";
const [query, setQuery] = useState("");
const [notice, setNotice] = useState<string | null>(null);
@@ -384,8 +387,8 @@ function PickView({
type="search"
value={query}
autoFocus
- placeholder="Search"
- aria-label="Search"
+ placeholder={t("teleport.picker.search")}
+ aria-label={t("teleport.picker.search")}
onChange={(event) => setQuery(event.target.value)}
/>
</div>
@@ -416,7 +419,7 @@ function PickView({
)}
<div className="hp-footer-right">
<button type="button" className="hp-cancel" onClick={onCancel}>
- Cancel
+ {t("common.action.cancel")}
</button>
<button
type="button"
diff --git a/apps/cua-spaces/src/components/ThisMachinePanel.tsx b/apps/cua-spaces/src/components/ThisMachinePanel.tsx
index a4a9570ac6..87b73a4e03 100644
--- a/apps/cua-spaces/src/components/ThisMachinePanel.tsx
+++ b/apps/cua-spaces/src/components/ThisMachinePanel.tsx
@@ -6,6 +6,7 @@ import { useCallback, useEffect, useState } from "react";
import { hostPanel, settingChange, type HostAction, type HostActionId, type PermissionRow } from "../model/host";
import type { HostBridge, HostStatus } from "../native/host";
import { HostSetupForm } from "./HostSetupForm";
+import { useT } from "../i18n";
/** "just now", "5 min ago", "3 h ago", "2 d ago" (the viewer's locale). */
export function relativeTime(atMs: number, nowMs: number): string {
@@ -67,6 +68,7 @@ export function ThisMachinePanel({
/** Open with the setup form showing (captures). */
initialSetup?: boolean;
}) {
+ const t = useT("settings");
const [status, setStatus] = useState<HostStatus | null>(null);
const [setup, setSetup] = useState(initialSetup);
const [busy, setBusy] = useState(false);
@@ -164,7 +166,7 @@ export function ThisMachinePanel({
</dl>
)}
{view.toggles && view.toggles.length > 0 && (
- <div className="this-machine-settings" role="group" aria-label="Sharing">
+ <div className="this-machine-settings" role="group" aria-label={t("settings.this_machine.sharing_label")}>
{view.toggles.map((t) => (
<label className="create-cloud-toggle" key={t.id} title={t.help}>
<input
diff --git a/apps/cua-spaces/src/components/desktop/AgentsPages.tsx b/apps/cua-spaces/src/components/desktop/AgentsPages.tsx
index c9c1207a47..dab19e96fb 100644
--- a/apps/cua-spaces/src/components/desktop/AgentsPages.tsx
+++ b/apps/cua-spaces/src/components/desktop/AgentsPages.tsx
@@ -23,6 +23,7 @@ import type { AgentsBridge } from '../../native/persistent';
import { readSetting, writeSetting } from '../../state/settings';
import { featureSignals } from "../../model/telemetry";
import { telemetryBridge } from "../../native/telemetry";
+import { useT } from "../../i18n";
function message(error: unknown): string {
return error instanceof Error ? error.message : String(error);
@@ -88,6 +89,7 @@ function Group({ title, children }: { title?: string; children: React.ReactNode
* word; this loads its input and runs its requests through the daemon.
*/
export function AgentsPage({ bridge, thisMachine, now = Date.now }: { bridge: AgentsBridge; thisMachine: string | null; now?: () => number }) {
+ const t = useT("agents");
const [input, setInput] = useState<AgentsInput>({ agents: [], thisMachine });
// Persistent agents adoption: the page was opened.
useEffect(() => telemetryBridge().recordSignals(featureSignals("agents_page_open")), []);
@@ -218,15 +220,15 @@ export function AgentsPage({ bridge, thisMachine, now = Date.now }: { bridge: Ag
</Group>
<Group>
<div className="st-row">
- <input className="dw-input" aria-label="Title" placeholder="Title" value={d.form.title} onChange={(e) => void send({ type: 'set-title', title: e.target.value })} />
+ <input className="dw-input" aria-label={t("agents.routine.title")} placeholder={t("agents.routine.title")} value={d.form.title} onChange={(e) => void send({ type: 'set-title', title: e.target.value })} />
</div>
<div className="st-row">
- <input className="dw-input" aria-label="Prompt" placeholder="Prompt" value={d.form.prompt} onChange={(e) => void send({ type: 'set-prompt', prompt: e.target.value })} />
+ <input className="dw-input" aria-label={t("agents.routine.prompt")} placeholder={t("agents.routine.prompt")} value={d.form.prompt} onChange={(e) => void send({ type: 'set-prompt', prompt: e.target.value })} />
</div>
<div className="st-row">
<select
className="dw-input"
- aria-label="Schedule"
+ aria-label={t("agents.routine.schedule")}
value={d.form.schedule}
onChange={(e) => void send({ type: 'set-schedule', schedule: e.target.value as 'every' | 'daily' | 'weekly' })}
>
@@ -239,17 +241,17 @@ export function AgentsPage({ bridge, thisMachine, now = Date.now }: { bridge: Ag
{d.form.schedule === 'every' ? (
<input
className="dw-input"
- aria-label="Minutes"
+ aria-label={t("agents.routine.minutes")}
type="number"
min={1}
value={d.form.minutes}
onChange={(e) => void send({ type: 'set-minutes', minutes: Number(e.target.value) })}
/>
) : (
- <input className="dw-input" aria-label="Time" value={d.form.time} onChange={(e) => void send({ type: 'set-time', time: e.target.value })} />
+ <input className="dw-input" aria-label={t("agents.routine.time")} value={d.form.time} onChange={(e) => void send({ type: 'set-time', time: e.target.value })} />
)}
{d.form.schedule === 'weekly' && (
- <select className="dw-input" aria-label="Day" value={d.form.weekday} onChange={(e) => void send({ type: 'set-weekday', weekday: e.target.value })}>
+ <select className="dw-input" aria-label={t("agents.routine.day")} value={d.form.weekday} onChange={(e) => void send({ type: 'set-weekday', weekday: e.target.value })}>
{['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'].map((w) => (
<option key={w} value={w}>
{w}
diff --git a/apps/cua-spaces/src/i18n/index.ts b/apps/cua-spaces/src/i18n/index.ts
index 0a4cdc0eda..a1c70f74b0 100644
--- a/apps/cua-spaces/src/i18n/index.ts
+++ b/apps/cua-spaces/src/i18n/index.ts
@@ -109,7 +109,9 @@ void i18next
initAsync: false,
interpolation: { escapeValue: false }, // React escapes
returnNull: false,
- react: { useSuspense: false },
+ // Keys are unique across namespaces (`<ns>.…`), so a hook over several
+ // namespaces looks the key up in each, not only the first.
+ react: { useSuspense: false, nsMode: "fallback" },
});
/** The locale in use right now (not the OS locale). */
diff --git a/apps/cua-spaces/src/i18n/locales/en/agents.json b/apps/cua-spaces/src/i18n/locales/en/agents.json
index 0967ef424b..44d576ab9e 100644
--- a/apps/cua-spaces/src/i18n/locales/en/agents.json
+++ b/apps/cua-spaces/src/i18n/locales/en/agents.json
@@ -1 +1,8 @@
-{}
+{
+ "agents.routine.title": "Title",
+ "agents.routine.prompt": "Prompt",
+ "agents.routine.schedule": "Schedule",
+ "agents.routine.minutes": "Minutes",
+ "agents.routine.time": "Time",
+ "agents.routine.day": "Day"
+}
diff --git a/apps/cua-spaces/src/i18n/locales/en/common.json b/apps/cua-spaces/src/i18n/locales/en/common.json
index 905beeb0cf..be16c3b7e6 100644
--- a/apps/cua-spaces/src/i18n/locales/en/common.json
+++ b/apps/cua-spaces/src/i18n/locales/en/common.json
@@ -2,5 +2,12 @@
"common": {
"app_name": "Cua Spaces"
},
- "common.action.dismiss": "Dismiss"
+ "common.action.dismiss": "Dismiss",
+ "common.action.retry": "Retry",
+ "common.action.cancel": "Cancel",
+ "common.action.close": "Close",
+ "common.action.reconnect": "Reconnect",
+ "common.status.connecting": "Connecting…",
+ "common.action.back": "Back",
+ "common.action.done": "Done"
}
diff --git a/apps/cua-spaces/src/i18n/locales/en/devices.json b/apps/cua-spaces/src/i18n/locales/en/devices.json
index 0967ef424b..fff37ab359 100644
--- a/apps/cua-spaces/src/i18n/locales/en/devices.json
+++ b/apps/cua-spaces/src/i18n/locales/en/devices.json
@@ -1 +1,8 @@
-{}
+{
+ "devices.banner.label": "Device enrollment",
+ "devices.section.label": "Devices",
+ "devices.section.title": "Devices",
+ "devices.recent.not_yours_label": "Not one of your devices",
+ "devices.enroll.code_label": "One-time code",
+ "devices.approve.passphrase_label": "Keyvault passphrase"
+}
diff --git a/apps/cua-spaces/src/i18n/locales/en/errors.json b/apps/cua-spaces/src/i18n/locales/en/errors.json
index 0967ef424b..b20c30ccef 100644
--- a/apps/cua-spaces/src/i18n/locales/en/errors.json
+++ b/apps/cua-spaces/src/i18n/locales/en/errors.json
@@ -1 +1,9 @@
-{}
+{
+ "errors.viewer.stream_unreachable": "Could not reach the desktop stream.",
+ "errors.viewer.agent_open_failed": "Couldn't open {agent}: {reason}",
+ "errors.viewer.stop_hotspot_failed": "Couldn't stop sharing",
+ "errors.spaces.create_failed": "Couldn’t create a Space",
+ "errors.spaces.refresh_failed": "Could not refresh Spaces. Previously loaded rows may be out of date.",
+ "errors.spaces.load_failed": "Could not load Spaces. Try refreshing again.",
+ "errors.settings.sign_in_start_failed": "Could not start sign-in"
+}
diff --git a/apps/cua-spaces/src/i18n/locales/en/settings.json b/apps/cua-spaces/src/i18n/locales/en/settings.json
index 0967ef424b..d7827a4cb5 100644
--- a/apps/cua-spaces/src/i18n/locales/en/settings.json
+++ b/apps/cua-spaces/src/i18n/locales/en/settings.json
@@ -1 +1,8 @@
-{}
+{
+ "settings.this_machine.sharing_label": "Sharing",
+ "settings.cloud.clouds_label": "Clouds",
+ "settings.cloud.sign_in_found": "Sign-in found",
+ "settings.cloud.touches_label": "What Cua will touch",
+ "settings.cloud.checks_label": "Checks",
+ "settings.accessibility.enable_window_drag": "Enable window dragging in System Settings → Privacy → Accessibility"
+}
diff --git a/apps/cua-spaces/src/i18n/locales/en/sharing.json b/apps/cua-spaces/src/i18n/locales/en/sharing.json
index 0967ef424b..7820346e44 100644
--- a/apps/cua-spaces/src/i18n/locales/en/sharing.json
+++ b/apps/cua-spaces/src/i18n/locales/en/sharing.json
@@ -1 +1,4 @@
-{}
+{
+ "sharing.sheet.role_label": "Role",
+ "sharing.sheet.shared_with_label": "Shared with"
+}
diff --git a/apps/cua-spaces/src/i18n/locales/en/spaces.json b/apps/cua-spaces/src/i18n/locales/en/spaces.json
index 4c363e67a9..2e65450ce4 100644
--- a/apps/cua-spaces/src/i18n/locales/en/spaces.json
+++ b/apps/cua-spaces/src/i18n/locales/en/spaces.json
@@ -43,5 +43,22 @@
"spaces.wizard.steps_label": "Steps",
"spaces.wizard.cost_label": "Cost",
"spaces.wizard.resources_label": "Resources",
- "spaces.wizard.summary_label": "Summary"
+ "spaces.wizard.summary_label": "Summary",
+ "spaces.viewer.controls_label": "Space controls",
+ "spaces.viewer.launch_agent_hint": "Launch a coding agent for this Space",
+ "spaces.viewer.launch_agent": "Launch Agent",
+ "spaces.viewer.agents_menu_label": "Coding agents",
+ "spaces.viewer.stop_hotspot_hint": "Stop sharing your network with this Space",
+ "spaces.viewer.stop_hotspot": "Stop sharing network",
+ "spaces.viewer.teleport_hint": "Teleport an app into {name}",
+ "spaces.viewer.teleport": "Teleport an app…",
+ "spaces.viewer.connecting_to": "Connecting to {name}…",
+ "spaces.viewer.stream_ended": "Stream ended.",
+ "spaces.viewer.transferring": "Transferring the session…",
+ "spaces.viewer.agent_installing": "Still installing {agent}",
+ "spaces.viewer.agent_opened": "{agent} is open in a terminal in this Space; sign in there",
+ "spaces.window_stream.waiting_for": "Waiting for {name}…",
+ "spaces.window_stream.no_windows": "No open windows in {name} yet.",
+ "spaces.window_stream.close_window": "Close window",
+ "spaces.create.creating": "Creating a Space…"
}
diff --git a/apps/cua-spaces/src/i18n/locales/en/teleport.json b/apps/cua-spaces/src/i18n/locales/en/teleport.json
index 0967ef424b..661d07bb77 100644
--- a/apps/cua-spaces/src/i18n/locales/en/teleport.json
+++ b/apps/cua-spaces/src/i18n/locales/en/teleport.json
@@ -1 +1,38 @@
-{}
+{
+ "teleport.sheet.label": "Teleport an app to {name}",
+ "teleport.app_picker.loading": "Looking for apps…",
+ "teleport.app_picker.search_placeholder": "Search apps",
+ "teleport.app_picker.search_label": "Search apps",
+ "teleport.app_picker.what_moves_label": "What moves",
+ "teleport.app_picker.also_send_label": "Also send",
+ "teleport.app_picker.remove_file": "Remove",
+ "teleport.app_picker.add_files": "Add files or folders…",
+ "teleport.app_picker.review": "Review",
+ "teleport.app_picker.preparing": "Preparing {name}…",
+ "teleport.app_picker.preparing_fallback": "the teleport",
+ "teleport.app_picker.consent_title": "Teleport {app} to {space}?",
+ "teleport.app_picker.secret_flag": "Secret",
+ "teleport.app_picker.send_secrets": "Send the secrets above",
+ "teleport.app_picker.keyvault_hint": "Keep this signed-in session sealed in your Cua Keyvault so it can be delivered again without asking again.",
+ "teleport.app_picker.save_to_keyvault": "Save to Keyvault for reuse",
+ "teleport.app_picker.send_unencrypted": "Send without end-to-end encryption",
+ "teleport.app_picker.bytes_leave": "{size} leaves this Mac",
+ "teleport.app_picker.nothing_leaves": "Nothing leaves this Mac",
+ "teleport.app_picker.confirm": "Teleport",
+ "teleport.app_picker.running_title": "Teleporting {app} to {space}…",
+ "teleport.app_picker.starting": "Starting…",
+ "teleport.app_picker.event_line": "{kind}: {detail}",
+ "teleport.app_picker.done_installed": "Installed {apps}.",
+ "teleport.app_picker.done_sent": "Sent {count} item(s).",
+ "teleport.app_picker.done_imported": "Imported {count} item(s).",
+ "teleport.app_picker.done_opened": "Opened.",
+ "teleport.app_picker.done_title": "{app} is in {space}",
+ "teleport.app_picker.done_title_fallback": "The app",
+ "teleport.app_picker.error_title": "Could not teleport",
+ "teleport.app_picker.error_title_named": "Could not teleport {name}",
+ "teleport.picker.open_failed": "Could not open the teleport picker",
+ "teleport.picker.preparing": "Preparing…",
+ "teleport.picker.tabs_label": "Teleport",
+ "teleport.picker.search": "Search",
+ "teleport.drop_zone.label": "Teleport to {name}"
+}
diff --git a/apps/cua-spaces/src/i18n/noHardcodedStrings.test.ts b/apps/cua-spaces/src/i18n/noHardcodedStrings.test.ts
index 123dad8a4a..679b1a2816 100644
--- a/apps/cua-spaces/src/i18n/noHardcodedStrings.test.ts
+++ b/apps/cua-spaces/src/i18n/noHardcodedStrings.test.ts
@@ -15,21 +15,7 @@ declare const process: { cwd(): string };
* Paths relative to `src/` (files, or directories scanned recursively) whose
* strings are all extracted. Add yours when you finish an area.
*/
-export const MIGRATED: string[] = [
- "components/Onboarding.tsx",
- "components/InstallerFlow.tsx",
- "components/desktop/OnboardingPage.tsx",
- "components/SpaceTile.tsx",
- "components/Thumbnail.tsx",
- "components/SpacesStackMark.tsx",
- "components/Ambient.tsx",
- "components/FactList.tsx",
- "components/SpaceWindowList.tsx",
- "components/SpaceAgentList.tsx",
- "components/Switcher.tsx",
- "components/desktop/MainWindow.tsx",
- "components/desktop/NewSpaceWizard.tsx",
-];
+export const MIGRATED: string[] = ["."]; // every shared component; new UI strings go through t()
/** JSX attributes whose string values the user sees or hears. */
const VISIBLE_ATTRS = new Set(["title", "aria-label", "placeholder", "alt", "label"]);
diff --git a/apps/cua-spaces/src/state/cloud.tsx b/apps/cua-spaces/src/state/cloud.tsx
index 42a3450314..aa1e1bb329 100644
--- a/apps/cua-spaces/src/state/cloud.tsx
+++ b/apps/cua-spaces/src/state/cloud.tsx
@@ -13,6 +13,7 @@
* also what keeps the existing tests hermetic.
*/
+import { t } from "../i18n";
import { createContext, useCallback, useContext, useEffect, useRef, useState } from "react";
import {
@@ -189,8 +190,8 @@ export function useFleetSync(
} catch {
// Do not display server bodies or credential-bearing URLs.
const message = rosterLoaded.current
- ? "Could not refresh Spaces. Previously loaded rows may be out of date."
- : "Could not load Spaces. Try refreshing again.";
+ ? t("errors:errors.spaces.refresh_failed")
+ : t("errors:errors.spaces.load_failed");
setRosterError(message);
throw new Error(message);
} finally {
diff --git a/apps/cua-spaces/src/viewer/SpaceViewer.tsx b/apps/cua-spaces/src/viewer/SpaceViewer.tsx
index 1f33ea776f..cddf38ef86 100644
--- a/apps/cua-spaces/src/viewer/SpaceViewer.tsx
+++ b/apps/cua-spaces/src/viewer/SpaceViewer.tsx
@@ -37,6 +37,7 @@ import type { MediaStatus, MediaTicket } from "@cua/spacesd-html5/core/mediaSess
import { MediaCanvas, toMediaTicket } from "./WindowStream";
import { useAppDropTeleport } from "./useAppDrop";
import { PresenceOverlay } from "./presence/PresenceOverlay";
+import { useT } from "../i18n";
interface SpaceViewerProps {
fleet: FleetBridge;
@@ -104,6 +105,7 @@ const CODING_AGENTS: readonly CodingAgent[] = [
];
export function SpaceViewer({ fleet, transfer }: SpaceViewerProps) {
+ const t = useT(["spaces", "common", "errors"]);
const [boot, setBoot] = useState<Boot>({ kind: "loading" });
const transferBridge = useMemo(() => transfer ?? createTransferBridge(), [transfer]);
// An app dropped on the Space window opens "Teleport an app…" for it.
@@ -130,7 +132,7 @@ export function SpaceViewer({ fleet, transfer }: SpaceViewerProps) {
}, [fleet]);
if (boot.kind === "loading") {
- return <div className="viewer viewer-message">Connecting…</div>;
+ return <div className="viewer viewer-message">{t("common.status.connecting")}</div>;
}
if (boot.kind === "error") {
return <div className="viewer viewer-message viewer-error">{boot.message}</div>;
@@ -172,6 +174,7 @@ function ViewerSession({
config: ViewerConfig;
desktopStream: boolean;
}) {
+ const t = useT(["spaces", "common", "errors"]);
const [phase, setPhase] = useState<Phase>(desktopStream ? "connecting" : "unsupported");
// Bumped by Retry/Reconnect to force a fresh session.
const [attempt, setAttempt] = useState(0);
@@ -296,16 +299,16 @@ function ViewerSession({
return;
}
if (agentInstalling) {
- setTopbarNotice(`Still installing ${agentInstalling}`);
+ setTopbarNotice(t("spaces.viewer.agent_installing", { agent: agentInstalling }));
return;
}
setAgentInstalling(agent.name);
fleet
.launchAgentTerminal(space, agent.id)
- .then(() => setTopbarNotice(`${agent.name} is open in a terminal in this Space; sign in there`))
+ .then(() => setTopbarNotice(t("spaces.viewer.agent_opened", { agent: agent.name })))
.catch((error: unknown) =>
setTopbarNotice(
- `Couldn't open ${agent.name}: ${error instanceof Error ? error.message : String(error)}`,
+ t("errors.viewer.agent_open_failed", { agent: agent.name, reason: error instanceof Error ? error.message : String(error) }),
),
)
.finally(() => setAgentInstalling(null));
@@ -336,7 +339,7 @@ function ViewerSession({
};
}, [fleet, space.id]);
const stopHotspot = () => {
- void fleet.stopHotspot().catch(() => setTopbarNotice("Couldn't stop sharing"));
+ void fleet.stopHotspot().catch(() => setTopbarNotice(t("errors.viewer.stop_hotspot_failed")));
};
// Keep the Space window at the remote desktop's aspect ratio while windowed.
@@ -411,7 +414,7 @@ function ViewerSession({
// the whole window UNDER it (goes under the notch); this bar overlays
// the top strip so the notch sits invisibly within it. Buttons flank
// the centered notch via space-between.
- <div className="viewer-topbar" role="toolbar" aria-label="Space controls">
+ <div className="viewer-topbar" role="toolbar" aria-label={t("spaces.viewer.controls_label")}>
<div className="viewer-agent-menu" ref={agentMenuRef}>
<button
type="button"
@@ -419,15 +422,15 @@ function ViewerSession({
aria-haspopup="menu"
aria-expanded={agentMenuOpen}
onClick={() => setAgentMenuOpen((open) => !open)}
- title="Launch a coding agent for this Space"
+ title={t("spaces.viewer.launch_agent_hint")}
>
- Launch Agent
+ {t("spaces.viewer.launch_agent")}
</button>
{agentMenuOpen && (
<div
className="viewer-agent-menu-list"
role="menu"
- aria-label="Coding agents"
+ aria-label={t("spaces.viewer.agents_menu_label")}
onKeyDown={onAgentMenuKeyDown}
>
{CODING_AGENTS.map((agent) => (
@@ -449,10 +452,10 @@ function ViewerSession({
type="button"
className="viewer-hotspot-stop"
onClick={stopHotspot}
- title="Stop sharing your network with this Space"
+ title={t("spaces.viewer.stop_hotspot_hint")}
>
<HotspotGlyph className="viewer-hotspot-stop-glyph" />
- Stop sharing network
+ {t("spaces.viewer.stop_hotspot")}
</button>
)}
<div className="viewer-topbar-right">
@@ -469,9 +472,9 @@ function ViewerSession({
type="button"
className="viewer-topbar-btn"
onClick={openTeleport}
- title={`Teleport an app into ${space.name}`}
+ title={t("spaces.viewer.teleport_hint", { name: space.name })}
>
- Teleport an app…
+ {t("spaces.viewer.teleport")}
</button>
</div>
{(agentInstalling || topbarNotice) && (
@@ -523,20 +526,20 @@ function ViewerSession({
</div>
{phase !== "connected" && (
<div className="viewer-status">
- {phase === "connecting" && <span>Connecting to {space.name}…</span>}
+ {phase === "connecting" && <span>{t("spaces.viewer.connecting_to", { name: space.name })}</span>}
{phase === "disconnected" && (
<>
- <span>Stream ended.</span>
+ <span>{t("spaces.viewer.stream_ended")}</span>
<button type="button" className="ghost-button" onClick={retry}>
- Reconnect
+ {t("common.action.reconnect")}
</button>
</>
)}
{phase === "failed" && (
<>
- <span>Could not reach the desktop stream.</span>
+ <span>{t("errors.viewer.stream_unreachable")}</span>
<button type="button" className="ghost-button" onClick={retry}>
- Retry
+ {t("common.action.retry")}
</button>
</>
)}
@@ -568,6 +571,7 @@ export function TransferOverlayView({
onRetry: () => void;
onCancel: () => void;
}) {
+ const t = useT(["spaces", "common", "errors"]);
const isError = state.phase === "error";
const progress = transferProgress(state);
const sizeLabel = transferSizeLabel(state);
@@ -582,14 +586,14 @@ export function TransferOverlayView({
</p>
<div className="viewer-transfer-actions">
<button type="button" className="ghost-button" onClick={onRetry}>
- Retry
+ {t("common.action.retry")}
</button>
<button
type="button"
className="ghost-button viewer-transfer-cancel"
onClick={onCancel}
>
- Cancel
+ {t("common.action.cancel")}
</button>
</div>
</>
@@ -619,7 +623,7 @@ export function TransferOverlayView({
<div className="viewer-transfer-bar" data-testid="transfer-bar" aria-hidden="true">
<span className="viewer-transfer-sweep" />
</div>
- <p className="viewer-transfer-hint">Transferring the session…</p>
+ <p className="viewer-transfer-hint">{t("spaces.viewer.transferring")}</p>
</>
)}
</div>
diff --git a/apps/cua-spaces/src/viewer/WindowStream.tsx b/apps/cua-spaces/src/viewer/WindowStream.tsx
index 248d1b7faf..0f69f4ee16 100644
--- a/apps/cua-spaces/src/viewer/WindowStream.tsx
+++ b/apps/cua-spaces/src/viewer/WindowStream.tsx
@@ -32,6 +32,7 @@ import { createTeleportBridge } from "../native/teleport";
import { telemetryBridge, type TelemetryBridge } from "../native/telemetry";
import { PresenceOverlay } from "./presence/PresenceOverlay";
import { MediaSession, type MediaStatus, type MediaTicket, type SessionOpenedPayload } from "@cua/spacesd-html5/core/mediaSession";
+import { useT } from "../i18n";
export { applyCursorShape, cursorShapeToCss } from "./cursorShape";
@@ -177,6 +178,7 @@ type Boot =
| { kind: "ready"; config: ViewerConfig };
export function WindowStream({ fleet, listWindows }: WindowStreamProps) {
+ const t = useT(["spaces", "common"]);
const [boot, setBoot] = useState<Boot>({ kind: "loading" });
useEffect(() => {
@@ -195,7 +197,7 @@ export function WindowStream({ fleet, listWindows }: WindowStreamProps) {
};
}, [fleet]);
- if (boot.kind === "loading") return <div className="viewer viewer-message">Connecting…</div>;
+ if (boot.kind === "loading") return <div className="viewer viewer-message">{t("common.status.connecting")}</div>;
if (boot.kind === "error") {
return <div className="viewer viewer-message viewer-error">{boot.message}</div>;
}
@@ -216,6 +218,7 @@ async function currentWindow() {
}
function SingleWindowStream({ fleet, config }: { fleet: FleetBridge; config: ViewerConfig }) {
+ const t = useT(["spaces", "common"]);
const target = config.targetWindow!;
const space = config.space;
const [status, setStatus] = useState<MediaStatus>("connecting");
@@ -343,7 +346,7 @@ function SingleWindowStream({ fleet, config }: { fleet: FleetBridge; config: Vie
<span>{detail ?? "The stream ended."}</span>
{!borrowed && (
<button type="button" className="ghost-button" onClick={() => setGeneration((g) => g + 1)}>
- Retry
+ {t("common.action.retry")}
</button>
)}
</>
@@ -375,6 +378,7 @@ function MultiWindowStream({
config: ViewerConfig;
listWindows: (spaceId: string) => Promise<RemoteWindow[]>;
}) {
+ const t = useT(["spaces", "common"]);
const space = config.space;
const [windows, setWindows] = useState<RemoteWindow[]>([]);
const [status, setStatus] = useState<"waiting" | "connected">("waiting");
@@ -415,12 +419,12 @@ function MultiWindowStream({
{status === "waiting" && (
<div className="window-stream-status">
<span className="window-stream-spinner" aria-hidden="true" />
- <span>Waiting for {space.name}…</span>
+ <span>{t("spaces.window_stream.waiting_for", { name: space.name })}</span>
</div>
)}
{status === "connected" && windows.length === 0 && (
<div className="window-stream-status">
- <span>No open windows in {space.name} yet.</span>
+ <span>{t("spaces.window_stream.no_windows", { name: space.name })}</span>
</div>
)}
</div>
@@ -438,6 +442,7 @@ function WindowPanel({
win: RemoteWindow;
index: number;
}) {
+ const t = useT(["spaces", "common"]);
const [pos, setPos] = useState({ x: 30 + ((index * 40) % 300), y: 24 + ((index * 36) % 220) });
const [title, setTitle] = useState(win.title);
const [badge, setBadge] = useState("");
@@ -473,7 +478,7 @@ function WindowPanel({
<button
type="button"
className="ws-frame-close"
- aria-label="Close window"
+ aria-label={t("spaces.window_stream.close_window")}
onClick={() => {
const id = sessionRef.current?.id;
if (id) void fleet.closeStream(spaceId, id).catch(() => {});