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

Content language setting is not working consistently in Skosmos 3 #1692

Open
osma opened this issue Oct 3, 2024 · 0 comments · May be fixed by #1693
Open

Content language setting is not working consistently in Skosmos 3 #1692

osma opened this issue Oct 3, 2024 · 0 comments · May be fixed by #1693
Labels

Comments

@osma
Copy link
Member

osma commented Oct 3, 2024

URL address of the page where you encountered the problem

http://localhost/Skosmos/ykl/fi/

Description of the problem

  1. Clear cookies for localhost (just in case)
  2. Go to http://localhost/Skosmos/ykl/en/
  3. In the content language dropdown, select Finnish (this will set the SKOSMOS_SEARCH_LANG cookie to fi and reload the page with the ?clang=fi attribute)
  4. Again go to http://localhost/Skosmos/ykl/en/ (without the clang parameter)
  5. Look at the content language selection: it shows Finnish, while the hierarchy shows class names in English.
  6. Open one of the branches of the hierarchy (e.g. 0 GENERAL...)
  7. The classes in the branch now have class names in Finnish

Additional information (e.g. screenshots) about the problem

image

I think the problem happens because of the way the SKOSMOS_SEARCH_LANG cookie is handled. The idea is to remember the content language chosen by the user. But in step 4 above, by the time the hierarchy renders, the SKOSMOS.content_language setting is still en and thus the top level of the hierarchy is rendered in English. When SKOSMOS.content_language is changed later by the search component, it's already too late, although subsequent request (for example opening new branches in step 6) will use the new setting.

Either we should drop the SKOSMOS_SEARCH_LANG cookie completely (it seems to me that having two mechanisms for this - the clang parameter and the cookie - is a recipe for problems) or if we need to keep it, then at least it should be processed very early in the frontend code (or possibly already on the backend side) so that SKOSMOS.content_language always matches the language set in the cookie.

The browser you used when the problem appeared

Firefox

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

Successfully merging a pull request may close this issue.

1 participant