Closed
Description
Symfony version(s) affected
5.2.0 and higher
Description
When generating yaml translation files and using the --as-tree=3
option on the translation:extract
command, the Translation component generates a tree of translatable strings. Therefore, it explodes the translatable string by the .
, which can result in odd behavior when the user is not using translation keys, but full sentences. For example, a lot of validation error messages end in with a dot, resulting in yaml like this:
'This value should be false':
'': 'This value should be false.'
'This value should be true':
'': 'This value should be true.'
'This value should be of type {{ type }}':
'': 'This value should be of type {{ type }}.'
While it's impossible to prevent this behavior when dots are in the middle of a strings, I think dots at the start and end of a translation key are supposed to be trimmed.
How to reproduce
symfony create --webapp
and then bin/console translation:extract --force --format=yaml --as-tree=3 en
Possible Solution
No response
Additional Context
No response