Displaying comment's permalink using language interface leads to "page not found"

Created on 5 February 2025, 2 months ago

Problem/Motivation

I have a multilingual site: French (default language) and English. Some content type are translatable and their nodes are translated in both language, while other content types are published only in the default language. Interface language selector is available on the entire site regardless nodes have or not a translation.

- Switching language works on nodes display (regardless nodes have or not a translation)
- Switching language doesn't work on comments display (using permalink)

Steps to reproduce

- Enable two languages A and B, set A as default (admin/config/regional/language)
- Configure the Interface text language detection to "Language from the URL" with path prefix (admin/config/regional/language/detection)
- Create a content type (admin/structure/types)
- Verify that A is the default language and that translation is not enabled (admin/structure/types/manage/the_content_type > Language settings)
- Do the same for the associated comment type (admin/structure/comment)
- Create some content and comments

- Display a node in default language (https://www.example.com/node/1234)
- Pick the comment permalink or click on it's title (https://www.example.com/comment/72471#comment-72471)

OK that displays fine. Switching interface language on not translated nodes works https://www.drupal.org/project/drupal/issues/3196886

- Switch the language interface to language B => You're redirected to this url "https://www.example.com/en/comment/72471" and you get a 404 "Page not found" error
- Switch back to the default language => You're redirected to the front page (https://www.example.com/?page=0)

Switching interface language on not translated comments DOESN'T work

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Active

Version

10.4

Component

comment.module

Created by

🇫🇷France erwangel

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

Comments & Activities

  • Issue created by @erwangel
  • 🇳🇿New Zealand quietone

    @erwangel, did you search for duplicates? I recall seeing similar issues.

    Changes are made on on 11.x (our main development branch) first, and are then back ported as needed according to the Core change policies .

  • 🇫🇷France erwangel

    Yes, the closest issue I found is the one reported in "related issues" but as this issue summarizes several other related issues I found it hard to follow it. That's why I created a new one focusing to just one point: comment dispaly with the interface language change. As for the Drupal version I thought we had to report the version in use, not the version where changes are made on. But I understand your the backporting logic.

Production build 0.71.5 2024