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

Get language/multilingual settings from the backend #5507

Open
erral opened this issue Dec 7, 2023 · 2 comments
Open

Get language/multilingual settings from the backend #5507

erral opened this issue Dec 7, 2023 · 2 comments

Comments

@erral
Copy link
Member

erral commented Dec 7, 2023

PLIP (Plone Improvement Proposal)

Responsible Persons

Proposer: Mikel Larreategi

Seconder:

Abstract

When using Volto we have 2 places where we need to set the language settings:

  • In the backend:
    • Install plone.app.multilingual
    • Set the default language
    • Set the available languages
  • In the front-end configuration:
    • Set config.settings.isMultilingual = true
    • Set config.settings.defaultLanguage = 'en'
    • Set config.settings.availableLanguages = ['en', 'es', 'de']

This is a bit cumbersome, because it should be as easy as just enabling the languages in the backend to be able to have them in the frontend.

Motivation

  • Reduce the number of possible failure points.
  • Simplify the configuration.
  • Imagine a user that wants to have multilingual features in Volto UI as they has in Classic UI. It is not possible without creating a frontend configuration and tweaking it in config.

Assumptions

Proposal & Implementation

  • Add Plone's language configuration in the @site endpoint
  • Add a new AsyncPropExtender that queries the list of addons and sets a isMultilingual key in redux to true if plone.app.multilingual is installed in the backend
  • Modify all uses of Volto language settings to get the value from redux
  • Deprecate Volto settings for language handling from config (isMultilingual, defaultLanguage, availableLanguages

Deliverables

Risks

  • We currently use Volto language settings in places where we do not have access to the redux store, such as routes or middleware . We may have some difficulties, or perhaps impossibilities to be able to achieve this as proposed; or we may need to change that configuration to something else.
  • This would be definitely a breaking change.

Participants

  • Mikel Larreategi
@JeffersonBledsoe
Copy link
Member

@erral Would we have to make this language request on each SSR render, or would it be possible to make the call on the Volto server startup and store the AsyncConnect result somewhere?

@erral
Copy link
Member Author

erral commented Dec 8, 2023

  • If we add the languages information to the @site endpoint, we already have an asyncpropsextender that will do the query and store it in redux in SSR.

  • regarding the isMultilingual setting, I initially thought to add it in the @site endpoint too and have it for free... but then I did it through the @addons endpoint and add a key in the reducer, and also add an asyncpropsextenders to the @addons endpoint. I don't know which option is better or more canonical regarding the REST API definition so I'm open to discuss it.

@plone plone locked and limited conversation to collaborators Feb 14, 2024
@sneridagh sneridagh added this to the Plone 7.0 milestone Dec 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Status: No status
Development

No branches or pull requests

3 participants