- Issue created by @lostcarpark
In ScheduledPublishGenericFormatter, the following is used:
public function viewElements(FieldItemListInterface $items, $langcode): array {
$elements = [];
$strDateFormat = $this->getSetting('date_format');
$strTextPattern = $this->getSetting('text_pattern');
foreach ($items as $delta => $item) {
/**
* @var \Drupal\scheduled_publish\Plugin\Field\FieldType\ScheduledPublish $item
*/
$rawValue = $item->getValue();
$dateTime = $rawValue['value'];
$moderationState = t($rawValue['moderation_state']);
$elements[$delta] = ['#markup' => $this->parseData($dateTime, $strDateFormat, $moderationState, $strTextPattern)];
}
return $elements;
}
This is problematic because is is using UI translation to translate configuration elements. This could lead to site specific translations getting pushed to the drupal.org translations.
Change to use config translation. I think the schema for this is already present in the core workflows module, so it should already be translatable, so it should just be a matter of making sure the correct translated text is used. I expect most translated sites should already have translations in place for their moderation states.
Remove t().
Check correct translated moderation state is used.
Test.
Consider adding automated test.
Consider providing upgrade script.
Translation of the moderation state will be through config translation.
None.
None.
Active
3.0
Code