diff --git a/image_compression.module b/image_compression.module
index 938cf50..e6b2f3a 100644
--- a/image_compression.module
+++ b/image_compression.module
@@ -85,9 +85,9 @@ function image_compression_and_file_validate_size(
   if (!empty($errors) && $status['compressed'] === TRUE) {
     $errors[] = t("The original file size was %original when we compressed the image it became %compressed however it is still larger than the upload %limit.",
       [
-        '%original' => format_size($originalSize),
-        '%compressed' => format_size($newSize),
-        '%limit' => format_size($file_limit),
+        '%original' => \Drupal\Component\Utility\DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '10.2.0', fn() => \Drupal\Core\StringTranslation\ByteSizeMarkup::create($originalSize), fn() => format_size($originalSize)),
+        '%compressed' => \Drupal\Component\Utility\DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '10.2.0', fn() => \Drupal\Core\StringTranslation\ByteSizeMarkup::create($newSize), fn() => format_size($newSize)),
+        '%limit' => \Drupal\Component\Utility\DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '10.2.0', fn() => \Drupal\Core\StringTranslation\ByteSizeMarkup::create($file_limit), fn() => format_size($file_limit)),
       ]
     );
   }
