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

No translation for add/edit form validation messages #3997

Open
szakitibi opened this issue Aug 7, 2024 · 1 comment
Open

No translation for add/edit form validation messages #3997

szakitibi opened this issue Aug 7, 2024 · 1 comment

Comments

@szakitibi
Copy link
Contributor

What I did:

Used translated version of the forms on the classic demo site:

https://classic.demo.plone.org/de/++add++Folder
https://classic.demo.plone.org/de/demo/edit

Removed the title value to force a validation error.

What I expect to happen:

I expect translated pre-submit validation messages. Seems like

What actually happened:

The validation errors are not translated:

image

Please note, that the validation errors after submit are properly displayed, it is just the ones failing before form submit.

What version of Plone/ Addons I am using:

Plone 6.0.12 (6023)

I assume it runs on:
plone.staticresources 2.1.14
plone.mockup 5.1.12

Possible solution:

According to the patterns validation documentation custom messages can be provided for the forms with data-pat-validation attribute. It would be possible to set the translated message strings for example in plone.app.z3cform's macros.pt

@szakitibi
Copy link
Contributor Author

Note:

Although quick tests showed, that passing a translated message-required to data-pat-validation fixes the originally reported "Please fill out this field." message translation, but the proposed fix is limited to the Patternslib provided validation values only - see [1], [2].

Each browser will have its own unique set of validation messages for each html type. The set of messages for all ValidityState properties are different in each browser. It is unlikely that all the messages can be translated, unless the native validation is dropped and the backend validation with @@z3cform_validate_field calls brought back.

I'm not sure what happens when the OS and Browser is both using the selected language. Are these browser native validatoin messages translated? (E.g when the OS language is German and the browser localization is also German.)

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

2 participants