You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The error message type is limited to being a string.
This makes things complicated when it comes to localization of error messages in combination with resolvers and form libraries like react-hook-form.
since RHF use some memoization on error messages, translation isn't recomputed after a "change locale event"
every schema is computed from a hook that use the useTranslate hook under the hood (not very suitable since the ideal solution would be to declare schema outside the React lifecycle)
The goal would be to do the translation at the very last moment when it comes to rendering / declaring the JSX
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
The error message type is limited to being a string.
This makes things complicated when it comes to localization of error messages in combination with resolvers and form libraries like react-hook-form.
There was basically the same discussion in the yup repository:
https://github.com/orgs/react-hook-form/discussions/3808#discussioncomment-2150621
@balzdur summarized it pretty well.
there are these two issues:
The goal would be to do the translation at the very last moment when it comes to rendering / declaring the JSX
Beta Was this translation helpful? Give feedback.
All reactions