Skip to content

UI: localize login gate hardcoded labels#61062

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

UI: localize login gate hardcoded labels#61062
rubensfox20 wants to merge 2 commits into
openclaw:mainfrom
rubensfox20:fix/login-gate-i18n-hardcoded-labels

Conversation

@rubensfox20

Copy link
Copy Markdown
Contributor

Summary

  • Problem: the login gate still had several hardcoded English placeholders and visibility labels even when a non-English locale was selected.
  • Why it matters: users hit those mixed-language labels before they even connect, so the login path undermines the Control UI locale experience.
  • What changed: moved the login gate placeholders and token/password visibility labels into locale keys and wired login-gate.ts to read them through t(...).
  • What did NOT change (scope boundary): no auth behavior, no connection flow changes, and no UI work outside the login gate.

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 login-gate labels were still embedded directly in ui/src/ui/views/login-gate.ts instead of using locale files.
  • Missing detection / guardrail: locale infrastructure exists, but there was no guardrail forcing those labels through i18n.
  • Contributing context (if known): this PR intentionally scopes the cleanup to the login gate only.

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:
    • login gate locale lookups resolve correctly for the newly added keys.
  • Why this is the smallest reliable guardrail:
    • the change is isolated to locale keys plus one login 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 login gate 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 login gate
  • Relevant config (redacted): N/A

Steps

  1. Switch the Control UI locale away from English.
  2. Open the login gate.
  3. Inspect the gateway URL placeholder, token placeholder, and token/password visibility labels.

Expected

  • Those login-gate labels should come from locale files instead of staying hardcoded in English.

Actual

  • The login gate 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 login-gate 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 existing auth behavior and connect-on-Enter behavior
    • localized only labels/placeholders, not secrets handling or connection logic
  • What you did not verify:
    • full browser walkthrough of every locale on the login gate

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 login gate 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: f08f6b8c92

ℹ️ 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/login-gate.ts
@greptile-apps

greptile-apps Bot commented Apr 4, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR moves hardcoded English strings in the login gate (gateway URL placeholder, token/password visibility labels) into locale keys and wires them through t(...), with translations provided for en and pt-BR. The approach is sound and the Lit template bindings are correct.

  • Regression in zh-CN / zh-TW (tokenPlaceholder key): The original code composed the token placeholder inline using the already-translated login.passwordPlaceholder key, so zh-CN/zh-TW users previously saw \"OPENCLAW_GATEWAY_TOKEN (可选)\". Replacing that with a single tokenPlaceholder key that is absent from zh-CN.ts and zh-TW.ts causes a fallback to the English string, silently removing an existing translation for those locales.
  • The remaining new keys (showToken, hideToken, toggleTokenVisibility, showPassword, hidePassword, togglePasswordVisibility, gatewayUrlPlaceholder) were all hardcoded English before this PR, so their English fallback for de, es, zh-CN, and zh-TW is not a regression.
  • gatewayUrlPlaceholder carries the same technical URL string in both en and pt-BR, which is correct (URLs shouldn't be translated)."

Confidence Score: 3/5

Not safe to merge as-is — the tokenPlaceholder consolidation regresses an existing zh-CN/zh-TW translation.

The change is well-scoped i18n cleanup with correct fallback infrastructure, but one specific key (tokenPlaceholder) inadvertently drops a pre-existing Chinese translation that was present via the old composed-string approach. This is a concrete, verifiable regression rather than a speculative concern.

ui/src/i18n/locales/zh-CN.ts and ui/src/i18n/locales/zh-TW.ts — both need tokenPlaceholder added to their login: block to avoid the English fallback regression.

Prompt To Fix All With AI
This is a comment left during a code review.
Path: ui/src/i18n/locales/pt-BR.ts
Line: 159-163

Comment:
**Regression for zh-CN and zh-TW locales**

The original token-field placeholder was composed as `"OPENCLAW_GATEWAY_TOKEN (${t("login.passwordPlaceholder")})"`, which meant `zh-CN` and `zh-TW` users — who already had `passwordPlaceholder: "可选"` / `"可選"` translated — saw `"OPENCLAW_GATEWAY_TOKEN (可选)"`. Consolidating this into a single `tokenPlaceholder` key without also adding it to `zh-CN.ts` and `zh-TW.ts` silently drops those translations. The fallback chain yields the English `"OPENCLAW_GATEWAY_TOKEN (optional)"` for those locales instead.

To restore parity, add `tokenPlaceholder` to `ui/src/i18n/locales/zh-CN.ts` (at the `login:` block, line 154) and `ui/src/i18n/locales/zh-TW.ts` (same location):

```ts
// zh-CN.ts – login block
login: {
  subtitle: "网关仪表盘",
  tokenPlaceholder: "OPENCLAW_GATEWAY_TOKEN (可选)",
  passwordPlaceholder: "可选",
},

// zh-TW.ts – login block
login: {
  subtitle: "閘道儀表板",
  tokenPlaceholder: "OPENCLAW_GATEWAY_TOKEN (可選)",
  passwordPlaceholder: "可選",
},
```

The remaining seven new keys (`showToken`, `hideToken`, etc.) were hardcoded English before this PR, so their fallback to English for zh-CN/zh-TW is not a regression — only `tokenPlaceholder` regresses because it absorbs the previously-translated `passwordPlaceholder`.

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

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

Comment thread ui/src/i18n/locales/pt-BR.ts
@rubensfox20

Copy link
Copy Markdown
Contributor Author

Good catch — I restored the previous zh-CN / zh-TW token placeholder behavior by adding login.tokenPlaceholder to both locale files, so those locales no longer fall back to English for that field. Revalidated with:\n\n- pnpm --dir ui build ✅\n- pnpm test ui/src/i18n/test/translate.test.ts -- --project ui

@sallyom
sallyom force-pushed the fix/login-gate-i18n-hardcoded-labels branch from cab4fcc to f591fbb Compare April 20, 2026 04:50

@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: f591fbb622

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

state.applySettings({ ...state.settings, token: v });
}}
placeholder="OPENCLAW_GATEWAY_TOKEN (${t("login.passwordPlaceholder")})"
placeholder=${t("login.tokenPlaceholder")}

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 Badge Restore localized token placeholder fallback

Switching the token input to t("login.tokenPlaceholder") drops localized placeholders in locales that still only provide login.passwordPlaceholder; before this change, the token placeholder reused passwordPlaceholder, but now those locales fall back to English OPENCLAW_GATEWAY_TOKEN (optional). Fresh evidence in this commit is that de, es, fr, id, ja-JP, ko, pl, tr, and uk locale bundles still omit login.tokenPlaceholder, so users selecting those languages see mixed-language text on the login gate.

Useful? React with 👍 / 👎.

@sallyom
sallyom force-pushed the fix/login-gate-i18n-hardcoded-labels branch from 7b86525 to f591fbb Compare April 20, 2026 05:50
@sallyom

sallyom commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

Closing in favor of #61054.

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.

2 participants