I set up a multilingual blog with Drupal 8 (in English and Chinese), I want to list articles according to current language in the front page.
However, if an article does not has an translation in the current language, I want it to default to the original untranslated version(whatever language), with a hint like "This content is not available in Chinese, we are showing the original article in English."
Assuming that I have 3 blog articles (nodes), with or without translation:
- Article 1 (original language: English; translated to: Chinese)
- Article 2 (original language: Chinese; translated to: English)
- Article 3 (original language: English)
When a user visits the English front page at example.com/en
, they will see:
- Article 1 (in English, original)
- Article 2 (in English, translated)
- Article 3 (in English, original)
which is the default behaviour of Drupal 8.
Now, when a user visits the Chinese front page at example.com/zh-hans
, I would like them to see:
- Article 1 (in Chinese, translated)
- Article 2 (in Chinese, original)
- Article 3 (in English, with a hint)
However, Drupal 8 out of the box will display:
- Article 1 (in Chinese, translated)
- Article 2 (in Chinese, original)
I tried editing the front page as it is a view in Drupal 8, but with the filters in view I could not achieve this.
(Filters in view)
Do I need to implement a custom filter for the front page view? Please suggest where should I start, I have no idea how to do this.
Thanks!