Is it possible to use cli command to build translation if I use constant in $translator->trans();

125 views Asked by At

Is it possible to use Symfony CLI command (ex: php bin/console translation:update --force -en) to build translation if I use a constant in a translator like that:

$translator->trans(self::ANY_CONSTANT);

That doesn't work for me now... But, if I put a string on it, that's work!

I am using Symfony 5 with twig.

I am not used Symfony for long and english is my second language, so, please, be indulgent.

Thanks in advance for your answers. ;)

PS: I did many research before asking this question. I found many things about translation, but no good information about how work this CLI command.

1

There are 1 answers

0
JessGabriel On

Translator and Console are two different component of symfony. Problem doesn't come from Console, please check if your CONSTANT value is an existing translation key.

If you got an error, please put here also your error message