Problem/Motivation

I'm opening this issue here to raise focus on the subject as all the other similar bugs that are filed 1. are not concentrated somewhere, 2. are 4 years old without major progress 3. none of them has made enough impression to show to the community how important they are.

The comment module at the moment for a multilingual Drupal 8/9 site is completely useless. I'm developing a site the last weeks and I hit a wall the moment I started testing the comments. According to the existing solutions we should hack the core and the suggested solutions address only a fraction of the problems. It makes me great surprise how the developers/maintainers of drupal core are proudly moving to D9 when such important issues aren't even solved in D8!!

So let's present here the major problems the comment module is currently having:
1. Not able to filter comments per language
2. If you write a comment in a translated page you get redirected to the non-translated page when you save
3. Previewing a comment is not working if you are in a translated page (white screen of death)
4. Deletion of a comment in a translated page redirects you back to the non-translated one
5. Number of comments shows the sum for all languages not the ones corresponding to the current language (this should be addressed together with 1.). Also this sum is shown only in the non translated page. In the translated page no counter is shown.
6. Removing title from comments without changing twig files. Other frameworks have no title in comments so this should be an option.
7. Permalinks sometimes include the language code and sometimes not, often leading to "page not found" errors. Node comments behave differently compared to Forum comments regarding language code in permalinks.

How proud should we be for the multilingual capabilities of Drupal if the above really basic functionality is not available? Personally, I selected Drupal for my last project exactly because I was believing that would be really powerful for a multilingual site, but now I'm stuck and I'm forced to use another framework. All my work is now gone...

Steps to reproduce

Install a new D8/D9
Enable multilingual
Enable another language
Make an article and a translation of it.
Try to write, preview and delete comments in the translated article.

Proposed resolution

The maintainers should focus on this and solve the issues as this module is in the core and most of the solutions currently require hacking the core. I consider this major issue and really basic and important functionality.

Similar topics

#2751269: Submitting a comment in the non default language redirects you to the default language -> 4,5 years old. Addresses only No.2 by hacking the core

#2751267: Comments are not filtered on language -> 4.5 years old. Simple solution without core patch is #38 but not reliable and not a real solution. Patch #33 is a real solution but there are still issues with permalinks in translated pages and the sum of comments is not calculated per language.

#3145146: On the translated node the comment preview functionality is not working -> 0.5 years old. No answer whatsoever

Personally I gave up hope when I realized that the community the last 4.5 years has not solved these. As my last action before surrendering is this post here with the hope to raise awareness! Let's hope for the best. I really love drupal and it's really hard to give up on it...

Comments

cptX created an issue. See original summary.

andypost’s picture

Title: Comment module in multilingual D8/D9 is trash » Comment module multilingual improvement for 9.x / 10.x
Version: 9.0.x-dev » 9.2.x-dev
Category: Bug report » Plan

Thanks for starting to aggregate roadmap 👍
Here's more actionable title and it needs to figure how drupal.org will work after upgrade to 9/10 as forum and issues are comments

cptX’s picture

Issue summary: View changes
cptX’s picture

As I said we need to get focus on this, that's why I used the word "trash" in the title

The word "improvement" is too soft and actually shows that something is working and needs improvement which is not the case as it is not working at all at the moment ("preview function and redirects" for example). We need to create a title that shows really the size of the problem. Currently I'm stuck with my development because of this. It's major!!

I'm changing the title to "Comment module major multilingual issues"

cptX’s picture

Title: Comment module multilingual improvement for 9.x / 10.x » Comment module major multilingual issues
cptX’s picture

@andypost I just realized you are one of the comment module maintainers. I'm glad to have you in this topic and I want to ask you a direct and honest question: Is there any hope to see these issues solved in the near future? I'm stuck because of these comment problems which break the basic functionality I need my multilingual site to have and at the moment I don't know how to proceed. These issues are raised 4,5 years ago and the progress is minimal. Of course I wouldn't like 4 years more in order to see them solved. What hope is there? I could spend weeks trying to solve the issues in the core but I'm not in position to do so at the moment.

andypost’s picture

As I know nobody using multilingual comments yet.
I bet because it's tricky to implement and maintain,
the same applies to comment revisions (which was a requirement for jsonapi or kinda)

Consequence is that we have no "80% use-case" which could be implemented in core and extensible in by contrib/custom code

I'd like to collect in this issue a possible cases how it can affect comment storage/access/performance

cptX’s picture

What do you mean by "nobody using multilingual comments yet"? There are thousands of multilingual drupal sites. I cannot imagine that I'm the first that needs to have comments in a multilingual site. In D7 for example there was an option to filter comments per language. This option was removed in D8. I think in previous versions drupal gave more capabilities regarding comments in multilingual site than in current versions.

I hope you are not confusing the concept of having comments in a multilingual site with the concept of having multilingual comments (aka translated comments). I'm referring only to the first case which is really basic and usual for every multilingual site.

larowlan’s picture

Title: Comment module major multilingual issues » [Plan] Comment module major multilingual issues
cptX’s picture

I found solutions for the following 3 issues

  1. Comment Save redirect in a translated page
  2. Comment Delete redirect in a translated page
  3. Comment Preview in a translated page

and posted them in the corresponding issue here: https://www.drupal.org/project/drupal/issues/2751269#comment-13990351

Next step is to work in filtering comments per language...

cptX’s picture

Issue summary: View changes
cptX’s picture

Issue summary: View changes
cptX’s picture

Issue summary: View changes
andypost’s picture

Issue summary: View changes
andypost’s picture

cptX’s picture

Issue summary: View changes
cptX’s picture

Regarding comment filtering per language this patch #33 does a great job on the subject of course by hacking the core... Introduces a new filtering option in the /admin/structure/types/manage/article/display comment settings. With this patch though the comment permalinks are having issues.

So regarding comment permalinks I did some small progress and now they include the correct language code in the url and not producing "page not found" errors.
I've posted my suggestions here https://www.drupal.org/project/drupal/issues/2751267#comment-13991968

After the above, remaining issues currently are:
1. Clicking on a permalink still doesn't land to the correct page which includes the corresponding comment because the pager is calculated including all the comments and not the filtered ones according to the filter patch #33 introduces
I think the following functions are responsible for this:
/core/modules/comment/src/CommentStorage.php -> function getDisplayOrdinal() and function loadThread()
2. Calculating and showing the correct sum of comments in every node according to the language filter applied.

joseph.olstad’s picture

I was just made aware of this issue, definately we need this working!

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

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.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.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.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.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.

bigboy’s picture

Subscribe to this issue.

As a workaround for displaying comments in correct language you can use Views to display comments in block.

However, other things, such as redirect to correct language version after submitting is not working out of the box.

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.