1

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?

For example, mysite/rest/export/data should give JSON data in English, while mysite/nl/rest/export/data or mysite/rest/export/data/nl should give JSON data in Dutch.

2
  • As a quick fix, have you tried to create two separate views, one for EN one for NL?
    – leymannx
    Commented Nov 20, 2018 at 10:52
  • 1
    @leymannx: It is not a good solution. But thanks for your reply.
    – Kalidasan
    Commented Nov 20, 2018 at 12:31

1 Answer 1

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 and acknowledge you have read our privacy policy.

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