Repository navigation
fix(app-shell): allowed-visualization chips read the view-type select's words in zh-CN - #30433
Merged
Merged
Conversation
…'s words in zh-CN Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CZxcXXabvxgwiUDTa3
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CZxcXXabvxgwiUDTa3
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CZxcXXabvxgwiUDTa3
Contributor
Author
|
domain:ui#2 · os-bill · session_01Utp6Cb5R6JDdfyvtj3dPR2 维护者速读
席位核对 — ACCEPT · domain:ui#2 · head
|
This was referenced Nov 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Bill · project thread
domain:ui#2 · os-bill · session_01Utp6Cb5R6JDdfyvtj3dPR2
Fixes #30358
Clause-②: no
Metadata-protocol: none
维护者速读
ui/packages/app-shell/src/views/metadata-admin/widgets.tsx的enumOptionLabel→viewTypeLabels.ts(从ViewVariantInspector.tsx挪出的取词函数)→ 新测试MultiSelectWidget.viewTypeLabels-30358.test.tsx。pnpm --dir ui exec vitest run packages/app-shell/src/views/metadata-admin/MultiSelectWidget.viewTypeLabels-30358.test.tsx,预期 3/3 通过(main 源码上 zh-CN 一条失败,读到 Grid…Tree)。What changes
The 允许的可视化 chips (
appearance.allowedVisualizations) are themultiselectwidget inwidgets.tsx. With nofieldSpec.options, it named each enum value withhumanizeOption(v)(grid→Grid) in every locale. The view-type select a few rows up names the same values throughtypeLabelinViewVariantInspector.tsx(theengine.inspector.view.type.*keys, then an English fallback map).typeLabeland its fallback map move to a shared module,metadata-admin/viewTypeLabels.ts(viewTypeLabel,isKnownViewType).ViewVariantInspectorimports it, so the select is unchanged. The fallback map gainstree, the one view type it lacked (the catalog already hasengine.inspector.view.type.treein en and zh).enumOptionLabel: when every value is a view type and the console is not en-US, a chip readsviewTypeLabel(v, locale), the select's own word. Otherwise it keepshumanizeOption.humanizeOptionfor en-US rather than routing en through the shared helper with agridoverride: the en catalog word forgridis "Table / List", so routing en through the helper would need a per-value exception to keep "Grid". Keeping en on its existing path is the smaller change and leaves all nine en names byte-identical by construction. The console's locale iszh-CNoren-US(useMetadataLocale), so "not en-US" is zh-CN today.WidgetProps), so it recognises the view-type enum by its values, not by the field's name. A mixed enum (['grid', 'start_date']) keeps the humanised names in zh-CN too, so a list is never half translated.fieldSpec.optionslabels still win when a form supplies them.Tests
MultiSelectWidget.viewTypeLabels-30358.test.tsx, over the spec's realappearance.allowedVisualizationsJSONSchema (fromgetListVariantSchema(), not a copied enum) and the shippedstudiocatalogue:t('engine.inspector.view.type.' + v, 'zh-CN')for every enum value, in enum order, and none of them is Latin text.Grid, Kanban, Gallery, Calendar, Timeline, Gantt, Map, Chart, Tree.['Grid', 'Start Date'].Tests 1 failed | 2 passed (3). The zh-CN case failed withexpected [ 'Grid', 'Kanban', 'Gallery', …(6) ] to deeply equal [ '表格 / 列表', '看板', '画廊', '日历', …(5) ]. Both en and mixed passed on main, which pins that they are unchanged. Green after the fix:Tests 3 passed (3). The red run on main's source is the ablation leg; the fix is the only source change and the tests importsrc.6daec651: the existingMultiSelectWidget.test.tsx, fourViewVariantInspector.*.test.tsx,unknownValueFlag.i18n-9652.test.tsx(the select's unknown-type label), and fourSchemaForm/ResourceEditPagesuites that render the multiselect.Test Files 11 passed (11),Tests 170 passed (170).pnpm exec turbo run type-check --filter=@object-ui/app-shell --concurrency=2:Tasks: 68 successful, 68 total.eslinton the four changed ui files: 0 errors (42 warnings, all on lines this PR does not touch inwidgets.tsx).Live probe
Example CRM (
examples/app-crm,objectstack dev --seed-admin --fresh) with the branch's console (vite dev). Studio →crm_activity.all→ 终端用户控制 → 外观 → 允许的可视化, read from the DOM ([role=group] [role=checkbox]):Grid, Kanban, Gallery, Calendar, Timeline, Gantt, Map, Chart, Tree.表格 / 列表, 看板, 画廊, 日历, 时间线, 甘特图, 地图, 图表, 树形. The view-type select on the same page reads 表格 / 列表.Grid, Kanban, Gallery, Calendar, Timeline, Gantt, Map, Chart, Tree.The card's before-shot path is not in this project's folder, so the before leg was taken here, on main's widget source.
Acceptance notes
appearance/userActionskeys still read English (Allowed Visualizations,Show Description,Sort,Search, and the quick-filter element's labels). These come from the spec's.describe()and the metadata-forms catalogs, which this card leaves to the catalog channel (zh-CN metadata forms served by the platform still say 仪表板 where the Console now says 仪表盘 #30164). Not changed here.Verification
Derived gates (dispatch-gates --commands, final tree `6daec651`)
node scripts/check-adr-0087-registration.mjs --base origin/main:: exit 0node scripts/check-adr-0087-registration.mjs --self-test:: exit 0node scripts/check-changeset-no-major.mjs --base origin/main:: exit 0node scripts/check-closing-keyword-parity.mjs:: exit 0node scripts/check-closing-keyword-parity.mjs --self-test:: exit 0node scripts/check-comment-mask-corpus.mjs:: exit 0node scripts/check-empty-changeset.mjs --base origin/main:: exit 0node scripts/check-empty-changeset.mjs --self-test:: exit 0node scripts/check-sdui-manifest.mjs:: exit 0node scripts/check-sdui-manifest.mjs --self-test:: exit 0node scripts/pm/release-rehearsal-clone.mjs --self-test:: exit 0node scripts/release-pending-publish.mjs --self-test:: exit 0pnpm --dir ui exec vitest run scripts/:: exit 0pnpm --filter @objectstack/spec run check:duration-unit-keys:: exit 0pnpm check:changeset-gate-self-tests:: exit 0pnpm check:closed-ceremony-text:: exit 0pnpm check:cross-package-test-inputs:: exit 0pnpm check:dispatcher-error-vocabulary:: exit 0pnpm check:driver-memory-census:: exit 0pnpm check:engine-double-contract:: exit 0pnpm check:gitlink-declared:: exit 0pnpm check:nul-bytes:: exit 0pnpm check:published-files:: exit 0pnpm check:query-options-erasure:: exit 0pnpm check:refd-timer-probe:: exit 0pnpm check:registry-log-declared:: exit 0pnpm check:rest-log-spy-declared:: exit 0pnpm check:skill-identifier-liveness:: exit 0pnpm check:test-source-alias:: exit 0pnpm check:tier-file-adoption:: exit 0pnpm check:type-check-coverage:: exit 0pnpm check:type-check-debt:: exit 0pnpm check:undeclared-dep-imports:: exit 0pnpm check:watch-hint-literal:: exit 0pnpm check:where-matcher:: exit 0node scripts/pm/dispatch-gates.mjs --ran: 35 derived, 35 run, 0 NOT-MEASURED, 0 UNRUN.check:type-check-debtran under the verify lock (VERDICT command-exit 0).check:sdui-manifest(standing ui gate) is in the list.Generated by Claude Code