fix(fields): #3342 TagsField placeholder 走 field.placeholder → i18n → 英文默认三级链,移除硬编码中文 - #3350
Merged
Merged
Conversation
…er → i18n → English default, no hardcoded Chinese
The tags widget's input placeholder was a hardcoded Chinese literal
(Commandment #-1 violation) and ignored the author-declared
field.placeholder. It now resolves through the pinned chain:
field.placeholder (author declaration wins) → t('fields.tags.placeholder')
via useFieldTranslation() → English FIELD_DEFAULTS fallback when no
I18nProvider is mounted. The new key is added at full parity across all
ten locale packs; Chinese lives in the zh pack only.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NVPjPzmmAJ2Ngtvgg5MSRa
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
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.
Fixes #3342
问题
packages/fields/src/widgets/TagsField.tsx的输入框 placeholder 是硬编码中文字符串(输入后回车添加…):useFieldTranslation()i18n 通道;field.placeholder在此 widget 中被完全忽略。修复(按 issue 评论中的 PM 裁决)
三级优先链,与 SelectField 的
config?.placeholder || t('common.selectOption')同构:field.placeholder—— 作者声明永远优先(即使切到非英文 locale 也不被翻译覆盖);t('fields.tags.placeholder')—— 经useFieldTranslation()从 locale 包取(key 组织对齐fields.*既有命名空间,紧邻fields.options/fields.objectRef);I18nProvider时渲染Type and press Enter to add…,绝不渲染裸 key。中文文案进 zh locale 包,代码中不再含 CJK。
fields.tags.placeholder按 #3328(objectui#3321)的方式在全部 10 个 locale 包(en/zh/ja/ko/de/fr/es/pt/ru/ar)补齐 —— 派单里写的"11 个"沿用了 #3328 changeset 的笔误,仓库实际是 10 个包(all-locales-key-parity测试钉住OTHER_LOCALES长度为 9 + en)。保留原有行为:placeholder 仅在标签列表为空时显示(已有标签时输入框是续接条,提示是噪音)。
验证
pnpm exec vitest run packages/fields/src/widgets/TagsField.placeholder.test.tsx packages/fields/src/widgets/TagsField.placeholder.no-provider.test.tsxpnpm exec vitest run …widget-aria-invalid-registry-e2e… …widget-dom-leak-e2e… …all-locales-key-parity… …en-zh-key-parity…(连同新增测试共 6 文件)pnpm --filter @object-ui/fields type-check/--filter @object-ui/i18n type-check破坏验证实录
fields.tags.placeholder→all-locales-key-parity红(ar is missing 1 key(s): [ 'fields.tags.placeholder' ])→ 还原 → 20/20 绿。测试布局说明
no-provider 断言独立成文件(
TagsField.placeholder.no-provider.test.tsx),原因与OptionsEmptyState.no-provider.test.tsx相同:一旦挂过I18nProvider,initReactI18next会把实例装成 react-i18next 全局默认,同一模块图内不再存在"无 provider"状态可观测。Commandment #-1 的 CJK pin 也放在该文件(无 provider 时渲染出的文案必然来自代码,正则用转义\u区间以免测试自身携带 CJK 字面量)。Changeset
@object-ui/fields+@object-ui/i18n均 patch(fixed group,无 major)。未触碰content/docs/releases/。🤖 Generated with Claude Code
https://claude.ai/code/session_01NVPjPzmmAJ2Ngtvgg5MSRa
Generated by Claude Code