Repository navigation
refactor(website): fill translation placeholders with named values - #18945
Conversation
t() takes named values and tAround splits a message around one slot, so
components stop filling placeholders with String.replace. A value the
caller does not pass keeps its {name} visible. The split heroTitle
before/after pair becomes one message, and the zh-CN product and hub
labels say features and workflows.
🧩 Custom Nodes Ecosystem Matrix: 🟡 Withheld — could not measureExecutes the frontend JS of every registry pack that ships any, against this change, in both renderers. The eight This candidate changes nothing the matrix measures, so every expensive stage was skipped. Reproduce locally# build one shard's fixture, then run it
python3 scripts/registry-census/build_matrix.py --shard 1/4
MATRIX_RENDERER=vue MATRIX_VUE=1 \
npx vitest run --config vitest.matrix.config.mts
Full docs: scripts/registry-census/README.md 🌐 Website E2ETip All tests passed.
🌾 Fallow: ✅ PassedFallow audits the diff for duplication, complexity and dead code. It gates on new findings only, so when the audit completes, a red is something this PR introduced or moved — never inherited backlog. A red can also mean the audit itself did not finish; the details below say which happened. Fallow gates on new findings in changed files only, so everything below was introduced or moved by this PR (87 changed files).
Pre-existing findings are baselined in Reproduce locally# the base the gate compared against
npx fallow audit --root . --quiet --format json \
--changed-since 7f38fbf7ed87f918fe05ee016e2e0a43c4185f5f
Full docs: ADR-DEVEX-LINT-0015 🔗 Website PreviewWebsite Preview: https://comfy-website-preview-pr-18945.vercel.app Models is built and gated by PostHog (workshop-enabled), using staging Cloud. This commit: https://website-frontend-llmxeke1n-comfyui.vercel.app Last updated: 2026-09-28T21:22:29Z for |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: Comfy-Org/ComfyUI_frontend/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (8)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughWebsite translation APIs now support named-value interpolation and slot splitting. Components, routes, utilities, and tests pass dynamic values through those APIs instead of replacing placeholders in returned strings. Count-label contracts and selected Chinese translation copy also change. ChangesWebsite translation updates
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~30 minutes Change: Refactor Merge Risk: ⚪ Minimal · up to The translation changes are mergeable after normal checks; no actionable issue remains established. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The shared formatting change reaches many website labels, but the examined dynamic values remain in escaped text or attribute bindings, with no demonstrated increase in privileges or sensitive-data exposure. The breadth of the migration limits confidence in a minimal-risk assessment. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
🚥 Pre-merge checks | ✅ 7✅ Passed checks (7 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
…the tAround slot tc() takes the same named values as t() through a shared interpolate module, so the studio's ten remaining .replace call sites go. tAround throws when a message lacks its slot, the models hero title lets the message own the spacing around the brand, and the i18n tests assert exact output.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
…me the gallery brand once
The Reshoot and Router copy dictionaries take named values like tc(), so
no website call site fills placeholders with .replace any more. The
gallery hero title becomes one message with a {brand} slot, which stops
the zh-CN heading from repeating ComfyUI.
DrJKL
left a comment
There was a problem hiding this comment.
Verdict: needs follow-up on tAround marker handling and wrapper regression coverage
No P0 or P1 blockers found. I found one reproducible P2 rendering defect, two P2 test gaps, one P3 duplicate test, and two PR-description issues.
Findings without an anchorable line
- P2: The Review Focus says rendered output is unchanged except for the listed zh-CN copy, but the new callback interpolation intentionally changes values containing JavaScript replacement tokens such as
$&,$`, and$'. The new unit test confirms this behavior. Please qualify the claim so it distinguishes ordinary current values from replacement-token values. - P3 Nit: The single Changes bullet combines the API contract, migration scope, copy changes, and test coverage. Splitting those into separate bullets would make the exhaustive claims independently reviewable.
Existing findings confirmed or contested
- CodeRabbit marker collision: confirmed.
tAround('models.list.heroTitle', 'en', 'brand', { name: '{brand}' })throwsrepeats slot {brand}even though the source translation contains one brand slot. - Codecov patch coverage: confirmed and narrowed. The reported 77.17% is accurate. The marker collision is the concrete missed branch I reproduced. The full website unit suite still passed 9,262 tests.
- Fallow, PlaygroundOutput.vue template complexity: contested. The base has the same control flow; this diff removes chained replacements and shortens the block.
- Fallow, ModelDetail.vue template complexity: contested. The base has the same structure; this diff replaces chained substitutions with one translation call.
- Fallow, PlaygroundField.vue template complexity: contested. The base has the same template branches; the changed expressions are simpler.
- Fallow, BrowseToolbar.vue template complexity: contested. The label-contract change adds no template control flow.
- Fallow, FacetSheet.vue template complexity: contested. The diff replaces a placeholder label with a function call without adding branches.
- Fallow, PlaygroundField.vue
formatValue: contested. The base has the same branches; this diff deletes the local interpolation reducer. - Fallow, WorkshopCatalog.vue template complexity: contested. The changed expression only moves interpolation into
t().
Checked and cleared
- The seven Fallow rows above were not introduced or worsened by this diff.
- I rejected a proposed placeholder-specific
NamedValuestype. The PR explicitly preserves visible missing placeholders and compatibility with the later vue-i18n wrapper, so a dynamic named-value record is part of the intended boundary. - Exact searches found no remaining placeholder-oriented
String.replacecall sites in the migrated website scope and no newany, assertions, suppressions, lint disables, prohibited Tailwind patterns, raw telemetry sinks, or PrimeVue usage.
Coverage
- Depth: standard.
- Lanes: correctness, maintainability, idiomaticity, tests, and documentation.
- Scope: all 79 changed files; no path was sampled or left unread.
- Tests: 475 unit files passed with 9,262 tests and 4 skips; website typecheck, ESLint, Astro formatting, and the production build passed; the two changed Playwright specs passed all 38 desktop cases.
- Visual check: the preview rendered
Grok Imagine in ComfyUIand the zh-CN gallery heading在 ComfyUI 中构建、调整与创想with one brand and no visible placeholders. - One initial Playwright launch exited because Astro's preview command daemonized. Reusing the confirmed listening preview completed the focused run successfully.
| named: NamedValues = {} | ||
| ): [string, string] { | ||
| const marker = `{${slot}}` | ||
| const message = t(key, locale, { |
There was a problem hiding this comment.
[P2] tAround counts the slot marker after interpolating the other named values, so caller text can be mistaken for translation structure. I reproduced this with tAround('models.list.heroTitle', 'en', 'brand', { name: '{brand}' }): it throws repeats slot {brand} even though the source message contains one brand slot. This also contradicts the documented literal-value behavior. Please validate and split the unresolved message first, then interpolate each side, and add this marker-shaped value as a regression case.
There was a problem hiding this comment.
Fixed in 5a52023. tAround now finds and validates the slot in the unresolved message, then interpolates each side. translations.test.ts has your { name: '{brand}' } case, which now returns ['{brand} in ', '']. I confirmed it fails against the previous implementation.
| ): string { | ||
| const entry: LocalizedText = copy[key] | ||
| return entry[locale] ?? entry.en | ||
| return interpolate(entry[locale] ?? entry.en, named) |
There was a problem hiding this comment.
[P2] This new named-interpolation path lacks an independent output test. ReshootMoveControls.test.ts builds its expected accessible name with rc itself, so an rc implementation that ignores named can leave {time} in both the UI and the test oracle and still pass. Please add a direct literal-output assertion for a parameterized rc message.
There was a problem hiding this comment.
Added reshoot-copy.test.ts in 5a52023. It asserts literal reshoot.frames output in en and zh-CN, so an rc that dropped named would fail independently of the component test.
| ): string { | ||
| const entry: LocalizedText = copy[key] | ||
| return entry[locale] ?? entry.en | ||
| return interpolate(entry[locale] ?? entry.en, named) |
There was a problem hiding this comment.
[P2] I could not find a test that calls routerT with named values. The existing router copy tests only exercise unparameterized keys, so dropping this argument or interpolating the wrong locale would stay green. Please add one direct literal-output case for a parameterized router message.
There was a problem hiding this comment.
Added routerCopy.test.ts in 5a52023. It asserts literal platform.router.coverage.browseAll output with count: 120 in en and zh-CN, which also catches interpolating the wrong locale.
| }) | ||
|
|
||
| describe('tPlural', () => { | ||
| it.for([ |
There was a problem hiding this comment.
[P3] Nit: this table duplicates the dedicated src/i18n/tPlural.test.ts suite, which already covers counts 1, 3, and 0, zh-CN rules, English fallback rules, and single-form messages. Removing this duplicate keeps one owner for plural behavior without losing a falsifier.
There was a problem hiding this comment.
Removed in 5a52023; tPlural.test.ts is the single owner now.
|
Addressed the review in 5a52023 and replied in each thread. For the two description findings: Review Focus now says output is unchanged for current values and calls out that |
DrJKL
left a comment
There was a problem hiding this comment.
Verdict: prior findings addressed; base conflict remains
I verified the follow-up commit against every finding from my previous review. All six are fixed, and I found no new issues in the four-file delta.
Prior finding dispositions
- C1, fixed:
tAroundnow validates and splits the unresolved translation before interpolating either side. The marker-shaped value regression returns['{brand} in ', '']. - T2A, fixed:
reshoot-copy.test.tsindependently checks parameterizedrcoutput in English and zh-CN. - T2B, fixed:
routerCopy.test.tsindependently checks parameterizedrouterToutput in English and zh-CN. - T3, fixed: the duplicate plural table was removed;
tPlural.test.tsremains the single owner. - D2, fixed: Review Focus now qualifies the no-output-change claim and names the literal replacement-token behavior.
- D3, fixed: Changes is split into API, Migration, Messages, zh-CN copy, and Tests bullets.
Verification
- Focused unit tests: 4 files, 21 tests passed.
- Website typecheck: 0 errors.
- Changed-file ESLint and formatting: passed.
- Standard follow-up lanes: correctness, maintainability, idiomaticity, tests, and documentation; no new candidates.
GitHub currently reports the branch as conflicting with main, so this is not yet ready for approval.
|
Merged |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Agreed—the abbreviation is opaque. I opened FE-3071 to remove both tc and rc when cinematic and reshoot copy moves into the shared catalog.
| ): string { | ||
| const entry: LocalizedText = copy[key] | ||
| return entry[locale] ?? entry.en | ||
| return interpolate(entry[locale] ?? entry.en, named) |
There was a problem hiding this comment.
Can we eliminate this here?, same for the other poorly named functions that just wrap a single function call.
There was a problem hiding this comment.
The full cleanup is tracked in FE-3071. I would keep this PR focused on interpolation and remove these wrappers with the shared-catalog migration rather than rename or duplicate them here.
Summary
Website components fill translation placeholders with named values passed to
t()instead of callingString.replaceon the returned copy, so the storage and runtime swap in #18013 no longer carries a 50-file call-site migration.Changes
t(key, locale, named)interpolates{name}placeholders; a value the caller does not pass keeps its{name}visible, and values are inserted literally (no$&expansion).tAround(key, locale, slot, named)splits the unresolved message around one slot, then fills each side, so a heading can wrap that slot in markup; it throws unless the message contains that slot exactly once. The Cinematic Studio'stc(), the Reshootrc()and the Router page'srouterT()take the same named values through a sharedsrc/i18n/interpolate.ts..replace, including every Cinematic Studio, Reshoot and Router call site. Label objects handed to child components carry functions instead of placeholder strings. The local interpolators inauth-schemas.tsandmodelFaq.tsgo.models.list.heroTitle.before/.afterpair becomes one message,{name} in {brand}/{brand} 中的 {name}, and the hero template no longer adds spacing of its own around the brand.gallery.heroTitle.beforelikewise becomesgallery.heroTitlewith a{brand}slot, which stops the zh-CN gallery heading from repeating ComfyUI.src/i18njoins unit-test coverage.tc(),rc()androuterT()each have a literal-output test for a parameterized message.Review Focus
For current values, rendered output is unchanged apart from the two zh-CN wording fixes and the zh-CN gallery heading, which no longer says ComfyUI twice. A value containing a
String.replacetoken such as$&,$`or$'now renders literally instead of expanding. The dictionary stays intranslations.ts; #18013 moves it to JSON catalogs rendered with vue-i18n, which keeps the samet()signature and missing-value behavior.Part of FE-2045: one localization system for the monorepo (one JSON catalog format, one translation pipeline and workflow).