Repository navigation
Commit ea5807e
fix(console): zh form titles space a Latin object name, the lookup create dialog has a title, the success toast names the action, money metrics keep currency decimals (#30495)
domain:ui#5 · os-sales · session_01L6bhgTuQiDduLj5Xcj3KMa
<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuXevN4DpuBALL1b2DnF5gWK)_
Part of #30126
Clause-②: yes (widening)
Metadata-protocol: none
## 维护者速读
- 只做 #30126 的 items 1、2、3、7;其余条目不在本 PR。
- item 1:zh 的「新建/编辑/查看{{object}}」在对象名是拉丁文时补一个空格(「新建 Repair
Ticket」),中文名不变(「新建联系人」)。做法是 i18n.ts 里按 key 列表生效的 zh
postProcessor,语言包拼法不动。
- item 2:查找字段「新建关联记录」弹窗有了标题,复用 form.createTitle;作者写的 title 仍优先。
- item 3:默认成功提示说出动作名(「“解决”已完成」),新 key actions.completedNamed(10 个语言包);无
label 的动作仍是通用文案。
- item 7:无 format 的金额指标按币种自身小数位显示(CNY ¥1,293.00、JPY ¥1,293),与列表单元格一致;根因在
core 的 dataset-format.ts,MetricWidget 静态卡同规则修。
- 门禁 35/35 exit 0,type-check 与 check:spec-symbols exit 0;五处消融各自变红;1440 宽
zh 前后截图见下。
## What changes
- **item 1, zh titles space a Latin object name.**
`ui/packages/i18n/src/i18n.ts` registers an i18next post-processor that
runs only for the keys in `CJK_LATIN_SPACED_KEYS` (`form.createTitle`,
`form.editTitle`, `form.viewTitle`, `console.ai.recordWriteCreateTitle`,
`console.ai.recordWriteUpdateTitle`) and only in `zh`. It pads the
interpolated `object` value with a space on each side where a Latin
letter or digit meets Han text. `新建{{object}}` stays the pack spelling,
so the placeholder-spelling ruling (objectui#3512) holds.
- **item 2, the lookup's create dialog has a title.** `useActionModal`'s
`{ objectName, mode: 'create' }` branch titles the form with
`form.createTitle` and the object's label (the console's own New dialog
title) when the descriptor has no `title`. An authored `title` wins; an
edit form is not given one.
- **item 3, the default success toast names the action.**
`ActionRunner.composeSuccessMessage`'s last rung reads the new key
`actions.completedNamed` (`{{action}} completed`, zh `“{{action}}”已完成`)
for an action with a `label`; an action with no label keeps
`actions.completedSuccessfully`. The host still localizes the label
before dispatch, so the toast carries the label the user saw on the
button.
- **item 7, money metrics keep the currency's decimals.**
`formatMeasure` (core `dataset-format.ts`) no longer passes
`minimumFractionDigits: 0, maximumFractionDigits: 2` to a currency
amount with no `format`, so Intl uses the currency's own minor-unit
width. `MetricWidget`'s static card with a `currency` and no `format`
gets the same rule instead of whole units. An authored `format` pattern
still states its width.
- Changeset: patch for `@object-ui/i18n`, `@object-ui/core`,
`@object-ui/app-shell`, `@object-ui/plugin-dashboard`.
## Tests
- `i18n.test.ts`: zh 新建/编辑/查看 + `Repair Ticket` is spaced; `新建维修工单` is
not; a key outside the table (`form.createSuccess`) is not; ja and en
are untouched; unit cases for `spaceLatinValueFromCjk`.
- `useActionModal.objectCreateTitle-30126.test.tsx` (new): en `Create
Repair Ticket`, zh `新建 Repair Ticket`, authored title wins, CONTROL edit
form has no create title.
- `ActionRunner.defaultSuccessToast-10900.test.ts`: `Resolve completed`
with no translator; the translator is asked for `actions.completedNamed`
with `action`; an empty answer falls back to the filled English; a blank
label keeps the generic line; `successMessage` still wins.
- `dataset-format.test.ts`: CNY 1293 → `¥1,293.00`, 1280.5 →
`¥1,280.50`, JPY `¥1,293`, KWD three decimals, pattern `0,0` → `¥1,293`.
- `MetricWidget.numberFormat.test.tsx`: CNY `¥1,293.00` / `¥1,280.50`,
JPY `¥1,293`, pattern `0,0` → `¥1,281`.
- Moved pins (each now reads the new behaviour):
`RecordFormPage.i18n.test.tsx` (`新建 Contacts`, pack value still
`新建{{object}}`), the two `flowDoneSuccessMessage-12274` tests (`Escalate
case completed`), `ObjectView.toolbarScriptSelection-12331` (`Add to
Campaign completed`), and `MetricWidget.numberFormat` (`$1,930,000.00`,
`1.930.000,00 €`).
## Acceptance notes
- **Out of scope:** #30126 items 4, 5, 6 and 8 to 16 (server, CLI,
re-measure, or held by other cards). Nothing here touches `packages/**`,
`AppHeader.tsx` or `RecordDetailView`.
- **Mechanism deviation 1 (item 1):** an i18next formatter has to be
spelled inside the pack value (`{{object, name}}`), which breaks the
placeholder-spelling gate (`fallback-placeholder-spelling-3512.test.ts`,
the objectui#3512 / #4135 ruling: packs use `{{name}}` only). A
key-listed post-processor gives the same result with the pack unchanged;
the seat agreed (claim amendment 2).
- **Mechanism deviation 2 (item 7):** the reported readings do not come
from `MetricWidget.metricPatternDecimals`. They come from the dataset
metric path, `DatasetWidget` → core `formatMeasure`, which passed
`minimumFractionDigits: 0, maximumFractionDigits: 2` (code identical at
the `@object-ui/*@18.3.0` release commit 83d7e4a and on `main`). That
pair is exactly what prints `¥1,280.5` for 1280.5 (the 18.3.0 report)
and `¥1,293` for 1293.00 (the `main` report); `Intl` with no fraction
options gives `¥1,280.50` / `¥1,293.00`. Re-measured live on `main`
(989ae42): `¥1,293` before, `¥1,293.00` after. The static
`MetricWidget` card had the same gap in a different form (whole units,
`¥1,281`), fixed by the same rule. The seat added `dataset-format.ts` to
the surface.
- **Bounded in-place widening:** `form.editTitle`, `form.viewTitle` and
`console.ai.recordWriteUpdateTitle` share the exact shape of
`createTitle`, so they are in the key list too.
- **item 3 interpolation:** `completedNamedText` fills the one
`{{action}}` hole with a single `String.replace` for the no-translator
fallback; it is not a new general interpolator (the 3512 gate's needle
list is unchanged).
- **Pre-existing:** `eslint` reports one error in `MetricWidget.tsx`
(react-hooks "Cannot create components during render"); it is on base at
line 419 too, not from this diff.
- New i18n key `actions.completedNamed` in all 10 packs is the Clause-②
widening; no key is removed or renamed.
## Verification
- Head `70fc02c9` (`origin/main` merged; merge-tree against today's
`main` is clean).
- `node scripts/pm/dispatch-gates.mjs --commands` on the changed paths:
35 derived families, all run, all exit 0; `--ran` reconcile: 0
NOT-MEASURED, 0 UNRUN.
- `type-check` exit 0 for i18n, core, react, plugin-dashboard, app-shell
(i18n and app-shell re-run after the merge). `pnpm --dir ui run
check:spec-symbols` exit 0. `check:new-line-citations`: 0 new.
- vitest on the touched packages after the merge: 100/100 files, 1508
tests passed. `pnpm --dir ui exec vitest run scripts/`: 170 files passed
(2 skipped), 4985 tests.
- Ablations (each reverted, `git diff HEAD` empty after): post-processor
off → 1 failed; modal title off → 2 failed; named toast off → 3 failed;
`formatMeasure` width back → 3 failed; `MetricWidget` width back → 4
failed.
<details><summary>Before / after, zh, 1440 wide (showcase stack, objects
Repair Ticket / Repair Asset)</summary>
| item | before (`main`) | after |
|---|---|---|
| 1 | [新建Repair
Ticket](https://github.com/objectstack-ai/objectstack/blob/a21e05e8838cb35609a47e759ef901af618b342a/evidence/30126/item1-before-zh-1440.png)
| [新建 Repair
Ticket](https://github.com/objectstack-ai/objectstack/blob/a21e05e8838cb35609a47e759ef901af618b342a/evidence/30126/item1-after-zh-1440.png)
|
| 2 | [no
heading](https://github.com/objectstack-ai/objectstack/blob/a21e05e8838cb35609a47e759ef901af618b342a/evidence/30126/item2-before-zh-1440.png)
| [新建 Repair
Asset](https://github.com/objectstack-ai/objectstack/blob/a21e05e8838cb35609a47e759ef901af618b342a/evidence/30126/item2-after-zh-1440.png)
|
| 3 |
[操作已成功完成](https://github.com/objectstack-ai/objectstack/blob/a21e05e8838cb35609a47e759ef901af618b342a/evidence/30126/item3-before-zh-1440.png)
|
[“Resolve”已完成](https://github.com/objectstack-ai/objectstack/blob/a21e05e8838cb35609a47e759ef901af618b342a/evidence/30126/item3-after-zh-1440.png)
|
| 7 |
[¥1,293](https://github.com/objectstack-ai/objectstack/blob/a21e05e8838cb35609a47e759ef901af618b342a/evidence/30126/item7-before-zh-1440.png)
|
[¥1,293.00](https://github.com/objectstack-ai/objectstack/blob/a21e05e8838cb35609a47e759ef901af618b342a/evidence/30126/item7-after-zh-1440.png)
|
The screenshots live on evidence commit a21e05e and are removed by the
next commit, so the diff carries no binaries.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01L6bhgTuQiDduLj5Xcj3KMa)_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01L6bhgTuQiDduLj5Xcj3KMa
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent c322421 commit ea5807e
25 files changed
Lines changed: 402 additions & 26 deletions
File tree
- .changeset
- ui/packages
- app-shell/src
- hooks
- __tests__
- views
- core/src
- actions
- __tests__
- utils
- __tests__
- i18n/src
- __tests__
- locales
- plugin-dashboard/src
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
59 | | - | |
| 58 | + | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| |||
165 | 166 | | |
166 | 167 | | |
167 | 168 | | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
168 | 172 | | |
169 | 173 | | |
170 | 174 | | |
| |||
267 | 271 | | |
268 | 272 | | |
269 | 273 | | |
| 274 | + | |
270 | 275 | | |
271 | 276 | | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
276 | 289 | | |
277 | 290 | | |
278 | 291 | | |
| |||
281 | 294 | | |
282 | 295 | | |
283 | 296 | | |
284 | | - | |
| 297 | + | |
285 | 298 | | |
286 | 299 | | |
287 | 300 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
280 | | - | |
| 280 | + | |
| 281 | + | |
281 | 282 | | |
282 | 283 | | |
283 | 284 | | |
| |||
296 | 297 | | |
297 | 298 | | |
298 | 299 | | |
299 | | - | |
| 300 | + | |
| 301 | + | |
300 | 302 | | |
301 | 303 | | |
302 | 304 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
90 | | - | |
| 89 | + | |
| 90 | + | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
184 | | - | |
185 | | - | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
186 | 188 | | |
187 | 189 | | |
188 | 190 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
643 | 643 | | |
644 | 644 | | |
645 | 645 | | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
646 | 649 | | |
647 | 650 | | |
648 | 651 | | |
| |||
666 | 669 | | |
667 | 670 | | |
668 | 671 | | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
669 | 676 | | |
670 | 677 | | |
671 | 678 | | |
| |||
682 | 689 | | |
683 | 690 | | |
684 | 691 | | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
685 | 702 | | |
686 | 703 | | |
687 | 704 | | |
| |||
1372 | 1389 | | |
1373 | 1390 | | |
1374 | 1391 | | |
1375 | | - | |
| 1392 | + | |
1376 | 1393 | | |
1377 | 1394 | | |
1378 | 1395 | | |
| |||
1433 | 1450 | | |
1434 | 1451 | | |
1435 | 1452 | | |
1436 | | - | |
| 1453 | + | |
1437 | 1454 | | |
1438 | 1455 | | |
1439 | 1456 | | |
| |||
1916 | 1933 | | |
1917 | 1934 | | |
1918 | 1935 | | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
1919 | 1947 | | |
1920 | 1948 | | |
1921 | 1949 | | |
| |||
1924 | 1952 | | |
1925 | 1953 | | |
1926 | 1954 | | |
1927 | | - | |
| 1955 | + | |
| 1956 | + | |
| 1957 | + | |
| 1958 | + | |
1928 | 1959 | | |
1929 | 1960 | | |
1930 | 1961 | | |
| |||
1986 | 2017 | | |
1987 | 2018 | | |
1988 | 2019 | | |
1989 | | - | |
| 2020 | + | |
| 2021 | + | |
| 2022 | + | |
| 2023 | + | |
1990 | 2024 | | |
1991 | 2025 | | |
1992 | 2026 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
0 commit comments