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 · 2 comments · May be fixed by #1720
Open

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

osma opened this issue Oct 3, 2024 · 2 comments · May be fixed by #1720
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

@joelit
Copy link
Contributor

joelit commented Dec 12, 2024

Now that I think this critically, it's probably better to drop the search language cookie and just use the UI language as the only language cookie. The reason bein, UI language options are particular to a single Skosmos instance, but content languages (i.e. search language) is particular to any given vocabulary. Switching from one vocab to another could cause further problems if the search language cookie is not updated accordingly.

It's way clearer to handle search language with clang and anylang parameters.

@osma
Copy link
Member Author

osma commented Dec 12, 2024

Agree, let's get rid of the cookie for content language.

@joelit joelit linked a pull request Dec 12, 2024 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants