- π¨π¦Canada Liam Morland Ontario, CA π¨π¦
We are having this problem as well on Drupal 9.5. The work-around in #77 is working for us.
- π¨π¦Canada Liam Morland Ontario, CA π¨π¦
We have had the problem return, despite the work-around in #77. Are others seeing it too?
- πͺπΈSpain penyaskito Seville π, Spain πͺπΈ, UTC+2 πͺπΊ
@Liam I'd recommend opening a new issue.
- π¨π¦Canada Liam Morland Ontario, CA π¨π¦
Looking at it more, I think we're experiencing π Wrong language field labels after `drush cr` because of Drush language negotiation Needs work .
- π¨π¦Canada joseph.olstad
@Liam Morland, #77 didn't work for us, and I didn't use drush to rebuild cache.
Debugged the cache tags, the language context is there and the language code shows up in the debug. Still getting the unexpected label values and it seems to be rather isolated.
We're getting this with display manager. I will try converting it to layout_builder, I suspect the issue will go away with layout_builder but not sure why.
- π¨π¦Canada joseph.olstad
Changing to layout builder didn't make a difference.
I'm surprised that this is an outstanding issue.
Seems like there's a problem with the language context and the cache tags not being respected
- π¨π¦Canada joseph.olstad
Patch I tried at 3114824 sounded promising but didn't help either.
π Add multilingual support for caching basefield definitions Needs work - π¨π¦Canada joseph.olstad
Workaround, I wasn't able to find a better way for now.
Here is an example of what I did, but not exactly since I targetted the preprocess_field a bit more but for this example I'm flattenning it out.
In this example it's the hook_preprocess_field , but in my case I added a new twig based on the theming suggestions and used hook_preprocess_field__node__field_from__news() instead.
/** * Implements hook_preprocess_field(). This goes into mythemename.theme file and replace hook_ with mythemename_. */ function hook_preprocess_field(&$variables) { $langId = \Drupal::languageManager()->getCurrentLanguage()->getId(); $variables['language'] = $langId; $label = trim($variables['label']); $label = strtolower($label); if ($langId == 'fr' && $label == 'date posted:') { $variables['label'] = "Date d'affichage :"; } if ($langId == 'en' && $variables['label'] == "Date d'affichage :") { $variables['label'] = 'Date posted:'; } }