diff --git a/Entity/BaseScheduledCommand.php b/Entity/BaseScheduledCommand.php index 683413fa..a8965a20 100644 --- a/Entity/BaseScheduledCommand.php +++ b/Entity/BaseScheduledCommand.php @@ -326,10 +326,10 @@ public function getNextRunDate(bool $checkExecuteImmediately = true): ?DateTime return (new CronExpressionLib($this->getCronExpression()))->getNextRunDate(); } - public function getCronExpressionTranslated(): string + public function getCronExpressionTranslated(string $locale = 'en', bool $timeFormat24hours = false): string { try { - return CronTranslator::translate($this->getCronExpression()); + return CronTranslator::translate($this->getCronExpression(), $locale, $timeFormat24hours); } catch (\Exception $e) { return 'error: could not translate cron expression'; } diff --git a/Entity/ScheduledCommandInterface.php b/Entity/ScheduledCommandInterface.php index 5fc022ca..05224628 100644 --- a/Entity/ScheduledCommandInterface.php +++ b/Entity/ScheduledCommandInterface.php @@ -86,7 +86,7 @@ public function setNotes(string $notes): static; public function getNextRunDate(bool $checkExecuteImmediately = true): ?DateTime; - public function getCronExpressionTranslated(): string; + public function getCronExpressionTranslated(string $locale = 'en', bool $timeFormat24hours = false): string; public function __toString(): string; } diff --git a/Resources/views/List/index.html.twig b/Resources/views/List/index.html.twig index ae73ae0c..554c1eb8 100644 --- a/Resources/views/List/index.html.twig +++ b/Resources/views/List/index.html.twig @@ -55,7 +55,7 @@ {{ command.command }} {{ command.arguments }} - {{ command.cronExpression }} + {{ command.cronExpression }} {{ command.logFile }} diff --git a/composer.json b/composer.json index a4709178..aa6efd36 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "doctrine/persistence": "^3.4.1 || ^4.1", "dragonmantank/cron-expression": "^3.6", "knplabs/knp-time-bundle": "^2.4", - "lorisleiva/cron-translator": "^0.5", + "lorisleiva/cron-translator": "^0.5.0", "symfony/asset": "^7.4 || ^8.0", "symfony/config": "^7.4 || ^8.0", "symfony/console": "^7.4 || ^8.0",