Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add lang property in ParseInfo supported props #23

Merged
merged 3 commits into from
Apr 16, 2024

Conversation

depsimon
Copy link
Contributor

This PR allows the user to pass the lang param to valibot, used for i18n.

const submission = await parseWithValibot(formData, {
    schema,
    info: { lang: await i18nServer.getLocale(request) },
});

Copy link
Owner

@chimame chimame left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @depsimon

Thank you for creating the pull request.
I think valibot supported translation from 0.28 onwards. First of all, I think it is necessary to upgrade the compatible version of valibot.

Then you will need to modify your type definition and tests. Can it be fixed?

parse.ts Outdated Show resolved Hide resolved
@depsimon
Copy link
Contributor Author

@chimame Sure, I've updated valibot to ^0.28.0 and adapted the tests & types.

The main changes are the ParseInfo > SchemaConfig and the error messages that are more verbose now.

@depsimon depsimon requested a review from chimame April 16, 2024 07:52
Copy link
Owner

@chimame chimame left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your great work! 👍
Let's merge and release.

@chimame chimame merged commit c36f0b1 into chimame:main Apr 16, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants