diff --git a/.changes/unreleased/Fixed-20250702-135534.yaml b/.changes/unreleased/Fixed-20250702-135534.yaml new file mode 100644 index 000000000..75a911301 --- /dev/null +++ b/.changes/unreleased/Fixed-20250702-135534.yaml @@ -0,0 +1,6 @@ +kind: Fixed +body: 'Fix translations for social action fields in admin form: results, goals, evaluations' +time: 2025-07-02T13:55:34.599050626+02:00 +custom: + Issue: "" + SchemaChange: No schema change diff --git a/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialActionType.php b/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialActionType.php index 0b6cbe73d..31fa6f432 100644 --- a/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialActionType.php +++ b/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialActionType.php @@ -25,21 +25,14 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\NumberType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; +use Symfony\Contracts\Translation\TranslatorInterface; /** * Class SocialActionType. */ class SocialActionType extends AbstractType { - /** - * @var TranslatableStringHelper - */ - protected $translatableStringHelper; - - public function __construct(TranslatableStringHelper $translatableStringHelper) - { - $this->translatableStringHelper = $translatableStringHelper; - } + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly TranslatorInterface $translator) {} public function buildForm(FormBuilderInterface $builder, array $options) { @@ -64,6 +57,7 @@ class SocialActionType extends AbstractType ->add('results', EntityType::class, [ 'class' => Result::class, 'required' => false, + 'label' => $this->translator->trans('person_admin.social_result'), 'multiple' => true, 'attr' => ['class' => 'select2'], 'choice_label' => fn (Result $r) => $this->translatableStringHelper->localize($r->getTitle()), @@ -74,6 +68,7 @@ class SocialActionType extends AbstractType 'required' => false, 'multiple' => true, 'attr' => ['class' => 'select2'], + 'label' => $this->translator->trans('person_admin.social_goal'), 'choice_label' => fn (Goal $g) => $this->translatableStringHelper->localize($g->getTitle()), ]) @@ -82,6 +77,7 @@ class SocialActionType extends AbstractType 'required' => false, 'multiple' => true, 'attr' => ['class' => 'select2'], + 'label' => $this->translator->trans('person_admin.social_evaluation'), 'choice_label' => fn (Evaluation $e) => $this->translatableStringHelper->localize($e->getTitle()), ])