This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Repository navigation
Commit 36e27db
fix(app-shell): the designer's unknown-value flags read in the designer's locale (objectui#9652) (#10445)
Fixes #9652
Clause-②: no
## What was wrong
A designer picker that holds a stored value its roster does not offer
still shows that value, flagged with the reason. The flag was an English
template literal at each site, so a zh-CN author read `(not found)`,
`(not in object)` or `(deprecated)` on an otherwise Chinese inspector.
The designer catalogue
(`packages/app-shell/src/views/metadata-admin/i18n.ts`) already carried
`engine.form.notInObject` in en and zh, and `widgets.tsx` already used
it.
## Sites (re-derived by grep on `origin/main` at the base `3335767b4`)
| site | flag | now |
|:--|:--|:--|
| `ViewColumnInspector` field picker | `(not in object)` |
`engine.form.notInObject` (existing row, unchanged) |
| `ViewVariantInspector` view type | `(not found)` |
`engine.form.notFound` (new) |
| `FlowNodeConfigField` select branch | `(deprecated)` |
`engine.form.deprecated` (new) |
| `FlowObjectListField` select cells | `(deprecated)` |
`engine.form.deprecated` |
| `InspectorSelectField` default (`_shared.tsx`) | `(not found)` |
`engine.form.notFound` |
`ActionDefaultInspector` only mentions `VALUE (not found)` in a comment.
Its `ActionTargetField` passes no `unknownValueLabel`, so it shows the
`_shared.tsx` default, which is now translated.
Two sites of the same class that the seat's list did not name. Both are
outside this claim's file surface, so they are **not** touched here.
They are listed in the report for the seat:
- `FlowReferenceField.tsx`, org-membership-level select: `label:
\`${current} (invalid)\``
- `HookDefaultInspector.tsx`, object picker: `label: \`${n} (not
published)\``
## Decisions, each measured
- **Keys.** `(not in object)` now uses the existing
`engine.form.notInObject`. Its value is unchanged, so the bare-suffix
readers in `widgets.tsx` (which draw it in a muted span of its own) keep
working. The catalogue had no row meaning "not found" or "deprecated"
(grep of both tables for `not found`, `deprecated`, `未找到` and `弃用`). One
key was added for each, as bare suffixes shaped like `notInObject`:
`engine.form.notFound` = `(not found)` / `(未找到)` and
`engine.form.deprecated` = `(deprecated)` / `(已弃用)`. `未找到` is the zh
pack's own word for "not found" (`未找到选项`, `未找到记录`). The catalogue
carries en and zh only, and every new key has a value in both.
- **Word order.** The catalogue's `tFormat` interpolates single-brace
`{token}` holes. `engine.form.notInObject` is a bare suffix, and its
value cannot take a `{value}` hole without changing `widgets.tsx`. So
the value and its flag are joined by one template,
`engine.form.flaggedValue`: en `{value} {flag}`, zh `{value}{flag}`. The
zh template drops the space because every zh flag opens with a
full-width bracket. That is the catalogue's own zh convention
(`component_id(此页面暂无组件)`), and a `${v} (flag)` literal at the call site
could not express it. This adds three keys, one more than "one key
each": the template is the word-order key that the open point asked for.
The helper is `flagUnknownValue(value, flag, locale)` in `_shared.tsx`,
a one-line `tFormat` call.
- **How the locale is obtained. No new plumbing.** The three sites that
already had a `locale` prop (`ViewColumnInspector`,
`ViewVariantInspector`, `FlowNodeConfigField`) translate with that prop.
Two places have no `locale` prop: `InspectorSelectField`'s default and
`FlowObjectListField`. They read `useMetadataLocale()`, the hook that
the designer's shared editors already read when no prop reaches them
(`widgets.tsx`, `SchemaForm.tsx`, and `ConditionBuilder.tsx` in this
same directory). Every production host (`ResourceEditPage`,
`StudioDesignSurface`, `ObjectActionsPanel`) derives the `locale` prop
it hands to inspectors from that same hook.
- **The `_shared.tsx` default.** It is translated. The other route would
have been a `locale` prop on `InspectorSelectField`, but that needs a
`locale` argument at each of the call sites that pass no
`unknownValueLabel`, which are in other inspector files outside this
claim. The hook covers them with no call-site edit.
## Pins
The new file is `inspectors/unknownValueFlag.i18n-9652.test.tsx`, with
14 cases. For each site it has one render-level zh case and one en case,
and it reads the rendered trigger or option text:
- zh expectations are the value followed directly by the catalogue's zh
flag. A guard proves each flag row is a real zh value: not the key
echoed back, not the English value, and opening with a full-width
bracket.
- en expectations are the pre-fix literals byte for byte (`amount (not
in object)`, `legacy_board (not found)`, `sms (deprecated)`, `role
(deprecated)`, `retired_group (not found)`).
- The prop-channel sites pass `locale` with no provider. The
hook-channel sites mount `I18nProvider` in the language under test.
No existing test was rewritten or deleted. None of them asserted an
English flag under a zh locale: every existing literal assertion
(`ReportDefaultInspector.test.tsx`,
`FlowNodeInspector.declaredDefault.test.tsx`,
`FlowNodeConfigField.test.tsx`, `FlowObjectListField.select.test.tsx`,
the `_shared.*` and `ViewColumnInspector.*` suites) renders en.
## Reverse proof (run at `ff58a68b1`, which has the same code as the
head; the next commit adds only the changeset)
Mutations were made through `ablation-replace.mjs`. Each anchor hit
exactly once, the blob changed, the file was restored to its HEAD blob
afterwards, and `git diff HEAD` was empty:
- **A.** `ViewColumnInspector` back to `` `${v} (not in object)` ``:
`Tests 1 failed | 1 passed | 12 skipped`. The zh case failed with
`Expected: "amount(不在对象中)" Received: "amount (not in object)"`, and the
en case stayed green.
- **B.** The `_shared.tsx` default back to `` `${v} (not found)` ``:
`Tests 1 failed | 2 passed | 11 skipped`. The zh default case failed
with `expected 'retired_group (not found)' to be 'retired_group(未找到)'`,
and the en and caller-override cases stayed green.
## Verification (head `f96ee760a`)
- `vitest run` on `metadata-admin/inspectors/` (all of it) plus
`check-i18n-{designer-table-parity,dead-keys,call-site-keys,en-drift}.test.ts`,
`perm-home-namespace-3546`, `objectView-config-keys-retired-4730`,
`block-config-i18n`, `block-config`, `studio-locale.i18n` and the
console `preview-samples-designer-options`: `Test Files 100 passed
(100)`, `Tests 1570 passed | 1 skipped`.
- `vitest run` on tests that render these inspectors from outside the
directory: `studio-design/` (all of it), both `ViewConfigPanel` suites,
`ResourceEditPage.defaultGate`, `ConditionalFormattingEditor.celGate`,
`FieldsListEditor.retiredAliases`, `view-column-io.retiredAliases`,
`page-schema`, `ViewRefWidget` and four designer i18n tests: `Test Files
73 passed (73)`, `Tests 401 passed`.
- `turbo run build --filter=@object-ui/app-shell^... --concurrency=2`
built 28 of 28 tasks. Then `pnpm --filter @object-ui/app-shell
type-check` (`tsc --noEmit && tsc -p tsconfig.test.json`) exited 0.
`--listFilesOnly` confirms the test tsconfig includes the new test file.
- These gates exited 0: `check:i18n-designer-parity` ("Every en row has
a zh row, and every shared row carries the same placeholders."),
`check:i18n-drift` (designer table: 3 keys added, 0 en values changed),
`check:i18n-keys`, `check-changeset-presence`,
`check-changeset-no-major`, `check:new-line-citations` (0 new),
`check:control-bytes`, `check:changeset-claims`,
`check:pending-changeset-literals`, `check:vi-mock-specifiers`,
`check:vi-mock-inherit`, `check:vi-mock-override-shape` and
`check:test-path-roots`.
- `check:changeset-claims` reported three pending changesets that name
`i18n.ts`: `6310-designer-formula-key-retired`,
`7125-dashboard-empty-state-keys-retired` and
`8632-malformed-picklist-option-loud`. I read each paragraph, and all
stay true: the keys they name are untouched and still present.
- Lint was a proven narrowing, not a repo-wide run. `eslint
--no-inline-config --format json` on the 7 touched `.ts`/`.tsx` files
gave 7 files, 0 errors and 12 warnings. The population comes from
eslint's own config: `calculateConfigForFile` does not ignore these
files, and `languageOptions.parserOptions.project` is null. Invariance:
type-aware linting is off, and no rule in `eslint-rules/` reads other
files, so this diff cannot move a verdict on an untouched file.
## Acceptance notes
- One new lint warning: `react-refresh/only-export-components` on the
exported `flagUnknownValue`. `_shared.tsx` already exports non-component
helpers such as `rosterFrom` and `uniqueId` under the same warning, and
`lint.yml` sets no `--max-warnings` on purpose.
- The console preview gallery's `?locale=zh-CN` forces the `locale` prop
without switching the i18n language. There, the two hook-read flags
follow the i18n language, as `SchemaForm` and `widgets.tsx` already do
on that page. Production hosts get both from the same hook.
- `defaultRosterFailureLabel` stays raw English. Every current `roster`
caller passes `t('engine.form.optionsLoadFailedTitle', …)`, so nothing
renders it. Its comment is reworded because the old one called the
module locale-free.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01BP8CMtACxTdLjqR6rhd33C)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent cc4366d commit 36e27db
8 files changed
Lines changed: 376 additions & 18 deletions
File tree
- .changeset
- packages/app-shell/src/views/metadata-admin
- inspectors
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1004 | 1004 | | |
1005 | 1005 | | |
1006 | 1006 | | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
1007 | 1017 | | |
1008 | 1018 | | |
1009 | 1019 | | |
| |||
2980 | 2990 | | |
2981 | 2991 | | |
2982 | 2992 | | |
| 2993 | + | |
| 2994 | + | |
| 2995 | + | |
| 2996 | + | |
| 2997 | + | |
2983 | 2998 | | |
2984 | 2999 | | |
2985 | 3000 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
304 | 305 | | |
305 | 306 | | |
306 | 307 | | |
307 | | - | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
308 | 311 | | |
309 | 312 | | |
310 | 313 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
126 | 127 | | |
127 | 128 | | |
128 | 129 | | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
129 | 135 | | |
130 | 136 | | |
131 | 137 | | |
| |||
358 | 364 | | |
359 | 365 | | |
360 | 366 | | |
361 | | - | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
362 | 374 | | |
363 | 375 | | |
364 | 376 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
281 | 282 | | |
282 | 283 | | |
283 | 284 | | |
284 | | - | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
285 | 288 | | |
286 | 289 | | |
287 | 290 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
407 | 408 | | |
408 | 409 | | |
409 | 410 | | |
410 | | - | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
411 | 414 | | |
412 | 415 | | |
413 | 416 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
18 | 26 | | |
19 | 27 | | |
20 | 28 | | |
21 | 29 | | |
22 | 30 | | |
23 | 31 | | |
24 | 32 | | |
| 33 | + | |
25 | 34 | | |
26 | 35 | | |
27 | 36 | | |
| |||
300 | 309 | | |
301 | 310 | | |
302 | 311 | | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
307 | 316 | | |
308 | 317 | | |
309 | 318 | | |
310 | 319 | | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
316 | 329 | | |
317 | | - | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
318 | 337 | | |
319 | 338 | | |
320 | 339 | | |
321 | 340 | | |
322 | 341 | | |
323 | 342 | | |
324 | 343 | | |
325 | | - | |
| 344 | + | |
326 | 345 | | |
327 | 346 | | |
328 | 347 | | |
| |||
334 | 353 | | |
335 | 354 | | |
336 | 355 | | |
337 | | - | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
338 | 359 | | |
339 | 360 | | |
340 | 361 | | |
| |||
360 | 381 | | |
361 | 382 | | |
362 | 383 | | |
363 | | - | |
| 384 | + | |
364 | 385 | | |
365 | 386 | | |
366 | 387 | | |
| |||
378 | 399 | | |
379 | 400 | | |
380 | 401 | | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
381 | 410 | | |
382 | 411 | | |
383 | 412 | | |
| |||
0 commit comments