Skip to content

Concatenation in translatable string #29956

Closed
@Stadly

Description

@Stadly

Symfony Translation Component 4.2.2

When translating long strings that can be pluralized, splitting the parts often improves readability (and compliance with maximum line length code style rules):

$translator->trans(
    'There must be at least one lower case letter.|'.
    'There must be at least %count% lower case letter.',
    ['%count%' => $constraint->getMin()]
);

instead of

$translator->trans(
    'There must be at least one lower case letter.|There must be at least %count% lower case letter.',
    ['%count%' => $constraint->getMin()]
);

The PhpExtractor does not recognize the string concatenation, but includes only the first string (There must be at least one lower case letter.| in this case) in the extracted translations.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions