Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown "__" function in "embed.html.twig" #10

Open
marek-72 opened this issue Jul 10, 2024 · 0 comments
Open

Unknown "__" function in "embed.html.twig" #10

marek-72 opened this issue Jul 10, 2024 · 0 comments

Comments

@marek-72
Copy link

Got error while scanning twig file:

PHP Fatal error: Uncaught Twig\Error\SyntaxError: Unknown "__" function in "embed.html.twig" at line 2. in /*/vendor/twig/twig/src/ExpressionParser.php:762

Do I need to add something to twig?

My code is:


use Gettext\Scanner\TwigScanner;
use Gettext\Translations;
use Gettext\Generator\PoGenerator;


$twigScanner = new TwigScanner( Translations::create('pl'));
$twigScanner->setDefaultDomain('pl');
$twigScanner->extractCommentsStartingWith('i18n:', 'Translators:');
$twigScanner->ignoreInvalidFunctions(true);
$twigScanner->scanFile('embed.html.twig');


$generator = new PoGenerator();
foreach ($twigScanner->getTranslations() as $domain => $translations) {
    $generator->generateFile($translations, "{$domain}_twig.po");
}


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant