Fixed translation of stock change type in log table

This commit is contained in:
Jan Böhmer 2023-11-25 19:16:54 +01:00
parent b447a69dae
commit 9e69a09a19
2 changed files with 6 additions and 1 deletions

View file

@ -139,7 +139,7 @@ class LogDataTable implements DataTableTypeInterface
if ($context instanceof PartStockChangedLogEntry) { if ($context instanceof PartStockChangedLogEntry) {
$text .= sprintf( $text .= sprintf(
' (<i>%s</i>)', ' (<i>%s</i>)',
$this->translator->trans('log.part_stock_changed.' . $context->getInstockChangeType()->toExtraShortType()) $this->translator->trans($context->getInstockChangeType()->toTranslationKey())
); );
} }

View file

@ -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 public static function fromExtraShortType(string $value): self
{ {
return match ($value) { return match ($value) {