Skip to content

Translations: incorrect domain using "t" function and named domain argument #44899

Closed
@noofaq

Description

@noofaq

Symfony version(s) affected

5.4.2

Description

Using Symfony\Component\Translation\t function and using named domain argument "translation:extract" and "debug:translations" use incorrect domain (default one messages is used).

How to reproduce

class DAMFileNameTemplate extends Constraint
{
    public function getMessage()
    {
        return t('error.dam_file_name_template_evaluation', domain: 'validators');
    }
}

Calling debug:translation reports incorrect domain:
obraz

Workaround:

class DAMFileNameTemplate extends Constraint
{
    public function getMessage()
    {
        return t('error.dam_file_name_template_evaluation', [], 'validators');
    }
}

Calling debug:translation reports correctly:
obraz

Possible Solution

No response

Additional Context

No response

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