Fixes and unit tests for UI language detection #1457
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reasons for creating this PR
@namedgraph reported in #1453 that there are problems with the UI language detection. The main problems were fixed in PR #1455, also by @namedgraph.
The WebController.guessLanguage method which is the core of language detection did not have unit tests, and as it was written, it was difficult to unit test it because it accesses cookies and HTTP header values directly.
This PR makes some changes to WebController.guessLanguage that make it easier to test, adds some basic unit tests that verify the main language detection cases, and then applies the fixes from #1455 on top.
Link to relevant issue(s), if any
Description of the changes in this PR
willdurand/negotiation
from 3.0.* to 3.1.* because only 3.1 is compatible with PHP 8.1in_array
(from PR UI language negotiation fix #1455)skosmos:languages
settings in the sample configs for Docker (from PR UI language negotiation fix #1455)Known problems or uncertainties in this PR
The same fixes need to be applied to the
skosmos-3
branch as well. I will do that in a follow-up PR.Checklist
.sr-only
class, color contrast)