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

Add validator for default_language in language control panel #6811

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

sneridagh
Copy link
Member

@sneridagh sneridagh commented Mar 5, 2025

Fixes the use case that you can save a new default language without adding it to the list of available languages.
Now it complains, on blur and on save.
Probably, it would need a server side validator too.

Depends on plone/plone.i18n#73 but not requires it.

Also fixes a section of the docs that was incorrect.


📚 Documentation preview 📚: https://volto--6811.org.readthedocs.build/

Copy link

netlify bot commented Mar 5, 2025

Deploy Preview for plone-components canceled.

Name Link
🔨 Latest commit 189301e
🔍 Latest deploy log https://app.netlify.com/sites/plone-components/deploys/67c84bf5ada3f300086110a3

@sneridagh sneridagh requested review from stevepiercy and a team March 5, 2025 11:29
config.registerUtility({
name: 'default_language',
type: 'validator',
dependencies: { format: 'default_language' },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use fieldName: 'default_language' so plone/plone.i18n#73 isn't needed?

Copy link
Member Author

@sneridagh sneridagh Mar 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have this feature (yet). Do you really think it's the way to go? For me, the problem is the lack of expressivity in the definition of the fields in the backend source, which is not Volto to blame. And it's not only here. It's all over the place in the backend fields definitions.

Specially on control panels. So the field fix in plone/plone.i18n#73 should not only be the hint for the client side validation, but also having a server one where the validation of the default_language field is tied to the available_languages one.

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

Successfully merging this pull request may close these issues.

3 participants