my_module.module function my_module_preprocess_field(&$variables): void { if ($variables['element']['#bundle'] == 'my_bundle') { if (in_array($variables['element']['#field_name'], ['my_field'])) { $variables['attributes']['lang'] = 'en'; } } } 13.11.2025 | Michael Ebert How to alter the langcode of a field for accessibility reasons