The session language detection method is responsible of several open bugs in the language system queue:

#815526: Session language switcher prevents pages from being cached
#815544: Remove the language query string when using session language switch links
#768240: Session language switcher links do not report the active status correctly

Moreover it has been defined a really bad idea from one major D7 contributor.

As the current language system maintainer and being the one who actually coded it, I think it can safely be moved in contrib as the main reason it was introduced was allowing to set interface language and content language separately. This functionality has already been moved in contrib so there should be no harm in moving the session language detection method in contrib too. This would give us also the time to refine it and make it more solid.

A positive side effect would be that we would have only the original language detection methods available in the language detection and selection page, thus reducing the gap from the D6 UI.

Comments

plach’s picture

Issue tags: +UI Change
StatusFileSize
new17.22 KB
new18.64 KB

Attached you can find how the UI would change.

plach’s picture

I spent three hours trying to fix #815544: Remove the language query string when using session language switch links last night but I could not come out with a working solution yet.

In the meantime I realized that the main problem with the session language provider is it was designed to work with the URL language provider (to be able to convey two language types within the same URL) and not as an alternative to it. With content language negotiation out of core the session language has no real meaning, and using it as an alternative to URL language negotiation can potentially cause duplicates both in Drupal's page cache and in the search engines' indexes (which is bad!).

Given this situation I'd strongly advocate removing session language negotiation from core to have time to rework it more carefully.

By the way, another related bug:

#784832: Conflict with the session language provider while creating a translation

damien tournoud’s picture

I support remove of this one, as already stated elsewhere. It breaks the principle of one URL == always the same content, which leads to a bunch of subtile and no-so-subtile bugs.

gábor hojtsy’s picture

Agreed. In D6 we had some big efforts to tie URLs to the exact same content without out of URL swicthes to use different languages. Let's not break that tradition :)

andypost’s picture

I support this partially. Principle if same content on same URL is useless for content editor! I need native language UI (switchable) while editing any multilingual content

plach’s picture

@Damien Tournoud, @Gábor Hojtsy:

It breaks the principle of one URL == always the same content

In D6 we had some big efforts to tie URLs to the exact same content without out of URL swicthes to use different languages

Well, the main idea behind the redesign of the language negotiation system was to achieve two separate behaviors (we used wikipedia as an inspiration):

  • For anonymous users keep always intact the concept of same URL == same content: browser language and user language are ignored for anonymous users so this leaves us only session and URL. We tried to implement the session language provider so that for anonynous users it always uses the URL parameter, this way pages differing only for the UI language actually have different URLs. The problem here is the opposite: we have multiple URLs for the same content (i.e. #815544: Remove the language query string when using session language switch links).
  • For authenticated users we break the concept of same URL == same content - which actually is already broken because the same page might hold different content depending on which user views it - and we allow different languages for the same URL.

@andypost:

Principle if same content on same URL is useless for content editor! I need native language UI (switchable) while editing any multilingual content

Totally agreed. But if we can't fix the session language provider in core, IMO it's better to remove it and fix it in contrib.

By the way, while testing user language as an alternative to session language for content editors, I found this: #855380: $language_url should be used to lookup the current path alias :(

sun’s picture

Status: Active » Postponed

I've looked through all mentioned, related issues and actually have to say that I like the fixes for the bugs that seem to have been revealed by the session language handling. Hence, if this turns out to be excellent regression testing (like our beloved Poll module), then I'd rather keep it.

At the very least, we can fix those other issues first. If it keeps on being doomed afterwards, we can continue to discuss.

plach’s picture

Status: Postponed » Closed (won't fix)

We can't do this anymore.

alexpott’s picture

Title: Remove the session language detection method » Deprecate the session language detection method
Version: 7.x-dev » 9.4.x-dev
Issue summary: View changes

We now can deprecate things and then remove them in future versions. This seems like a good candidate for that.

alexpott’s picture

Status: Closed (won't fix) » Needs work
alexpott’s picture

Status: Needs work » Needs review
StatusFileSize
new1.47 KB

Let's deprecate the plugin and see what breaks.

Status: Needs review » Needs work

The last submitted patch, 11: 817114-11.patch, failed testing. View results

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

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now 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.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now 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: 10.1.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, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.