+ // Makes sure region names are translatable.
+ $regions = array_map(function ($region) {
+ if (!$region['label'] instanceof TranslatableMarkup) {
+ // Region labels from YAML discovery needs translation.
+ $region['label'] = new TranslatableMarkup($region['label'], [], ['context' => 'layout_region']);
+ }
+ return $region;
+ }, $definition->getRegions());
+ $definition->setRegions($regions);