You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The translation:extract command looks for missing translations in:
...
- Any PHP file/class that injects or autowires the translator service and makes calls to the trans() method..
...
When bundle is specified, this does not work as stated. Following line limits path to extract texts to only bundle template folder:
I did not find any other official way to extract PHP code translations from bundle. I believe at least PHP files using translator service should be included in extracted bundle translations.
Hello @cuchac, thank you for your report, it makes sense to be able to extract translations from PHP code from bundles too. However, Symfony could never guarantee that external code respect the recommended ways to translate strings. So like in your own code, the bundles you want to extract translation may use some special cases like concatenation of strings the translation:extract command could never extract at all.
But please, if you want, open a Pull Request to handle translations extraction from PHP Code of bundles, then we can discuss about the proper implementation.
Symfony version(s) affected
7.1
Description
Documentation mentions
When bundle is specified, this does not work as stated. Following line limits path to extract texts to only bundle template folder:
symfony/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php
Line 159 in 29b00c2
I did not find any other official way to extract PHP code translations from bundle. I believe at least PHP files using
translator
service should be included in extracted bundle translations.How to reproduce
Only translations from templates (
AcmeBundle/templates
) are extracted. No PHPtrans()
calls are extracted.Possible Solution
Use result from
$this->getRootCodePaths($kernel)
and leave all files from given bundle.symfony/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php
Lines 149 to 159 in 29b00c2
Additional Context
No response
The text was updated successfully, but these errors were encountered: