User "Administration pages language" setting not respected in views ajax calls

Created on 1 June 2024, 6 months ago
Updated 3 July 2024, 5 months ago

Problem/Motivation

"Administration pages language" setting is not taken in account after an ajax call (views/ajax): labels and field options return to current interface language (selected by language prefix) right after applying ajax filtering or sorting.

Steps to reproduce

On a vanilla Drupal, activate at least two languages (for example English and Italian, setting Italian as default).
Enable in language "Detection and selection" "Account administration pages" and "URL" items, leaving default values and weights.
Set Administration pages language English for current user.
Enable ajax for a view, for example admin/content.
Visit the view page at /admin/content (default interface language don't have prefix): view is correctly rendered in English (admin language selected for the user).
Try to click on Filter submit button or on a table header for sorting.
The view rebuilt by ajax call is now rendered in Italian language (labels, filters, table heading), which is wrong (current interface language).

Proposed resolution

N/A

Remaining tasks

N/A

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A

🐛 Bug report
Status

Active

Version

11.0 🔥

Component
Views 

Last updated about 1 hour ago

Created by

🇮🇹Italy maurizio.ganovelli Arezzo

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @maurizio.ganovelli
  • 🇮🇳India kalpanajaiswal

    The issue is not reproducible in Drupal 10.2.6
    Feature is working as expected, adding few screenshots for help.

  • 🇮🇹Italy maurizio.ganovelli Arezzo

    Thank you, for reply!
    I hadn't the "Follow the user's language preference" flag active on "Detection and selection" page: I've tried with this change but only partially solves the problem. Now works but only when language prefix in not on url.
    Try adding a new language, let's say French, keeping all other settings as already defined.
    Visit /fr/admin/content: view is rendered in English (admin language) but if i try to click on filter ajax callback renders views in French (url language).
    Attached a short screencast (i'm using Drupal 10.2.6).

  • 🇮🇳India kalpanajaiswal

    I tried all the above mentioned steps and below are the response.

    When I visit "/fr/admin/content'
    One popup came, I selected english

    I refreshed the page and now I selected french

  • 🇮🇹Italy maurizio.ganovelli Arezzo

    The popup visible on your screenshot came from Chrome auto-translation feature, if possible turn it off for the tests.
    I tried with Chrome too (all previous tests are done on Firefox) but i get the same behavior you can see on screencast.
    I'll try to do a debug session in next days to investigate furthermore.

  • 🇮🇹Italy maurizio.ganovelli Arezzo

    Maybe that the problem comes from Drupal\user\Plugin\LanguageNegotiation\LanguageNegotiationUserAdmin::isAdminPath. The route views.ajax with path /views/ajax is never considered as administrative, so user preferred admin language is not applied to views ajax calls.

  • 🇳🇿New Zealand quietone

    Fixes are made on on 11.x (our main development branch) first, and are then back ported as needed according to our policies. Also, 10.2 is in security mode now.

Production build 0.71.5 2024