rjsf-team / react-jsonschema-form

A React component for building Web forms from JSON Schema.
https://rjsf-team.github.io/react-jsonschema-form/
Apache License 2.0
14.38k stars 2.2k forks source link

doc about localization of ajv incomplete for MUI forms #4092

Open dberardo-com opened 9 months ago

dberardo-com commented 9 months ago

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

heath-freenome commented 9 months ago

@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

dberardo-com commented 9 months ago

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 commented 9 months ago

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

dberardo-com commented 9 months ago

i see, will give it a try