2

I have Drupal 8 site which interacts with a React component.

I want to expose one of my content type's content using REST export in views.

How do I set views path to create REST export for multilingual support?

Example:

  1. mysite/rest/export/data - It should give JSON data in English
  2. mysite/nl/rest/export/data or mysite/rest/export/data/nl - It should give JSON data in NL(Dutch)
  • As a quick fix, have you tried to create two separate views, one for EN one for NL? – leymannx Nov 20 '18 at 10:52
  • 1
    @leymannx: It is not a good solution. But thanks for your reply. – kalidasan Nov 20 '18 at 12:31
2

Found solution in two ways.

Method-1:

Add language in filter criteria as mentioned below.

enter image description here

Method-2:

1) Add language in contextual filter

2) Provide a default value & select path component(I have selected 2)

3) Provide view path as "rest/nl/export" - EN or NL provide your language code

enter image description here enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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