1

I have a view with multiple displays, each configured as follows.

Display 1: Articles

  • FILTER CRITERIA:
    • Content: Published (= Yes)
    • Content: Content type (= Article)
  • PAGE SETTINGS:
    • Path: /articles/insights

Display 2: Page

  • FILTER CRITERIA:
    • Content: Published (= Yes)
    • Content: Content type (= Article)
    • Content: Page Category (= Glossary)
  • PAGE SETTINGS:
    • Path: /articles/glossary

Display 3: A-F

  • FILTER CRITERIA:
    • Content: Published (= Yes)
    • Content: Content type (= Article)
    • Content: Page Category (= Glossary)
    • Content: Subtitle (regex ^[A-Fa-f].*$)
  • BLOCK SETTINGS:
    • Block name: None
    • Block category: Lists (Views)
    • Allow settings: Items per page

The first display, "Articles," with the path /articles/insights, shows the article listing, while the second, third, and other similar displays show the Glossary of articles. The Page Category is a field called field_page_category, which can be selected when adding an article.

Now, I have some articles that are translated into Portuguese-Brazil (pt-br) and have the page category as Glossary. I want to display these links when I access /pt-br/articles/glossary. I tried creating a new display for the View with the path /pt-br/articles/glossary, and in the filter criteria, I added:

  • Content: Translation language (= Portuguese, Brazil)
  • Content revision: Translation language (= Portuguese, Brazil)

However, it still displays all the links in English. I'm unable to find a Language filter when attempting to add it.

The SQL query I received is:

SELECT "node_field_data"."langcode" AS "node_field_data_langcode", "node__field_subtitle"."field_subtitle_value" AS "node__field_subtitle_field_subtitle_value", "node_field_data"."nid" AS "nid"
FROM
{node_field_data} "node_field_data"
INNER JOIN {node__field_page_category} "node__field_page_category" ON node_field_data.nid = node__field_page_category.entity_id AND node__field_page_category.deleted = '0'
INNER JOIN {node_field_revision} "node_field_revision" ON node_field_data.vid = node_field_revision.vid
LEFT JOIN {node__field_subtitle} "node__field_subtitle" ON node_field_data.nid = node__field_subtitle.entity_id AND (node__field_subtitle.deleted = '0' AND node__field_subtitle.langcode = node_field_data.langcode)
WHERE ((node__field_page_category.field_page_category_value = 'Glossary')) AND (("node_field_data"."status" = '1') AND ("node_field_data"."type" IN ('article')) AND ("node_field_data"."langcode" IN ('pt-br')) AND ("node_field_revision"."langcode" IN ('pt-br')))
ORDER BY "node__field_subtitle_field_subtitle_value" ASC

How can I configure Drupal Views to display content in Portuguese (pt-br) when accessing the /pt-br/articles/glossary URL? I can't seem to find the Language filter to achieve this.

The language filters I already have are as follows:

Title Category
Delivery Language Content
Original language Content
Translation language Content
Translation source Content
Original language Content revision
Original language Content revision
Translation language Content revision
Translation source Content revision

2 Answers 2

1

If I understand your problem, you are close of the solution.

On your view add

Content: Translation language

And then choose

Interface text language selected for page

Instead of choosing the language. With this option, everytime you enter the page you will get the content based on your language switcher block or URL prefix.

1
  • And make sure this is set: Rendering Language: Content language of view row
    – Bisonbleu
    Nov 10, 2023 at 13:33
0

You don't need to create /pt-br/articles/glossary path

Drupal add language prefix automatically. Needs to add views filter criteria Content: Translation language (= current language). When user select Brazil language only Brazil articles will show.

And of course you need to add Brazil language to site settings

2
  • I have tried this. I am using Drupal 9, and I have selected Content: Translation language (= Interface text language selected for page) , but it is still showing articles in all the languages. Sep 19, 2023 at 11:19
  • Show screenshot of your views settings and screenshot of your node translations tab. And views results screenshot too
    – Vanish
    Sep 20, 2023 at 5:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.