From 5293a50051e325d280a213a2c85d19cfac2a5cf6 Mon Sep 17 00:00:00 2001 From: Cyril Date: Wed, 30 Oct 2019 12:36:14 +0100 Subject: [PATCH] Translate forms --- src/Form/AddressBookType.php | 16 +++++++-- src/Form/CalendarInstanceType.php | 26 +++++++++++---- translations/messages+intl-icu.en.xlf | 48 +++++++++++++++++++++++++++ 3 files changed, 81 insertions(+), 9 deletions(-) diff --git a/src/Form/AddressBookType.php b/src/Form/AddressBookType.php index d2c8f56..6972fa3 100644 --- a/src/Form/AddressBookType.php +++ b/src/Form/AddressBookType.php @@ -5,6 +5,7 @@ namespace App\Form; use App\Entity\AddressBook; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; +use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -14,9 +15,18 @@ class AddressBookType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { $builder - ->add('uri', TextType::class, ['disabled' => !$options['new'], 'help' => "This is the unique identifier for this address book. Allowed characters are digits, lowercase letters and the dash symbol '-'."]) - ->add('displayName', TextType::class, ['help' => 'This name will be displayed in your CardDAV client']) - ->add('description') + ->add('uri', TextType::class, [ + 'label' => 'form.uri', + 'disabled' => !$options['new'], + 'help' => 'form.uri.help.carddav', + ]) + ->add('displayName', TextType::class, [ + 'label' => 'form.displayName', + 'help' => 'form.name.help.carddav', + ]) + ->add('description', TextAreaType::class, [ + 'label' => 'form.description', + ]) ->add('save', SubmitType::class, [ 'label' => 'save', ]); diff --git a/src/Form/CalendarInstanceType.php b/src/Form/CalendarInstanceType.php index 6c52add..68e6cb0 100644 --- a/src/Form/CalendarInstanceType.php +++ b/src/Form/CalendarInstanceType.php @@ -6,6 +6,7 @@ use App\Entity\CalendarInstance; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; +use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -15,21 +16,34 @@ class CalendarInstanceType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { $builder - ->add('uri', TextType::class, ['disabled' => !$options['new'], 'help' => "This is the unique identifier for this calendar. Allowed characters are digits, lowercase letters and the dash symbol '-'.", 'required' => true]) - ->add('displayName', TextType::class, ['help' => 'This name will be displayed in your CalDAV client']) - ->add('description') + ->add('uri', TextType::class, [ + 'label' => 'form.uri', + 'disabled' => !$options['new'], + 'help' => 'form.uri.help.caldav', + 'required' => true, + ]) + ->add('displayName', TextType::class, [ + 'label' => 'form.displayName', + 'help' => 'form.name.help.caldav', + ]) + ->add('description', TextareaType::class, [ + 'label' => 'form.description', + ]) ->add('calendarColor', TextType::class, [ + 'label' => 'form.color', 'required' => false, - 'help' => "This is the color that will be displayed in your CalDAV client. It must be supplied in the format '#RRGGBBAA' (alpha channel is optional) with hexadecimal values. This value is optional.", + 'help' => 'form.color.help', 'attr' => ['placeholder' => '#RRGGBBAA'], ]) ->add('todos', CheckboxType::class, [ + 'label' => 'form.todos', 'mapped' => false, - 'help' => 'If checked, todos will be enabled on this calendar.', + 'help' => 'form.todos.help', ]) ->add('notes', CheckboxType::class, [ + 'label' => 'form.notes', 'mapped' => false, - 'help' => 'If checked, notes will be enabled on this calendar.', + 'help' => 'form.notes.help', ]) ->add('save', SubmitType::class, [ 'label' => 'save', diff --git a/translations/messages+intl-icu.en.xlf b/translations/messages+intl-icu.en.xlf index 2f2e4d2..af200a0 100644 --- a/translations/messages+intl-icu.en.xlf +++ b/translations/messages+intl-icu.en.xlf @@ -257,6 +257,54 @@ form.username.help May be an email, but not forcibly. + + form.notes + Notes + + + form.todos + Todos + + + form.uri + URI + + + form.description + Description + + + form.color + Calendar color + + + form.name.help.carddav + This name will be displayed in your CardDAV client + + + form.name.help.caldav + This name will be displayed in your CalDAV client + + + form.uri.help.carddav + This is the unique identifier for this address book. Allowed characters are digits, lowercase letters and the dash symbol '-'. + + + form.uri.help.caldav + This is the unique identifier for this calendar. Allowed characters are digits, lowercase letters and the dash symbol '-'. + + + form.color.help + This is the color that will be displayed in your CalDAV client. It must be supplied in the format '#RRGGBBAA' (alpha channel is optional) with hexadecimal values. This value is optional. + + + form.todos.help + If checked, todos will be enabled on this calendar. + + + form.notes.help + If checked, notes will be enabled on this calendar. +