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 `<div class="hidden">{{ form_rest(form) }}</div>`
This commit is contained in:
Jeremy Benoist
2016-03-09 08:59:08 +01:00
parent d2b4f01d74
commit 0d42217e4e
80 changed files with 1145 additions and 868 deletions

View File

@ -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)
;
}

View File

@ -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)
;
}

View File

@ -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',
))
;
}

View File

@ -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',
))
;
}

View File

@ -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',
))
;
}

View File

@ -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)
;
}

View File

@ -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)
;
}

View File

@ -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',
))
;
}

View File

@ -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);

View File

@ -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')
;