fix(grid): localize import result errors (objectstack#3566 follow-up) - #2861
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
The import completion screen rendered the raw English server message verbatim (field name twice, internal object api-name, all English) while the dry-run panel already localized the same errors. Route the result list through the same formatDryRunError path and thread the error `code` through ImportResult.errors. - Code-driven translations for the remaining structured import errors (invalid_boolean/number/date/option, required, AMBIGUOUS_MATCH) + zh copy in @object-ui/i18n. - isPlausibleEmail: spell the ASCII range with printable bounds (0x20-0x7e) so the regex carries no control character (eslint no-control-regex). - Tests for the new code mappings; updated the ImportResult.errors shape assertion. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Follow-up to the merged #2840 (which shipped the email-preview validation for objectstack-ai/objectstack#3566). This adds the error-message localization half.
Problem
The import completion screen rendered the raw English server message verbatim — e.g.
— with the field name twice, an internal object api-name, all in English, while the dry-run "Validate" panel already localized the exact same errors. Two rendering paths, inconsistent.
Change
formatDryRunErrorpath as the dry-run panel: it drives off the structured errorcode, resolves the field api-name to its label, and drops the duplicated<api-name>:prefix. Threaded the errorcodethroughImportResult.errorsto make this possible.invalid_boolean/invalid_number/invalid_date/invalid_option/required/AMBIGUOUS_MATCH— with Chinese (zh) copy in@object-ui/i18n, alongside the existingreference_not_found/reference_ambiguous.isPlausibleEmail: spelled the ASCII range with printable bounds (0x20-0x7e) so the regex literal carries no control character (eslintno-control-regex).Result
Row 6 (position): position: "装配工" matches more than one os_..._position — ...→第 6 行:职位:“装配工” 匹配到多条记录,请使用唯一值或记录 IDTests
importDryRun.test.ts— new cases forinvalid_number/invalid_option/required/AMBIGUOUS_MATCH(code-driven, no raw server text / api-name leaks).importAsyncPath.test.ts— updated theImportResult.errorsshape assertion (now carriescode).🤖 Generated with Claude Code