- Issue created by @himanshu raj
Implemented a theme-level workaround using hook_preprocess_paragraph() to ensure translated paragraph field values are rendered automatically without needing to use the |translation filter manually in Twig templates.
This improves consistency across multilingual sites and removes the need for repetitive Twig adjustments.
function YOURTHEME_preprocess_paragraph(array &$variables) { \$langcode = \Drupal::languageManager()->getCurrentLanguage()->getId(); if (!empty(\$variables['paragraph']) && \$variables['paragraph']->hasTranslation(\$langcode)) { \$variables['paragraph'] = \$variables['paragraph']->getTranslation(\$langcode); } }
This workaround respects the current language context and works well with translated paragraph entities inside nodes or blocks.- ๐ฎ๐ณIndia himanshu raj Noida
Hi guys,
Currently, paragraph field values in multilingual sites do not auto-translate in Twig templates unless we explicitly use the |translation filter. This feels inconsistent, especially when the parent entity (like a translated node or block) is rendered correctly in the current language.Using |translation manually in every template is not scalable or developer-friendly. Also, relying on hook_preprocess_paragraph() or other custom workarounds is not ideal for long-term multilingual support.
It would be great if this behavior is handled automatically by Drupal core or the Paragraphs module โ so that referenced paragraphs follow the parentโs language context, just like other translatable fields.
If anyone has a clean solution or update on this, please let me know. Thanks!
- ๐ง๐ชBelgium BramDriesen Belgium ๐ง๐ช
I think this needs a lot of clarification. It sounds more like a paragraphs issue. On the other hand I have no reasons to believe paragraph fields are untranslatable.