-1

I tried to get the value with (what didn't work):

{{ paragraph.activeLangcode }} {{ paragraph.activeLangcode.value }}

enter image description here

2 Answers 2

3

Get the language of the paragraph entity through the method language() in a preprocess hook:

function mytheme_preprocess_paragraph(&$variables) {
  $variables['lang_id'] = $variables['paragraph']->language()->getId();
}

For a Twig only solution you would need to adjust the twig sandbox policy, see Language name of translated node

-1

Didn't work for me; So I used this method:

{% set language = content.field_title['#language'] %}

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.