Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Translation] extract-option 'as-tree' creates empty property keys in Yaml #51536

Copy link
Copy link
Closed
@tjveldhuizen

Description

@tjveldhuizen
Issue body actions

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.