Closed verheyenkoen closed 4 years ago
The same error occurs for form fields (not in admin filter). The bug is a little more complicated as it needs 2 twig fixes I think. Not sure if we should open a new issue for that.
choice_translation_domain
was introduced "recently", right? Not sure if it's an error or a failure to update. Can you determine when it was introduced, and how the native choice field from sf template evolved?
Was introduced in Symfony 2.7.
I guess all the related changes are in this commit: https://github.com/symfony/symfony/commit/52755ba26d59057bc5642fb97df9454457d06df9.
Sonata has a lot more twig code than that (just for expanded mode) and also different templates for filter fields vs form fields.
I think it was introduced a bit earlier, in https://github.com/symfony/symfony/pull/13651/files . The logic is quite natural: use choice_translation_domain
if defined and not false, otherwise use whatever was used before. Would you be willing to contribute this?
I'll try. I was already trying to prove the bug in a unit test. I can do this for the choice_translation_domain=false
scenario, but not for the choice_translation_domain='some_custom_domain'
(also broken), as the rendered result would be the same as with the default domain (messages).
I think I could inherit from Symfony\Bundle\FrameworkBundle\Tests\Templating\Helper\Fixtures\StubTranslator
and add the translation domain to the annotation (when different than 'messages'), eg.: [trans|my_custom_domain]translation.id[/trans]
. Then I would be able to prove the other bug I guess.
Another option is to use the translation profiler but that requires a functional test. All test I've seen till now are building a form and putting it through the render function.
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
I'm not doing PHP/Symfony/Sonata Admin anymore so don't know if this still an issue for anyone. Feel free to close.
Environment
Sonata packages
Symfony packages
PHP version
Subject
When you add a choice filter with options
expanded
set totrue
andchoice_translation_domain
setfalse
in theconfigureDatagridFilters
method of a sonata admin, like so:... no missing translation errors should be produced.
Instead, Symfony reports missing translations for the choices in the
messages
domain.The error is probably here. The variable
translation_domain
is used instead ofchoice_translation_domain
, and translation should be omitted ifchoice_translation_domain
is false.