2

First I have content type "Quiz option" which is translatable.

Then I have a view that returns Entity references of that type. For language option I selected "Content language of view row" and also added filter "Content: Translation language = interface text language selected for page".

I translated (to German - original language is English) only one content of that entity and when I test view on view edit page it works well:

If I'm editing view on English view edit page I see all the content on English, except that German one. And when I'm editing view on German view edit page (with that "de" in path prefix) I see only one entity - the translated one and it's title is displayed well, on German. So far, so good.

Now I have a webform with some select button where for options I'm using reference mode with that view for selecting elements. And on front-end I always see content title on English? Why is that? So on front-end if I'm on German page I see only one option - the translated one, but it's title is on English, not on German?!?

I tried removing language filter I mentioned above and then I see all the options, but again they are all on English.

So, when I test view everything seems fine and when editing webform field I have only option for selecting the view (and passing the parameters), but nothing related to language.

And even if i.e. I force strictly German as "Rendering language" in views options I still see my options on English on front-end.

Any idea why I'm getting entity titles in default language (English) instead of in language of the current page (German)?

  • This is probably an issue for entity reference select views displays in general, not only in webforms: drupal.stackexchange.com/questions/273654/… – 4k4 Aug 21 at 12:05
  • Hmm..yes I saw that question and even commented it. But there's no solution for that issue. Right? – MilanG Aug 21 at 12:28
  • I've just wanted to connect both questions and express my doubts this has anything to do with Webform. – 4k4 Aug 21 at 12:33
  • Sure, thank you for that. – MilanG Aug 21 at 12:34
  • 1
    Comparing ViewsSelection::getReferenceableEntities with TermSelection::getReferenceableEntities, the Views version does not translate the entities before returning the entity labels: \Drupal::service('entity.repository')->getTranslationFromContext($entity); – 4k4 Aug 21 at 13:08

Your Answer

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

Browse other questions tagged or ask your own question.