Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
feat(spaces): i18n infrastructure for the shared web UI (CUA-1928) (#5568)
Francesco Bonaccib30982f2a78d
diff --git a/apps/cua-spaces/docs/i18n.md b/apps/cua-spaces/docs/i18n.mdnew file mode 100644index 0000000000..78d2dafd67--- /dev/null+++ b/apps/cua-spaces/docs/i18n.md@@ -0,0 +1,29 @@+# Translating UI strings++The shared web UI uses i18next with ICU messages. Only English (`en`) is bundled for now; translations are generated in CI later, so edit `en` only.++## Add a string++1. Pick the namespace for the area (`common`, `onboarding`, `spaces`, `sharing`, `billing`, `settings`, `teleport`, `agents`, `devices`, `installer`, `errors`) and add the key to `src/i18n/locales/en/<ns>.json`.+2. Name it `<area>.<screen_or_component>.<element>` in lower snake case, by role, never by its English text: `sharing.sheet.invite_button`.+3. Use it:++```tsx+import { useT } from "../i18n";++const t = useT("sharing");+<button title={t("sharing.sheet.invite_button_hint")}>{t("sharing.sheet.invite_button")}</button>;+```++Outside React, use `t("sharing:sheet.invite_button")` from `src/i18n`.++## Rules++- Write the whole sentence in one key. Never concatenate pieces.+- Variables and plurals use ICU: `"{count, plural, one {# Space} other {# Spaces}}"`, called as `t("spaces.list.count", { count })`.+- Rust returns error codes and variables, never English. Map them to `errors` keys in the UI.+- Keep product names (Cua, Spaces, Cua Driver, Teams, Pro) as they are.++## Guardrail++`src/i18n/noHardcodedStrings.test.ts` fails on JSX text and on `title`, `aria-label`, `placeholder`, `alt` and `label` string literals in the files listed in `MIGRATED`. When you finish extracting a file or directory (paths relative to `src/`), add it to that list in the same PR.diff --git a/apps/cua-spaces/package.json b/apps/cua-spaces/package.jsonindex a0d426b909..5ba7ed3bc0 100644--- a/apps/cua-spaces/package.json+++ b/apps/cua-spaces/package.json@@ -22,8 +22,12 @@"@tauri-apps/api": "^2.5.0","@tauri-apps/plugin-process": "^2.0.0","@tauri-apps/plugin-updater": "^2.0.0",+ "i18next": "^26.5.2",+ "i18next-icu": "^2.6.1",+ "intl-messageformat": "^12.1.3","react": "^19.1.0",- "react-dom": "^19.1.0"+ "react-dom": "^19.1.0",+ "react-i18next": "^17.1.0"},"devDependencies": {"@tauri-apps/cli": "^2.5.0",diff --git a/apps/cua-spaces/pnpm-lock.yaml b/apps/cua-spaces/pnpm-lock.yamlindex 54365f1766..db9e47d201 100644--- a/apps/cua-spaces/pnpm-lock.yaml+++ b/apps/cua-spaces/pnpm-lock.yaml@@ -17,12 +17,24 @@ importers:'@tauri-apps/plugin-updater':specifier: ^2.0.0version: 2.11.0+ i18next:+ specifier: ^26.5.2+ version: 26.5.2([email protected])+ i18next-icu:+ specifier: ^2.6.1+ version: 2.6.1([email protected])+ intl-messageformat:+ specifier: ^12.1.3+ version: 12.1.3react:specifier: ^19.1.0version: 19.2.8react-dom:specifier: ^19.1.0version: 19.2.8([email protected])+ react-i18next:+ specifier: ^17.1.0+ version: 17.1.0([email protected]([email protected]))([email protected]([email protected]))([email protected])([email protected])devDependencies:'@tauri-apps/cli':specifier: ^2.5.0@@ -340,6 +352,15 @@ packages:cpu: [x64]os: [win32]+ '@formatjs/[email protected]':+ resolution: {integrity: sha512-zXfhLpvA6T7+efdt9JLbBwZ00tT7NsBMDVnDu8rpHeNNv8KfRZAMo2gkG0k9lK/Nzc//3kJ9pImsfuJxk3KhUA==}++ '@formatjs/[email protected]':+ resolution: {integrity: sha512-Vnl7IOSyMRaP4Pjv48etkT2nlcIwzh4QWIa3hewzGlZZPBbft+TbMir4MijpDViOLN/1hvkGC10oYMuilsG+fw==}++ '@formatjs/[email protected]':+ resolution: {integrity: sha512-ca7tZMLpfHX3sUD7hP6gE/qr6Iq89EDd3ZLeRhbsB7r0UD55DGJq+tmFLzrGrnx5StahUevQmQQVtbDRHsfDHA==}+'@jridgewell/[email protected]':resolution: {integrity: sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==}@@ -361,6 +382,7 @@ packages:engines: {node: ^22.20 || ^24.12 || >=25}cpu: [x64]os: [linux]+ libc: [glibc]'@rolldown/[email protected]':resolution: {integrity: sha512-+d0F4MKMCbeVUJwG96uQ4SgAznZNSq93I3V+9NHA4OpvqG8mRCpGdKmK8l/dl02h2CCDHwW2FqilnTyDcAnqjA==}@@ -399,66 +421,79 @@ packages:resolution: {integrity: sha512-YDUNvVM85TI3g/1OpnqKP1h4NeW/j64DfWMf+G3M809xNk1bJSnpFp4sh83NpmVE5DXnkh8ULor4LTVZKoYLHw==}cpu: [arm]os: [linux]+ libc: [glibc]'@rollup/[email protected]':resolution: {integrity: sha512-7Mcn71p9ZuQFAj+h+dhQXy/yeLePRS2yKRnmW1DijA9thKO5qap0GNOIQK4yQ6iP3SU0Mrb/yWo8h8vgRba8lw==}cpu: [arm]os: [linux]+ libc: [musl]'@rollup/[email protected]':resolution: {integrity: sha512-4YiLQTX6U4CSl0L9cluep9A9W6UmTfqBDc2/CH6wlu54pl4E7Jn3cOD8oxzvBDEGk/JMKgJ47C8g+radF7mwvg==}cpu: [arm64]os: [linux]+ libc: [glibc]'@rollup/[email protected]':resolution: {integrity: sha512-2ra8F7w8OquwZN9z2/fKFnli69wa8PLwaVzRMIPGb13ByMJwC28Fbp8YcVGoUhlYMTt7j5j9bNgpysrN2UM+vw==}cpu: [arm64]os: [linux]+ libc: [musl]'@rollup/[email protected]':resolution: {integrity: sha512-Sy20ncyhjmBP0Ml+UvQbimjlk6VFgjW5uNP+qqwHB00mTE8Bl2C1TuHTlRwK2YoXeZbee5lP2XevBWVkAQAtSQ==}cpu: [loong64]os: [linux]+ libc: [glibc]'@rollup/[email protected]':resolution: {integrity: sha512-noITLp8oNjYliPnGWmLyelIHwULGqbHloQHGw1rtxbWhTuWooRpnZarZQJ1y9EUC4szuCusCc+HEpUtxpIwYvA==}cpu: [loong64]os: [linux]+ libc: [musl]'@rollup/[email protected]':resolution: {integrity: sha512-hlxxXd+F1mWiAcaFR7Sv9ZQT6m6UfI8+Vy/kFJzztq2pDMU/0wZ9sish0iszNZvsQDo8Gc0i5yuFEOz5dDf6fA==}cpu: [ppc64]os: [linux]+ libc: [glibc]'@rollup/[email protected]':resolution: {integrity: sha512-EF7OpqQTQ/BvGqLzUi4rEHuagCV9MugAUXSHemwPW5vxZ75RR+jxO/2j95Ph2dalMpFHSVECjRoioHZgA9zOYA==}cpu: [ppc64]os: [linux]+ libc: [musl]'@rollup/[email protected]':resolution: {integrity: sha512-wQO3JesW9PRkwlabQ27y7sPfVOOTLRG73I4F2UYHG5PXun3J9U3y+b7ezVKSYbsvSKGQ1k1cq8Qlun4C9kLt3w==}cpu: [riscv64]os: [linux]+ libc: [glibc]'@rollup/[email protected]':resolution: {integrity: sha512-ouAGwhO6wHRXdnOVCOsB0tRFkA7nhNB2Nwax6oECXN0YiN8EYUTBAOudADOB1PI+yDL61TeNx/u7MVCzksNbkQ==}cpu: [riscv64]os: [linux]+ libc: [musl]'@rollup/[email protected]':resolution: {integrity: sha512-q2R38Sn+1J8RxhfJ+T54wSWmyKXWec+9jgDfqO2AtArEqHO5R2aeayp5H5OYLr5UYDVGsVaZPEFUooMhYCdz5A==}cpu: [s390x]os: [linux]+ libc: [glibc]'@rollup/[email protected]':resolution: {integrity: sha512-gfI5T24WLLuFfSKw7Go/zDXjAAV0fny0swTaDv+WjK7vqcw4cRhFfdsyKL1n+ukI+ooBxn3bVQnyrn06WpI50w==}cpu: [x64]os: [linux]+ libc: [glibc]'@rollup/[email protected]':resolution: {integrity: sha512-4h6XqthmB4Hspji84wvgk+ElodTsGj+dbZqHJHHtKxj4mYq0ANSEEPX9ys3moJueqsRjwpaJYH7874Itwnj2ow==}cpu: [x64]os: [linux]+ libc: [musl]'@rollup/[email protected]':resolution: {integrity: sha512-dlfCOa87o1VAYegLQ9EKilx2JCeRofiyPGhTCmqnuXZ6bMPiycO1rq1+sKoulAp7pGLIsTIw+1x5R+zgh5LhhA==}@@ -516,30 +551,35 @@ packages:engines: {node: '>= 10'}cpu: [arm64]os: [linux]+ libc: [glibc]'@tauri-apps/[email protected]':resolution: {integrity: sha512-v277UnT/fB64xAfSroL5N3Km3tLmvATWqJJw/wRI+g6o+HkeD0slyE7gOhNs1MbjE41R7bQOTxMVoL3aomUJmw==}engines: {node: '>= 10'}cpu: [arm64]os: [linux]+ libc: [musl]'@tauri-apps/[email protected]':resolution: {integrity: sha512-qqgNkQ2u1yZHxjhxsZaxUtRDW8dIqIYm33rx/mzwQv0SfY9x1B+iraj8vWeFiXjjSVVhEMepXSOts1TqPzvXNQ==}engines: {node: '>= 10'}cpu: [riscv64]os: [linux]+ libc: [glibc]'@tauri-apps/[email protected]':resolution: {integrity: sha512-2VRNWl84FOH0m2giiDkO2h0QXlcMJeX+zJDpI5kDIQAx6s+geF3v48F4DXfJez4GS/FdoDGnPnw1C2iYGbQ7bQ==}engines: {node: '>= 10'}cpu: [x64]os: [linux]+ libc: [glibc]'@tauri-apps/[email protected]':resolution: {integrity: sha512-o9GyhYor/nc7xarmwDE3ka2szuW3uuZzXjHWh64Q8YX5AtSgxdQkFWzrY4O8KiGtVNvFBI14H3Q49Qj5TOIP/A==}engines: {node: '>= 10'}cpu: [x64]os: [linux]+ libc: [musl]'@tauri-apps/[email protected]':resolution: {integrity: sha512-ld5Ehb598m0VkYyylRPNeCFsBe/km0jxis6KgMpl3IGY6I/i1RwQXO05I1AsXUXO2WC6AvB/Lw4qTf/asiuEiQ==}@@ -805,6 +845,9 @@ packages:resolution: {integrity: sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ==}engines: {node: '>=18'}+ resolution: {integrity: sha512-0zHsZJrK7S3K2aucXWL6ycoYJ/iNtIcFHC/nYQgFklPtrv5LpJctIiSCroWZWeuoXvuyFdzp6KzjJQ+OT5MfFw==}+resolution: {integrity: sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==}engines: {node: '>= 14'}@@ -813,6 +856,19 @@ packages:resolution: {integrity: sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==}engines: {node: '>= 14'}+ resolution: {integrity: sha512-ATlbwNqJoa3dUl2+eBcbU7gVgRulPB/rUy1ddLUDTrc9qO2Yjdg3agZSyTrpjhRXKRXxNvMXymoyXvE23/QhbA==}+ peerDependencies:+ intl-messageformat: '>=10.3.3 <13.0.0'++ resolution: {integrity: sha512-6fIXt//2MZNok3tULyjnypxe3vbsy3pV1bVg8p2x3yKrzZvp7z3T+wXx/88LQsATRdhyJeAUAvUxEtxsHdJ29w==}+ peerDependencies:+ typescript: ^5 || ^6 || ^7+ peerDependenciesMeta:+ typescript:+ optional: true+resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==}engines: {node: '>=0.10.0'}@@ -821,6 +877,9 @@ packages:resolution: {integrity: sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==}engines: {node: '>=8'}+ resolution: {integrity: sha512-JXi5wk8R/oSECKyxSIZ00VS8KG6MZkHM0qU4NS7RrvIWWXkiv3wVqGlCvEvyXiDvKlt2yqwZMiZGIv+I8rrnZQ==}+resolution: {integrity: sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==}@@ -918,6 +977,22 @@ packages:peerDependencies:react: ^19.2.8+ resolution: {integrity: sha512-4VouOnTDyvhvqXx6WZ+s3/cgSiaLutILdYkO3P1Ms+4qcKR7At+JP4Vi7IeHkVLyVV+DmN1l23Pn73UcwSGGPA==}+ peerDependencies:+ i18next: '>= 26.2.0'+ react: '>= 16.8.0'+ react-dom: '*'+ react-native: '*'+ typescript: ^5 || ^6 || ^7+ peerDependenciesMeta:+ react-dom:+ optional: true+ react-native:+ optional: true+ typescript:+ optional: true+resolution: {integrity: sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==}@@ -1026,6 +1101,11 @@ packages:peerDependencies:browserslist: '>= 4.21.0'+ resolution: {integrity: sha512-6L+EeigHMQhdaIPNIFUKwfWJSwWFQ8gJbJ2DLOs5sDIegTwR9fRxvnM3uciHKjIZhFz+KAv2emhWMRvDmMcY8A==}+ peerDependencies:+ react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0+resolution: {integrity: sha512-EbKSKh+bh1E1IFxeO0pg1n4dvoOTt0UDiXMd/qn++r98+jPO1xtJilvXldeuQ8giIB5IkpjCgMleHMNEsGH6pg==}engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0}@@ -1371,6 +1451,14 @@ snapshots:'@esbuild/[email protected]':optional: true+ '@formatjs/[email protected]': {}++ '@formatjs/[email protected]':+ dependencies:+ '@formatjs/icu-skeleton-parser': 2.1.12++ '@formatjs/[email protected]': {}+'@jridgewell/[email protected]':dependencies:'@jridgewell/sourcemap-codec': 1.6.0@@ -1779,6 +1867,8 @@ snapshots:dependencies:whatwg-encoding: 3.1.1+ [email protected]: {}+dependencies:agent-base: 7.1.4@@ -1793,12 +1883,25 @@ snapshots:transitivePeerDependencies:- supports-color+ dependencies:+ intl-messageformat: 12.1.3++ optionalDependencies:+ typescript: 5.9.3+dependencies:safer-buffer: 2.1.2+ dependencies:+ '@formatjs/fast-memoize': 3.1.7+ '@formatjs/icu-messageformat-parser': 3.5.21+@@ -1891,6 +1994,17 @@ snapshots:react: 19.2.8scheduler: 0.27.0+ [email protected]([email protected]([email protected]))([email protected]([email protected]))([email protected])([email protected]):+ dependencies:+ '@babel/runtime': 7.29.7+ html-parse-stringify: 4.0.1+ i18next: 26.5.2([email protected])+ react: 19.2.8+ use-sync-external-store: 1.7.0([email protected])+ optionalDependencies:+ react-dom: 19.2.8([email protected])+ typescript: 5.9.3+@@ -2001,6 +2115,10 @@ snapshots:escalade: 3.2.0picocolors: 1.1.1+ dependencies:+ react: 19.2.8+dependencies:cac: 6.7.14diff --git a/apps/cua-spaces/src/i18n/index.test.ts b/apps/cua-spaces/src/i18n/index.test.tsnew file mode 100644index 0000000000..c41c6ba451--- /dev/null+++ b/apps/cua-spaces/src/i18n/index.test.ts@@ -0,0 +1,40 @@+// SPDX-License-Identifier: FSL-1.1-MIT+// Copyright (c) 2026 Cua AI, Inc.++import { describe, expect, it } from "vitest";++import i18n, { currentUiLocale, detectLocale, matchLocale, t } from "./index";++describe("i18n", () => {+ it("starts in English, synchronously", () => {+ expect(currentUiLocale()).toBe("en");+ expect(t("common.app_name")).toBe("Cua Spaces");+ expect(i18n.t("missing.key", { defaultValue: "x" })).toBe("x");+ });++ it("formats ICU plurals", () => {+ i18n.addResource("en", "spaces", "test.count", "{count, plural, one {# Space} other {# Spaces}}");+ expect(t("spaces:test.count", { count: 1 })).toBe("1 Space");+ expect(t("spaces:test.count", { count: 3 })).toBe("3 Spaces");+ i18n.removeResourceBundle("en", "spaces");+ });++ it("matches tags by language, script and region", () => {+ const all = ["en", "zh-Hans", "pt-BR", "ja"];+ expect(matchLocale("zh-CN", all)).toBe("zh-Hans");+ expect(matchLocale("zh-SG", all)).toBe("zh-Hans");+ expect(matchLocale("zh-TW", all)).toBeNull();+ expect(matchLocale("pt-PT", all)).toBe("pt-BR");+ expect(matchLocale("ja-JP", all)).toBe("ja");+ expect(matchLocale("fr-FR", all)).toBeNull();+ expect(matchLocale("not a tag", all)).toBeNull();+ });++ it("prefers the saved setting, then browser languages, then en", () => {+ const all = ["en", "ja", "es"];+ expect(detectLocale("es", ["ja"], all)).toBe("es");+ expect(detectLocale(null, ["fr", "ja-JP"], all)).toBe("ja");+ expect(detectLocale("xx", ["fr"], all)).toBe("en");+ expect(detectLocale(null, ["ja"])).toBe("en"); // phase 1: only en is bundled+ });+});diff --git a/apps/cua-spaces/src/i18n/index.ts b/apps/cua-spaces/src/i18n/index.tsnew file mode 100644index 0000000000..0a4cdc0eda--- /dev/null+++ b/apps/cua-spaces/src/i18n/index.ts@@ -0,0 +1,130 @@+// SPDX-License-Identifier: FSL-1.1-MIT+// Copyright (c) 2026 Cua AI, Inc.++import i18next, { type TOptions } from "i18next";+import ICU from "i18next-icu";+import { initReactI18next, useTranslation } from "react-i18next";++import common from "./locales/en/common.json";+import onboarding from "./locales/en/onboarding.json";+import spaces from "./locales/en/spaces.json";+import sharing from "./locales/en/sharing.json";+import billing from "./locales/en/billing.json";+import settings from "./locales/en/settings.json";+import teleport from "./locales/en/teleport.json";+import agents from "./locales/en/agents.json";+import devices from "./locales/en/devices.json";+import installer from "./locales/en/installer.json";+import errors from "./locales/en/errors.json";++/** One namespace per product area. Keys: `<area>.<screen>.<element>`. */+export const NAMESPACES = [+ "common",+ "onboarding",+ "spaces",+ "sharing",+ "billing",+ "settings",+ "teleport",+ "agents",+ "devices",+ "installer",+ "errors",+] as const;+export type Namespace = (typeof NAMESPACES)[number];++/** Languages whose resources are bundled. Phase 1 ships English only. */+export const AVAILABLE_LOCALES = ["en"] as const;+export const FALLBACK_LOCALE = "en";++/** localStorage key for the Settings language choice (absent = system default). */+export const LOCALE_SETTING_KEY = "cua.settings.locale";++const resources = {+ en: { common, onboarding, spaces, sharing, billing, settings, teleport, agents, devices, installer, errors },+};++/**+ * Map a BCP 47 tag to one of the app's locale codes, or null when the+ * language is unknown. Matches by language, then script or region.+ */+export function matchLocale(tag: string, available: readonly string[] = AVAILABLE_LOCALES): string | null {+ let canonical: string;+ try {+ canonical = Intl.getCanonicalLocales(tag)[0] ?? "";+ } catch {+ return null;+ }+ if (!canonical) return null;+ const [lang = "", ...rest] = canonical.split("-");+ let candidate = canonical;+ if (lang === "zh") {+ const traditional = rest.some((p) => p === "Hant" || p === "TW" || p === "HK" || p === "MO");+ candidate = traditional ? "zh-Hant" : "zh-Hans"; // zh-CN, zh-SG, zh -> Hans+ } else if (lang === "pt") {+ candidate = "pt-BR"; // pt-PT and bare pt -> pt-BR+ } else {+ candidate = lang;+ }+ return available.includes(candidate) ? candidate : null;+}++function savedLocale(): string | null {+ try {+ return window.localStorage?.getItem(LOCALE_SETTING_KEY) || null;+ } catch {+ return null;+ }+}++/** Saved setting, then the OS/browser languages, then English. */+export function detectLocale(+ saved: string | null = savedLocale(),+ languages: readonly string[] = typeof navigator !== "undefined" ? (navigator.languages ?? []) : [],+ available: readonly string[] = AVAILABLE_LOCALES,+): string {+ if (saved) {+ const m = matchLocale(saved, available);+ if (m) return m;+ }+ for (const tag of languages) {+ const m = matchLocale(tag, available);+ if (m) return m;+ }+ return FALLBACK_LOCALE;+}++// Synchronous init with bundled resources: the first render is already in+// the right language, so there is no flash.+void i18next+ .use(new ICU())+ .use(initReactI18next)+ .init({+ resources,+ lng: detectLocale(),+ fallbackLng: FALLBACK_LOCALE,+ supportedLngs: [...AVAILABLE_LOCALES],+ ns: [...NAMESPACES],+ defaultNS: "common",+ initAsync: false,+ interpolation: { escapeValue: false }, // React escapes+ returnNull: false,+ react: { useSuspense: false },+ });++/** The locale in use right now (not the OS locale). */+export function currentUiLocale(): string {+ return i18next.resolvedLanguage ?? i18next.language ?? FALLBACK_LOCALE;+}++/** Non-React translate. Use `ns:key` or pass `{ ns }`. */+export function t(key: string, options?: TOptions): string {+ return i18next.t(key, options) as string;+}++/** React hook: `const t = useT("sharing")`. Re-renders on locale change. */+export function useT(ns: Namespace | Namespace[] = "common") {+ return useTranslation(ns).t;+}++export default i18next;diff --git a/apps/cua-spaces/src/i18n/locales/en/agents.json b/apps/cua-spaces/src/i18n/locales/en/agents.jsonnew file mode 100644index 0000000000..0967ef424b--- /dev/null+++ b/apps/cua-spaces/src/i18n/locales/en/agents.json@@ -0,0 +1 @@+{}diff --git a/apps/cua-spaces/src/i18n/locales/en/billing.json b/apps/cua-spaces/src/i18n/locales/en/billing.jsonnew file mode 100644index 0000000000..0967ef424b--- /dev/null+++ b/apps/cua-spaces/src/i18n/locales/en/billing.json@@ -0,0 +1 @@+{}diff --git a/apps/cua-spaces/src/i18n/locales/en/common.json b/apps/cua-spaces/src/i18n/locales/en/common.jsonnew file mode 100644index 0000000000..53d341c8bf--- /dev/null+++ b/apps/cua-spaces/src/i18n/locales/en/common.json@@ -0,0 +1,5 @@+{+ "common": {+ "app_name": "Cua Spaces"+ }+}diff --git a/apps/cua-spaces/src/i18n/locales/en/devices.json b/apps/cua-spaces/src/i18n/locales/en/devices.jsonnew file mode 100644index 0000000000..0967ef424b--- /dev/null+++ b/apps/cua-spaces/src/i18n/locales/en/devices.json@@ -0,0 +1 @@+{}diff --git a/apps/cua-spaces/src/i18n/locales/en/errors.json b/apps/cua-spaces/src/i18n/locales/en/errors.jsonnew file mode 100644index 0000000000..0967ef424b--- /dev/null+++ b/apps/cua-spaces/src/i18n/locales/en/errors.json@@ -0,0 +1 @@+{}diff --git a/apps/cua-spaces/src/i18n/locales/en/installer.json b/apps/cua-spaces/src/i18n/locales/en/installer.jsonnew file mode 100644index 0000000000..0967ef424b--- /dev/null+++ b/apps/cua-spaces/src/i18n/locales/en/installer.json@@ -0,0 +1 @@+{}diff --git a/apps/cua-spaces/src/i18n/locales/en/onboarding.json b/apps/cua-spaces/src/i18n/locales/en/onboarding.jsonnew file mode 100644index 0000000000..0967ef424b--- /dev/null+++ b/apps/cua-spaces/src/i18n/locales/en/onboarding.json@@ -0,0 +1 @@+{}diff --git a/apps/cua-spaces/src/i18n/locales/en/settings.json b/apps/cua-spaces/src/i18n/locales/en/settings.jsonnew file mode 100644index 0000000000..0967ef424b--- /dev/null+++ b/apps/cua-spaces/src/i18n/locales/en/settings.json@@ -0,0 +1 @@+{}diff --git a/apps/cua-spaces/src/i18n/locales/en/sharing.json b/apps/cua-spaces/src/i18n/locales/en/sharing.jsonnew file mode 100644index 0000000000..0967ef424b--- /dev/null+++ b/apps/cua-spaces/src/i18n/locales/en/sharing.json@@ -0,0 +1 @@+{}diff --git a/apps/cua-spaces/src/i18n/locales/en/spaces.json b/apps/cua-spaces/src/i18n/locales/en/spaces.jsonnew file mode 100644index 0000000000..0967ef424b--- /dev/null+++ b/apps/cua-spaces/src/i18n/locales/en/spaces.json@@ -0,0 +1 @@+{}diff --git a/apps/cua-spaces/src/i18n/locales/en/teleport.json b/apps/cua-spaces/src/i18n/locales/en/teleport.jsonnew file mode 100644index 0000000000..0967ef424b--- /dev/null+++ b/apps/cua-spaces/src/i18n/locales/en/teleport.json@@ -0,0 +1 @@+{}diff --git a/apps/cua-spaces/src/i18n/noHardcodedStrings.test.ts b/apps/cua-spaces/src/i18n/noHardcodedStrings.test.tsnew file mode 100644index 0000000000..7afc20405f--- /dev/null+++ b/apps/cua-spaces/src/i18n/noHardcodedStrings.test.ts@@ -0,0 +1,74 @@+// SPDX-License-Identifier: FSL-1.1-MIT+// Copyright (c) 2026 Cua AI, Inc.++// Fails on user-visible English left in components that have been moved to+// i18n. Area PRs add the files or directories they extract to MIGRATED.+// The webview build has no Node types; tests run in Node.+// @ts-expect-error node:fs is untyped here+import { readdirSync, readFileSync, statSync } from "node:fs";+import ts from "typescript";+import { describe, expect, it } from "vitest";++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[] = [];++/** JSX attributes whose string values the user sees or hears. */+const VISIBLE_ATTRS = new Set(["title", "aria-label", "placeholder", "alt", "label"]);++const hasLetters = (s: string) => /\p{L}/u.test(s);++function listTsx(rel: string, out: string[] = []): string[] {+ const abs = `${process.cwd()}/src/${rel}`;+ if (statSync(abs).isDirectory()) {+ for (const name of readdirSync(abs) as string[]) listTsx(`${rel}/${name}`, out);+ } else if (rel.endsWith(".tsx") && !/\.test\.tsx$/.test(rel)) {+ out.push(rel);+ }+ return out;+}++/** Hard-coded user-visible strings in one source file, as `line: text`. */+export function findHardcodedStrings(fileName: string, source: string): string[] {+ const sf = ts.createSourceFile(fileName, source, ts.ScriptTarget.ES2022, true, ts.ScriptKind.TSX);+ const found: string[] = [];+ const report = (node: ts.Node, text: string) => {+ const { line } = sf.getLineAndCharacterOfPosition(node.getStart(sf));+ found.push(`${fileName}:${line + 1}: ${JSON.stringify(text.trim())}`);+ };+ const visit = (node: ts.Node) => {+ if (ts.isJsxText(node) && hasLetters(node.text)) report(node, node.text);+ if (ts.isJsxAttribute(node) && VISIBLE_ATTRS.has(node.name.getText(sf)) && node.initializer) {+ const init = node.initializer;+ const lit = ts.isStringLiteral(init)+ ? init+ : ts.isJsxExpression(init) && init.expression &&+ (ts.isStringLiteral(init.expression) || ts.isNoSubstitutionTemplateLiteral(init.expression))+ ? init.expression+ : null;+ if (lit && hasLetters(lit.text)) report(node, lit.text);+ }+ ts.forEachChild(node, visit);+ };+ visit(sf);+ return found;+}++describe("no hard-coded UI strings in migrated files", () => {+ it("detects JSX text and visible attributes", () => {+ const src = `export const A = () => <button title="Save" aria-label={"Close"} data-x="abc">Hello {n}<i>{t("k")}</i></button>;`;+ expect(findHardcodedStrings("a.tsx", src)).toHaveLength(3);+ expect(findHardcodedStrings("b.tsx", `export const B = () => <b title={t("k")}>{t("k")} 42</b>;`)).toEqual([]);+ });++ it("finds none in MIGRATED files", () => {+ const offenders = MIGRATED.flatMap((rel) => listTsx(rel)).flatMap((rel) =>+ findHardcodedStrings(rel, readFileSync(`${process.cwd()}/src/${rel}`, "utf8")),+ );+ expect(offenders).toEqual([]);+ });+});diff --git a/apps/cua-spaces/src/main.tsx b/apps/cua-spaces/src/main.tsxindex 6db8288e33..d668cc2889 100644--- a/apps/cua-spaces/src/main.tsx+++ b/apps/cua-spaces/src/main.tsx@@ -7,6 +7,7 @@ import ReactDOM from "react-dom/client";import { App } from "./App";import { TeleportPicker } from "./components/TeleportPicker";import { MainWindow } from "./components/desktop/MainWindow";+import "./i18n";import { initCore } from "./core";import { createBridge, hasTauri } from "./native/bridge";import { createFleetBridge } from "./native/fleet";diff --git a/apps/cua-spaces/src/test/setup.ts b/apps/cua-spaces/src/test/setup.tsindex d2c7b789ef..28c008cc5c 100644--- a/apps/cua-spaces/src/test/setup.ts+++ b/apps/cua-spaces/src/test/setup.ts@@ -8,6 +8,7 @@ import { cleanup } from "@testing-library/react";import { readFileSync } from "node:fs";import { afterEach } from "vitest";+import "../i18n";import { initCoreSync } from "../core";// The app core (wasm), loaded once before any test imports a model.