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

Problem with error message translations if use valibot in form #1782

Open
ncodealex opened this issue May 12, 2024 · 2 comments · May be fixed by #1783
Open

Problem with error message translations if use valibot in form #1782

ncodealex opened this issue May 12, 2024 · 2 comments · May be fixed by #1783
Labels
bug Something isn't working

Comments

@ncodealex
Copy link

Environment

Version

v2.16.0

Reproduction

https://stackblitz.com/edit/nuxt-starter-cf4613?file=app.vue

Description

Hello! 👋 Thanks for package!
I very likes use Nuxt Ui / Pro in my projects !

I use valibot in forms and set globally translation. ( please see reproduction )

Expected behavior: after set globally translation language in valibot, issues message shows in set globally lang
Actual behavior: issues message shows in default language "en"

Under the hood we used ._parse method

#https://github.com/nuxt/ui/blob/main/src/runtime/components/forms/Form.vue

Please see string 263.

fabian-hiller says:

._parse is an internal API and should not be used directly. If you parse your schema with parse or safeParse, it should work as expected: https://valibot.dev/guides/parse-data/

For this reason we don't get messages with current translation.

Issue in valibot repo: https://github.com/fabian-hiller/valibot/issues/576

Please help with this problem, or if need i can try solve this problem and send new pull request!

Additional context

No response

Logs

No response

@ncodealex ncodealex added the bug Something isn't working label May 12, 2024
@ncodealex ncodealex changed the title Problem with error translation if use valibot in form Problem with error message translations if use valibot in form May 12, 2024
@ncodealex
Copy link
Author

Tagging @fabian-hiller for feedback

@fabian-hiller
Copy link

Short explanation: Valibot captures the configuration when calling parse and safeParse and then passes it to ._parse. Since ._parse is called directly, the global configuration is probably ignored. I am happy to help with any questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants