Here is a way to save a few lines of code when pluralizing sentences
$count = 1;
$message_one = \Drupal::translation()->formatPlural($count, "$count node was updated.", "$count nodes were updated.");
echo $message_one // "1 node was updated."
$count = 8;
$message_two = \Drupal::translation()->formatPlural($count, "$count node was updated.", "$count nodes were updated.");
echo $message_two // "8 nodes were updated."