From 9e69a09a19cb91fbedcf198371994485cc760b08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sat, 25 Nov 2023 19:16:54 +0100 Subject: [PATCH] Fixed translation of stock change type in log table --- src/DataTables/LogDataTable.php | 2 +- src/Entity/LogSystem/PartStockChangeType.php | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/DataTables/LogDataTable.php b/src/DataTables/LogDataTable.php index c00b7446..976dcfa7 100644 --- a/src/DataTables/LogDataTable.php +++ b/src/DataTables/LogDataTable.php @@ -139,7 +139,7 @@ class LogDataTable implements DataTableTypeInterface if ($context instanceof PartStockChangedLogEntry) { $text .= sprintf( ' (%s)', - $this->translator->trans('log.part_stock_changed.' . $context->getInstockChangeType()->toExtraShortType()) + $this->translator->trans($context->getInstockChangeType()->toTranslationKey()) ); } diff --git a/src/Entity/LogSystem/PartStockChangeType.php b/src/Entity/LogSystem/PartStockChangeType.php index bbd574a7..92c5073f 100644 --- a/src/Entity/LogSystem/PartStockChangeType.php +++ b/src/Entity/LogSystem/PartStockChangeType.php @@ -39,6 +39,11 @@ enum PartStockChangeType: string }; } + public function toTranslationKey(): string + { + return 'log.part_stock_changed.' . $this->value; + } + public static function fromExtraShortType(string $value): self { return match ($value) {