New answers tagged


The easiest way to do it: $entity_translated = \Drupal::service('entity.repository')->getTranslationFromContext($entity); This will load according to the UI/content language as it was selected, can be fed with any type of entity (content type, comment, media, etc), and if there's no current language it will provide the fallback language content. Please ...


In Drupal 8 and 9, use t ( or trans) filter in twig element in your Global: Custom text”. for example, create a Global: custom text field and paste {{ 'this text will be available in translate interface'|t }} Ref for reading more:


Enable "Configuration Translation" core module Go to your view edit and you will see a "Translate view" tab You'll find your language in the list there. Then click on "Edit" next to the language Expand panels and you will find your header text under the "Header" panel

Top 50 recent answers are included