Skip to content

[gantt] Conflict dialog renders count placeholder as {2}: locale pack uses {{count}} but render code does .replace('{count}') #4157

Description

@baozhoutao

Summary

In a type:'gantt' view, the dependency-conflict dialog renders its count placeholder literally as {2} instead of the number. Root cause is a placeholder-syntax mismatch between the render code and the locale bundle:

  • Render side uses a literal string replace with single braces:
    A(`gantt.conflict.body`).replace(`{count}`, String(n))
  • zh-CN locale bundle writes the string with double braces (i18next style):
    gantt.conflict.body: "此次移动与依赖约束冲突。是否自动重新排程 {{count}} 个受影响的任务?"
    
  • Result: "…{{count}}…".replace("{count}", "2")"…{2}…".

The plugin's built-in English fallback string uses single braces, so the fallback path renders correctly — the bug only appears once a locale bundle is loaded (i.e. all real usage).

Scope (verified vs. suspected)

  • Verified in the @objectstack/console@17.0.0-rc.6 bundle: gantt.conflict.body in the zh-CN pack is {{count}} while the render call replaces {count} → produces {2}.
  • Worth a sweep (not asserted): other locale packs and any other gantt string rendered via .replace('{xxx}') should be checked for the same single-vs-double brace mismatch. Note some sibling keys (e.g. autoScheduleDlg.body, quickFilter.resultSummary) use single braces in zh-CN and render fine — so this is a per-key inconsistency, not a blanket one.

Fix direction

Prefer converting gantt.conflict.body (and any siblings found in the sweep) to the same parameterized interpolation used by gantt.delete.body (t('gantt.delete.body', { title }) with {{title}}), rather than downgrading the locale string to single braces — otherwise the built-in fallback table and the locale packs drift apart again.

Environment

  • @objectstack/console@17.0.0-rc.6 (also present in rc.5).

Steps to reproduce

  1. Any type:'gantt' view with a dependenciesField; UI language zh-CN.
  2. Create two tasks A→B with a dependency; drag B so it starts before A finishes to trigger the conflict dialog (data-testid="gantt-conflict-dialog").
  3. Read the dialog body.

Expected: "…auto-reschedule 2 affected task(s)?"
Actual: "…自动重新排程 {2} 个受影响的任务?"

Observed while building an ObjectStack 17 app.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions