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 onboarding and installer strings to i18n (CUA-1928) (#5577)

Francesco Bonaccia0a81853fbb9
diff --git a/apps/cua-spaces/src/components/InstallerFlow.tsx b/apps/cua-spaces/src/components/InstallerFlow.tsx
index 2af12c3a37..0c27d7d861 100644
--- a/apps/cua-spaces/src/components/InstallerFlow.tsx
+++ b/apps/cua-spaces/src/components/InstallerFlow.tsx
@@ -4,6 +4,7 @@
import { type ReactElement, type ReactNode, useEffect, useMemo, useRef, useState } from "react";
import { core } from "../core";
+import { useT } from "../i18n";
import { hostOs, permissionRows } from "../model/host";
import {
initialOnboarding,
@@ -118,6 +119,7 @@ export function InstallerFlow({
telemetry?: TelemetryBridge;
onDone: (mode: OnboardingMode) => void;
}) {
+ const t = useT("installer");
// Settings, Experiments decide the pages (Cua Volume's only with it on).
const [state, setState] = useState<OnboardingState>(() =>
reduceOnboarding(
@@ -500,7 +502,7 @@ export function InstallerFlow({
return (
<section
className="shelf create-cloud onboarding installer"
- aria-label="Set up Cua"
+ aria-label={t("installer.flow.label")}
data-step={view.step}
data-layout={view.step === "welcome" ? "center" : "split"}
>
@@ -510,7 +512,7 @@ export function InstallerFlow({
</span>
)}
{body}
- <ol className="installer-steps installer-dots" aria-label="Setup steps">
+ <ol className="installer-steps installer-dots" aria-label={t("installer.flow.steps_label")}>
{view.dots.map((d) => (
<li key={d.step} aria-current={d.current ? "step" : undefined} aria-label={d.label} title={d.label} />
))}
@@ -525,6 +527,7 @@ export function InstallerFlow({
* clipboard on click and says "Copied".
*/
function PromptList({ prompts }: { prompts: string[] }) {
+ const t = useT("installer");
const [copied, setCopied] = useState<string | null>(null);
const timer = useRef<number | undefined>(undefined);
useEffect(() => () => window.clearTimeout(timer.current), []);
@@ -541,7 +544,7 @@ function PromptList({ prompts }: { prompts: string[] }) {
return (
<div className="ob-prompts">
<p className="ob-prompts-label" id="ob-prompts-label">
- Try asking your agent:
+ {t("installer.prompts.label")}
</p>
<ul className="ob-prompts-list" aria-labelledby="ob-prompts-label">
{prompts.map((p) => (
@@ -549,7 +552,7 @@ function PromptList({ prompts }: { prompts: string[] }) {
<button type="button" className="ob-prompt" data-owns-enter onClick={() => copy(p)}>
<span>{`\u201C${p}\u201D`}</span>
<span className="ob-prompt-copied" aria-live="polite">
- {copied === p ? "Copied" : ""}
+ {copied === p ? t("installer.prompts.copied") : ""}
</span>
</button>
</li>
@@ -861,6 +864,7 @@ function AgentsStep({
installer: InstallerBridge;
onNext: (configured: string[]) => void;
}) {
+ const t = useT("installer");
const copy = onboardingCopy();
const [report, setReport] = useState<AgentDetectReport | null>(null);
const [error, setError] = useState<string | null>(null);
@@ -933,7 +937,7 @@ function AgentsStep({
</button>
}
>
- <ul className="installer-agents" aria-label="Setup results">
+ <ul className="installer-agents" aria-label={t("installer.agents.results_label")}>
{summaries.map(({ agent, s }) => (
<li key={agent.id} className={s.failed.length ? "installer-agent failed" : "installer-agent"}>
<span className="installer-agent-name" title={s.text}>
@@ -978,7 +982,7 @@ function AgentsStep({
{!report && !error && <p className="host-setup-lede">{copy.agentsLooking}</p>}
{report && installed.length === 0 && <p className="host-setup-lede">{copy.agentsNone}</p>}
{installed.length > 0 && (
- <fieldset className="installer-agents" aria-label="Detected agents">
+ <fieldset className="installer-agents" aria-label={t("installer.agents.detected_label")}>
{installed.map((a) => (
<label key={a.id} className="create-cloud-toggle installer-agent">
<input type="checkbox" checked={selected.has(a.id)} onChange={() => toggle(a.id)} />
diff --git a/apps/cua-spaces/src/components/Onboarding.tsx b/apps/cua-spaces/src/components/Onboarding.tsx
index ce96ae0026..225da59fe8 100644
--- a/apps/cua-spaces/src/components/Onboarding.tsx
+++ b/apps/cua-spaces/src/components/Onboarding.tsx
@@ -8,6 +8,7 @@ import { initialOnboarding, onboardingView, type OnboardingView } from "../model
import type { HostBridge, HostStatus, OnboardingMode } from "../native/host";
import { HostSetupForm } from "./HostSetupForm";
import { Page } from "./desktop/OnboardingPage";
+import { useT } from "../i18n";
/**
* First run: what is this machine for?
@@ -39,6 +40,7 @@ export function Onboarding({
identity?: string;
onDone: (mode: OnboardingMode, status?: HostStatus) => void;
}) {
+ const t = useT("onboarding");
const view = viewProp ?? onboardingView({ ...initialOnboarding(installerMode ?? null, identity ?? null), step: "mode" });
const [form, setForm] = useState(view.preselectedMode === "host");
// Choosing only selects; Continue (or Enter) moves on. "Access other
@@ -111,7 +113,7 @@ export function Onboarding({
))}
</div>
<p className="host-setup-lede" data-testid="mode-later">
- Change it later from This computer in your Spaces list.
+ {t("onboarding.mode.change_later")}
</p>
{view.notice && (
<p className="onboarding-telemetry-notice" data-testid="telemetry-notice">
diff --git a/apps/cua-spaces/src/i18n/locales/en/installer.json b/apps/cua-spaces/src/i18n/locales/en/installer.json
index 0967ef424b..0d26009425 100644
--- a/apps/cua-spaces/src/i18n/locales/en/installer.json
+++ b/apps/cua-spaces/src/i18n/locales/en/installer.json
@@ -1 +1,8 @@
-{}
+{
+ "installer.flow.label": "Set up Cua",
+ "installer.flow.steps_label": "Setup steps",
+ "installer.prompts.label": "Try asking your agent:",
+ "installer.prompts.copied": "Copied",
+ "installer.agents.results_label": "Setup results",
+ "installer.agents.detected_label": "Detected agents"
+}
diff --git a/apps/cua-spaces/src/i18n/locales/en/onboarding.json b/apps/cua-spaces/src/i18n/locales/en/onboarding.json
index 0967ef424b..622feb24d6 100644
--- a/apps/cua-spaces/src/i18n/locales/en/onboarding.json
+++ b/apps/cua-spaces/src/i18n/locales/en/onboarding.json
@@ -1 +1,3 @@
-{}
+{
+ "onboarding.mode.change_later": "Change it later from This computer in your Spaces list."
+}
diff --git a/apps/cua-spaces/src/i18n/noHardcodedStrings.test.ts b/apps/cua-spaces/src/i18n/noHardcodedStrings.test.ts
index 7afc20405f..7c35c02997 100644
--- a/apps/cua-spaces/src/i18n/noHardcodedStrings.test.ts
+++ b/apps/cua-spaces/src/i18n/noHardcodedStrings.test.ts
@@ -15,7 +15,11 @@ 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[] = [];
+export const MIGRATED: string[] = [
+ "components/Onboarding.tsx",
+ "components/InstallerFlow.tsx",
+ "components/desktop/OnboardingPage.tsx",
+];
/** JSX attributes whose string values the user sees or hears. */
const VISIBLE_ATTRS = new Set(["title", "aria-label", "placeholder", "alt", "label"]);