choice_translation_domain not working in symfony 2.7

1.6k views Asked by At

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.

1

There are 1 answers

2
acme ceo On

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 option choice_translation_domain work.