Problem/Motivation
When selecting Browser and User detection method, browser always has a bigger weight (is always applied).
in the attached example pictures the user(pkersten) has a language set as English and the default language for the browser is french.
When selecting browser method with a lower weight, the browser method wins vs the user method.
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | language_detection-2830033-11.patch | 5.5 KB | tassilogroeper |
| #11 | interdiff-2830033-10-11.txt | 5.29 KB | tassilogroeper |
| #7 | language_detection-2830033-7.patch | 1.26 KB | tassilogroeper |
| #7 | interdiff-2830033-4-7.txt | 1.21 KB | tassilogroeper |
| #4 | 2830033-language_detection_browser_vs_user-4.patch | 923 bytes | akozma |
Comments
Comment #2
pkersten@pkconsult.be commentedComment #3
akozma commentedComment #4
akozma commentedThe issue occurs only when the user language == default language.
The current behavior:
The main Language Negotiator (See LanguageNegotiator::initializeType()) tries to detect the language based on the existing language negotiation options, but will stop when one of the option will return a valid language object.
The user language negotiation class returns NULL if the user language == default language so the main language negotiator will continue to check the next option (Browser).
Comment #5
akozma commentedComment #7
tassilogroeper commentedI had a look at the patch and cleaned it up a bit.
Note: the
interface LanguageNegotiationMethodInterfaceactually states, that this function will returnA valid language code or FALSE if the negotiation was unsuccessful.But it returns just NULL. This is consistent behavior in the other implementation of this interface as well... so probably the docs need to be updated at this point.Comment #9
tassilogroeper commentedtests need to be updated
Comment #10
tassilogroeper commentedComment #11
tassilogroeper commentedLooking into the
LanguageNegotiationUserAdmin, there is the very same problem and some code cleanups neededComment #20
quietone commentedI tested this today on Drupal 11.x, standard install with French and Italian installed. Using the information in the issue summary I was not able to reproduce a problem with behavior of the Detection and Selection related to the User and Browser methods. I tried various combinations but never found a situation where the Browser method override the User method, when the Browser method was sorted lower in the list at the 'Detection and selection' page.
Therefore, closing as outdated. If this is incorrect reopen the issue, by setting the status to 'Active', and add a comment explaining what still needs to be done. Also, add complete steps to reproduce.
Thanks!