From 0d42217e4e8210dd2cf86f35ba9662ca02c8a2dc Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 9 Mar 2016 08:59:08 +0100 Subject: Convert english translation file - convert english translation to translate key - remove baggy template for login (never used since user isn't logged in and it'll use the default theme: material) - fix tests about text in response (now checking translation key instead of translated text) - remove all ugly `` --- .../CoreBundle/Form/Type/ChangePasswordType.php | 16 ++++++++++------ src/Wallabag/CoreBundle/Form/Type/ConfigType.php | 11 +++++++++-- .../CoreBundle/Form/Type/EditEntryType.php | 19 ++++++++++++++++--- .../CoreBundle/Form/Type/EntryFilterType.php | 16 +++++++++++++--- src/Wallabag/CoreBundle/Form/Type/NewEntryType.php | 7 ++++--- src/Wallabag/CoreBundle/Form/Type/NewTagType.php | 2 -- src/Wallabag/CoreBundle/Form/Type/NewUserType.php | 22 +++++++++++++++------- src/Wallabag/CoreBundle/Form/Type/RssType.php | 8 ++++++-- .../CoreBundle/Form/Type/TaggingRuleType.php | 13 ++++++++++--- .../CoreBundle/Form/Type/UserInformationType.php | 17 +++++++++++++---- 10 files changed, 96 insertions(+), 35 deletions(-) (limited to 'src/Wallabag/CoreBundle/Form/Type') diff --git a/src/Wallabag/CoreBundle/Form/Type/ChangePasswordType.php b/src/Wallabag/CoreBundle/Form/Type/ChangePasswordType.php index 7d05a5d8..841af51e 100644 --- a/src/Wallabag/CoreBundle/Form/Type/ChangePasswordType.php +++ b/src/Wallabag/CoreBundle/Form/Type/ChangePasswordType.php @@ -16,23 +16,27 @@ class ChangePasswordType extends AbstractType { $builder ->add('old_password', PasswordType::class, array( - 'constraints' => new UserPassword(array('message' => 'Wrong value for your current password')), + 'constraints' => new UserPassword(array('message' => 'validator.password_wrong_value')), + 'label' => 'config.form_password.old_password_label', )) ->add('new_password', RepeatedType::class, array( 'type' => PasswordType::class, - 'invalid_message' => 'The password fields must match.', + 'invalid_message' => 'validator.password_must_match', 'required' => true, - 'first_options' => array('label' => 'New password'), - 'second_options' => array('label' => 'Repeat new password'), + 'first_options' => array('label' => 'config.form_password.new_password_label'), + 'second_options' => array('label' => 'config.form_password.repeat_new_password_label'), 'constraints' => array( new Constraints\Length(array( 'min' => 8, - 'minMessage' => 'Password should by at least 8 chars long', + 'minMessage' => 'validator.password_too_short', )), new Constraints\NotBlank(), ), + 'label' => 'config.form_password.new_password_label', + )) + ->add('save', SubmitType::class, array( + 'label' => 'config.form.save', )) - ->add('save', SubmitType::class) ; } diff --git a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php index 0a5ea6cc..25ea9efa 100644 --- a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php +++ b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php @@ -33,9 +33,13 @@ class ConfigType extends AbstractType ->add('theme', ChoiceType::class, array( 'choices' => array_flip($this->themes), 'choices_as_values' => true, + 'label' => 'config.form_settings.theme_label', + )) + ->add('items_per_page', null, array( + 'label' => 'config.form_settings.items_per_page_label', )) - ->add('items_per_page') ->add('reading_speed', ChoiceType::class, array( + 'label' => 'config.form_settings.reading_speed', 'choices' => array( 'I read ~100 words per minute' => '0.5', 'I read ~200 words per minute' => '1', @@ -46,8 +50,11 @@ class ConfigType extends AbstractType ->add('language', ChoiceType::class, array( 'choices' => array_flip($this->languages), 'choices_as_values' => true, + 'label' => 'config.form_settings.language_label', + )) + ->add('save', SubmitType::class, array( + 'label' => 'config.form.save', )) - ->add('save', SubmitType::class) ; } diff --git a/src/Wallabag/CoreBundle/Form/Type/EditEntryType.php b/src/Wallabag/CoreBundle/Form/Type/EditEntryType.php index 2b1e1ef4..23d7b239 100644 --- a/src/Wallabag/CoreBundle/Form/Type/EditEntryType.php +++ b/src/Wallabag/CoreBundle/Form/Type/EditEntryType.php @@ -14,9 +14,22 @@ class EditEntryType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { $builder - ->add('title', TextType::class, array('required' => true)) - ->add('is_public', CheckboxType::class, array('required' => false)) - ->add('save', SubmitType::class) + ->add('title', TextType::class, array( + 'required' => true, + 'label' => 'entry.edit.title_label', + )) + ->add('is_public', CheckboxType::class, array( + 'required' => false, + 'label' => 'entry.edit.is_public_label', + )) + ->add('url', TextType::class, array( + 'disabled' => true, + 'required' => false, + 'label' => 'entry.edit.url_label', + )) + ->add('save', SubmitType::class, array( + 'label' => 'entry.edit.save_label', + )) ; } diff --git a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php index ee10bc8b..ec36503b 100644 --- a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php +++ b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php @@ -34,7 +34,9 @@ class EntryFilterType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { $builder - ->add('readingTime', NumberRangeFilterType::class) + ->add('readingTime', NumberRangeFilterType::class, array( + 'label' => 'entry.filters.reading_time.label', + )) ->add('createdAt', DateRangeFilterType::class, array( 'left_date_options' => array( 'attr' => array( @@ -50,6 +52,7 @@ class EntryFilterType extends AbstractType 'format' => 'dd/MM/yyyy', 'widget' => 'single_text', ), + 'label' => 'entry.filters.created_at.label', ) ) ->add('domainName', TextFilterType::class, array( @@ -62,9 +65,14 @@ class EntryFilterType extends AbstractType return $filterQuery->createCondition($expression); }, + 'label' => 'entry.filters.domain_label', + )) + ->add('isArchived', CheckboxFilterType::class, array( + 'label' => 'entry.filters.archived_label', + )) + ->add('isStarred', CheckboxFilterType::class, array( + 'label' => 'entry.filters.starred_label', )) - ->add('isArchived', CheckboxFilterType::class) - ->add('isStarred', CheckboxFilterType::class) ->add('previewPicture', CheckboxFilterType::class, array( 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { if (false === $values['value']) { @@ -75,10 +83,12 @@ class EntryFilterType extends AbstractType return $filterQuery->createCondition($expression); }, + 'label' => 'entry.filters.preview_picture_label', )) ->add('language', ChoiceFilterType::class, array( 'choices' => array_flip($this->repository->findDistinctLanguageByUser($this->user->getId())), 'choices_as_values' => true, + 'label' => 'entry.filters.language_label', )) ; } diff --git a/src/Wallabag/CoreBundle/Form/Type/NewEntryType.php b/src/Wallabag/CoreBundle/Form/Type/NewEntryType.php index fbce13f1..69fab6fb 100644 --- a/src/Wallabag/CoreBundle/Form/Type/NewEntryType.php +++ b/src/Wallabag/CoreBundle/Form/Type/NewEntryType.php @@ -3,7 +3,6 @@ namespace Wallabag\CoreBundle\Form\Type; use Symfony\Component\Form\AbstractType; -use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Core\Type\UrlType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -13,8 +12,10 @@ class NewEntryType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { $builder - ->add('url', UrlType::class, array('required' => true)) - ->add('save', SubmitType::class) + ->add('url', UrlType::class, array( + 'required' => true, + 'label' => 'entry.new.form_new.url_label', + )) ; } diff --git a/src/Wallabag/CoreBundle/Form/Type/NewTagType.php b/src/Wallabag/CoreBundle/Form/Type/NewTagType.php index 0f559031..c7568de7 100644 --- a/src/Wallabag/CoreBundle/Form/Type/NewTagType.php +++ b/src/Wallabag/CoreBundle/Form/Type/NewTagType.php @@ -3,7 +3,6 @@ namespace Wallabag\CoreBundle\Form\Type; use Symfony\Component\Form\AbstractType; -use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -14,7 +13,6 @@ class NewTagType extends AbstractType { $builder ->add('label', TextType::class, array('required' => true)) - ->add('save', SubmitType::class) ; } diff --git a/src/Wallabag/CoreBundle/Form/Type/NewUserType.php b/src/Wallabag/CoreBundle/Form/Type/NewUserType.php index 6eb0e63f..60fcc20c 100644 --- a/src/Wallabag/CoreBundle/Form/Type/NewUserType.php +++ b/src/Wallabag/CoreBundle/Form/Type/NewUserType.php @@ -17,22 +17,30 @@ class NewUserType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { $builder - ->add('username', TextType::class, array('required' => true)) + ->add('username', TextType::class, array( + 'required' => true, + 'label' => 'config.form_new_user.username_label', + )) ->add('plainPassword', RepeatedType::class, array( 'type' => PasswordType::class, - 'invalid_message' => 'The password fields must match', - 'first_options' => array('label' => 'Password'), - 'second_options' => array('label' => 'Repeat new password'), + 'invalid_message' => 'validator.password_must_match', + 'first_options' => array('label' => 'config.form_new_user.password_label'), + 'second_options' => array('label' => 'config.form_new_user.repeat_new_password_label'), 'constraints' => array( new Constraints\Length(array( 'min' => 8, - 'minMessage' => 'Password should by at least 8 chars long', + 'minMessage' => 'validator.password_too_short', )), new Constraints\NotBlank(), ), + 'label' => 'config.form_new_user.plain_password_label', + )) + ->add('email', EmailType::class, array( + 'label' => 'config.form_new_user.email_label', + )) + ->add('save', SubmitType::class, array( + 'label' => 'config.form.save', )) - ->add('email', EmailType::class) - ->add('save', SubmitType::class) ; } diff --git a/src/Wallabag/CoreBundle/Form/Type/RssType.php b/src/Wallabag/CoreBundle/Form/Type/RssType.php index def8782c..a9f68e54 100644 --- a/src/Wallabag/CoreBundle/Form/Type/RssType.php +++ b/src/Wallabag/CoreBundle/Form/Type/RssType.php @@ -12,8 +12,12 @@ class RssType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { $builder - ->add('rss_limit') - ->add('save', SubmitType::class) + ->add('rss_limit', null, array( + 'label' => 'config.form_rss.rss_limit', + )) + ->add('save', SubmitType::class, array( + 'label' => 'config.form.save', + )) ; } diff --git a/src/Wallabag/CoreBundle/Form/Type/TaggingRuleType.php b/src/Wallabag/CoreBundle/Form/Type/TaggingRuleType.php index 5815b8c6..cfee21f1 100644 --- a/src/Wallabag/CoreBundle/Form/Type/TaggingRuleType.php +++ b/src/Wallabag/CoreBundle/Form/Type/TaggingRuleType.php @@ -14,12 +14,19 @@ class TaggingRuleType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { $builder - ->add('rule', TextType::class, array('required' => true)) - ->add('save', SubmitType::class) + ->add('rule', TextType::class, array( + 'required' => true, + 'label' => 'config.form_rules.rule_label', + )) + ->add('save', SubmitType::class, array( + 'label' => 'config.form.save', + )) ; $tagsField = $builder - ->create('tags', TextType::class) + ->create('tags', TextType::class, array( + 'label' => 'config.form_rules.tags_label', + )) ->addModelTransformer(new StringToListTransformer(',')); $builder->add($tagsField); diff --git a/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php b/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php index f491b0ae..799ea39e 100644 --- a/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php +++ b/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php @@ -15,10 +15,19 @@ class UserInformationType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { $builder - ->add('name', TextType::class) - ->add('email', EmailType::class) - ->add('twoFactorAuthentication', CheckboxType::class, array('required' => false)) - ->add('save', SubmitType::class) + ->add('name', TextType::class, array( + 'label' => 'config.form_user.name_label', + )) + ->add('email', EmailType::class, array( + 'label' => 'config.form_user.email_label', + )) + ->add('twoFactorAuthentication', CheckboxType::class, array( + 'required' => false, + 'label' => 'config.form_user.twoFactorAuthentication_label', + )) + ->add('save', SubmitType::class, array( + 'label' => 'config.form.save', + )) ->remove('username') ->remove('plainPassword') ; -- cgit v1.2.3 From 3fae7f1d08be2debb5aff7d14e0976b6197323b8 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 16 Mar 2016 23:56:42 +0100 Subject: Add missing developer page --- src/Wallabag/CoreBundle/Form/Type/ClientType.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Wallabag/CoreBundle/Form/Type') diff --git a/src/Wallabag/CoreBundle/Form/Type/ClientType.php b/src/Wallabag/CoreBundle/Form/Type/ClientType.php index dd934715..9f620414 100644 --- a/src/Wallabag/CoreBundle/Form/Type/ClientType.php +++ b/src/Wallabag/CoreBundle/Form/Type/ClientType.php @@ -14,8 +14,8 @@ class ClientType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { $builder - ->add('redirect_uris', UrlType::class, array('required' => true, 'label' => 'Redirect URIs')) - ->add('save', SubmitType::class, array('label' => 'Create a new client')) + ->add('redirect_uris', UrlType::class, array('required' => true, 'label' => 'developer.client.form.redirect_uris_label')) + ->add('save', SubmitType::class, array('label' => 'developer.client.form.save_label')) ; $builder->get('redirect_uris') -- cgit v1.2.3 From f3e49264f23627df27d1e0b6964295a6d7899b85 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sun, 20 Mar 2016 22:09:00 +0100 Subject: Add reading time translation --- src/Wallabag/CoreBundle/Form/Type/ConfigType.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/Wallabag/CoreBundle/Form/Type') diff --git a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php index 25ea9efa..b30b4706 100644 --- a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php +++ b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php @@ -39,12 +39,12 @@ class ConfigType extends AbstractType 'label' => 'config.form_settings.items_per_page_label', )) ->add('reading_speed', ChoiceType::class, array( - 'label' => 'config.form_settings.reading_speed', + 'label' => 'config.form_settings.reading_speed.label', 'choices' => array( - 'I read ~100 words per minute' => '0.5', - 'I read ~200 words per minute' => '1', - 'I read ~300 words per minute' => '1.5', - 'I read ~400 words per minute' => '2', + 'config.form_settings.reading_speed.100_word' => '0.5', + 'config.form_settings.reading_speed.200_word' => '1', + 'config.form_settings.reading_speed.300_word' => '1.5', + 'config.form_settings.reading_speed.400_word' => '2', ), )) ->add('language', ChoiceType::class, array( -- cgit v1.2.3