Skip to content

feat: add localization runtime foundation - #109456

Closed
giodl73-repo wants to merge 3 commits into
openclaw:mainfrom
giodl73-repo:user/giodl/localization-core
Closed

giodl73-repo wants to merge 3 commits into
openclaw:mainfrom
giodl73-repo:user/giodl/localization-core

Conversation

@giodl73-repo

Copy link
Copy Markdown
Contributor

Related: #88570
Related: #81253

RFC: openclaw/rfcs#42

What Problem This Solves

OpenClaw currently has localized Control UI, native-app, documentation, and
onboarding content, but those surfaces do not share a package-wide locale
contract. Runtime work therefore has no canonical locale registry, fallback
behavior, immutable catalog snapshot, or honest cross-surface coverage baseline
to build on.

This is visible today in gaps such as hardcoded runtime and approval copy,
inconsistent platform locale discovery, missing RTL document metadata, and no
single inventory showing which product surfaces and locales are actually
supported.

Why This Change Was Made

This introduces a private browser/server-safe @openclaw/localization-core
package and proves it through two existing production consumers: Control UI and
the onboarding wizard. It centralizes the existing 22-locale product registry,
strict explicit overrides, inferred platform matching, English fallback,
immutable catalog snapshots, interpolation, plural/select rendering, and
catalog validation.

It also checks in a generated 15-surface by 22-locale coverage baseline with
representative expansion, bidi, shaping, and segmentation fixtures. The
baseline is conservative: translated content is marked partial unless reviewed
ownership and completeness evidence exists.

This PR does not localize Gateway protocols, channel messages, CLI/TUI output,
or plugin catalogs. Those remain later RFC 0024 slices.

User Impact

  • Control UI follows ordered browser language preferences and keeps document
    lang and dir synchronized, including Arabic and Persian RTL presentation.
  • Onboarding uses the same locale and fallback rules across Windows, macOS,
    Linux, containers, and explicit OPENCLAW_LOCALE overrides.
  • Stale browser preferences recover safely, and concurrent lazy locale loads
    cannot overwrite a newer user choice.
  • Maintainers gain a deterministic coverage inventory and drift check before
    migrating safety-critical runtime messages.

Existing English behavior and protocol shapes remain unchanged.

Evidence

  • 78 focused localization-core, coverage, revision, wizard, and Control UI
    tests.
  • 18 dev-watch tests covering the new workspace package source root.
  • Narrow core and UI TypeScript checks.
  • Package build emits the declared .mjs and .d.mts exports.
  • Representative Windows BCP 47 locale probes, including zh-Hans-CN,
    zh-Hant-HK, fa-IR, and pt-PT.
  • .craft/roles review across runtime, platform, security, simplicity, and
    maintainer lenses.
  • Final codex review --uncommitted: no actionable findings.

giodl73-repo and others added 2 commits July 16, 2026 17:28
Co-authored-by: Copilot <[email protected]>
Copilot-Session: 4ade23d8-abc3-418f-b143-0bf668e98582
Co-authored-by: Copilot <[email protected]>
Copilot-Session: 4ade23d8-abc3-418f-b143-0bf668e98582
@giodl73-repo
giodl73-repo requested a review from a team as a code owner July 17, 2026 00:29
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui scripts Repository scripts size: XL maintainer Maintainer-authored PR labels Jul 17, 2026
@github-actions github-actions Bot added the dependencies-changed PR changes dependency-related files label Jul 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Dependency Guard

This PR changes dependency-related files. Maintainers should confirm these changes are intentional.

Changed files:

  • package.json
  • packages/localization-core/package.json
  • pnpm-lock.yaml
  • ui/package.json

Maintainer follow-up:

  • Review whether the dependency changes are intentional.
  • Inspect resolved package deltas when lockfile, shrinkwrap, or workspace dependency policy changes are present.
  • Treat package-lock.json and npm-shrinkwrap.json diffs as security-review surfaces.
  • Run pnpm deps:changes:report -- --base-ref origin/main --markdown /tmp/dependency-changes.md --json /tmp/dependency-changes.json locally for detailed release-style evidence.

@github-actions

github-actions Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Dependency graph changes are blocked

OpenClaw does not accept dependency graph changes through PRs unless a repository admin or security explicitly authorizes the current head SHA. Dependency updates are generated internally by maintainers so external PRs cannot change the resolved graph.

Detected dependency graph changes:

  • pnpm-lock.yaml changed.
  • package.json changed devDependencies.
  • packages/localization-core/package.json changed name, version.
  • ui/package.json changed dependencies, devDependencies.

Auto-scrub was not attempted because this PR changes package manifest dependency graph fields:

  • package.json changed devDependencies.
  • packages/localization-core/package.json changed name, version.
  • ui/package.json changed dependencies, devDependencies.

Dependency graph changes must be reviewed by security or handled by maintainers internally. Please remove lockfile changes manually if they are not needed.

To remove lockfile changes, restore them from the target branch:

git fetch origin
git checkout 'origin/main' -- 'pnpm-lock.yaml'
git commit -m 'chore: remove dependency lockfile change'
git push

If this PR intentionally needs a dependency graph change, ask a repository admin or member of @openclaw/openclaw-secops to comment:

/allow-dependencies-change

The action will approve the current head SHA (e5cb283b0320d01fd27739dfa18ac9c040b62a4e) when it reruns. A later push requires a fresh approval.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. feature: ✨ showcase ClawSweeper spotlight: unusually compelling feature idea for maintainer attention. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jul 17, 2026
@clawsweeper

clawsweeper Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 16, 2026, 11:04 PM ET / July 17, 2026, 03:04 UTC.

ClawSweeper review

What this changes

Adds a private shared localization package and coverage baseline, then migrates Control UI and onboarding locale resolution to the shared runtime.

Merge readiness

⛔ Blocked until real behavior proof is added - 8 items remain

Keep this PR open for explicit maintainer review: it carries the protected maintainer label, establishes a repository-wide localization architecture tied to an open RFC, and still lacks inspectable real-behavior proof.

Priority: P2
Reviewed head: e5cb283b0320d01fd27739dfa18ac9c040b62a4e
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The implementation appears structured and well tested, but absent real behavior proof remains a merge gate and the architecture still needs explicit owner approval.
Proof confidence 🧂 unranked krab (1/6) Needs real behavior proof before merge: The PR provides tests and build claims but no inspectable after-fix browser or terminal artifact; add redacted Control UI RTL, ordered-language and stale-preference evidence plus real onboarding output, then update the PR body to trigger review or ask a maintainer for @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR provides tests and build claims but no inspectable after-fix browser or terminal artifact; add redacted Control UI RTL, ordered-language and stale-preference evidence plus real onboarding output, then update the PR body to trigger review or ask a maintainer for @clawsweeper re-review.
Evidence reviewed 9 items New localization owner boundary: The branch introduces the private @openclaw/localization-core package with catalog, context, coverage, and locale-registry entrypoints.
Control UI consumer migration: Control UI moves locale context, catalog snapshots, browser preference ordering, document direction, and stale-preference handling into the shared runtime.
Onboarding consumer migration: The onboarding wizard replaces its local locale normalization and resolution with the shared catalog and process-context implementation.
Findings 1 actionable finding [P3] Remove the contributor changelog entry
Security Needs attention Authorize the dependency graph change: The new workspace package dependency and pnpm-lock.yaml changes are intentional-looking but remain blocked by repository policy until an administrator or security owner authorizes this exact head.

Decision needed

Question Recommendation
Should OpenClaw adopt this package and generated 15-surface coverage model as the canonical localization foundation before the linked RFC is accepted? Adopt the shared foundation: Approve the package and coverage contract after localization-owner review, exact-head dependency authorization, and live behavior proof.

Why: The patch is technically plausible, but it assigns policy and ownership across core runtime, channels, apps, plugins, CLI, documentation, and security-sensitive copy; that permanent boundary requires maintainer intent rather than automated code judgment.

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR provides tests and build claims but no inspectable after-fix browser or terminal artifact; add redacted Control UI RTL, ordered-language and stale-preference evidence plus real onboarding output, then update the PR body to trigger review or ask a maintainer for @clawsweeper re-review.
  • Remove the contributor changelog entry (P3) - CHANGELOG.md is release-owned under repository policy and normal feature PRs must leave it for the release process; remove this branch's entry and keep release-note context in the PR body or commit message.
  • Resolve security concern: Authorize the dependency graph change - The new workspace package dependency and pnpm-lock.yaml changes are intentional-looking but remain blocked by repository policy until an administrator or security owner authorizes this exact head.
  • Resolve merge risk (P1) - The package and 15-surface coverage matrix create a permanent cross-owner architecture contract before the linked localization RFC has been accepted.
  • Resolve merge risk (P1) - Invalid explicit OPENCLAW_LOCALE values now force English rather than continuing through other locale signals, so existing mistyped overrides can change behavior after upgrade.
  • Resolve merge risk (P1) - The workspace dependency and lockfile changes cannot merge from this external branch without exact-head authorization under the repository dependency policy.
  • Resolve merge risk (P1) - No live evidence currently demonstrates ordered browser preferences, Arabic or Persian RTL metadata, stale stored-locale recovery, or real cross-platform onboarding behavior.

Findings

  • [P3] Remove the contributor changelog entry — CHANGELOG.md:7
  • [medium] Authorize the dependency graph change — pnpm-lock.yaml:2105
Agent review details

Security

Needs attention: No secret-handling or malicious-code concern is evident, but the external branch changes the workspace dependency graph and lockfile and therefore needs authorized exact-head supply-chain review.

PR surface

Source +1066, Tests +587, Docs +1, Config +52, Other +1549. Total +3255 across 36 files.

View PR surface stats
Area Files Added Removed Net
Source 12 1228 162 +1066
Tests 10 587 0 +587
Docs 1 1 0 +1
Config 4 52 0 +52
Generated 0 0 0 0
Other 9 1551 2 +1549
Total 36 3419 164 +3255

Review metrics

Metric Value Why it matters
Localization contract 15 surfaces × 22 locales The generated baseline assigns a new repository-wide coverage policy that many independent owners would need to maintain.
Package surface 5 export entrypoints added The new private package becomes a shared browser/server runtime dependency and should have an explicitly approved long-term boundary.
Override semantics 1 existing environment override changed An invalid OPENCLAW_LOCALE now selects English instead of continuing to platform locale discovery, which is observable during upgrades.

Stored data model

Persistent data-model change detected: migration/backfill/repair: CHANGELOG.md, serialized state: packages/localization-core/src/coverage.test.ts, serialized state: packages/localization-core/src/locale-registry.test.ts, serialized state: scripts/control-ui-i18n-verify.ts, serialized state: ui/src/i18n/test/translate.test.ts, vector/embedding metadata: packages/localization-core/src/coverage.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Approve and prove the contract (recommended)
    Authorize the package direction and dependency graph, then require fresh-install and upgrade proof for persisted browser locale and onboarding override behavior.
  2. Reduce the architectural scope
    Remove the repository-wide coverage contract and retain only consumer changes that existing Control UI and onboarding owners approve.
  3. Pause for the RFC
    Keep the branch available but defer merging until the linked localization RFC establishes ownership and compatibility expectations.

Technical review

Best possible solution:

Adopt one owner-approved shared locale registry and catalog contract, keep consumer migrations narrow, document intentional override semantics, remove release-owned changelog editing, authorize the exact dependency graph, and prove the resulting Control UI and onboarding behavior in real setups.

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

Not applicable: this PR establishes a new localization architecture rather than repairing one already-defined broken behavior, although it includes narrower consumer improvements.

Is this the best way to solve the issue?

Unclear: a shared browser/server-safe package is a credible design, but adopting its cross-surface ownership model before RFC approval is not demonstrably the best permanent solution without maintainer direction.

Full review comments:

  • [P3] Remove the contributor changelog entry — CHANGELOG.md:7
    CHANGELOG.md is release-owned under repository policy and normal feature PRs must leave it for the release process; remove this branch's entry and keep release-note context in the PR body or commit message.
    Confidence: 0.99

Overall correctness: patch is correct
Overall confidence: 0.88

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 082ffd442ae0.

Labels

Label justifications:

  • P2: This is a significant but non-urgent localization architecture improvement with bounded current consumers and broad future ownership implications.
  • merge-risk: 🚨 compatibility: The PR changes persisted browser-locale recovery, onboarding locale selection, explicit environment override fallback, package wiring, and dependency resolution.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR provides tests and build claims but no inspectable after-fix browser or terminal artifact; add redacted Control UI RTL, ordered-language and stale-preference evidence plus real onboarding output, then update the PR body to trigger review or ask a maintainer for @clawsweeper re-review.

Evidence

Security concerns:

  • [medium] Authorize the dependency graph change — pnpm-lock.yaml:2105
    The new workspace package dependency and pnpm-lock.yaml changes are intentional-looking but remain blocked by repository policy until an administrator or security owner authorizes this exact head.
    Confidence: 0.99

What I checked:

  • New localization owner boundary: The branch introduces the private @openclaw/localization-core package with catalog, context, coverage, and locale-registry entrypoints. (packages/localization-core/package.json:2, e5cb283b0320)
  • Control UI consumer migration: Control UI moves locale context, catalog snapshots, browser preference ordering, document direction, and stale-preference handling into the shared runtime. (ui/src/i18n/lib/translate.ts:2, e5cb283b0320)
  • Onboarding consumer migration: The onboarding wizard replaces its local locale normalization and resolution with the shared catalog and process-context implementation. (src/wizard/i18n/index.ts:2, e5cb283b0320)
  • Cross-surface policy contract: The generated baseline declares required coverage across 15 product surfaces and all 22 registered locales, including future runtime, channel, CLI, native-app, and documentation surfaces. (packages/localization-core/src/coverage.ts:43, e5cb283b0320)
  • Explicit override behavior: The new tests define an invalid OPENCLAW_LOCALE value as a strict override failure that selects English rather than continuing through other platform locale signals. (packages/localization-core/src/context.test.ts:37, e5cb283b0320)
  • Dependency authorization gate: Repository automation reports that this external PR changes package dependency graph fields and the lockfile, requiring repository-admin or security authorization for the exact head. (pnpm-lock.yaml:2105, e5cb283b0320)

Likely related people:

  • sebslight: Opened the long-running repository localization tracking discussion and is the strongest public history signal for the intended cross-surface localization direction. (role: localization initiative author; confidence: medium; files: ui/src/i18n/lib/translate.ts, src/wizard/i18n/index.ts, packages/localization-core/src/coverage.ts)
  • vincentkoc: Provided the recent public direction on the localization initiative, including the need to separate architectural work from translation-content ownership. (role: recent product-direction contributor; confidence: medium; files: ui/src/i18n/lib/translate.ts, packages/localization-core/src/coverage.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add redacted Control UI screenshots or a recording showing ordered browser preferences, stale preference recovery, and Arabic or Persian lang/dir behavior.
  • Add terminal or live output proving onboarding locale selection on a real Windows or representative cross-platform setup.
  • Remove the changelog entry and obtain exact-head dependency authorization after the localization direction is approved.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-07-17T00:36:45.077Z sha dcec9d0 :: needs real behavior proof before merge. :: none

Co-authored-by: Copilot <[email protected]>

Copilot-Session: 4ade23d8-abc3-418f-b143-0bf668e98582
@clawsweeper

clawsweeper Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: feat: add localization runtime foundation This is item 1/1 in the current shard. Shard 21/22.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@Patrick-Erichsen

Copy link
Copy Markdown
Contributor

Closing this as superseded by the smaller, owner-scoped RFC 0024 implementation stack now under review:

This branch combines the shared runtime, wizard, Control UI, and coverage governance in one broad change. The replacement stack intentionally separates those ownership boundaries so each contract can be reviewed and corrected independently. This branch should not merge alongside them; please continue the work in the split PRs.

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 dependencies-changed PR changes dependency-related files feature: ✨ showcase ClawSweeper spotlight: unusually compelling feature idea for maintainer attention. maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. scripts Repository scripts size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants