php-translation / extractor

Extracts translation strings from source code
MIT License
126 stars 33 forks source link

How to ignore a trans call? #146

Closed Guite closed 4 years ago

Guite commented 4 years ago

I am trying to get the extraction working for the first time.

Unfortunately I am not able to get the Ignore annotation working properly yet.

Here is what I am doing:

use Translation\Extractor\Annotation\Ignore;

// ...
echo $this->getTranslator()->trans(/** @Ignore */$id, $parameters);

This leads to Argument 1 passed to Translation\Extractor\Visitor\BaseVisitor::addLocation() must be of the type string, null given, called in /.../vendor/php-translation/extractor/src/Visitor/Php/Symfony/ContainerAwareTrans.php on line 50 pointing to this call. Seems it still tries to extract this key.

When I exclude the affected class using excluded_names the process continues to the next occurence.

Is there something obvious I am missing?

Guite commented 4 years ago

Fixed by #147 :tada: