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

Multilingual redirector does not take into account the stored cookie in SSR #5628

Closed
sneridagh opened this issue Jan 16, 2024 · 4 comments
Closed
Assignees

Comments

@sneridagh
Copy link
Member

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. As anonymous user/admin
  2. In a multilingual setup, (eg. EN/DE), go to 'http://localhost:3000/' (root)
  3. Click on the language switcher to EN
  4. Load again http://localhost:3000/ (no /de or /en, not navigating, in SSR, first request)
  5. Actual behavior: the site redirects to /de always (default language set)

Expected behavior
The site redirects to /en (the value that is stored in the language cookie, since we went to /en in the beginning)

@robgietema
Copy link
Member

I can not reproduce this error, for me this works (both in Volto and in client projects).

@robgietema
Copy link
Member

robgietema commented Jan 18, 2024

The issue is that the language selector checks if the language set by the cookie (in this case EN) is different from the language from the content object (in this case the root is set to DE). When it is different it sets the cookie to the language of the content object. What needs to be changed to fix this is either don't do this check on the siteroot or make the siteroot language independent and don't set the cookie if the langage is not set for the content object.

@robgietema
Copy link
Member

#5665

@sneridagh
Copy link
Member Author

Holly F.... ok, got it. Merged!

I guess that a quick fix is to remove the lang from the Plone Site Root DX type. Meh.

Thanks for looking into it!

sneridagh added a commit that referenced this issue Jan 21, 2024
* main: (39 commits)
  Attempt to build the components storybook only when its source files … (#5600)
  Added Storybook to Netlify build to allow relative links from documentation (#5599)
  Fix multilingual redirector (#5628) (#5665)
  Update ref from install-from-packages to create-project (#5654)
  Pin Vale to 2.30.0 to allow build of documentation until we can upgrade to v3.x (#5656)
  Temporarily pin `sphinxcontrib-*help` dependencies so docs can build (#5655)
  Merge the StyleWrapper styles with the draggable props from b-D&D (#5652)
  Fix order of preference in addons-registry for the theme (#5649)
  Unify variables in Makefile (#5637)
  Links references view cypress tests (#5111)
  Unify start command, trigger `build:deps` command too (#5633)
  Release generate-volto 9.0.0-alpha.3
  Release @plone/types 1.0.0-alpha.2
  Improve Blocks typings. Refactor `volto-coresandbox` to TS. (#5624)
  i18n polishing (#5542)
  Release @plone/scripts 3.2.1
  Fix @plone/scripts for 17 and below (#5613)
  Release @plone/scripts 3.2.0
  Enhance `ColorPickerWidget` (#5585)
  edit recurrence button is aligned properly (#5590)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

2 participants