Skip to content

UI: localize instances hardcoded labels#61073

Closed
rubensfox20 wants to merge 2 commits into
openclaw:mainfrom
rubensfox20:fix/instances-i18n-hardcoded-labels
Closed

UI: localize instances hardcoded labels#61073
rubensfox20 wants to merge 2 commits into
openclaw:mainfrom
rubensfox20:fix/instances-i18n-hardcoded-labels

Conversation

@rubensfox20

Copy link
Copy Markdown
Contributor

Summary

  • Problem: the Instances screen still had multiple hardcoded English labels, button states, and fallback strings even when a non-English locale was selected.
  • Why it matters: that leaves mixed-language UI in a top-level Control UI tab and weakens the locale experience.
  • What changed: moved the Instances screen labels and fallback copy into locale keys and wired instances.ts through t(...).
  • What did NOT change (scope boundary): no data flow changes, no presence logic changes, and no i18n work outside the Instances screen.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

Root Cause (if applicable)

  • Root cause: these Instances labels were still embedded directly in ui/src/ui/views/instances.ts instead of using locale files.
  • Missing detection / guardrail: locale infrastructure exists, but the screen still carried hardcoded copy.
  • Contributing context (if known): this PR intentionally keeps the cleanup to one screen.

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file:
    • ui/src/i18n/test/translate.test.ts
  • Scenario the test should lock in:
    • locale lookups for the new Instances keys resolve correctly.
  • Why this is the smallest reliable guardrail:
    • the change is isolated to locale keys plus one view.
  • Existing test that already covers this (if any):
    • ui/src/i18n/test/translate.test.ts
  • If no new test is added, why not:
    • existing i18n coverage plus successful UI build were sufficient for this scoped change.

User-visible / Behavior Changes

  • The Instances screen no longer shows those hardcoded English labels when pt-BR is selected.

Diagram (if applicable)

N/A

Security Impact (required)

  • New permissions/capabilities? (Yes/No): No
  • Secrets/tokens handling changed? (Yes/No): No
  • New/changed network calls? (Yes/No): No
  • Command/tool execution surface changed? (Yes/No): No
  • Data access scope changed? (Yes/No): No
  • If any Yes, explain risk + mitigation:

Repro + Verification

Environment

  • OS: Windows 10
  • Runtime/container: local Node/pnpm dev environment
  • Model/provider: N/A
  • Integration/channel (if any): Control UI Instances screen
  • Relevant config (redacted): N/A

Steps

  1. Switch the Control UI locale away from English.
  2. Open the Instances tab.
  3. Inspect the title, subtitle, host-visibility labels, loading button label, empty state, and entry metadata labels.

Expected

  • Those Instances labels should come from locale files instead of staying hardcoded in English.

Actual

  • The Instances screen now uses locale-backed strings for those labels.

Evidence

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Validation:

pnpm --dir ui build
pnpm test ui/src/i18n/test/translate.test.ts -- --project ui

Human Verification (required)

  • Verified scenarios:
    • reviewed the Instances diff to ensure only hardcoded labels were moved to locale keys
    • confirmed local build passes
    • confirmed targeted UI translation test passes
  • Edge cases checked:
    • preserved masking/reveal behavior for hosts and IPs
    • preserved presence rendering while localizing only labels/fallback text
  • What you did not verify:
    • full browser walkthrough of every locale on the Instances screen

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? (Yes/No): Yes
  • Config/env changes? (Yes/No): No
  • Migration needed? (Yes/No): No
  • If yes, exact upgrade steps:

Risks and Mitigations

  • Risk: other screens may still contain hardcoded strings.
    • Mitigation: this PR intentionally scopes the cleanup to the Instances screen only.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d4148133e5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ui/src/ui/views/instances.ts Outdated
@greptile-apps

greptile-apps Bot commented Apr 4, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR localizes the previously hardcoded English labels on the Instances screen by extracting them into instances.* locale keys in en.ts and pt-BR.ts, then wiring them through t(…) calls in ui/src/ui/views/instances.ts. The scope is narrow and intentional — only the Instances view is touched, and the English fallback path in the i18n manager ensures other locales (de, es, zh-CN, zh-TW) still display correctly.

  • New instances key block is correctly added to both en.ts and pt-BR.ts with matching shape and interpolation placeholders.
  • Static labels (title, subtitle, toggle button, loading state, empty state, unknown fallbacks) are wired correctly.
  • Interpolated keys (lastInput, scopesCount, scopesList) pass non-empty values and work fine.
  • One regression: t(\"instances.reason\", { value: entry.reason ?? \"\" }) passes an empty string when entry.reason is null/undefined. The t() helper's interpolation uses params[k] || \\{${k}}\``, which treats \"\" as falsy — causing the literal string `Reason {value}` to appear in the UI instead of a clean empty state. See the inline comment for the fix.

Confidence Score: 3/5

Mostly safe but has one visible UI regression where a null/undefined reason renders the raw placeholder string 'Reason {value}'.

The change is well-scoped and the locale keys are correctly structured. One logic bug is introduced: passing an empty string param through the t() helper exposes a pre-existing falsy-check flaw in translate.ts, causing 'Reason {value}' to appear in the UI when no reason is set. This is user-visible and worth fixing before merge.

ui/src/ui/views/instances.ts line 99 — the entry.reason ?? "" passed to t() triggers the empty-string falsy bug in ui/src/i18n/lib/translate.ts.

Prompt To Fix All With AI
This is a comment left during a code review.
Path: ui/src/ui/views/instances.ts
Line: 99

Comment:
**Empty reason leaks `{value}` placeholder into UI**

When `entry.reason` is `null` or `undefined`, the expression `entry.reason ?? ""` produces `""`. The `t()` interpolation in `translate.ts` uses `params[k] || \`{${k}}\`` (line 142 of `ui/src/i18n/lib/translate.ts`), which treats an empty string as falsy — so instead of substituting `""`, it leaves the literal `{value}` in the output. Users will see **"Reason {value}"** rendered in the UI instead of the previous "Reason " or nothing.

A safe fix is to guard with a conditional so an empty param is never passed:

```suggestion
        <div class="muted">${entry.reason ? t("instances.reason", { value: entry.reason }) : ""}</div>
```

Alternatively, the `t()` helper itself could be hardened to use `params[k] !== undefined ? params[k] : \`{${k}}\`` — but that is a separate change with wider blast radius.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "UI: localize instances hardcoded labels" | Re-trigger Greptile

Comment thread ui/src/ui/views/instances.ts Outdated
@rubensfox20

Copy link
Copy Markdown
Contributor Author

Good catch — I updated the Instances screen to skip the localized reason line when entry.reason is empty, so the UI no longer risks rendering the raw {value} placeholder. Revalidated with:\n\n- pnpm --dir ui build ✅\n- pnpm test ui/src/i18n/test/translate.test.ts -- --project ui

@clawsweeper

clawsweeper Bot commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Keep this PR open: current main and v2026.6.6 already cover much of the static Instances localization, but the branch still contains useful unique cleanup for fallback/scope strings and the empty reason placeholder. It needs a rebase onto the current generated i18n workflow, regenerated locale artifacts, and real behavior proof before it is mergeable.

Canonical path: Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review.

So I’m closing this here because the remaining work is already tracked in the canonical issue.

Review details

Best possible solution:

Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review.

Do we have a high-confidence way to reproduce the issue?

Yes from source inspection, but not from a live browser run: current main still hits hardcoded Instances fallback/scope strings and an empty-reason translation path when the relevant entry fields are missing or scoped. The PR body provides steps, but no screenshot, recording, or runtime output for the rendered UI.

Is this the best way to solve the issue?

No, not as submitted. The idea is sound and narrow, but the best current solution is to rebase onto main's generated i18n pipeline and regenerate all locale artifacts instead of hand-maintaining pt-BR only.

Security review:

Security review cleared: The diff is limited to Control UI rendering text and locale strings; I found no concrete security or supply-chain concern.

AGENTS.md: found and applied where relevant.

What I checked:

  • stale F-rated PR: PR was opened 2026-04-04T23:23:21Z, is older than 30 days, and the latest review rated it F.
  • proof blocker: real behavior proof is mock_only and proof tier is F, so this branch is not merge-ready without contributor follow-up.
  • no human follow-up: live comments and timeline hydrated by apply contain no non-automation activity after the ClawSweeper review.

Likely related people:

  • BunsDev: Authored the merged dashboard-v2 views refactor that introduced ui/src/ui/views/instances.ts and the surrounding Control UI view/i18n surface. (role: feature introducer; confidence: high; commits: f76a3c5225bb; files: ui/src/ui/views/instances.ts, ui/src/i18n/locales/en.ts, ui/src/i18n/locales/pt-BR.ts)
  • RomneyDa: Authored the merged PR that marked non-English Control UI locale bundles and i18n metadata as generated artifacts, which is central to the review finding here. (role: adjacent i18n workflow contributor; confidence: medium; commits: 87944c0d80ec; files: .gitattributes, ui/src/i18n/locales/*.ts, ui/src/i18n/.i18n/*)
  • samzong: Authored the merged Control UI i18n baseline report work that touched ui/AGENTS.md and documented the generated-locale workflow around this surface. (role: adjacent i18n tooling contributor; confidence: medium; commits: 731c8843ff2a; files: ui/AGENTS.md, scripts/control-ui-i18n-report.ts)

Codex review notes: model internal, reasoning high; reviewed against 6c88811b4bba.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels May 19, 2026
@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. label May 19, 2026
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label May 19, 2026
@clawsweeper

clawsweeper Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat.

Where did the egg go?
  • The egg game starts only after the PR passes the real-behavior proof check.
  • Before that, no creature or rarity is rolled. The treat waits for real proof.
  • This is still just collectible flavor: proof affects review readiness, not creature quality.

@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jun 11, 2026
@clawsweeper clawsweeper Bot added rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jun 11, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Jun 13, 2026
@clawsweeper clawsweeper Bot removed the rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. label Jun 13, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jun 13, 2026
@clawsweeper

clawsweeper Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper applied the proposed close for this PR.

@clawsweeper clawsweeper Bot closed this Jun 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant