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

Comments

pkersten@pkconsult.be’s picture

Category: Support request » Bug report
akozma’s picture

Assigned: Unassigned » akozma
akozma’s picture

The 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).

akozma’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 4: 2830033-language_detection_browser_vs_user-4.patch, failed testing.

tassilogroeper’s picture

Assigned: akozma » tassilogroeper
Status: Needs work » Needs review
StatusFileSize
new1.21 KB
new1.26 KB

I had a look at the patch and cleaned it up a bit.

Note: the interface LanguageNegotiationMethodInterface actually states, that this function will return A 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.

Status: Needs review » Needs work

The last submitted patch, 7: language_detection-2830033-7.patch, failed testing.

tassilogroeper’s picture

Assigned: tassilogroeper » Unassigned

tests need to be updated

tassilogroeper’s picture

tassilogroeper’s picture

Status: Needs work » Needs review
StatusFileSize
new5.29 KB
new5.5 KB

Looking into the LanguageNegotiationUserAdmin, there is the very same problem and some code cleanups needed

Status: Needs review » Needs work

The last submitted patch, 11: language_detection-2830033-11.patch, failed testing.

Version: 8.2.3 » 8.2.x-dev

Core issues are now filed against the dev versions where changes will be made. Document the specific release you are using in your issue comment. More information about choosing a version.

Version: 8.2.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Branches prior to 8.8.x are not supported, and Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Issue summary: View changes
Status: Needs work » Closed (outdated)
Issue tags: +Bug Smash Initiative

I 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!