Skip to content

Concatenation in translatable string #125

@Stadly

Description

@Stadly

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 ContainerAwareTrans and ContainerAwareTransChoice extractors (I have not tested the others) do not recognize the string concatenation, but sets the message to null in the extracted translations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions