// Add a translation to the views configuration for the past and future
// formats.
$this->
drupalGet('admin/structure/views/view/content/translate/de/edit'
);
$edit =
[ 'translation[config_names][views.view.content][display][default][display_options][fields][changed][settings][future_format]' => '@interval später',
'translation[config_names][views.view.content][display][default][display_options][fields][changed][settings][past_format]' => 'vor @interval',
];
$this->
submitForm($edit, 'Save translation'
);
// Create a timestamp just over an hour in the past and set the nodes update
// time to this.
$past_timestamp = \Drupal::
time()->
getCurrentTime() - 3700;
$node->
setChangedTime($past_timestamp);
$node->
save();
$this->
drupalGet('/de/admin/content'
);
// Not all normal string translations are available, so 'hour' is still in
// English.
$this->
assertSession()->
pageTextContains('vor 1 hour'
);
// Create a timestamp just over an hour in the future and set the nodes
// update time to this.
$past_timestamp = \Drupal::
time()->
getCurrentTime() + 3700;