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.

3.1 KB
Raw Blame

Translating UI strings

The shared web UI uses i18next with ICU messages. English (en) is the source; zh-Hans, ko, pt-BR, ja and es are generated by CI and bundled, so edit en only and never hand-edit another language.

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:
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.

Translations

  • When locales/en/*.json changes on main, .github/workflows/i18n-translate-spaces.yml runs scripts/i18n-translate.mjs: it translates only new or changed keys (hash per key in src/i18n/i18n.lock.json) with Claude Sonnet through the LiteLLM gateway, validates them, and opens a PR labelled i18n. Run it by hand from the Actions tab (optionally locales, force).
  • Needs the repository secrets LITELLM_BASE_URL and LITELLM_API_KEY (optional variable I18N_MODEL, default claude-sonnet-5-5). Locally: I18N_BASE_URL=... I18N_API_KEY=... node scripts/i18n-translate.mjs, or --provider claude-cli to use the claude CLI.
  • src/i18n/glossary.json holds the do-not-translate list (Cua, Cua Spaces, Spaces, Cua Driver, Teams, Pro, Free and more), the tone guidance and preferred terms per language. Change it, then rerun with --force.
  • Checks before a PR: valid ICU, same variables, tags and select keywords as English, complete plural categories, product names kept, no empty values (blocking, retried with feedback). Length over 1.5x the English and back-translation meaning drift are listed in the PR body for review.
  • translations.test.ts keeps every committed string valid; renderOverflow.test.tsx renders Onboarding and Settings in every language and fails on raw keys, leftover ICU or controls wider than the display budget. Pixel-level overflow checks with Playwright can follow once apps/cua-spaces-web (which has the Playwright setup) is on i18n.
  • Settings has a Language row (System default plus the six languages). It saves cua.settings.locale, switches the UI live and reports ui_locale.