Repository navigation
fix(i18n): add missing async action translations - #1645
Conversation
`_addIssue` looks up a specific message by the action's own `reference` function, and an async action's reference is the async function itself, not its sync twin. `Language['specific']` listed `partialCheck`, `rawCheck` and `rawTransform` but none of their `Async` counterparts, so no locale ever registered a message for them and `partialCheckAsync`, `rawCheckAsync` and `rawTransformAsync` fell back to the English default while the sync twin in the same pipeline was translated. Each new key reuses the string already written for its sync twin, which is how `checkAsync` and `checkItemsAsync` are handled, so no new wording is introduced. The generated `package.json` and `jsr.json` export maps gain the matching submodule entries.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (38)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. WalkthroughThe i18n package adds localized messages for Suggested reviewers: Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to The async validation translations and locale export paths are consistently added with no actionable current-head issue identified. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
commit: |
yslpn
left a comment
There was a problem hiding this comment.
Yes, it seems we've lost that. Thank you!
|
Thank you! |
@valibot/i18nnever translates issues frompartialCheckAsync,rawCheckAsyncorrawTransformAsync. A pipeline that uses one of them reports the English default message while the sync twin in the same locale is translated.This hits anyone doing cross-field validation against a database or an API, which is the main reason to reach for
partialCheckAsyncin the first place. The form ends up with a mix of translated and untranslated messages.Cause
_addIssueresolves a specific message by the action's ownreferencefunction, inlibrary/src/utils/_addIssue/_addIssue.ts:getSpecificMessage(context.reference, issue.lang). An async action's reference is the async function itself, solibrary/src/actions/partialCheck/partialCheckAsync.tssetsreference: partialCheckAsync, notpartialCheck, andrawCheck/rawCheckAsync.tsandrawTransform/rawTransformAsync.tsin the same folder layout do the same. The registrations come fromLanguage['specific']inpackages/i18n/src/types.ts, which listedpartialCheck,rawCheckandrawTransformwith noAsyncsiblings, sosetSpecificMessagewas never called for the three async references and the lookup always missed.check/checkAsyncandcheckItems/checkItemsAsyncwere already listed as separate keys, so this was the remaining gap rather than a design choice.Comparing the 105 actions under
library/src/actionsthat call_addIssueagainst the 102 keys inLanguage['specific']leaves exactlypartialCheckAsync,rawCheckAsyncandrawTransformAsync, and nothing in the other direction.Fix
The three keys are added to
Language['specific']and to all 34 locale files, each reusing the string already written for its sync twin, exactly ascheckAsyncandcheckItemsAsyncalready do. No wording is invented and no existing message changes.kr.tsis untouched because it spreadsko. The generatedpackages/i18n/package.jsonandpackages/i18n/jsr.jsonexport maps gain the matching submodule entries in the position the build scripts emit them, which is the order ofObject.entries(language.specific), so each new entry sits immediately after its sync twin in all 34 emitted languages and both files stay byte identical to their generated form.pnpm-lock.yaml, the build scripts and the library itself are not touched.Tests
packages/i18nhas no test runner and no job in.github/workflows/ci.yml(which coverslibrary,packages/to-json-schema,websiteand the codemod), so nothing automated would have caught this and the guard here is theLanguageinterface: dropping any one of the new keys from a single locale file is atsc --noEmiterror naming that file, which is what proves all 34 were updated. I also ran the repro above both ways against the locale data. Before the change the three async messages come back asInvalid input: Received Objectand the sync one is translated. After it, all four returnUngültige Eingabe: Object erhalten.Verification
tsc --noEmitoverpackages/i18n/srcpasses (thescriptshalf of that package's lint needs@types/node, which the scoped install does not pull, and nothing underscriptschanged) and the diff is 1231 insertions with zero deletions across 38 files.pnpm testinlibrary: 530 files, 4688 tests passed, no type errors.prettier --checkon the changed files passes.Summary by CodeRabbit