#! code: Drupal 9: Setting Up Multilingual Content Views

Drupal Views is a powerful module. The ability to generate lists of things in Drupal means that it is used everywhere. It even has a powerful plugin system that allows other modules to interface with it and create more functionality.

With multilingual sites there is a common issue I come across quite a lot that is quite easy to fix. A View will be created (usually via the Views wizard) that is intended to list a type of content. When an item of content is translated the content is duplicated in the View and you end up with a single list containing both translations of a single content item.

Let’s take an example of this on a site with English and Welsh as the two languages present. I set up a standard View that shows articles content types in a list and then generated a few items of content using devel generate. After translating one of the articles the list looks like the image below with the first article in the list being duplicated. Since the original version was in latin (thanks to devel generate) I have just added the name of the language to the start translation title to show the new content.
Views content translation, showing duplicate content in an article list.This is clearly a problem as it creates lists of content containing duplicated items.

Here is the administration for this article listing View. As I said there is nothing wrong with how this is set up as it was done through the Views wizard, it is just that it doesn’t support multilingual content.

Read more.


Go to Source
Author: