Skip to content

fix(ui): use i18n t() for Node option in exec approvals target select#68152

Open
patricklee001 wants to merge 1 commit intoopenclaw:mainfrom
patricklee001:fix-i18n-node-option
Open

fix(ui): use i18n t() for Node option in exec approvals target select#68152
patricklee001 wants to merge 1 commit intoopenclaw:mainfrom
patricklee001:fix-i18n-node-option

Conversation

@patricklee001
Copy link
Copy Markdown

What

Fix hardcoded Node string in ui/src/ui/views/nodes-exec-approvals.ts that bypasses the i18n system.

The translation key nodes.binding.node already exists in all locale files with proper translations (e.g. 节点 for zh-CN, 節點 for zh-TW).

How

Replace the hardcoded string in the exec approvals target <select> with t("nodes.binding.node").

Testing

  1. Open Control UI with zh-CN locale
  2. Navigate to Nodes → Exec Approvals
  3. Confirm the "Node" Host option is no longer hardcoded English

Related

Fixes #24803

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 17, 2026

Greptile Summary

Replaces the hardcoded "Node" string in the exec approvals target <select> with t("nodes.binding.node"), which already has translations in all locale files (e.g. 节点 in zh-CN). The change is correct and the translation key exists. The sibling <option value="gateway"> in the same select remains hardcoded English, leaving a mixed-language display for non-English users (e.g. "Gateway / 节点").

Confidence Score: 5/5

Safe to merge; the change is a minimal, correct i18n fix with no logic impact.

The only remaining finding is a P2 consistency suggestion (translating the sibling Gateway option). No logic, correctness, or security concerns.

ui/src/ui/views/nodes-exec-approvals.ts — the sibling Gateway option on line 258 is still hardcoded English.

Prompt To Fix All With AI
This is a comment left during a code review.
Path: ui/src/ui/views/nodes-exec-approvals.ts
Line: 258

Comment:
**Sibling `Gateway` option still hardcoded**

The `Node` option is now translated but the `Gateway` option immediately above it in the same `<select>` remains a hardcoded English string. Non-English locales will see a mixed select (e.g. "Gateway / 节点" in zh-CN). A `nodes.binding.gateway: "Gateway"` key should be added to `en.ts`, the locale bundles regenerated with `pnpm ui:i18n:sync`, and `Gateway` replaced with `${t("nodes.binding.gateway")}` here.

```suggestion
              <option value="gateway" ?selected=${state.target === "gateway"}>${t("nodes.binding.gateway")}</option>
```

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

Reviews (1): Last reviewed commit: "fix(ui): use i18n t() for Node option in..." | Re-trigger Greptile

@@ -256,7 +256,7 @@ function renderExecApprovalsTarget(state: ExecApprovalsState) {
}}
>
<option value="gateway" ?selected=${state.target === "gateway"}>Gateway</option>
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.

P2 Sibling Gateway option still hardcoded

The Node option is now translated but the Gateway option immediately above it in the same <select> remains a hardcoded English string. Non-English locales will see a mixed select (e.g. "Gateway / 节点" in zh-CN). A nodes.binding.gateway: "Gateway" key should be added to en.ts, the locale bundles regenerated with pnpm ui:i18n:sync, and Gateway replaced with ${t("nodes.binding.gateway")} here.

Suggested change
<option value="gateway" ?selected=${state.target === "gateway"}>Gateway</option>
<option value="gateway" ?selected=${state.target === "gateway"}>${t("nodes.binding.gateway")}</option>
Prompt To Fix With AI
This is a comment left during a code review.
Path: ui/src/ui/views/nodes-exec-approvals.ts
Line: 258

Comment:
**Sibling `Gateway` option still hardcoded**

The `Node` option is now translated but the `Gateway` option immediately above it in the same `<select>` remains a hardcoded English string. Non-English locales will see a mixed select (e.g. "Gateway / 节点" in zh-CN). A `nodes.binding.gateway: "Gateway"` key should be added to `en.ts`, the locale bundles regenerated with `pnpm ui:i18n:sync`, and `Gateway` replaced with `${t("nodes.binding.gateway")}` here.

```suggestion
              <option value="gateway" ?selected=${state.target === "gateway"}>${t("nodes.binding.gateway")}</option>
```

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

@clawsweeper
Copy link
Copy Markdown
Contributor

clawsweeper Bot commented Apr 27, 2026

Codex review: needs changes before merge.

Summary
The branch replaces the exec approvals target selector's Node option with t("nodes.binding.node") in ui/src/ui/views/nodes-exec-approvals.ts.

Reproducibility: yes. The code path is deterministic: current main renders Gateway and Node literally, while this PR would render Gateway plus a translated node label and would also change the raw-copy count without updating the baseline.

Next step before merge
This is a narrow PR-branch repair with clear UI/i18n files, no protected labels, and no security-sensitive behavior change.

Security
Cleared: The diff changes only a Control UI label expression and does not touch CI, dependencies, secrets, package metadata, or code execution paths.

Review findings

  • [P2] Translate the gateway target option — ui/src/ui/views/nodes-exec-approvals.ts:258
  • [P2] Update the raw-copy baseline with the i18n sync output — ui/src/ui/views/nodes-exec-approvals.ts:259
Review details

Best possible solution:

Localize the complete target selector in one i18n workflow change: add the gateway source key, render both options through t(), and commit generated locale and .i18n output.

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

Yes. The code path is deterministic: current main renders Gateway and Node literally, while this PR would render Gateway plus a translated node label and would also change the raw-copy count without updating the baseline.

Is this the best way to solve the issue?

No. The PR is a valid partial fix, but the narrow maintainable solution is to update the whole selector and generated i18n metadata together.

Full review comments:

  • [P2] Translate the gateway target option — ui/src/ui/views/nodes-exec-approvals.ts:258
    This change makes only node locale-aware while the adjacent gateway option remains a literal, so non-English locales render a mixed selector such as Gateway / 节点. Add a source key and render both options through t().
    Confidence: 0.92
  • [P2] Update the raw-copy baseline with the i18n sync output — ui/src/ui/views/nodes-exec-approvals.ts:259
    Replacing one literal Node removes a raw-copy finding, but the committed baseline still records two Node entries. pnpm ui:i18n:check compares those counts and will report baseline drift until the generated i18n metadata is updated.
    Confidence: 0.9

Overall correctness: patch is incorrect
Overall confidence: 0.91

Acceptance criteria:

  • pnpm ui:i18n:check
  • pnpm test ui/src/i18n/test/translate.test.ts ui/src/ui/views/nodes.devices.test.ts
  • pnpm exec oxfmt --check --threads=1 ui/src/ui/views/nodes-exec-approvals.ts ui/src/i18n/locales/en.ts
  • git diff --check

What I checked:

Likely related people:

  • vincentkoc: Recent history shows Control UI i18n and raw-copy gate work, including commits that localized UI strings, aligned locale outputs, split view type seams, and added the raw-copy baseline gate. (role: recent Control UI i18n maintainer; confidence: high; commits: e8f0f91d2907, 297f4c6e603b, 01058162bebb; files: ui/src/i18n/locales/en.ts, scripts/control-ui-i18n.ts, ui/src/ui/views/nodes-exec-approvals.ts)
  • steipete: GitHub history shows the exec approvals UI module was split out by this maintainer, with nearby Control UI and i18n script maintenance in the same area. (role: exec approvals UI introducer and adjacent maintainer; confidence: medium; commits: 9fab0d2ced25, 1fb2e18f47e0, 9f19e5be5253; files: ui/src/ui/views/nodes-exec-approvals.ts, scripts/control-ui-i18n.ts)

Remaining risk / open question:

  • Validation was not executed because this was a read-only review; the repair should run the focused Control UI i18n checks after regenerating locale output.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 225b71db1ee8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Control UI i18n: non-English locale not loaded on initialization + incomplete translation coverage

1 participant