Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Command translation:update doesn't take into account domain #42285

Closed
@lukepass

Description

@lukepass

Hello, I am using Symfony 4.4 and I just realized that when using the following command:

php bin/console translation:update --force en

The command doesn't take into account the specified domain, for example:

class ChangePasswordFormType extends AbstractType
{
    /**
     * @var TranslatorInterface
     */
    private $translator;

    public function __construct(TranslatorInterface $translator)
    {
        $this->translator = $translator;
    }

    /**
     * @param mixed[]                                           $options
     * @param FormBuilderInterface<FormBuilderInterface|string> $builder
     */
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $message = $this->translator->trans('This is the string I would like to translate', $parameters = [], $domain = 'validators');

        // other code...
    }
}

The string This is the string I would like to translate should be inserted in the file validators.en.xlf but it's written in the messages.en.xlf file.

Thanks!

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