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

doc about localization of ajv incomplete for MUI forms #4092

Open
4 tasks done
dberardo-com opened this issue Feb 16, 2024 · 6 comments
Open
4 tasks done

doc about localization of ajv incomplete for MUI forms #4092

dberardo-com opened this issue Feb 16, 2024 · 6 comments

Comments

@dberardo-com
Copy link

Prerequisites

What theme are you using?

mui

Version

5.x

Current Behavior

the ajv localizer is called only when the formData validation is performaded on the overall formData payload, thus the content is partially translated.

in particular the "required" fields are not triggering the ajv validation, thus they are not translated.

so using the example from the doc, this is working:

image

but this is not translated:

image

Expected Behavior

according to this https://rjsf-team.github.io/react-jsonschema-form/docs/usage/validation/#some-examples the required field should also be translated

Steps To Reproduce

No response

Environment

- OS:
- Node:
- npm:

Anything else?

No response

@dberardo-com dberardo-com added bug needs triage Initial label given, to be assigned correct labels and assigned labels Feb 16, 2024
@heath-freenome
Copy link
Member

@dberardo-com If you are referring to the Please fill in this field text, then that is coming directly from your browser and has nothing to do with RJSF. If you don't want that then set the noHtml5Validate prop on the Form to false

@heath-freenome heath-freenome added awaiting response and removed needs triage Initial label given, to be assigned correct labels and assigned labels Feb 16, 2024
@dberardo-com
Copy link
Author

i see, i will give it a try, thanks for pointing that out. i think it would be worthwhile to have this hint as part of the i18n doc.

also: apart from validation, i understand that the only way to translate other text elements inside the form is to override the default templates / widgets with own components, right ? or are there any other elements related to localization other than ajv-localizer and ui-schemas ?

@heath-freenome
Copy link
Member

You can translate the strings in the out of the box components using the translateString property on Form

@dberardo-com
Copy link
Author

i see, will give it a try

@Ramadan4
Copy link

@dberardo-com If you are referring to the Please fill in this field text, then that is coming directly from your browser and has nothing to do with RJSF. If you don't want that then set the noHtml5Validate prop on the Form to false

can we change it to any text else

@heath-freenome
Copy link
Member

@Ramadan4 If you are asking about the Please fill in this field text then short of you patching the browser, I'd say no.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants