I just upgraded my project to Symfony 2.7. One of the features why I wanted to upgrade as soon as possible, was the choice_translation_domain
option for form fields.
But somehow there are still more then 3000 warnings for missing translations.
Here is how I added one field where the translation is already handled by doctrine:
$builder->add('product', 'entity', array(
'class' => 'MyProject:Product',
'required' => false,
'multiple' => false,
'empty_value' => '',
'choice_translation_domain' => false,
'label' => 'label.product',
'query_builder' => function(EntityRepository $er) {
return $er->createQueryBuilder('product')
->orderBy('product.title', 'ASC');
},
));
In translation debugging, I still see, that Symfony tries to translate the already translated product titles.
My problem was that we overwrite the default
form_div_layout
from Symfony.So I had to change our custom form layout
.twig
file in order to make the optionchoice_translation_domain
work.