pkp / pkp-lib

The library used by PKP's applications OJS, OMP and OPS, open source software for scholarly publishing.
https://pkp.sfu.ca
GNU General Public License v3.0
297 stars 442 forks source link

Use the Accept-Language header when assigning a default language to a new user session #7512

Open jonasraoni opened 2 years ago

jonasraoni commented 2 years ago

Describe the problem you would like to solve When a user accesses an OJS (OMP, OPS) website, OJS creates a session and assigns the primary locale to it. This becomes the default language the user will work with while interacting with the website, until he changes it. However, this may not correspond to the user's preferred language.

Describe the solution you'd like Instead of using the primary locale, we should use the Accept-Language header to detect the user's current locale and automatically select that (if available).

Who is asking for this feature? No user requests yet.

PRs

Additional information Reference: https://github.com/pkp/pkp-lib/pull/7336#discussion_r760303433

NateWr commented 2 years ago

@jonasraoni the link isn't taking me directly to the comment. This happens sometimes as GitHub hides some comments. Can you copy/paste the discussion or reasoning into this issue?

asmecher commented 2 years ago

You can access it by clicking "Show Resolved" links until you find the right one (:man_facepalming:) but to save you the trouble it's this conversation: image

NateWr commented 2 years ago

Ah, so this is during installation. I've updated the issue title/description, thanks!

asmecher commented 2 years ago

@NateWr, no, this isn't for during installation -- it's for when a user without a session first hits the OJS website.

NateWr commented 2 years ago

Ok, then I'm not understanding the issue description. Can one of you (@jonasraoni, @asmecher) update this with a clearer description of the problem and solution?

asmecher commented 2 years ago

@jonasraoni and @NateWr, I've updated the description. @jonasraoni, did I capture what you were proposing?

NateWr commented 2 years ago

Got it, thanks!

jonasraoni commented 2 years ago

@asmecher PRs

jonasraoni commented 2 years ago

@asmecher Some older PRs which I've rebased recently, so they are still ok to be merged.

asmecher commented 2 years ago

@jonasraoni I don't think anyone has identified this as a priority so I haven't reviewed it; strategically, I would much rather we considered e.g. adopting Laravel's session management toolset rather than refining our own.