Creating multilingual views
Views, being configuration entities, are available for translation. However, the power of multilingual views does not lie just in configuration translation. Views allow you to build filters that react to the current language code. This ensures that the content, which has been translated into the user’s language, is displayed.
In this recipe, we will create a multilingual view that provides a block showing recent articles. If there is no content, we will display a translated no
results
message.
Getting ready
Your Drupal site needs to have two languages enabled in order to use Content Translation. Install Spanish from the Languages interface. Enable content translation for Articles. You will also need to have some translated content as well.
How to do it…
- Go to Views from Structure, and click on Add new view.
- Provide a view name, such as
Recent articles
, and change the type of content toArticle
. Mark that you would like...