NelmioApiDocBundle
NelmioApiDocBundle copied to clipboard
Translations using translation_domain are not parsed
This is just a quick note - I have noticed translation_domain
passed to configureOptions()
in a form type are not parsed.
Here is a simple example:
Controller
/**
* Create new game.
*
* @ApiDoc(
* input="AppBundle\Form\Type\Game\GameFormType",
* )
*/
public function postAction()
GameFormType
class GameFormType extends AbstractType
{
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
parent::buildForm($builder, $options);
$builder->add('name', TextType::class, array(
'label' => 'form.game.name',
));
}
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'AppBundle\Entity\Game',
'translation_domain' => 'forms',
));
}
}
Resources/config/translations/forms.en.yml
form:
game:
name: Game
Happy to contribute if anyone has any direction for me to go into?
Sorry for the late answer, NelmioApiDocBundle 2.x is no longer maintained, we haven't added back form translation support but it would be a great addition if you are still willing to contribute :)